Skip to content

DynamicallyAccessedMembersAnalyzer errors - NullReferenceException and NotImplementedException #2718

@JamesNK

Description

@JamesNK

The DynamicallyAccessedMembersAnalyzer analyzer throws many errors when run on ASP.NET Core assemblies with trimming enabled.

PR that enables trimming analyzers - dotnet/aspnetcore#41021

Sample of errors:

43>CSC : warning AD0001: Analyzer 'ILLink.RoslynAnalyzer.DynamicallyAccessedMembersAnalyzer' threw an exception of type 'System.NotImplementedException' with message 'Microsoft.CodeAnalysis.Operations.FlowCaptureReferenceOperation'.
43>CSC : warning AD0001: Analyzer 'ILLink.RoslynAnalyzer.DynamicallyAccessedMembersAnalyzer' threw an exception of type 'System.NotImplementedException' with message 'Microsoft.CodeAnalysis.Operations.FlowCaptureReferenceOperation'.
43>CSC : warning AD0001: Analyzer 'ILLink.RoslynAnalyzer.DynamicallyAccessedMembersAnalyzer' threw an exception of type 'System.NotImplementedException' with message 'Microsoft.CodeAnalysis.Operations.FlowCaptureReferenceOperation'.
43>CSC : warning AD0001: Analyzer 'ILLink.RoslynAnalyzer.DynamicallyAccessedMembersAnalyzer' threw an exception of type 'System.NullReferenceException' with message 'Object reference not set to an instance of an object.'.
43>CSC : warning AD0001: Analyzer 'ILLink.RoslynAnalyzer.DynamicallyAccessedMembersAnalyzer' threw an exception of type 'System.NullReferenceException' with message 'Object reference not set to an instance of an object.'.
43>CSC : warning AD0001: Analyzer 'ILLink.RoslynAnalyzer.DynamicallyAccessedMembersAnalyzer' threw an exception of type 'System.NotImplementedException' with message 'Microsoft.CodeAnalysis.Operations.FlowCaptureReferenceOperation'.
43>CSC : warning AD0001: Analyzer 'ILLink.RoslynAnalyzer.DynamicallyAccessedMembersAnalyzer' threw an exception of type 'System.NotImplementedException' with message 'Microsoft.CodeAnalysis.Operations.FlowCaptureReferenceOperation'.
43>CSC : warning AD0001: Analyzer 'ILLink.RoslynAnalyzer.DynamicallyAccessedMembersAnalyzer' threw an exception of type 'System.NotImplementedException' with message 'Microsoft.CodeAnalysis.Operations.NoneOperation'.
43>CSC : warning AD0001: Analyzer 'ILLink.RoslynAnalyzer.DynamicallyAccessedMembersAnalyzer' threw an exception of type 'System.NotImplementedException' with message 'Microsoft.CodeAnalysis.Operations.FlowCaptureReferenceOperation'.

Also, in ASP.NET Core repo we have been using ILLink to provide warnings of trimming areas to fix. Enabling trim analyzers provides new warnings that weren't caught by ILLink. Is that expected?

e.g.

image

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions