Sdk: ResolvePackageAssets InvalidDataException Found invalid data while decoding

Created on 19 Apr 2019  路  10Comments  路  Source: dotnet/sdk

Resolution.targets(233,5): message NETSDK1062: Unable to use package assets cache due to I/O error. This can occur when
 the same project is built more than once in parallel. Performance may be degraded, but the build result will not be im
pacted. [D:\github\AspNetCore\artifacts\obj\LoggingBranch\Debug\net461\se\rs.csproj]

d:\github\AspNetCore\.dotnet\x64\sdk\3.0.100-preview4-011136\Sdks\Microsoft.NET.Sdk\targets\Microsoft.PackageDependency
Resolution.targets(233,5): error MSB4018: The "ResolvePackageAssets" task failed unexpectedly. [D:\github\AspNetCore\ar
tifacts\obj\LoggingBranch\Debug\net461\se\rs.csproj]
d:\github\AspNetCore\.dotnet\x64\sdk\3.0.100-preview4-011136\Sdks\Microsoft.NET.Sdk\targets\Microsoft.PackageDependency
Resolution.targets(233,5): error MSB4018: System.IO.InvalidDataException: Found invalid data while decoding. [D:\github
\AspNetCore\artifacts\obj\LoggingBranch\Debug\net461\se\rs.csproj]

d:\github\AspNetCore\.dotnet\x64\sdk\3.0.100-preview4-011136\Sdks\Microsoft.NET.Sdk\targets\Microsoft.PackageDependency
Resolution.targets(233,5): error MSB4018:    at Microsoft.NET.Build.Tasks.ResolvePackageAssets.CacheReader.ValidateHead
er(BinaryReader reader, Byte[] settingsHash) in /_/src/Tasks/Microsoft.NET.Build.Tasks/ResolvePackageAssets.cs:line 529
 [D:\github\AspNetCore\artifacts\obj\LoggingBranch\Debug\net461\se\rs.csproj]
d:\github\AspNetCore\.dotnet\x64\sdk\3.0.100-preview4-011136\Sdks\Microsoft.NET.Sdk\targets\Microsoft.PackageDependency
Resolution.targets(233,5): error MSB4018:    at Microsoft.NET.Build.Tasks.ResolvePackageAssets.CacheReader.OpenCacheStr
eam(Stream stream, Byte[] settingsHash) in /_/src/Tasks/Microsoft.NET.Build.Tasks/ResolvePackageAssets.cs:line 511 [D:\
github\AspNetCore\artifacts\obj\LoggingBranch\Debug\net461\se\rs.csproj]
d:\github\AspNetCore\.dotnet\x64\sdk\3.0.100-preview4-011136\Sdks\Microsoft.NET.Sdk\targets\Microsoft.PackageDependency
Resolution.targets(233,5): error MSB4018:    at Microsoft.NET.Build.Tasks.ResolvePackageAssets.CacheReader.CreateReader
FromDisk(ResolvePackageAssets task, Byte[] settingsHash) in /_/src/Tasks/Microsoft.NET.Build.Tasks/ResolvePackageAssets
.cs:line 492 [D:\github\AspNetCore\artifacts\obj\LoggingBranch\Debug\net461\se\rs.csproj]
d:\github\AspNetCore\.dotnet\x64\sdk\3.0.100-preview4-011136\Sdks\Microsoft.NET.Sdk\targets\Microsoft.PackageDependency
Resolution.targets(233,5): error MSB4018:    at Microsoft.NET.Build.Tasks.ResolvePackageAssets.CacheReader..ctor(Resolv
ePackageAssets task) in /_/src/Tasks/Microsoft.NET.Build.Tasks/ResolvePackageAssets.cs:line 440 [D:\github\AspNetCore\a
rtifacts\obj\LoggingBranch\Debug\net461\se\rs.csproj]
d:\github\AspNetCore\.dotnet\x64\sdk\3.0.100-preview4-011136\Sdks\Microsoft.NET.Sdk\targets\Microsoft.PackageDependency
Resolution.targets(233,5): error MSB4018:    at Microsoft.NET.Build.Tasks.ResolvePackageAssets.ReadItemGroups() in /_/s
rc/Tasks/Microsoft.NET.Build.Tasks/ResolvePackageAssets.cs:line 284 [D:\github\AspNetCore\artifacts\obj\LoggingBranch\D
ebug\net461\se\rs.csproj]
d:\github\AspNetCore\.dotnet\x64\sdk\3.0.100-preview4-011136\Sdks\Microsoft.NET.Sdk\targets\Microsoft.PackageDependency
Resolution.targets(233,5): error MSB4018:    at Microsoft.NET.Build.Tasks.ResolvePackageAssets.ExecuteCore() in /_/src/
Tasks/Microsoft.NET.Build.Tasks/ResolvePackageAssets.cs:line 276 [D:\github\AspNetCore\artifacts\obj\LoggingBranch\Debu
g\net461\se\rs.csproj]
d:\github\AspNetCore\.dotnet\x64\sdk\3.0.100-preview4-011136\Sdks\Microsoft.NET.Sdk\targets\Microsoft.PackageDependency
Resolution.targets(233,5): error MSB4018:    at Microsoft.NET.Build.Tasks.TaskBase.Execute() in /_/src/Tasks/Common/Tas
kBase.cs:line 35 [D:\github\AspNetCore\artifacts\obj\LoggingBranch\Debug\net461\se\rs.csproj]
d:\github\AspNetCore\.dotnet\x64\sdk\3.0.100-preview4-011136\Sdks\Microsoft.NET.Sdk\targets\Microsoft.PackageDependency
Resolution.targets(233,5): error MSB4018:    at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITask
ExecutionHost.Execute() [D:\github\AspNetCore\artifacts\obj\LoggingBranch\Debug\net461\se\rs.csproj]
d:\github\AspNetCore\.dotnet\x64\sdk\3.0.100-preview4-011136\Sdks\Microsoft.NET.Sdk\targets\Microsoft.PackageDependency
Resolution.targets(233,5): error MSB4018:    at Microsoft.Build.BackEnd.TaskBuilder.<ExecuteInstantiatedTask>d__26.Move
Next() [D:\github\AspNetCore\artifacts\obj\LoggingBranch\Debug\net461\se\rs.csproj]

