Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
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
5 changes: 4 additions & 1 deletion 5 src/msbuild/.vsts-dotnet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,10 @@ variables:
- name: SkipApplyOptimizationData
value: true
- name: EnableReleaseOneLocBuild
value: true
value: false
- ${{ if eq(variables['Build.SourceBranch'], 'refs/heads/main') }}:
- name: EnableReleaseOneLocBuild
value: true
- name: Codeql.Enabled
value: true
- group: DotNet-MSBuild-SDLValidation-Params
Expand Down
6 changes: 6 additions & 0 deletions 6 src/msbuild/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,12 @@
<PropertyGroup>
<TestRunnerName>XUnitV3</TestRunnerName>

<!-- Pin xunit.v3 / MTP up only when Arcade's default sits below our pin. -->
<_MSBuildXUnitV3Pin>3.2.2</_MSBuildXUnitV3Pin>
<_MSBuildMTPPin>1.9.1</_MSBuildMTPPin>

<XUnitV3Version Condition="'$(XUnitV3Version)' == '' or $([MSBuild]::VersionLessThan($(XUnitV3Version), $(_MSBuildXUnitV3Pin)))">$(_MSBuildXUnitV3Pin)</XUnitV3Version>
<MicrosoftTestingPlatformVersion Condition="'$(MicrosoftTestingPlatformVersion)' == '' or $([MSBuild]::VersionLessThan($(MicrosoftTestingPlatformVersion), $(_MSBuildMTPPin)))">$(_MSBuildMTPPin)</MicrosoftTestingPlatformVersion>
<OutputType Condition="$(MSBuildProjectName.EndsWith('.UnitTests')) or $(MSBuildProjectName.EndsWith('.Tests'))">Exe</OutputType>

<!-- xUnit1051: Calls to methods which accept CancellationToken should use TestContext.Current.CancellationToken to allow test cancellation to be more responsive. -->
Expand Down
4 changes: 2 additions & 2 deletions 4 src/msbuild/eng/Version.Details.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Dependencies>
<Source Uri="https://github.com/dotnet/dotnet" Mapping="msbuild" Sha="bf38c69d5d4087d1098b5f31283ad147feadf787" BarId="312135" />
<Source Uri="https://github.com/dotnet/dotnet" Mapping="msbuild" Sha="547c640d5626b2976499cb3433abc741a63d67c5" BarId="313814" />
<ProductDependencies>
<!-- Necessary for source-build. This allows the live version of the package to be used by source-build. -->
<Dependency Name="System.CodeDom" Version="10.0.4">
Expand Down Expand Up @@ -123,4 +123,4 @@
<Sha>3454b2fe822e52373f2604856417b0e6bce71d70</Sha>
</Dependency>
</ToolsetDependencies>
</Dependencies>
</Dependencies>
2 changes: 1 addition & 1 deletion 2 src/msbuild/eng/Versions.props
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@
</PropertyGroup>

<PropertyGroup>
<BootstrapSdkVersion>10.0.106</BootstrapSdkVersion>
<BootstrapSdkVersion>10.0.107</BootstrapSdkVersion>
</PropertyGroup>

<Target Name="OverrideArcadeFileVersion" AfterTargets="_InitializeAssemblyVersion">
Expand Down
13 changes: 11 additions & 2 deletions 13 src/msbuild/src/Build.UnitTests/BackEnd/LoggingService_Tests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1153,7 +1153,12 @@ public void ProcessLoggingEventConcurrentWithShutdown_DoesNotThrow()

LoggingService loggingService = (LoggingService)LoggingService.CreateLoggingService(LoggerMode.Asynchronous, 1);
((IBuildComponent)loggingService).InitializeComponent(mockHost);
loggingService.RegisterLogger(new ConsoleLogger());

loggingService.RegisterLogger(new MockLogger());

Exception loggingThreadException = null;
loggingService.OnLoggingThreadException += ex =>
Interlocked.CompareExchange(ref loggingThreadException, ex, null);

using ManualResetEvent startSignal = new ManualResetEvent(false);
Exception caughtException = null;
Expand All @@ -1166,7 +1171,10 @@ public void ProcessLoggingEventConcurrentWithShutdown_DoesNotThrow()
{
try
{
BuildMessageEventArgs msg = new BuildMessageEventArgs($"Message {i}", null, null, MessageImportance.Low);
BuildMessageEventArgs msg = new BuildMessageEventArgs($"Message {i}", null, null, MessageImportance.Low)
{
BuildEventContext = new BuildEventContext(0, 0, 0, 0),
};
loggingService.ProcessLoggingEvent(msg);
}
catch (Exception ex)
Expand All @@ -1186,6 +1194,7 @@ public void ProcessLoggingEventConcurrentWithShutdown_DoesNotThrow()
bool joined = logThread.Join(TimeSpan.FromSeconds(10));
joined.ShouldBeTrue("Logging thread did not terminate within the allotted time.");
caughtException.ShouldBeNull();
loggingThreadException.ShouldBeNull();
}

