Skip to content
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

Add additional information when we throw an 'unreachable' exception #64402

Merged
merged 1 commit into from
Sep 30, 2022

Conversation

CyrusNajmabadi
Copy link
Member

We've been getting "unreachable" exceptions that we're finding to difficult to take action on due to trouble determining what the actual throw point of hte exception was. This adds that information to the exception, in a similar way to how we added information to our Contract calls so that devs investigating the issue could track the exception back to the exact location it was thrown.

get { return new InvalidOperationException("This program location is thought to be unreachable."); }
}
internal static Exception Unreachable([CallerFilePath] string? path = null, [CallerLineNumber] int line = 0)
=> new InvalidOperationException($"This program location is thought to be unreachable. File='{path}' Line={line}");
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is the actual update to the helper property to be a helper method.

Copy link
Member

@jasonmalinowski jasonmalinowski left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Signing off on the helper change; and obviously not looking at the remaining 455 files. 😄

@CyrusNajmabadi
Copy link
Member Author

@dotnet/roslyn-compiler for this change to help diagnosability of watson dumps for exceptions.

@CyrusNajmabadi CyrusNajmabadi merged commit ab7dd82 into dotnet:main Sep 30, 2022
@ghost ghost added this to the Next milestone Sep 30, 2022
@CyrusNajmabadi
Copy link
Member Author

ack. did not intend to merge this.

@CyrusNajmabadi
Copy link
Member Author

Talking to infra now.

@CyrusNajmabadi CyrusNajmabadi deleted the unreachable branch September 30, 2022 21:21
Copy link
Member

@jcouv jcouv left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM Thanks (iteration 1)

Copy link
Member

@333fred 333fred left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Compiler changes LGTM

@CyrusNajmabadi
Copy link
Member Author

Thanks guys. Sorry for the accidental merge!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants