-
Notifications
You must be signed in to change notification settings - Fork 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
DoesNotReturn looked like it returned #3826
Comments
That is correct.
By returning a value in all codepaths, or making sure the endpoitn of the method is not reachable. :) -- Closing out as this is a question and the question has been answered. |
Related: #538. Presumably if that feature existed then OP's |
Saw something along the following lines suggested somewhere. Save one vertical line!
How's that for a logical way to do things? If I understand correctly then just using "throw;" in a catch clause would not capture the exception stack -- documentation is not very clear on this point though. |
Using UWP, .NET Core 3, I declared
and then a helper function
and then I used it like this (simplified version),
Actual: The compiler found an error that not all code paths of GetService return a value.
Expected was that there would be no error since the [DoesNotReturn] attribute should tell the compiler that the Rethrow method does not return.
Maybe [DoesNotReturn] is somehow only used in nullability analysis and not in flow of control analysis? How can I get the compiler to detect that all code paths in GetService return a value (aside from the rather gauche tactic of adding a redundant throw statement after e.Rethrow()) ?
The text was updated successfully, but these errors were encountered: