Notice (2018-05-24): bugzilla.xamarin.com is now in
Please join us on
Visual Studio Developer Community and in the
Mono organizations on
GitHub to continue tracking issues. Bugzilla will remain
available for reference in read-only mode. We will continue to work
on open Bugzilla bugs, copy them to the new locations
as needed for follow-up, and add the new items under Related
Our sincere thanks to everyone who has contributed on this bug
tracker over the years. Thanks also for your understanding as we
make these adjustments and improvements for the future.
Please create a new report on
GitHub or Developer Community with
your current version information, steps to reproduce, and relevant error
messages or log files if you are hitting an issue that looks similar to
this resolved bug and you do not yet see a matching new report.
Created attachment 3135 [details]
my local patch, don't commit
I have a bug for a specific manifestation of this: https://bugzilla.xamarin.com/show_bug.cgi?id=9124
And a WONTFIX for the actual modification of an in-use assembly: https://bugzilla.xamarin.com/show_bug.cgi?id=9128
When AssemblyBuilder writes an assembly, it calls File.Delete first (when running on mono). That causes a new inode to be created for the file, instead of overwriting it when it's mapped by another process.
Microsoft.common.targets uses <Copy/> to copy .dlls to the output directory as part of the deploy step, so it doesn't get deleted like if it were written straight to the output directory.
I'm attaching my local patch which adds a flag to <Copy/> to delete the target before copying, and updates Microsoft.common.targets to use it. It seems a bit hacky, but I'm not sure what the alternative is.
We can't add that as it changes the public API of the assemblies. For our purposes, I don't see a problem with unconditionally deleting the target file before copying the new one over. I can't think of anything that would break.
Implemented in git in both master and 2-10.
Yeah, File.Copy isn't atomic anyway, so that seems like a reasonable solution.
Thanks for the patch and report. The next release of mono should contain the fix. I'll take a quick look around to see if there are more places which might hit the same issue.