dotnet / sdk

Core functionality needed to create .NET Core projects, that is shared between Visual Studio and CLI
https://dot.net/core
MIT License
2.7k stars 1.06k forks source link

MSB4018: System.IO.EndOfStreamException #28734

Open deeprobin opened 2 years ago

deeprobin commented 2 years ago

Issue Description

My build is failing with a weird error. I can't share a reproduction unfortunately as it is a larger project. Actually I'm trying to build a .NET runtime (dotnet/runtime) project - It seems, however, not to be due to the build infrastructure of the repository.

The error only occurs since I updated the SDK to the latest RC version.

Steps to Reproduce

Expected Behavior

Passing build

Actual Behavior

binlog.zip

C:\Program Files\dotnet\sdk\7.0.100-rc.2.22477.23\Sdks\Microsoft.NET.Sdk\targets\Microsoft.PackageDependencyResolution.targets(267,5): error MSB4018: Unerwarteter Fehler bei der ResolvePackageAssets-Aufgabe.
[E:\external\dotnet\runtime\src\libraries\System.Collections\ref\System.Collections.csproj]
C:\Program Files\dotnet\sdk\7.0.100-rc.2.22477.23\Sdks\Microsoft.NET.Sdk\targets\Microsoft.PackageDependencyResolution.targets(267,5): error MSB4018: System.IO.EndOfStreamException: Unable to read beyond the
end of the stream. [E:\external\dotnet\runtime\src\libraries\System.Collections\ref\System.Collections.csproj]
C:\Program Files\dotnet\sdk\7.0.100-rc.2.22477.23\Sdks\Microsoft.NET.Sdk\targets\Microsoft.PackageDependencyResolution.targets(267,5): error MSB4018:    at System.IO.BinaryReader.InternalRead(Int32 numBytes)
[E:\external\dotnet\runtime\src\libraries\System.Collections\ref\System.Collections.csproj]
C:\Program Files\dotnet\sdk\7.0.100-rc.2.22477.23\Sdks\Microsoft.NET.Sdk\targets\Microsoft.PackageDependencyResolution.targets(267,5): error MSB4018:    at System.IO.BinaryReader.ReadInt32() [E:\external\dotn
et\runtime\src\libraries\System.Collections\ref\System.Collections.csproj]
C:\Program Files\dotnet\sdk\7.0.100-rc.2.22477.23\Sdks\Microsoft.NET.Sdk\targets\Microsoft.PackageDependencyResolution.targets(267,5): error MSB4018:    at Microsoft.NET.Build.Tasks.ResolvePackageAssets.Cache
Reader.ReadItemGroup() [E:\external\dotnet\runtime\src\libraries\System.Collections\ref\System.Collections.csproj]
C:\Program Files\dotnet\sdk\7.0.100-rc.2.22477.23\Sdks\Microsoft.NET.Sdk\targets\Microsoft.PackageDependencyResolution.targets(267,5): error MSB4018:    at Microsoft.NET.Build.Tasks.ResolvePackageAssets.ReadI
temGroups() [E:\external\dotnet\runtime\src\libraries\System.Collections\ref\System.Collections.csproj]
C:\Program Files\dotnet\sdk\7.0.100-rc.2.22477.23\Sdks\Microsoft.NET.Sdk\targets\Microsoft.PackageDependencyResolution.targets(267,5): error MSB4018:    at Microsoft.NET.Build.Tasks.ResolvePackageAssets.Execu
teCore() [E:\external\dotnet\runtime\src\libraries\System.Collections\ref\System.Collections.csproj]
C:\Program Files\dotnet\sdk\7.0.100-rc.2.22477.23\Sdks\Microsoft.NET.Sdk\targets\Microsoft.PackageDependencyResolution.targets(267,5): error MSB4018:    at Microsoft.NET.Build.Tasks.TaskBase.Execute() [E:\ext
ernal\dotnet\runtime\src\libraries\System.Collections\ref\System.Collections.csproj]
C:\Program Files\dotnet\sdk\7.0.100-rc.2.22477.23\Sdks\Microsoft.NET.Sdk\targets\Microsoft.PackageDependencyResolution.targets(267,5): error MSB4018:    at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.
Build.BackEnd.ITaskExecutionHost.Execute() [E:\external\dotnet\runtime\src\libraries\System.Collections\ref\System.Collections.csproj]
C:\Program Files\dotnet\sdk\7.0.100-rc.2.22477.23\Sdks\Microsoft.NET.Sdk\targets\Microsoft.PackageDependencyResolution.targets(267,5): error MSB4018:    at Microsoft.Build.BackEnd.TaskBuilder.ExecuteInstantia
tedTask(ITaskExecutionHost taskExecutionHost, TaskLoggingContext taskLoggingContext, TaskHost taskHost, ItemBucket bucket, TaskExecutionMode howToExecuteTask) [E:\external\dotnet\runtime\src\libraries\System.
Collections\ref\System.Collections.csproj]

... (see binlog)

Analysis

I don't know if this or sdk is the right repo

Versions & Configurations

MSBuild version 17.4.0-preview-22470-08+6521b1591 for .NET 17.4.0.47008

SDK 7.0.100-rc.2.22477.23

danmoseley commented 2 years ago

If you clean and then build does it still happen? Wonder whether the upgraded version can't read a file written by the previous version.

deeprobin commented 2 years ago

@danmoseley Unfortunately, yes.

rainersigwald commented 2 years ago

The task in question lives in dotnet/sdk so I'll move this.

rainersigwald commented 2 years ago

I believe, though, that this will be fixed (in 7.0.100 GA) by dotnet/sdk#28222.

nagilson commented 2 years ago

@deeprobin May you please report back if this is fixed in GA once released?

For now, it would be great if we could supply a workaround. But there's no current release that contains this fix. @marcpopMSFT @baronfel Do we have some sort of standardized, temporary-workaround guidance for customers who could be fixed by updating their SDK to an unofficial release? Alternatively, they could probably apply the patch https://github.com/dotnet/sdk/pull/28222/files here onto their local copy of the SDK since it's quite simple.

marcpopMSFT commented 2 years ago

Assuming it flowed into 7.0.2xx, that's what I would recommend someone installing to get unblocked. I realized the installer table wasn't updated so doing that too: https://github.com/dotnet/installer/pull/14831