#endregion
Expand Down
89 changes: 89 additions & 0 deletions 89 src/msbuild/src/Build.UnitTests/BackEnd/MSBuildClient_Tests.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

#nullable enable

using System;
using System.IO;
using System.Threading;
using Microsoft.Build.Experimental;
using Microsoft.Build.UnitTests;
using Shouldly;
using Xunit;

namespace Microsoft.Build.UnitTests.BackEnd
{
/// <summary>
/// Tests for the <see cref="MSBuildClient"/> fallback behaviour.
/// </summary>
public class MSBuildClient_Tests
{
private readonly ITestOutputHelper _output;

public MSBuildClient_Tests(ITestOutputHelper output)
{
_output = output;
}

/// <summary>
/// When the configured msbuild executable does not exist, launching the server fails.
/// <see cref="MSBuildClient.Execute"/> must return a recoverable exit type rather than
/// letting an exception escape — it is the host's contract that any failure inside
/// Execute routes through <see cref="MSBuildClientExitResult"/> so callers (e.g.
/// <c>MSBuildClientApp</c>) can fall back to in-process execution.
/// </summary>
/// <remarks>
/// Regression coverage for the .NET 10.0.300 / Aspire timeout: when
/// <c>DOTNET_CLI_USE_MSBUILD_SERVER=true</c> is honoured but the server child cannot
/// start (e.g. the apphost can't find the .NET runtime), <see cref="MSBuildClient.Execute"/>
/// must not propagate a <see cref="System.TimeoutException"/> or any other exception.
/// Pre-fix, an uncaught <c>TimeoutException</c> from <c>NamedPipeClientStream.Connect</c>
/// escaped past <c>MSBuildClientApp</c> and crashed the CLI; this test locks in the
/// no-exception-escape contract by simply calling <c>Execute</c> outside any try/catch
/// and asserting on the structured result.
/// </remarks>
[Fact]
public void Execute_WithUnreachableServer_DoesNotPropagateException()
{
// Isolate from any real MSBuild server / DOTNET_CLI_USE_MSBUILD_SERVER state on
// the dev or CI machine. Without this the named-mutex check in MSBuildClient can
// observe a warm server from another test/run, which makes the assertions below
// non-deterministic.
using TestEnvironment env = TestEnvironment.Create(_output);
env.SetEnvironmentVariable("DOTNET_CLI_USE_MSBUILD_SERVER", null);
env.SetEnvironmentVariable("MSBUILDUSESERVER", null);

string[] commandLine = ["dummy.proj"];
string nonexistentMsBuild = Path.Combine(
Path.GetTempPath(),
"msbuildclient-tests-" + Guid.NewGuid().ToString("N"),
"MSBuild.dll");

MSBuildClient client = new MSBuildClient(commandLine, nonexistentMsBuild);

// The whole point of the regression fix: this must NOT throw. xUnit fails the
// test with the offending stack if any exception escapes, which is the
// primary regression contract being verified.
MSBuildClientExitResult result = client.Execute(CancellationToken.None);

result.ShouldNotBeNull();

// The unreachable-server path must produce one of the recoverable failure types
// so that MSBuildClientApp can fall back to in-process execution. Crucially,
// ServerBusy is excluded here: ServerBusy is the "another client is racing for
// the launch mutex" path and is not what an unreachable server should produce —
// accepting it would mask a real regression where the failure was misclassified.
result.MSBuildClientExitType.ShouldBeOneOf(
MSBuildClientExitType.LaunchError,
MSBuildClientExitType.UnableToConnect,
MSBuildClientExitType.UnknownServerState);

// No server child was successfully launched, so the diagnostic helper should not
// have observed an exit code. (Once issue #13718 lands and the diagnostic helper
// is plumbed through every connect failure, this gives MSBuildClientApp the right
// signal to pick the generic "server unavailable" message rather than the more
// specific "crashed with exit code N" one.)
result.ServerProcessExitCode.ShouldBeNull();
}
}
}
Loading
Morty Proxy This is a proxified and sanitized view of the page, visit original site.