Skip to content

AdditionalLocations for CS8618 in DiagnosticSuppressor #58073

@roji

Description

@roji

In EF Core, dotnet/efcore#21608 introduced a DiagnosticsSuppressor to suppress CS8618 (non-nullable property is uninitialized) in a specific safe scenario. In classes without a constructor, the CS8618 diagnostic is reported on the property itself, so the suppressor can look at that property and function correctly. If a constructor is defined, however, the diagnostic is reported on the constructor declaration instead of the property, and the suppressor needs some way to resolve the uninitialized property.

Diagnostic seems to have an AdditionalLocations property which looks right for this, but it's empty (because not populated for CS8618? Because it's a DiagnosticsSuppressor rather than a regular analyzer?).

Am I missing something? What would be the correct, safe way to figure out which non-nullable property is uninitialized from CS8618 in a DiagnosticsSuppressor?

Tracking issue on the EF Core side: dotnet/efcore#26879

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions