Skip to content

Implement analyzer that validates MetadataUpdateHandlerAttribute usage #107644

@tmat

Description

@tmat

Description

MetadataUpdateHandlerAttribute expects the specified type to declare certain methods as documented here:

https://learn.microsoft.com/en-us/dotnet/api/system.reflection.metadata.metadataupdatehandlerattribute?view=net-8.0#remarks

There is no design-time validation of this contract though. It would be useful to implement an analyzer and include it in the SDK.

It would prevent issues like https://github.com/dotnet/AspNetCore-ManualTests/issues/3086

Reproduction Steps

See https://github.com/dotnet/AspNetCore-ManualTests/issues/3086

Expected behavior

Analyzer should warn that the type does not implement required contract.

Actual behavior

No warning during build.

Regression?

No response

Known Workarounds

No response

Configuration

No response

Other information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-System.Runtimecode-analyzerMarks an issue that suggests a Roslyn analyzerneeds-further-triageIssue has been initially triaged, but needs deeper consideration or reconsideration

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions