Skip to content

C# 7.x §C.3 AsyncMethodBuilderAttribute has AttributeTargets.Method #858

@KalleOlaviNiemitalo

Description

@KalleOlaviNiemitalo

Describe the bug

In the C# 7.x draft, §C.3 (Standard Library Types not defined in ISO/IEC 23271), AsyncMethodBuilderAttribute has AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Interface | AttributeTargets.Delegate | AttributeTargets.Enum | AttributeTargets.Method. Of these, AttributeTargets.Method is not needed for C# 7.3 and instead corresponds to a C# 10 feature.

Example

This should not be allowed in a C# 7.3 implementation without extensions.

using System.Runtime.CompilerServices;

public class C {
    [AsyncMethodBuilder(typeof(C))]
    void M() {}
}

Expected behavior

In §C.3, remove AttributeTargets.Method from AsyncMethodBuilderAttribute.

Additional context

The C# 7.0 Async Task Types in C# proposal does not mention AttributeTargets.

dotnet/runtime#50116 added AttributeTargets.Method to AsyncMethodBuilderAttribute, for the C# 10 AsyncMethodBuilder override proposal dotnet/csharplang#1407.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions