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

[automated] Merge branch 'release/9.0.1xx' => 'release/9.0.2xx' #43677

Merged
merged 2 commits into from
Sep 26, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -22,8 +22,11 @@ public IncrementalMSBuildWorkspace(IReporter reporter)
{
WorkspaceFailed += (_sender, diag) =>
{
// Errors reported here are not fatal, an exception would be thrown for fatal issues.
reporter.Verbose($"MSBuildWorkspace warning: {diag.Diagnostic}");
// Report both Warning and Failure as warnings.
// MSBuildProjectLoader reports Failures for cases where we can safely continue loading projects
// (e.g. non-C#/VB project is ignored).
// https://github.com/dotnet/roslyn/issues/75170
reporter.Warn($"msbuild: {diag.Diagnostic}", "⚠");
};

_reporter = reporter;
21 changes: 21 additions & 0 deletions test/dotnet-watch.Tests/HotReload/ApplyDeltaTests.cs
Original file line number Diff line number Diff line change
@@ -121,6 +121,27 @@ public async Task BlazorWasm()
//await App.AssertOutputLineStartsWith(MessageDescriptor.HotReloadSucceeded);
}

[Fact]
public async Task BlazorWasm_MSBuildWarning()
{
var testAsset = TestAssets
.CopyTestAsset("WatchBlazorWasm")
.WithSource()
.WithProjectChanges(proj =>
{
proj.Root.Descendants()
.Single(e => e.Name.LocalName == "ItemGroup")
.Add(XElement.Parse("""
<AdditionalFiles Include="Pages\Index.razor" />
"""));
});

App.Start(testAsset, [], testFlags: TestFlags.MockBrowser);

await App.AssertOutputLineStartsWith("dotnet watch ⚠ msbuild: [Warning] Duplicate source file");
await App.AssertWaitingForChanges();
}

// Test is timing out on .NET Framework: https://github.com/dotnet/sdk/issues/41669
[CoreMSBuildOnlyFact]
public async Task HandleMissingAssemblyFailure()
12 changes: 8 additions & 4 deletions test/dotnet-watch.Tests/Watch/Utilities/WatchableApp.cs
Original file line number Diff line number Diff line change
@@ -51,12 +51,16 @@ public async Task<string> AssertOutputLineStartsWith(string expectedPrefix, Pred
success: line => line.StartsWith(expectedPrefix, StringComparison.Ordinal),
failure: failure ?? new Predicate<string>(line => line.Contains(WatchErrorOutputEmoji, StringComparison.Ordinal)));

if (line == null && failure != null)
if (line == null)
{
Assert.Fail($"Failed to find expected text: '{expectedPrefix}'");
Assert.Fail(failure != null
? "Encountered failure condition"
: $"Failed to find expected prefix: '{expectedPrefix}'");
}
else
{
Assert.StartsWith(expectedPrefix, line, StringComparison.Ordinal);
}

Assert.StartsWith(expectedPrefix, line, StringComparison.Ordinal);

return line.Substring(expectedPrefix.Length);
}