Open drewnoakes opened 2 years ago
I updated this code recently but this code path didn't change that much. It used to run inside a throw away task.
I wonder if its been throwing for a while? If an exception is thrown, a "fatal build error" is logged, I wonder if we can get those exception details?
This code is handling a request from an out-of-proc node to get the path to an MSBuild project SDK. The out-of-proc node is waiting for a response we need to send something back I think. I really want to know what the exception is...
@jeffkl it should be easy enough to repro with the above steps. Let me know if it doesn't repro for you and we can take a look on my machine.
Interesting yeah it repros on 17.1.0 at least which means its not a regression from my recent change. Still not great obviously but it seems like the problem has been around for a while.
I tried debugging my local experimental instance which repro'd the problem but didn't see the exception, how do I get this to happen in a debugger? This is what I tried:
@drewnoakes Thanks for filing this, I got it to show me the exception. The .NET SDK resolver is throwing because the solution path is an empty string:
I can fix the MSBuild side of things to not throw an unhandled exception and we'll need to update the .NET SDK resolver to handle this as well. I had to make a similar update to the NuGet SDK resolver:
https://github.com/NuGet/NuGet.Client/pull/4335
FYI @rainersigwald @BenVillalobos
@BenVillalobos when working on a fix I realized that this is fallout from https://github.com/dotnet/msbuild/pull/6763 which technically is incomplete since it now throws an exception on the main node when an out-of-proc node is requesting SDK resolution. Should the fix be to serialize the SDKResolverException
back to the out-of-proc node and throw it there? Otherwise the current APIs only let me send back an error message to the out-of-proc node. ๐ก
Should the fix be to serialize the SDKResolverException back to the out-of-proc node and throw it there?
this sounds right, I'm not sure how large the work item is. it sounds like a new issue should be filed for it, where this one is specifically to capture the right exception before letting it throw
I also encountered an ArgumentNullException when I was building a .NET Aspire project using the tool aspirate:
PS C:\Users\32512\source\repos\LiveMusicProjectX\AspireApp.AppHost> aspirate.exe init
_ _ ___
/ \ ___ _ __ (_) _ __ ( _ )
/ _ \ / __| | '_ \ | | | '__| / _ \
/ ___ \ \__ \ | |_) | | | | | | (_) |
/_/ \_\ |___/ | .__/ |_| |_| \___/
|_|
Handle deployments of a .NET Aspire AppHost
โโ Handle Initialization Defaults โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
(?) Done: Set 'Container builder' to 'docker'.
Aspirate supports setting a fall-back value for projects that have not yet set a 'ContainerRegistry' in their csproj
file.
Would you like to set a fall-back value for the container registry? [y/n] (n): n
Aspirate supports setting a repository prefix for all for projects.
Would you like to set this value? [y/n] (n): n
(?) Done: Set 'Container fallback tag' to 'latest'.
Aspirate supports setting a custom directory for 'Templates' that are used when generating kustomize manifests.
Would you like to use a custom directory (selecting 'n' will default to built in templates ? [y/n] (n): n
(?) Done: Configuration for aspirate has been bootstrapped successfully at
'C:\Users\32512\source\repos\LiveMusicProjectX\AspireApp.AppHost\.\aspirate.json'.
?? Execution Completed ??
PS C:\Users\32512\source\repos\LiveMusicProjectX\AspireApp.AppHost> aspirate generate
_ _ ___
/ \ ___ _ __ (_) _ __ ( _ )
/ _ \ / __| | '_ \ | | | '__| / _ \
/ ___ \ \__ \ | |_) | | | | | | (_) |
/_/ \_\ |___/ | .__/ |_| |_| \___/
|_|
Handle deployments of a .NET Aspire AppHost
โโ Handling Aspirate State โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โโ Handling Aspirate Secrets โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Secrets are to be protected by a password
Please enter new Password: *
Please enter it again to confirm: *
Secret State has been initialised!.
โโ Handling Configuration โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Successfully loaded existing aspirate bootstrap settings from '.'.
โโ Handling Aspire Manifest โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Generating Aspire Manifest for supplied App Host
(?) Done: Created Aspire Manifest At Path:
C:\Users\32512\source\repos\LiveMusicProjectX\AspireApp.AppHost\manifest.json
โโ Selecting Required Components โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โโ Handling Aspire Dashboard โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Would you like to deploy the aspire dashboard and connect the OTLP endpoint? [y/n] (y): y
โโ Handling Inputs โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โโ Handle Value and Parameter Substitution โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โโ Handling DAPR Components โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
No Dapr components selected, skipping Dapr annotations.
โโ Gathering Information about deployables โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Gathering container details for each project in selected components
(?) Done: Populated container details cache for project livemusicserver
Gathering Tasks Completed - Cache Populated.
โโ Handling Projects โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Building all project resources, and pushing containers
Executing: dotnet publish
"C:\Users\32512\source\repos\LiveMusicProjectX\AspireApp.AppHost\../LiveMusicServer/LiveMusicServer.csproj"
-t:PublishContainer --verbosity "quiet" --nologo -r "linux-x64" -p:ContainerRepository="livemusicserver"
-p:ContainerImageTag="latest"
MSBUILD : error MSB4166:
็ๆฏๅฆญ้ๅ
โฌ?้ฅๆฟ็น้โ
โฌโฌ้ๆโฌๅ๎้ฆใฅๅง้๎
โฌๅๅฝฒๆต ใฅๆนช้ฅๆท:\Users\32512\AppData\Local\Temp\MSBuildTemp\้ฅๆฟ
่
้จๅฌๆๆต ๆต่
้ต
ๆงๅ็ๅฉๆๆทโไผ
้ๅฑฝ่็ๅๅพ้่ๆๆถ?MSBuild_*.failure.txt้ๅโฌๆฐณ็น็?MSBUILDDEBUGPATH
้๎๎จ้ๆฉๅบ็ๅฅ่ด้ๆต็ฒฌ้ฉ๎ผ็ถ้ๅฑฝๅฝฒ้ๅญๆผๅงใ็ถ
็ผ๎บโฌ?
MSBUILD : error MSB4166:
C:\Users\32512\AppData\Local\Temp\MSBuildTemp\MSBuild_pid-11684_35201d88d2ef435f91e00de445495441.failure.txt:
MSBUILD : error MSB4166: UNHANDLED EXCEPTIONS FROM PROCESS 11684:
MSBUILD : error MSB4166: =====================
MSBUILD : error MSB4166: 2024/8/30 4:04:33
MSBUILD : error MSB4166: System.ArgumentNullException: Value cannot be null. (Parameter 'value')
MSBUILD : error MSB4166: at System.ArgumentNullException.Throw(String paramName)
MSBUILD : error MSB4166: at System.IO.BinaryWriter.Write(String value)
MSBUILD : error MSB4166: at Microsoft.Build.Framework.TelemetryEventArgs.WriteToStream(BinaryWriter writer)
MSBUILD : error MSB4166: at Microsoft.Build.Shared.LogMessagePacketBase.WriteToStream(ITranslator translator)
MSBUILD : error MSB4166: at Microsoft.Build.BackEnd.NodeEndpointOutOfProcBase.RunReadLoop(Stream localReadPipe,
Stream localWritePipe, ConcurrentQueue`1 localPacketQueue, AutoResetEvent localPacketAvailable, AutoResetEvent
localTerminatePacketPump)
MSBUILD : error MSB4166: ===================
MSBUILD : error MSB4166:
MSBUILD : error MSB4166:
้ๅคๅฝฒ้ขใงๆฎๅฎธใค็ถ็็ปๆต้ๅญๆ้ๅๆน้ๅฎ ๎็ผๅไฟ้ญ๎ค็ด็็ฏ็น็?`dotnet workload list`้?
(1): Aspirate will now exit.
UNHANDLED EXCEPTIONS FROM PROCESS 9072:
=====================
2024/8/30 4:04:55
System.ArgumentNullException: Value cannot be null. (Parameter 'value')
at System.ArgumentNullException.Throw(String paramName)
at System.IO.BinaryWriter.Write(String value)
at Microsoft.Build.Framework.TelemetryEventArgs.WriteToStream(BinaryWriter writer)
at Microsoft.Build.Shared.LogMessagePacketBase.WriteToStream(ITranslator translator)
at Microsoft.Build.BackEnd.NodeEndpointOutOfProcBase.RunReadLoop(Stream localReadPipe, Stream localWritePipe, ConcurrentQueue`1 localPacketQueue, AutoResetEvent localPacketAvailable, AutoResetEvent localTerminatePacketPump)
===================
@ArsiIksait can you update your .NET SDK? That crash should be fixed by https://github.com/dotnet/msbuild/pull/10464.
@rainersigwald How do I update my .NET SDK? Is it from https://dotnet.microsoft.com/zh-cn/download Install .NET SDK 8.0.401? Or do I need to build this project myself?
@rainersigwald Thank you, this problem was solved after I updated it, but then a new problem appeared, I don't know what's happening
Executing: dotnet publish
"C:\Users\32512\source\repos\AspireApp.AppHost\../AspireApp.ApiService/AspireApp.ApiService.csproj" -t:PublishContainer
--verbosity "quiet" --nologo -r "linux-x64" -p:ContainerRepository="apiservice" -p:ContainerImageTag="latest"
C:\Program Files\dotnet\sdk\8.0.401\Containers\build\Microsoft.NET.Build.Containers.targets(242,5): error MSB4018:
้ฅๆทreateNewImage้ฅๆฟ
ๆข้โๅฐๆพถๆ งใ็ใฃโฌ?[C:\Users\32512\source\repos\AspireApp.ApiService\AspireApp.ApiService.csproj]
C:\Program Files\dotnet\sdk\8.0.401\Containers\build\Microsoft.NET.Build.Containers.targets(242,5): error MSB4018:
System.IO.IOException: Received an unexpected EOF or 0 bytes from the transport stream.
[C:\Users\32512\source\repos\AspireApp.ApiService\AspireApp.ApiService.csproj]
C:\Program Files\dotnet\sdk\8.0.401\Containers\build\Microsoft.NET.Build.Containers.targets(242,5): error MSB4018: at
System.Net.Security.SslStream.EnsureFullTlsFrameAsync[TIOAdapter](CancellationToken cancellationToken, Int32
estimatedSize) [C:\Users\32512\source\repos\AspireApp.ApiService\AspireApp.ApiService.csproj]
C:\Program Files\dotnet\sdk\8.0.401\Containers\build\Microsoft.NET.Build.Containers.targets(242,5): error MSB4018: at
System.Runtime.CompilerServices.PoolingAsyncValueTaskMethodBuilder`1.StateMachineBox`1.System.Threading.Tasks.Sources.IV
alueTaskSource<TResult>.GetResult(Int16 token)
[C:\Users\32512\source\repos\AspireApp.ApiService\AspireApp.ApiService.csproj]
C:\Program Files\dotnet\sdk\8.0.401\Containers\build\Microsoft.NET.Build.Containers.targets(242,5): error MSB4018: at
System.Net.Security.SslStream.ReadAsyncInternal[TIOAdapter](Memory`1 buffer, CancellationToken cancellationToken)
[C:\Users\32512\source\repos\AspireApp.ApiService\AspireApp.ApiService.csproj]
C:\Program Files\dotnet\sdk\8.0.401\Containers\build\Microsoft.NET.Build.Containers.targets(242,5): error MSB4018: at
System.Runtime.CompilerServices.PoolingAsyncValueTaskMethodBuilder`1.StateMachineBox`1.System.Threading.Tasks.Sources.IV
alueTaskSource<TResult>.GetResult(Int16 token)
[C:\Users\32512\source\repos\AspireApp.ApiService\AspireApp.ApiService.csproj]
C:\Program Files\dotnet\sdk\8.0.401\Containers\build\Microsoft.NET.Build.Containers.targets(242,5): error MSB4018: at
System.Net.Http.HttpConnection.FillAsync(Boolean async)
[C:\Users\32512\source\repos\AspireApp.ApiService\AspireApp.ApiService.csproj]
C:\Program Files\dotnet\sdk\8.0.401\Containers\build\Microsoft.NET.Build.Containers.targets(242,5): error MSB4018: at
System.Net.Http.HttpConnection.CopyToContentLengthAsync(Stream destination, Boolean async, UInt64 length, Int32
bufferSize, CancellationToken cancellationToken)
[C:\Users\32512\source\repos\AspireApp.ApiService\AspireApp.ApiService.csproj]
C:\Program Files\dotnet\sdk\8.0.401\Containers\build\Microsoft.NET.Build.Containers.targets(242,5): error MSB4018: at
System.Net.Http.HttpConnection.ContentLengthReadStream.CompleteCopyToAsync(Task copyTask, CancellationToken
cancellationToken) [C:\Users\32512\source\repos\AspireApp.ApiService\AspireApp.ApiService.csproj]
C:\Program Files\dotnet\sdk\8.0.401\Containers\build\Microsoft.NET.Build.Containers.targets(242,5): error MSB4018: at
Microsoft.NET.Build.Containers.Registry.DownloadBlobAsync(String repository, Descriptor descriptor, CancellationToken
cancellationToken) in /_/src/Containers/Microsoft.NET.Build.Containers/Registry/Registry.cs:line 337
[C:\Users\32512\source\repos\AspireApp.ApiService\AspireApp.ApiService.csproj]
C:\Program Files\dotnet\sdk\8.0.401\Containers\build\Microsoft.NET.Build.Containers.targets(242,5): error MSB4018: at
Microsoft.NET.Build.Containers.DockerCli.WriteImageToStreamAsync(BuiltImage image, SourceImageReference sourceReference,
DestinationImageReference destinationReference, Stream imageStream, CancellationToken cancellationToken) in
/_/src/Containers/Microsoft.NET.Build.Containers/LocalDaemons/DockerCli.cs:line 282
[C:\Users\32512\source\repos\AspireApp.ApiService\AspireApp.ApiService.csproj]
C:\Program Files\dotnet\sdk\8.0.401\Containers\build\Microsoft.NET.Build.Containers.targets(242,5): error MSB4018: at
Microsoft.NET.Build.Containers.DockerCli.LoadAsync(BuiltImage image, SourceImageReference sourceReference,
DestinationImageReference destinationReference, CancellationToken cancellationToken) in
/_/src/Containers/Microsoft.NET.Build.Containers/LocalDaemons/DockerCli.cs:line 104
[C:\Users\32512\source\repos\AspireApp.ApiService\AspireApp.ApiService.csproj]
C:\Program Files\dotnet\sdk\8.0.401\Containers\build\Microsoft.NET.Build.Containers.targets(242,5): error MSB4018: at
Microsoft.NET.Build.Containers.Tasks.CreateNewImage.PushToLocalRegistryAsync(BuiltImage builtImage, SourceImageReference
sourceImageReference, DestinationImageReference destinationImageReference, Telemetry telemetry, CancellationToken
cancellationToken) in /_/src/Containers/Microsoft.NET.Build.Containers/Tasks/CreateNewImage.cs:line 218
[C:\Users\32512\source\repos\AspireApp.ApiService\AspireApp.ApiService.csproj]
C:\Program Files\dotnet\sdk\8.0.401\Containers\build\Microsoft.NET.Build.Containers.targets(242,5): error MSB4018: at
Microsoft.NET.Build.Containers.Tasks.CreateNewImage.ExecuteAsync(CancellationToken cancellationToken) in
/_/src/Containers/Microsoft.NET.Build.Containers/Tasks/CreateNewImage.cs:line 182
[C:\Users\32512\source\repos\AspireApp.ApiService\AspireApp.ApiService.csproj]
C:\Program Files\dotnet\sdk\8.0.401\Containers\build\Microsoft.NET.Build.Containers.targets(242,5): error MSB4018: at
Microsoft.NET.Build.Containers.Tasks.CreateNewImage.Execute() in
/_/src/Containers/Microsoft.NET.Build.Containers/Tasks/CreateNewImage.cs:line 36
[C:\Users\32512\source\repos\AspireApp.ApiService\AspireApp.ApiService.csproj]
C:\Program Files\dotnet\sdk\8.0.401\Containers\build\Microsoft.NET.Build.Containers.targets(242,5): error MSB4018: at
Microsoft.Build.BackEnd.TaskExecutionHost.Execute()
[C:\Users\32512\source\repos\AspireApp.ApiService\AspireApp.ApiService.csproj]
C:\Program Files\dotnet\sdk\8.0.401\Containers\build\Microsoft.NET.Build.Containers.targets(242,5): error MSB4018: at
Microsoft.Build.BackEnd.TaskBuilder.ExecuteInstantiatedTask(TaskExecutionHost taskExecutionHost, TaskLoggingContext
taskLoggingContext, TaskHost taskHost, ItemBucket bucket, TaskExecutionMode howToExecuteTask)
[C:\Users\32512\source\repos\AspireApp.ApiService\AspireApp.ApiService.csproj]
้ๅคๅฝฒ้ขใงๆฎๅฎธใค็ถ็็ปๆต้ๅญๆ้ๅๆน้ๅฎ ๎็ผๅไฟ้ญ๎ค็ด็็ฏ็น็?`dotnet workload list`้?
(1): Aspirate will now exit.
Issue Description
Seeing an ANE crash while debugging VS, after creating a project.
Discovered while researching a hang reported in https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1462801. Perhaps the failures are related.
Steps to Reproduce
Analysis
The ANE originates here:
https://github.com/dotnet/msbuild/blob/9c173296404f9c365cc524569766f16d7cfcf308/src/Build/BackEnd/Components/SdkResolution/MainNodeSdkResolverService.cs#L93
response
will be null in thefinally
block if there was an exception. That null value triggers an exception, which crashes VS in the above scenario.#nullable enable
would flag this issue in the code.Versions & Configurations
VS 17.2.0 Preview 3.0 [32308.589.main]