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

Logger emits message on invalid property name #9570

Merged
merged 4 commits into from
Jan 4, 2024
Merged
Show file tree
Hide file tree
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
2 changes: 2 additions & 0 deletions src/Build/Definition/ProjectCollection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
using System.Threading;
using System.Xml;
using Microsoft.Build.BackEnd;
using Microsoft.Build.BackEnd.Logging;
using Microsoft.Build.Collections;
using Microsoft.Build.Construction;
using Microsoft.Build.Execution;
Expand Down Expand Up @@ -1732,6 +1733,7 @@ private void ShutDownLoggingService()
{
try
{
(LoggingService as LoggingService)?.WaitForLoggingToProcessEvents();
((IBuildComponent)LoggingService).ShutdownComponent();
}
catch (LoggerException)
Expand Down
16 changes: 16 additions & 0 deletions src/MSBuild.UnitTests/XMake_Tests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -793,6 +793,22 @@ public void ExecuteAppWithGetPropertyItemAndTargetResult(
results.ShouldNotContain(ResourceUtilities.GetResourceString("BuildFailedWithPropertiesItemsOrTargetResultsRequested"));
}

[Fact]
public void BuildFailsWithBadPropertyName()
{
using TestEnvironment env = TestEnvironment.Create();
TransientTestFile project = env.CreateFile("testProject.csproj", @"
<Project>
<Target Name=""Build"">
</Target>
</Project>
");
string results = RunnerUtilities.ExecMSBuild($" {project.Path} /p:someProperty:fdalse= ", out bool success);
success.ShouldBeFalse(results);

results.ShouldContain("error MSB4177");
}

[Theory]
[InlineData(true)]
[InlineData(false)]
Expand Down