Skip to content

AD0001: NullReferenceException #79059

Answered by RikkiGibson
csuzw asked this question in Q&A
Jun 19, 2025 · 1 comments · 4 replies
Discussion options

You must be logged in to vote

You may be missing a VS optional component which is recommended in this scenario: https://learn.microsoft.com/en-us/dotnet/csharp/roslyn-sdk/tutorials/how-to-write-csharp-analyzer-code-fix . I recommend you at least take a look at the template and extract out bits that look useful, as it is intended to address these basic quality of life issues for analyzer development.

Glancing at your code the following looks broken to me:
https://github.com/csuzw/curly-doodle/blob/d892f633b85cd07e1b3b09bd0460742acd324b3f/Infuriating.CodeAnalysis/MyRule.cs#L21

Unfortunately ImmutableArray due to being a struct has some weird ergonomics. Your code is creating a new ImmutableArray<DiagnosticDescriptor>(),…

Replies: 1 comment 4 replies

Comment options

You must be logged in to vote
4 replies
@csuzw
Comment options

@RikkiGibson
Comment options

Answer selected by csuzw
@csuzw
Comment options

@RikkiGibson
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants