Skip to content

Catch exceptions from user code - #1139

Merged
tmeschter merged 2 commits into
dotnet:masterfrom
tmeschter:HardenSolutionExplorer
Mar 10, 2015
Merged

Catch exceptions from user code#1139
tmeschter merged 2 commits into
dotnet:masterfrom
tmeschter:HardenSolutionExplorer

Conversation

@tmeschter

Copy link
Copy Markdown
Contributor

The Solution Explorer calls DiagnosticAnalyzer.SupportedDiagnostics to
determine the list of items to show. This property is implemented by a
3rd-party (the analyzer author) and could potentially throw.

Here we move to using the DiagnosticAnalyzerService to obtain this
data; it will catch any exceptions and handle reporting them to the user
as appropriate.

Fixes #898.

The Solution Explorer calls `DiagnosticAnalyzer.SupportedDiagnostics` to
determine the list of items to show. This property is implemented by a
3rd-party (the analyzer author) and could potentially throw.

Here we move to using the `DiagnosticAnalyzerService` to obtain this
data; it will catch any exceptions and handle reporting them to the user
as appropriate.

Fixes dotnet#898.
@tmeschter

Copy link
Copy Markdown
Contributor Author

@srivatsn @shyamnamboodiripad @mavasani @jmarolf @heejaechang @JohnHamby Could you take a look at this, please?

@mavasani

mavasani commented Mar 9, 2015

Copy link
Copy Markdown
Contributor

👍

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

If this cast is safe, why isn't the type of the field DiagnosticAnalyzerService?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

We should also consider just adding the GetDiagnosticDescriptors(Analyzer) method to IDiagnosticAnalyzerService interface.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@tmeschter can we just do that as part of this change?

@msJohnHamby

Copy link
Copy Markdown
Contributor

I sign off, because this is surely a good thing,

@jmarolf

jmarolf commented Mar 9, 2015

Copy link
Copy Markdown
Contributor

👍

@heejaechang

Copy link
Copy Markdown
Contributor

👍

@tmeschter @mavasani Tom, can you just add the method as part of the interface?

@tmeschter

Copy link
Copy Markdown
Contributor Author

@dotnet-bot Retest this, please.

@tmeschter

Copy link
Copy Markdown
Contributor Author

@heejaechang @mavasani I'll add the method to the interface.

Add the `GetDiagnosticDescriptors(DiagnosticAnalyzer)` method to the
`IDiagnosticAnalyzerService` interface.
tmeschter added a commit that referenced this pull request Mar 10, 2015
@tmeschter
tmeschter merged commit bcb2c8c into dotnet:master Mar 10, 2015
@tmeschter
tmeschter deleted the HardenSolutionExplorer branch March 10, 2015 17:11
dibarbet pushed a commit that referenced this pull request Aug 18, 2026
Support span and minimum severity in CreateFixAllContext
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.

All Analyzer entry points need to be audited to make sure that every one is wrapped in a catch-all exception handler

6 participants