il-repack icon indicating copy to clipboard operation
il-repack copied to clipboard

Exception when merging

Open kentcb opened this issue 8 years ago • 6 comments

Hi,

I'm getting the following exception when attempting to merge:

System.ArgumentException: Value does not fall within the expected range.
   at Mono.Cecil.SignatureWriter.WriteCustomAttributeEnumValue(TypeReference enum_type, Object value)
   at Mono.Cecil.SignatureWriter.WriteCustomAttributeElement(TypeReference type, CustomAttributeArgument argument)
   at Mono.Cecil.SignatureWriter.WriteCustomAttributeFixedArgument(TypeReference type, CustomAttributeArgument argument)
   at Mono.Cecil.SignatureWriter.WriteCustomAttributeNamedArgument(Byte kind, CustomAttributeNamedArgument named_argument)
   at Mono.Cecil.SignatureWriter.WriteCustomAttributeNamedArguments(Byte kind, Collection`1 named_arguments)
   at Mono.Cecil.SignatureWriter.WriteICustomAttributeNamedArguments(ICustomAttribute attribute)
   at Mono.Cecil.MetadataBuilder.GetCustomAttributeSignature(CustomAttribute attribute)
   at Mono.Cecil.MetadataBuilder.AddCustomAttributes(ICustomAttributeProvider owner)
   at Mono.Cecil.MetadataBuilder.AddType(TypeDefinition type)
   at Mono.Cecil.MetadataBuilder.AddTypeDefs()
   at Mono.Cecil.MetadataBuilder.BuildTypes()
   at Mono.Cecil.MetadataBuilder.BuildModule()
   at Mono.Cecil.ModuleWriter.BuildMetadata(ModuleDefinition module, MetadataBuilder metadata)
   at Mono.Cecil.ModuleWriter.WriteModuleTo(ModuleDefinition module, Stream stream, WriterParameters parameters)
   at Mono.Cecil.ModuleDefinition.Write(String fileName, WriterParameters parameters)
   at ILRepacking.ILRepack.Repack()
   at ILRepacking.Application.Main(String[] args)

My scenario is I'm just playing around with attempting to merge the DLLs that comprise an APK. I am hoping to squash it down to a single DLL to see whether there is any impact on Xamarin Android performance.

kentcb avatar Jan 29 '17 06:01 kentcb

@kentcb Which ILRepack version? Also, do you have a reproducible sample/reproduction path?

timotei avatar Jan 29 '17 11:01 timotei

@timotei version is 2.0.12. Unfortunately, the app I'm running this against isn't yet live in Google Play store. Can I send the APK to you directly?

kentcb avatar Jan 29 '17 22:01 kentcb

@kentcb That works too (you can do it via the rx slack). Does it also happen on a new sample app (maybe with some library as dependency)?

Also, Windows or UNIX?

timotei avatar Jan 29 '17 22:01 timotei

I am attempting to do this on Windows. I'll ping you with the APK 👍

kentcb avatar Jan 29 '17 22:01 kentcb

Instructions for repro:

  1. Unzip the provided APK to $root
  2. cd $root\assemblies
  3. ILRepack.exe /union /wildcards /out:whatever.dll /verbose QUT.dll *.dll

kentcb avatar Jan 29 '17 22:01 kentcb

I get the same exception when referencing netstandard libraries.

niklaslundberg avatar Mar 15 '17 11:03 niklaslundberg

Please reopen if this still reproduces on the latest version.

KirillOsenkov avatar Jan 07 '24 04:01 KirillOsenkov