-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Fix TimeoutException when DOTNET_CLI_USE_MSBUILD_SERVER=true on .NET 10.0.300 #13716
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
Merged
rainersigwald
merged 13 commits into
main
from
copilot/fix-timeout-exception-during-build
May 14, 2026
Merged
Changes from 6 commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
34cc9d2
Initial plan
Copilot 2b21ff0
Pass DOTNET_ROOT env overrides when launching MSBuild server node
Copilot 9e1ddf4
Improve server-launch diagnostics; fall back to in-proc on connect fa…
Copilot c84ecd1
Address review comments: drop placeholder issue link, enable nullable…
Copilot 794f83f
Address review: localize fallback messages, surface "server crashed" …
Copilot b9eb4ac
Merge branch 'main' into copilot/fix-timeout-exception-during-build
JanProvaznik 98f009d
Address review feedback: tighten test, neutralize fallback wording, c…
JanProvaznik ef83ce7
Merge branch 'main' into copilot/fix-timeout-exception-during-build
JanProvaznik 2514bf2
Merge remote-tracking branch 'origin/main' into copilot/fix-timeout-e…
rainersigwald 3df368f
Condense DOTNET_ROOT comment in MSBuildClient.TryLaunchServer
rainersigwald 6c378ce
Potential fix for pull request finding
rainersigwald e38dea6
Remove MSBUILDDEBUGCOMM mention and apply suggested wording in fallba…
Copilot c5a09b3
Potential fix for pull request finding
rainersigwald File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,50 @@ | ||
| // Licensed to the .NET Foundation under one or more agreements. | ||
| // The .NET Foundation licenses this file to you under the MIT license. | ||
|
|
||
| using System; | ||
| using System.IO; | ||
| using System.Threading; | ||
| using Microsoft.Build.Experimental; | ||
| using Shouldly; | ||
| using Xunit; | ||
|
|
||
| namespace Microsoft.Build.Engine.UnitTests.BackEnd | ||
| { | ||
| /// <summary> | ||
| /// Tests for the <see cref="MSBuildClient"/> fallback behaviour. | ||
| /// </summary> | ||
| public sealed class MSBuildClient_Tests | ||
| { | ||
| /// <summary> | ||
| /// When the configured msbuild executable does not exist, launching the server fails. | ||
| /// The client must report a recoverable exit type (LaunchError / UnableToConnect / | ||
| /// UnknownServerState / ServerBusy) rather than letting an exception escape. | ||
| /// </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"/> — it must return an exit type that | ||
| /// causes the host (<c>MSBuildClientApp</c>) to fall back to in-proc execution. | ||
| /// </remarks> | ||
| [Fact] | ||
| public void Execute_WithUnreachableServer_DoesNotPropagateException() | ||
| { | ||
| string[] commandLine = ["dummy.proj"]; | ||
| string nonexistentMsBuild = Path.Combine(Path.GetTempPath(), "does-not-exist-" + Guid.NewGuid().ToString("N"), "MSBuild.dll"); | ||
|
|
||
| MSBuildClient client = new MSBuildClient(commandLine, nonexistentMsBuild); | ||
|
|
||
| // The whole point of the regression fix: this must NOT throw. Any of the recoverable | ||
| // exit types is acceptable here — what matters is that MSBuildClientApp gets a chance | ||
| // to fall back to in-proc execution. | ||
| MSBuildClientExitResult result = client.Execute(CancellationToken.None); | ||
|
|
||
| result.MSBuildClientExitType.ShouldBeOneOf( | ||
| MSBuildClientExitType.LaunchError, | ||
| MSBuildClientExitType.UnableToConnect, | ||
| MSBuildClientExitType.UnknownServerState, | ||
| MSBuildClientExitType.ServerBusy); | ||
| } | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
|
rainersigwald marked this conversation as resolved.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.