Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Assert failure in BindMethodBody.assertBindIdentifierTargets() with [param:] attribute on local function #73905

Open
cston opened this issue Jun 8, 2024 · 0 comments
Assignees
Milestone

Comments

@cston
Copy link
Member

cston commented Jun 8, 2024

Version Used: e867be9

Steps to Reproduce:

Compile the following with a DEBUG build:

using System;

[AttributeUsage(AttributeTargets.All)]
class A : Attribute
{
    public A(string s) { }
}

class C
{
    event EventHandler E
    {
        add
        {
            [param: A(nameof(p))] void F(int p) { }
        }
        remove
        {
        }
    }
}

Result:

Debug.Assert() failure:

Microsoft.CodeAnalysis.CSharp.dll!Microsoft.CodeAnalysis.CSharp.MethodCompiler.BindMethodBody.__assertBindIdentifierTargets|42_3(Microsoft.CodeAnalysis.CSharp.InMethodBinder inMethodBinder, System.Collections.Concurrent.ConcurrentDictionary<Microsoft.CodeAnalysis.CSharp.Syntax.IdentifierNameSyntax, int> identifierMap, Microsoft.CodeAnalysis.CSharp.BoundNode methodBody, Microsoft.CodeAnalysis.CSharp.BindingDiagnosticBag diagnostics) Line 2143 C#
Microsoft.CodeAnalysis.CSharp.dll!Microsoft.CodeAnalysis.CSharp.MethodCompiler.BindMethodBody(Microsoft.CodeAnalysis.CSharp.Symbols.MethodSymbol method, Microsoft.CodeAnalysis.CSharp.TypeCompilationState compilationState, Microsoft.CodeAnalysis.CSharp.BindingDiagnosticBag diagnostics, bool includeInitializersInBody, Microsoft.CodeAnalysis.CSharp.BoundNode initializersBody, bool reportNullableDiagnostics, out Microsoft.CodeAnalysis.CSharp.ImportChain importChain, out bool originalBodyNested, out bool prependedDefaultValueTypeConstructorInitializer, out Microsoft.CodeAnalysis.CSharp.MethodBodySemanticModel.InitialState forSemanticModel) Line 1782 C#
Microsoft.CodeAnalysis.CSharp.dll!Microsoft.CodeAnalysis.CSharp.MethodCompiler.CompileMethod(Microsoft.CodeAnalysis.CSharp.Symbols.MethodSymbol methodSymbol, int methodOrdinal, ref Microsoft.CodeAnalysis.CSharp.Binder.ProcessedFieldInitializers processedInitializers, Microsoft.CodeAnalysis.CSharp.SynthesizedSubmissionFields previousSubmissionFields, Microsoft.CodeAnalysis.CSharp.TypeCompilationState compilationState) Line 991 C#
...

@dotnet-issue-labeler dotnet-issue-labeler bot added Area-Compilers untriaged Issues and PRs which have not yet been triaged by a lead labels Jun 8, 2024
@jaredpar jaredpar added Bug and removed untriaged Issues and PRs which have not yet been triaged by a lead labels Jun 11, 2024
@jaredpar jaredpar assigned jcouv and unassigned cston Jun 11, 2024
@jaredpar jaredpar added this to the 17.12 milestone Jun 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants