Describe the bug
In enabling the AOT readiness analyzers, the MessagePack codebase produces a lot of warnings. Among them is an AD0001 warning about a failed analyzer. See Exceptions section for details.
To Reproduce
git clone https://github.com/MessagePack-CSharp/MessagePack-CSharp.git
cd MessagePack-CSharp
git checkout dotnet/sdk/bug44120repro
.\MessagePack.sln
Inspect the error list, filtering to AD0001 entries.
Exceptions (if any)
Analyzer 'ILLink.RoslynAnalyzer.DynamicallyAccessedMembersAnalyzer' threw an exception of type 'System.ArgumentException' with message 'Reported diagnostic 'IL2075' has a source location in file 'Q:\source\MessagePack-CSharp\src\MessagePack.Annotations\Attributes.cs', which is not part of the compilation being analyzed. (Parameter 'diagnostic')'.
Exception occurred with following context:
Compilation: MessagePack
ISymbol: BuildCustomFormatterField (Method)
System.ArgumentException: Reported diagnostic 'IL2075' has a source location in file 'Q:\source\MessagePack-CSharp\src\MessagePack.Annotations\Attributes.cs', which is not part of the compilation being analyzed. (Parameter 'diagnostic')
at Microsoft.CodeAnalysis.Diagnostics.DiagnosticAnalysisContextHelpers.VerifyDiagnosticLocationInCompilation(String id, Location location, Compilation compilation)
at Microsoft.CodeAnalysis.Diagnostics.DiagnosticAnalysisContextHelpers.VerifyDiagnosticLocationsInCompilation(Diagnostic diagnostic, Compilation compilation)
at Microsoft.CodeAnalysis.Diagnostics.DiagnosticAnalysisContextHelpers.VerifyArguments(Diagnostic diagnostic, Compilation compilation, Func`3 isSupportedDiagnostic, CancellationToken cancellationToken)
at Microsoft.CodeAnalysis.Diagnostics.OperationBlockAnalysisContext.ReportDiagnostic(Diagnostic diagnostic)
at ILLink.RoslynAnalyzer.DynamicallyAccessedMembersAnalyzer.<>c.<Initialize>b__8_1(OperationBlockAnalysisContext context)
at Microsoft.CodeAnalysis.Diagnostics.AnalyzerExecutor.ExecuteAndCatchIfThrows_NoLock[TArg](DiagnosticAnalyzer analyzer, Action`1 analyze, TArg argument, Nullable`1 info, CancellationToken cancellationToken)
Further technical details
- Include the output of
dotnet --info
- The IDE (VS / VS Code/ VS4Mac) you're running on, and its version
Describe the bug
In enabling the AOT readiness analyzers, the MessagePack codebase produces a lot of warnings. Among them is an AD0001 warning about a failed analyzer. See Exceptions section for details.
To Reproduce
Inspect the error list, filtering to AD0001 entries.
Exceptions (if any)
Further technical details
dotnet --info