Closed deniszykov closed 3 years ago
Thanks for reporting this. I'm unable to reproduce, unfortunately. Can you narrow this down to a single project, then to the affected source file and submit a small repro?
This is difficult to narrow, because it is huge. I found workaround for me, I just removed all [[NotNull]] attributes with text replacement.
This code could give null because it based on GetDeclaredSymbolCore which could return null.
You could skip syntax which is not declaration, or generate warning/message to output.
Yes, but almost everything in roslyn returns null under some circumstances. For example, when typing code that is not yet valid syntax. The point is to validate upfront and skip analysis in those cases, instead of sprinkling the code full with null checks everywhere. So the question is: what piece of code is causing this?
You could skip syntax which is not declaration, or generate warning/message to output.
As far as I'm aware, analysis is configured to only run on type/member/parameter declarations, so I suspect something else is causing the error.
I will try to locate this error tomorrow.
Thanks. The next steps should make it easier to find the source file that causes this:
Note that the second VS instance will be very slow with attached debugger, so it may take some time to get there. Hope this helps.
This code cause error:
public class A
{
[NotNull]
public static implicit operator A([NotNull] string value)
{
return new A();
}
}
BTW, Thanks for your package. It helped me a lot.
Thank you for investigating the root cause. I can repro the problem now and the fix is coming soon.
Glad to hear my package is useful to you. Please thank me by adding a star to the repo. :)
Version Used: 2.0.0
Steps to Reproduce:
Expected Behavior: No error.
Actual Behavior: