Skip to content

Conversation

github-actions[bot]
Copy link
Contributor

@github-actions github-actions bot commented Sep 5, 2025

Backport of #118732 to release/10.0

/cc @elinor-fung @corngood

Customer Impact

  • Customer reported
  • Found internally

Publishing a single-file bundle fails when any file being bundled is a symlink. Reported (and fixed - thanks @corngood!) externally for source-build as well as internally for CloudBuild.

Regression

  • Yes
  • No

.NET 10 Preview 7: b79c4fb

Testing

Automated test added.

Risk

[High/Medium/Low. Justify the indication by mentioning how risks were measured and addressed.]

corngood and others added 2 commits September 5, 2025 18:35
FileInfo.Length will return the size of a symlink, rather than the file
itself. On a source-built dotnet SDK, a trivial test project will bundle
files like:

packs/Microsoft.NETCore.App.Runtime.linux-x64/10.0.0-preview.7.25380.108/runtimes/linux-x64/lib/net10.0/Microsoft.CSharp.dll

Which is a symlink to:

../../../../../../../shared/Microsoft.NETCore.App/10.0.0-preview.7.25380.108/Microsoft.CSharp.dll

This can result in:

> [...]/Microsoft.NET.Publish.targets(1132,5): error MSB4018: The "GenerateBundle" task failed unexpectedly. [/build/test/test.fsproj]
> [...]/Microsoft.NET.Publish.targets(1132,5): error MSB4018: System.NotSupportedException: Unable to expand length of this stream beyond its capacity. [/build/test/test.fsproj]
> [...]/Microsoft.NET.Publish.targets(1132,5): error MSB4018:    at System.IO.UnmanagedMemoryStream.WriteCore(ReadOnlySpan`1 buffer) [/build/test/test.fsproj]
> [...]/Microsoft.NET.Publish.targets(1132,5): error MSB4018:    at System.IO.Stream.CopyTo(Stream destination, Int32 bufferSize) [/build/test/test.fsproj]
> [...]/Microsoft.NET.Publish.targets(1132,5): error MSB4018:    at Microsoft.NET.HostModel.Bundle.Bundler.AddToBundle(Stream bundle, FileStream file, FileType type) [/build/test/test.fsproj]
> [...]/Microsoft.NET.Publish.targets(1132,5): error MSB4018:    at Microsoft.NET.HostModel.Bundle.Bundler.GenerateBundle(IReadOnlyList`1 fileSpecs) [/build/test/test.fsproj]
> [...]/Microsoft.NET.Publish.targets(1132,5): error MSB4018:    at Microsoft.NET.Build.Tasks.GenerateBundle.ExecuteCore() [/build/test/test.fsproj]
> [...]/Microsoft.NET.Publish.targets(1132,5): error MSB4018:    at Microsoft.NET.Build.Tasks.TaskBase.Execute() [/build/test/test.fsproj]
> [...]/Microsoft.NET.Publish.targets(1132,5): error MSB4018:    at Microsoft.Build.BackEnd.TaskExecutionHost.Execute() [/build/test/test.fsproj]
> [...]/Microsoft.NET.Publish.targets(1132,5): error MSB4018:    at Microsoft.Build.BackEnd.TaskBuilder.ExecuteInstantiatedTask(TaskExecutionHost taskExecutionHost, TaskLoggingContext taskLoggingContext, TaskHost taskHost, ItemBucket bucket, TaskExecutionMo

Fixes: b79c4fb
@jtschuster
Copy link
Member

cc @jkoritzinsky @ViktorHofer Does the 'Microsoft.IO.Redist' version and PackageDownloadAndReference look okay?

Copy link
Member

@jeffschwMSFT jeffschwMSFT left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

approved. we can merge when ready

@jeffschwMSFT jeffschwMSFT added Servicing-approved Approved for servicing release area-Host labels Sep 8, 2025
@jeffschwMSFT jeffschwMSFT added this to the 10.0.0 milestone Sep 8, 2025
Copy link
Contributor

Tagging subscribers to this area: @vitek-karas, @agocke, @VSadov
See info in area-owners.md if you want to be subscribed.

@elinor-fung
Copy link
Member

/ba-g Failure is unrelated: #110173

@jeffschwMSFT jeffschwMSFT merged commit 9ca7546 into release/10.0 Sep 11, 2025
162 of 167 checks passed
@elinor-fung elinor-fung deleted the backport/pr-118732-to-release/10.0 branch September 11, 2025 20:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-Host Servicing-approved Approved for servicing release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants