Costura on a multi-targeting project (net46;net47;netcoreapp3.0) throws exception
GeertvanHorrik opened this issue · 2 comments
GeertvanHorrik commented
Error:
1>MSBUILD : error : Fody: An unhandled exception occurred:
1>MSBUILD : error : Exception:
1>MSBUILD : error : Failed to execute weaver C:\Users\geert\.nuget\packages\costura.fody\3.2.0\netclassicweaver\Costura.Fody.dll
1>MSBUILD : error : Type:
1>MSBUILD : error : System.Exception
1>MSBUILD : error : StackTrace:
1>MSBUILD : error : at InnerWeaver.ExecuteWeavers()
1>MSBUILD : error : at InnerWeaver.Execute()
1>MSBUILD : error : Source:
1>MSBUILD : error : FodyIsolated
1>MSBUILD : error : TargetSite:
1>MSBUILD : error : Void ExecuteWeavers()
1>MSBUILD : error : An item with the same key has already been added.
1>MSBUILD : error : Type:
1>MSBUILD : error : System.ArgumentException
1>MSBUILD : error : StackTrace:
1>MSBUILD : error : at System.ThrowHelper.ThrowArgumentException(ExceptionResource resource)
1>MSBUILD : error : at System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value, Boolean add)
1>MSBUILD : error : at ModuleWeaver.EmbedResources(Configuration config)
1>MSBUILD : error : at ModuleWeaver.Execute()
1>MSBUILD : error : at InnerWeaver.ExecuteWeavers()
1>MSBUILD : error : Source:
1>MSBUILD : error : mscorlib
1>MSBUILD : error : TargetSite:
1>MSBUILD : error : Void ThrowArgumentException(System.ExceptionResource)
1>MSBUILD : error :
1>Done building project "Orc.Skia.csproj" -- FAILED.
This is the repro:
https://github.com/wildgums/orc.skia
FodyWeavers.xml:
<?xml version="1.0" encoding="utf-8"?>
<Weavers VerifyAssembly="true" VerifyIgnoreCodes="0x80131252,0x80131869" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="FodyWeavers.xsd">
<ModuleInit />
<MethodTimer />
<Obsolete />
<Catel />
<Costura>
<IncludeAssemblies>
SkiaSharp
</IncludeAssemblies>
<Unmanaged32Assemblies>
libSkiaSharp
</Unmanaged32Assemblies>
<Unmanaged64Assemblies>
libSkiaSharp
</Unmanaged64Assemblies>
</Costura>
</Weavers>
As soon as I remove Costura, it starts compiling.
Will work on a fix (but not tonight).
tom-englert commented
I once had a similar issue. However this was not caused by multi-targeting, but by an indirect dependency that was referenced from different packages with different versions (System.Windows.Interactivity
in my case).
I could solve this by just cleaning up the dependencies, however either a better error message or even automatic resolving of duplicate references by Costura would be better.
GeertvanHorrik commented
Created PR #331