Skip to content

Improve MSBuildWorkspace diagnostic reporting #75170

Open
@tmat

Description

@tmat

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 dotnet/sdk#43571.

Metadata

Metadata

Assignees

Type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions