gluck / il-repack

Open-source alternative to ILMerge
Apache License 2.0
1.16k stars 214 forks source link

DLL fails to load #326

Closed wally96334 closed 5 months ago

wally96334 commented 10 months ago

Hi,

This is a WPF app developed using Visual Studio 2017 Community on a Win 10 Pro system.

This is the error that I am getting:



INFO: Adding assembly for merge: C:\Projects\project_021\ScintillaNET.WPF-master_01\ScintillaNET.WPF\obj\Release\ScintillaNET.WPF.dll
ERROR: Failed to load assembly C:\Projects\project_021\ScintillaNET.WPF-master_01\ScintillaNET.WPF\obj\Release\ScintillaNET.WPF.dll
Mono.Cecil.AssemblyResolutionException: Failed to resolve assembly: 'ScintillaNET, Version=3.6.3.0, Culture=neutral, PublicKeyToken=null'
   at Mono.Cecil.BaseAssemblyResolver.Resolve(AssemblyNameReference name, ReaderParameters parameters)
   at Mono.Cecil.DefaultAssemblyResolver.Resolve(AssemblyNameReference name)
   at Mono.Cecil.MetadataResolver.Resolve(TypeReference type)
   at Mono.Cecil.TypeReference.Resolve()
   at Mono.Cecil.Mixin.CheckedResolve(TypeReference self)
   at Mono.Cecil.SignatureReader.ReadCustomAttributeEnum(TypeReference enum_type)
   at Mono.Cecil.SignatureReader.ReadCustomAttributeElement(TypeReference type)
   at Mono.Cecil.SignatureReader.ReadCustomAttributeElement(TypeReference type)
   at Mono.Cecil.SignatureReader.ReadCustomAttributeConstructorArguments(CustomAttribute attribute, Collection`1 parameters)
   at Mono.Cecil.MetadataReader.ReadCustomAttributeSignature(CustomAttribute attribute)
   at Mono.Cecil.CustomAttribute.<Resolve>b__34_0(CustomAttribute attribute, MetadataReader reader)
   at Mono.Cecil.ModuleDefinition.Read[TItem,TRet](TItem item, Func`3 read)
   at Mono.Cecil.CustomAttribute.get_ConstructorArguments()
   at Mono.Cecil.ImmediateModuleReader.ReadCustomAttributes(ICustomAttributeProvider provider)
   at Mono.Cecil.ImmediateModuleReader.ReadProperties(TypeDefinition type)
   at Mono.Cecil.ImmediateModuleReader.ReadType(TypeDefinition type)
   at Mono.Cecil.ImmediateModuleReader.ReadTypes(Collection`1 types)
   at Mono.Cecil.ImmediateModuleReader.ReadModule(ModuleDefinition module)
   at Mono.Cecil.ImmediateModuleReader.<ReadModule>b__1_0(ModuleDefinition module, MetadataReader reader)
   at Mono.Cecil.ModuleDefinition.Read[TItem,TRet](TItem item, Func`3 read)
   at Mono.Cecil.ModuleReader.CreateModuleFrom(Image image, ReaderParameters parameters)
   at Mono.Cecil.ModuleDefinition.ReadModule(String fileName, ReaderParameters parameters)
   at Mono.Cecil.AssemblyDefinition.ReadAssembly(String fileName, ReaderParameters parameters)
   at ILRepacking.ILRepack.ReadInputAssembly(String assembly, Boolean isPrimary)
   at ILRepacking.ILRepack.ReadInputAssemblies()
   at ILRepacking.ILRepack.Repack()
   at ILRepacking.Application.Main(String[] args)

EDIT:

I removed the reference mentioned above (ScintillaNET.WPF.dll) to see if the rest would pack. I now have a problem merging a DLL that was written in JScript.NET.


System.NullReferenceException: Field "Microsoft.JScript.RegExpObject <a5fbbc7a-272a-4757-977d-93b16e75e4a5>JScript 0::regexp 7" not found in type "<a5fbbc7a-272a-4757-977d-93b16e75e4a5>JScript 0".
   at ILRepacking.ReferenceFixator.Fix(FieldReference field)
   at ILRepacking.ReferenceFixator.FixReferences(Instruction instr)
   at ILRepacking.ReferenceFixator.FixReferences(MethodBody body)
   at ILRepacking.ReferenceFixator.FixReferences(MethodDefinition meth)
   at ILRepacking.ReferenceFixator.FixReferences(TypeDefinition type)
   at ILRepacking.Steps.ReferencesFixStep.Perform()
   at ILRepacking.ILRepack.Repack()
   at ILRepacking.Application.Main(String[] args)

Any assistance with this would be appreciated.

THANKS!

KirillOsenkov commented 8 months ago

To be able to help you we'd need better repro steps, ideally if you can include the .zip file with the assemblies (the minimal set required to reproduce this) as well as the exact command-line you're passing to ILRepack.exe in a cmd file such as repro.cmd. I should be able to run repro.cmd and have it repack and reproduce the issue. Thanks!

KirillOsenkov commented 5 months ago

Sorry, not sure how to help here without a repro.