Skip to content

Commit

Permalink
do not fail tests in areas where workspace warnings are expected
Browse files Browse the repository at this point in the history
  • Loading branch information
jmarolf committed Nov 8, 2021
1 parent a927732 commit 7395382
Show file tree
Hide file tree
Showing 3 changed files with 111 additions and 85 deletions.
8 changes: 6 additions & 2 deletions src/Workspaces/MSBuildTest/MSBuildWorkspaceTestBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -151,10 +151,14 @@ protected async Task<Solution> SolutionAsync(params IBuilder[] inputs)
}
}

protected static MSBuildWorkspace CreateMSBuildWorkspace(params (string key, string value)[] additionalProperties)
protected static MSBuildWorkspace CreateMSBuildWorkspace(bool throwOnWorkspaceFailed = true, params (string key, string value)[] additionalProperties)
{
var workspace = MSBuildWorkspace.Create(CreateProperties(additionalProperties));
workspace.WorkspaceFailed += (s, e) => throw new Exception($"Workspace failure {e.Diagnostic.Kind}:{e.Diagnostic.Message}");
if (throwOnWorkspaceFailed)
{
workspace.WorkspaceFailed += (s, e) => throw new Exception($"Workspace failure {e.Diagnostic.Kind}:{e.Diagnostic.Message}");
}

return workspace;
}

Expand Down
Loading

0 comments on commit 7395382

Please sign in to comment.