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.75k stars 1.07k forks source link

NRE from GenerateDepsFile during Roslyn build #2716

Open tmat opened 5 years ago

tmat commented 5 years ago

This is a non-standard build with my local changes. Not sure how to repro this exactly.

C:\Program Files\dotnet\sdk\2.1.600-preview-009426\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Sdk.targets(129,5): error MSB4018: The "GenerateDepsFile" task failed unexpectedly.
System.NullReferenceException: Object reference not set to an instance of an object.
   at Microsoft.NET.Build.Tasks.ReferenceInfo.GetVersion(ITaskItem referencePath)
   at Microsoft.NET.Build.Tasks.ReferenceInfo.CreateReferenceInfo(ITaskItem referencePath)
   at Microsoft.NET.Build.Tasks.ReferenceInfo.CreateReferenceInfos(IEnumerable`1 referencePaths)
   at Microsoft.NET.Build.Tasks.GenerateDepsFile.ExecuteCore()
   at Microsoft.NET.Build.Tasks.TaskBase.Execute()
   at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
   at Microsoft.Build.BackEnd.TaskBuilder.<ExecuteInstantiatedTask>d__26.MoveNext() [D:\R3\src\Workspaces\CSharp\Portable\Microsoft.CodeAnalysis.CSharp.Workspaces.csproj]

binlog: Binlog.zip

Binaries\Obj\Microsoft.CodeAnalysis.CSharp.Workspaces\project.assets.json project.assets.zip

livarcocc commented 5 years ago

@nguerrera is this in the cache code?

@tmat what version of the .net core SDK does this happen?

nguerrera commented 5 years ago

Not assets cache code of that's what you're asking.

nguerrera commented 5 years ago

What does non standard with local changes mean?

tmat commented 5 years ago

@nguerrera I was changing some of the build scripts to port to Arcade and this was built with incorrect combination of switches. If the issue is not obvious from the above info I can try to recreate the repro.

nguerrera commented 5 years ago

I'll check the binlog and source at that stack and let you know if that's enough.

nguerrera commented 5 years ago

Sorry for letting this sit. The binlog doesn't give a hint. Closing until we see another instance with repro.

ericstj commented 2 years ago

We see repros of this issue, here and here

We noticed it happened here: https://github.com/dotnet/sdk/blob/a5f5bb5183517cb301050288b25c9c727e52e8a6/src/Tasks/Microsoft.NET.Build.Tasks/ReferenceInfo.cs#L150

RAR was setting FusionName to a simple name so this ToString thows NRE

Linlccc commented 2 years ago

@ericstj https://github.com/dotnet/runtime/issues/67091#issuecomment-1077866445 The two issues mentioned here,

  1. The project I have built in advance to restore
  2. I don't see any missing items from the log, I haven't modified sln yet

I uploaded the binary log file binlog.zip