tunnelvisionlabs / ReferenceAssemblyAnnotator

IL weaver to add nullability annotations to .NET reference assemblies
MIT License
72 stars 8 forks source link

IOException: The file 'obj\Debug\net35\annotated\System.Core.xml' already exists. #74

Open jnm2 opened 4 years ago

jnm2 commented 4 years ago

error MSB4018: The "AnnotatorBuildTask" task failed unexpectedly. System.IO.IOException: The file 'obj\Debug\net35\annotated\System.Core.xml' already exists.

at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
at System.IO.File.InternalCopy(String sourceFileName, String destFileName, Boolean overwrite, Boolean checkHost)
at System.IO.File.Copy(String sourceFileName, String destFileName)
at TunnelVisionLabs.ReferenceAssemblyAnnotator.AnnotatorBuildTask.Execute()
at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
at Microsoft.Build.BackEnd.TaskBuilder.<ExecuteInstantiatedTask>d__26.MoveNext()

@sharwell If the file exists, would there ever be a reason that it would need to be updated? Rather than passing overwrite: true, maybe the IOException could be swallowed based on the error code (probably ERROR_FILE_EXISTS).

jnm2 commented 4 years ago

Not sure why this repros every single time when building NUnit in VS (no successful builds) but works from the command line. There might be something more here.

jnm2 commented 4 years ago

Ah, just figured it out. Repeated /t:Rebuild always works. Repeated /t:Build always crashes. Maybe the targets have incremental build problems.

jnm2 commented 4 years ago

@sharwell I can't reopen but I think there is more work here.

jnm2 commented 4 years ago

I'm consistently reproing this in CI with alpha.154 which I thought had the fix:

%userprofile%.nuget\packages\tunnelvisionlabs.referenceassemblyannotator\1.0.0-alpha.154\build\TunnelVisionLabs.ReferenceAssemblyAnnotator.targets(120,5): error MSB4018: The "AnnotatorBuildTask" task failed unexpectedly.

System.IO.IOException: The file 'obj\Release\annotated\System.Core.xml' already exists.

at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath) 
at System.IO.File.InternalCopy(String sourceFileName, String destFileName, Boolean overwrite, Boolean checkHost) 
at System.IO.File.Copy(String sourceFileName, String destFileName) 
at TunnelVisionLabs.ReferenceAssemblyAnnotator.AnnotatorBuildTask.Execute() 
at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute() 
at Microsoft.Build.BackEnd.TaskBuilder.<ExecuteInstantiatedTask>d__26.MoveNext()