dotnet / dotnet/roslyn

Improve MSBuildWorkspace diagnostic reporting

Open
#75,170 0 comments 0 reactions 1 assignee Claimed by @JoeRobich View on GitHub
Area-IDE IDE-MSBuildWorkspace
Dominant language
C#
Stars
20.7k
Forks
4.3k
PR merge metrics
PR metrics pending

Description

`MSBuildWorkspace.WorkspaceFailed` reports `WorkspaceDiagnosticKind.Failure` even for issues that can be safely ignored, such as failure to load project of unregistered extension.

Internally, `DiagnosticReporter.Report` conflates logging with exception handling. It's unclear why `DiagnosticReportingMode` is needed.
Callers that pass `DiagnosticReportingMode.Throw` should just throw the exception directly.
Callers that pass `DiagnosticReportingMode.Ignore` should not call the method at all - it's a no op.

`MSBuildWorkspace.WorkspaceFailed` should be called with `WorkspaceDiagnosticKind.Failure` only for unrecoverable errors. Presumably, we wouldn't immediately throw in these cases so that we can report all the errors. Failure should be reported if and only if the operation fails. If the operation can succeed (e.g. by ignoring certain projects) a warning should be reported.

Update dotnet-watch once fixed - see https://github.com/dotnet/sdk/pull/43571.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.