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

Remove places where the compiler is swallowing exceptions #58870

Merged

Conversation

jasonmalinowski
Copy link
Member

There are a few places where compiler APIs are swallowing internal exceptions and returning null from APIs as a way to march on; this removes those places, and then removes our ReportAndCatch* APIs from the compiler layer entirely. We currently have no (cross platform) way of implementing those in a way that would allow for non-fatal error reporting.

Closes #58375

@CyrusNajmabadi

This comment has been minimized.

@AraHaan

This comment has been minimized.

@jasonmalinowski
Copy link
Member Author

jasonmalinowski commented Jan 14, 2022

So note the first commit here is actually @chsienki's PR #58843, and this was building off of it. So @CyrusNajmabadi and @AraHaan your feedback should go there. (This is a draft so we can get the second part working while @chsienki finishes his part.)

@jasonmalinowski jasonmalinowski self-assigned this Jan 14, 2022
There are a few places where compiler APIs are swallowing internal
exceptions and returning null from APIs as a way to march on; this
removes those places, and then removes our ReportAndCatch* APIs from
the compiler layer entirely. We currently have no (cross platform)
way of implementing those in a way that would allow for non-fatal error
reporting.

Closes dotnet#58375
@jasonmalinowski jasonmalinowski force-pushed the stop-swallowing-exceptions branch from b2719a2 to d23fe1e Compare January 28, 2022 20:14
@jasonmalinowski jasonmalinowski marked this pull request as ready for review January 28, 2022 20:50
@jasonmalinowski jasonmalinowski requested review from a team as code owners January 28, 2022 20:50
Copy link
Contributor

@ryzngard ryzngard left a comment

Choose a reason for hiding this comment

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

Everything but the open question https://github.com/dotnet/roslyn/pull/58870/files#r794881243 LGTM. Signing off with the assumption that will be resolved before merge

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.

LGTM once the missing semicolon is added 😛

@jasonmalinowski jasonmalinowski force-pushed the stop-swallowing-exceptions branch from dfbd0ed to 45fbb55 Compare February 2, 2022 19:09
Copy link
Contributor

@RikkiGibson RikkiGibson left a comment

Choose a reason for hiding this comment

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

@jasonmalinowski jasonmalinowski force-pushed the stop-swallowing-exceptions branch from 45fbb55 to b250868 Compare February 2, 2022 21:31
@jasonmalinowski
Copy link
Member Author

@RikkiGibson @333fred @mavasani Turned out that change did require a test baseline to be updated in one test, and required another small tweak. I've made the update and you can view the diff here since I force-pushed.

We do have a test that confirms that nulls being returned from analyzers already produce diagnostics that it's bad, so no reason to report further exceptions there. The other test got a baseline update so we do have coverage on this path after all. I can't say the output of the exception in that case is pretty but if we want to tweak that further let's do so after this is in.

If an analyzer threw an exception, we generate a message that tells
you what diagnostic IDs the analzyer produces, so you know what to
disable so you can work around the analyzer. If the analyzer then also
were to throw exceptions while we ask it for it's SupportedDiagnostics,
we were eating that exception. This includes that as well.
@jasonmalinowski jasonmalinowski force-pushed the stop-swallowing-exceptions branch from b250868 to 496d572 Compare February 3, 2022 01:04
@RikkiGibson
Copy link
Contributor

Validation run is clean. Go for it @jasonmalinowski.

@jasonmalinowski jasonmalinowski merged commit 73ddbfd into dotnet:main Feb 3, 2022
@ghost ghost added this to the Next milestone Feb 3, 2022
@jasonmalinowski jasonmalinowski deleted the stop-swallowing-exceptions branch February 3, 2022 18:59
@RikkiGibson RikkiGibson removed this from the Next milestone Feb 4, 2022
@RikkiGibson RikkiGibson added this to the 17.2.P1 milestone Feb 4, 2022
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.

Delete FatalError.ReportIfNonFatalAndCatchUnlessCanceled
6 participants