i'm trying to use SheepAPO with NCrunch.
SheepAOP modifies the output assembly after compiling in a Post Build Event.
Sadly NCrunch is locking the file so that i have to disable Instrument Output Assembly to avoid this lock.
Would it be possible to set the file lock after compiling is finished?
/EDIT:
Would it be possible to lock the file just the time you analyze it?
Because is just got now the problem that the file is locked DURING the build event...
/EDIT
PS: NCrunch is AWESOME, thanks for this gorgeous tool!!
Thanks for posting and I'm glad you're enjoying NCrunch!
NCrunch only instruments an assembly AFTER the entire build process has finished (including all build events), so I'm wondering if the file lock may be the reverse of what you've described (SheepAOP holding a lock for a short period after its work has been done). I should be able to confirm this if you can submit a bug report after you experience the issue.
Does this happen for you consistently or intermittently?
I've been digging through the source code of the SheepAspect project and I think I may have found the issue.
When SheepAspect performs its manipulation of your output assemblies, it uses Mono.Cecil to write assemblies back to disk along with their symbols. The Mono.Cecil symbol writer is backed onto a COM object (ISymbolWriter) that tends to hold file locks until the object is fully disposed and garbage collected (which can happen at a non-deterministic time). I'm aware of this issue because I had similar problems with earlier versions of NCrunch and had to introduce a specific fix to address this.
Under process manager, it would likely show that the NCrunch taskrunner is holding the file lock. This is because the NCrunch taskrunner is hosting MSBuild along with the SheepAspect build step responsible for the above. Under non-NCrunch build conditions the msbuild process is transient; terminating after its work has been completed and thereby releasing the file lock.
Sorry, I'm afraid there is nothing I can do to solve this problem within NCrunch. You'll need to raise it with the SheepAspect developer.