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

fix for when a weaver has an AfterWeaving method. #304

Merged
merged 1 commit into from Apr 24, 2017
Merged

fix for when a weaver has an AfterWeaving method. #304

merged 1 commit into from Apr 24, 2017

Conversation

jasonwoods-7
Copy link
Contributor

I was working on updating my add-in for jasonwoods-7/Vandelay#2, and I found that when executing the Stamp.Fody add-in, it is throwing the following exception:

MSBUILD : error : Fody: An unhandled exception occurred:\r [R:\home\jwoods\src\git\AssertMessage\Fody\Fody.csproj]
MSBUILD : error : Exception:\r [R:\home\jwoods\src\git\AssertMessage\Fody\Fody.csproj]
MSBUILD : error : The process cannot access the file 'R:\home\jwoods\src\git\AssertMessage\Fody\obj\Debug\AssertMessage.Fody.dll.tmp' because it is being used by another process.\r [R:\home\jwoods\src\git\AssertMessage\Fody\Fody.csproj]
MSBUILD : error : StackTrace:\r [R:\home\jwoods\src\git\AssertMessage\Fody\Fody.csproj]
MSBUILD : error :    at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)\r [R:\home\jwoods\src\git\AssertMessage\Fody\Fody.csproj]
MSBUILD : error :    at System.IO.File.InternalCopy(String sourceFileName, String destFileName, Boolean overwrite, Boolean checkHost)\r [R:\home\jwoods\src\git\AssertMessage\Fody\Fody.csproj]
MSBUILD : error :    at System.IO.File.Copy(String sourceFileName, String destFileName, Boolean overwrite)\r [R:\home\jwoods\src\git\AssertMessage\Fody\Fody.csproj]
MSBUILD : error :    at InnerWeaver.ReadModule() in C:\projects\fody\FodyIsolated\ModuleReader.cs:line 22\r [R:\home\jwoods\src\git\AssertMessage\Fody\Fody.csproj]
MSBUILD : error :    at InnerWeaver.Execute() in C:\projects\fody\FodyIsolated\InnerWeaver.cs:line 93\r [R:\home\jwoods\src\git\AssertMessage\Fody\Fody.csproj]
MSBUILD : error : Source:\r [R:\home\jwoods\src\git\AssertMessage\Fody\Fody.csproj]
MSBUILD : error : mscorlib\r [R:\home\jwoods\src\git\AssertMessage\Fody\Fody.csproj]
MSBUILD : error : TargetSite:\r [R:\home\jwoods\src\git\AssertMessage\Fody\Fody.csproj]
MSBUILD : error : Void WinIOError(Int32, System.String)\r [R:\home\jwoods\src\git\AssertMessage\Fody\Fody.csproj]
MSBUILD : error :  [R:\home\jwoods\src\git\AssertMessage\Fody\Fody.csproj]

The file copy is failing since the ModuleDefinition field is locking the .tmp file.

To test that this is fixed, I added an AfterWeaving method to FakeModuleWeaver.cs in the FodyIsolated.Tests project. The WeavedAssembly_ShouldContainWeavedInfo test in WeavingInfoTests.cs throws the same exception before applying the two Dispose calls I added to InnerWeaver.cs.

@jasonwoods-7
Copy link
Contributor Author

Actually, I noticed that even though running Stamp.Fody throws the exception, the output assembly still has the updated AssemblyInformationalVersionAttribute with the git stamp.

It's possible I'm missing something, but I'm just wondering if the extra read/write is actually necessary. Thoughts?

@SimonCropp
Copy link
Member

Good catch. I will deploy a patch with this shortly

Re stamp. I am not really that motivated to look into it. I much prefer the gitversion approach https://github.com/GitTools/GitVersion

Do u want to take ownership of stamp ?

@SimonCropp SimonCropp merged commit 33470a3 into Fody:master Apr 24, 2017
@SimonCropp SimonCropp added this to the 2.0.3 milestone Apr 24, 2017
@SimonCropp
Copy link
Member

this is now released

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

Successfully merging this pull request may close these issues.

None yet

2 participants