diff --git a/src/Build/Definition/ProjectCollection.cs b/src/Build/Definition/ProjectCollection.cs index 924b3e25db7..11dd0a1143d 100644 --- a/src/Build/Definition/ProjectCollection.cs +++ b/src/Build/Definition/ProjectCollection.cs @@ -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; @@ -1732,6 +1733,7 @@ private void ShutDownLoggingService() { try { + (LoggingService as LoggingService)?.WaitForLoggingToProcessEvents(); ((IBuildComponent)LoggingService).ShutdownComponent(); } catch (LoggerException) diff --git a/src/MSBuild.UnitTests/XMake_Tests.cs b/src/MSBuild.UnitTests/XMake_Tests.cs index c18c5ad2d90..33c482df035 100644 --- a/src/MSBuild.UnitTests/XMake_Tests.cs +++ b/src/MSBuild.UnitTests/XMake_Tests.cs @@ -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", @" + + + + +"); + string results = RunnerUtilities.ExecMSBuild($" {project.Path} /p:someProperty:fdalse= ", out bool success); + success.ShouldBeFalse(results); + + results.ShouldContain("error MSB4177"); + } + [Theory] [InlineData(true)] [InlineData(false)]