Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The AnnotatorBuildTask task failed unexpectedly #40

Open
JohanLarsson opened this issue Oct 23, 2019 · 6 comments
Open

The AnnotatorBuildTask task failed unexpectedly #40

JohanLarsson opened this issue Oct 23, 2019 · 6 comments

Comments

@JohanLarsson
Copy link

Severity	Code	Description	Project	File	Line	Suppression State
Error	MSB4018	The "AnnotatorBuildTask" task failed unexpectedly.
System.IO.IOException: The process cannot access the file 'C:\Git\_GuOrg\Gu.Wpf.UiAutomation\Gu.Wpf.UiAutomation\obj\Debug\net45\annotated\mscorlib.dll' because it is being used by another process.
   at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
   at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost)
   at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share)
   at Mono.Cecil.ModuleDefinition.Write(String fileName, WriterParameters parameters)
   at TunnelVisionLabs.ReferenceAssemblyAnnotator.Program.Main(Nullable`1 log, String referenceAssembly, String annotatedReferenceAssembly, String outputAssembly)
   at TunnelVisionLabs.ReferenceAssemblyAnnotator.AnnotatorBuildTask.Execute()
   at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
   at Microsoft.Build.BackEnd.TaskBuilder.<ExecuteInstantiatedTask>d__26.MoveNext()	Gu.Wpf.UiAutomation	C:\Users\ds2346\.nuget\packages\tunnelvisionlabs.referenceassemblyannotator\1.0.0-alpha.77\build\TunnelVisionLabs.ReferenceAssemblyAnnotator.targets	60	

From the name I'm guessing it can be something in this nice package.
Repro in this commit https://github.com/GuOrg/Gu.Wpf.UiAutomation/tree/a5b789bf37742a9edd098d187d8a8362a80e43a8

I think I have only seen it after git clean and start Visual Studio

@jnm2
Copy link
Contributor

jnm2 commented Oct 27, 2019

I see this about once a day.

@jnm2
Copy link
Contributor

jnm2 commented Oct 31, 2019

@sharwell Should the annotator bail and assume that the only other process that will be causing this is another build of the same project, and that the file being written is what the annotator would have written anyway?

Or should it retry?

@jnm2
Copy link
Contributor

jnm2 commented Nov 3, 2019

This started happening repeatedly until I restarted VS.

@JohanLarsson
Copy link
Author

JohanLarsson commented Jan 2, 2020

Got this with 1.0.0-alpha.138. Repro: https://github.com/GuOrg/Gu.Wpf.ToolTips

Severity	Code	Description	Project	File	Line	Suppression State
Error	MSB4018	The "AnnotatorBuildTask" task failed unexpectedly.
System.IO.IOException: The file 'obj\Debug\netcoreapp3.1\annotated\Microsoft.CSharp.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()	Gu.Wpf.ToolTips	C:\Users\ds2346\.nuget\packages\tunnelvisionlabs.referenceassemblyannotator\1.0.0-alpha.138\build\TunnelVisionLabs.ReferenceAssemblyAnnotator.targets	89	

@sharwell
Copy link
Member

sharwell commented Jan 2, 2020

This is going to be possible in parallel build scenarios until file-system locking is used.

@jnm2
Copy link
Contributor

jnm2 commented Jan 2, 2020

I was going to say, I don't think it's project-specific. It crops up and requires a VS restart maybe once a day for me no matter what the project is.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants