-
Notifications
You must be signed in to change notification settings - Fork 4.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Custom roslyn analyzer to override nullability analysis? #32042
Comments
Moving to @dotnet/roslyn-ide as this appears to be more of a feature request for analyzers. |
This would be covered under #20242 if that API moves forward. |
Duplicate of #20242 |
@sharwell Let me give an example from NUnit test.
Suppose I'd like to support nullability changes for And to implement that in my suppression analyzer. |
@jaredpar #32042 (comment) sounds like a compiler request |
Currently no part of the compiler's analysis depends on any third party analyzer's input/output. Introducing any such feedback loop can potentially lead to unwanted deadlocks and/or infinite recursion. |
I understand that a bunch of annotations to inform nullability analysis is already in the works #26761, but I'd like to suggest that it would be useful to allow writing custom roslyn analyzers that can override the compiler's nullability warnings.
Mads mentioned in this video that a mini language of attributes is being developed to inform nullability analysis to cover 98% of cases. I think that custom analyzers might be able to cover the remaining 2% of cases.
The use cases that I'm currently thinking of are initializing fields of an object via reflection during construction.
The text was updated successfully, but these errors were encountered: