Replies: 1 comment
-
Moving to Roslyn discussions |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
It's my expectation that it will compile because the ThrowHelper methods are annotated with DoesNotReturn.
The two methods above are equivalent in my view.
I tried opening an issue https://developercommunity.visualstudio.com/t/The-DoesNotReturn-code-analysis-attrib/10495037?port=1025&fsid=99832d1c-2899-44ac-a4f0-88182ddfa0a9&ref=native&refTime=1697790182112&refUserId=7dbe2508-d94c-48bf-af55-63c2cfc609f9 against VS but this was rejected by the bot as a duplicate of https://developercommunity.visualstudio.com/t/DoesNotReturn-and-DoesNotReturnIf-is-not/10119245. I disagree with Jared Parsons that this behaviour is 'by design'.
If we look at https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/attributes/nullable-analysis it explicitly says that DoesNotReturn is 'A method that never returns. In other words, it always throws an exception.'
If I'm right can someone raise this with the compiler/VS team?
Beta Was this translation helpful? Give feedback.
All reactions