Repo: https://github.com/aspnet/aspnetcore
Branch: master
Command: build.cmd -all -pack
Tracking: https://github.com/aspnet/AspNetCore-Internal/issues/2009

How does one go about debugging this?

Store

All 10 comments

@nguerrera this is our cache right?

I get this with .NET core 2.2. It's reproducible for me by using a conditional ItemGroup in a .csproj file where the condition is satisfied:

<Project Sdk="Microsoft.NET.Sdk.Web">
  <PropertyGroup>
    <TargetFramework>netcoreapp2.2</TargetFramework>
    <AspNetCoreHostingModel>InProcess</AspNetCoreHostingModel>
    <TrimUnusedDependencies>true</TrimUnusedDependencies>
    <DefaultItemExcludes>$(DefaultItemExcludes);out/**</DefaultItemExcludes>
  </PropertyGroup>
  <ItemGroup>
    <PackageReference Include="Microsoft.AspNetCore.App" />
    <PackageReference Include="Microsoft.Packaging.Tools.Trimming" Version="1.1.0-preview1-26619-01" />
  </ItemGroup>
  <ItemGroup Condition="'$(Configuration)'=='Debug'">
    <PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.3.0" />
    <PackageReference Include="MSTest.TestAdapter" Version="1.1.18" />
    <PackageReference Include="MSTest.TestFramework" Version="1.1.18" />
  </ItemGroup>
</Project>

When I build this with dotnet build -o out --force -c Debug it consistently fails with:

/usr/share/dotnet/sdk/2.2.203/Sdks/Microsoft.NET.Sdk/targets/Microsoft.PackageDependencyResolution.targets(208,5): error MSB4018: The "ResolvePackageAssets" task failed unexpectedly. [/home/adam/Dusky/dotnet/agent/agent/Dusky.Agent.csproj]
/usr/share/dotnet/sdk/2.2.203/Sdks/Microsoft.NET.Sdk/targets/Microsoft.PackageDependencyResolution.targets(208,5): error MSB4018: System.IO.InvalidDataException: Found invalid data while decoding. [/home/adam/Dusky/dotnet/agent/agent/Dusky.Agent.csproj]
/usr/share/dotnet/sdk/2.2.203/Sdks/Microsoft.NET.Sdk/targets/Microsoft.PackageDependencyResolution.targets(208,5): error MSB4018: at Microsoft.NET.Build.Tasks.ResolvePackageAssets.CacheReader.ValidateHeader(BinaryReader reader, Byte[] settingsHash) [/home/adam/Dusky/dotnet/agent/agent/Dusky.Agent.csproj]
/usr/share/dotnet/sdk/2.2.203/Sdks/Microsoft.NET.Sdk/targets/Microsoft.PackageDependencyResolution.targets(208,5): error MSB4018: at Microsoft.NET.Build.Tasks.ResolvePackageAssets.CacheReader.OpenCacheStream(Stream stream, Byte[] settingsHash) [/home/adam/Dusky/dotnet/agent/agent/Dusky.Agent.csproj]
/usr/share/dotnet/sdk/2.2.203/Sdks/Microsoft.NET.Sdk/targets/Microsoft.PackageDependencyResolution.targets(208,5): error MSB4018: at Microsoft.NET.Build.Tasks.ResolvePackageAssets.CacheReader.CreateReaderFromDisk(ResolvePackageAssets task, Byte[] settingsHash) [/home/adam/Dusky/dotnet/agent/agent/Dusky.Agent.csproj]
/usr/share/dotnet/sdk/2.2.203/Sdks/Microsoft.NET.Sdk/targets/Microsoft.PackageDependencyResolution.targets(208,5): error MSB4018: at Microsoft.NET.Build.Tasks.ResolvePackageAssets.CacheReader..ctor(ResolvePackageAssets task) [/home/adam/Dusky/dotnet/agent/agent/Dusky.Agent.csproj]
/usr/share/dotnet/sdk/2.2.203/Sdks/Microsoft.NET.Sdk/targets/Microsoft.PackageDependencyResolution.targets(208,5): error MSB4018: at Microsoft.NET.Build.Tasks.ResolvePackageAssets.ReadItemGroups() [/home/adam/Dusky/dotnet/agent/agent/Dusky.Agent.csproj]
/usr/share/dotnet/sdk/2.2.203/Sdks/Microsoft.NET.Sdk/targets/Microsoft.PackageDependencyResolution.targets(208,5): error MSB4018: at Microsoft.NET.Build.Tasks.ResolvePackageAssets.ExecuteCore() [/home/adam/Dusky/dotnet/agent/agent/Dusky.Agent.csproj]
/usr/share/dotnet/sdk/2.2.203/Sdks/Microsoft.NET.Sdk/targets/Microsoft.PackageDependencyResolution.targets(208,5): error MSB4018: at Microsoft.NET.Build.Tasks.TaskBase.Execute() [/home/adam/Dusky/dotnet/agent/agent/Dusky.Agent.csproj]
/usr/share/dotnet/sdk/2.2.203/Sdks/Microsoft.NET.Sdk/targets/Microsoft.PackageDependencyResolution.targets(208,5): error MSB4018: at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute() [/home/adam/Dusky/dotnet/agent/agent/Dusky.Agent.csproj]
/usr/share/dotnet/sdk/2.2.203/Sdks/Microsoft.NET.Sdk/targets/Microsoft.PackageDependencyResolution.targets(208,5): error MSB4018: at Microsoft.Build.BackEnd.TaskBuilder.ExecuteInstantiatedTask(ITaskExecutionHost taskExecutionHost, TaskLoggingContext taskLoggingContext, TaskHost taskHost, ItemBucket bucket, TaskExecutionMode howToExecuteTask) [/home/adam/Dusky/dotnet/agent/agent/Dusky.Agent.csproj]

But maybe it won't reproduce for you...

@admilazz Unfortunately, I cannot repro that.

If someone can repro still repro this, the following would be usfeul:

  1. Binary log: https://gist.github.com/dsplaisted/b256d7804672a6f6375476a5f5658b7b
  2. Copy of obj\Debug\netcoreapp3.0\*.assets.cache

@Tratcher has a repro. See https://github.com/aspnet/AspNetCore-Internal/issues/2009#issuecomment-496696955 for internal network drop share that contains the log files.

Thanks. I'll take a look right away.

This is happening in dotnet store targets and is almost certainly a dupe of these issues that I am working on fixing with one big simplification of dotnet store:

https://github.com/dotnet/sdk/issues?q=is%3Aopen+is%3Aissue+assignee%3Anguerrera+label%3AStore

Hi @nguerrera. Do you have any update regarding this? Is this fixed (I see one issue from the list is closed): https://github.com/dotnet/sdk/issues/2914 ?

@mkArtakMSFT Yes, please try the latest preview7 core-sdk. I believe this should be fixed.

@JunTaoLuo Have you tried building with Preview 7 and without the workarounds? I'm closing this as fixed by #3345, but if you are still having issues, I can reopen.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

fmorriso picture fmorriso  路  3Comments

thomaslevesque picture thomaslevesque  路  3Comments

gkhanna79 picture gkhanna79  路  3Comments

moozzyk picture moozzyk  路  3Comments

srivatsn picture srivatsn  路  3Comments