Skip to content

Instantly share code, notes, and snippets.

@asbjornu
Created December 16, 2011 10:50
Show Gist options
  • Save asbjornu/1485605 to your computer and use it in GitHub Desktop.
Save asbjornu/1485605 to your computer and use it in GitHub Desktop.
Mono.Cecil throws ArgumentException on AssemblyDefinition.ReadAssembly()
System.ArgumentException: Value does not fall within the expected range.
at System.Runtime.CompilerServices.RuntimeHelpers.InitializeArray(Array array, RuntimeFieldHandle fldHandle)
at Mono.Cecil.Mixin.GetSize(CodedIndex self, Func`2 counter)
at Mono.Cecil.PE.Image.GetCodedIndexSize(CodedIndex coded_index)
at Mono.Cecil.PE.ImageReader.GetCodedIndexSize(CodedIndex index)
at Mono.Cecil.PE.ImageReader.ComputeTableInformations()
at Mono.Cecil.PE.ImageReader.ReadTableHeap()
at Mono.Cecil.PE.ImageReader.ReadMetadata()
at Mono.Cecil.PE.ImageReader.ReadImage()
at Mono.Cecil.PE.ImageReader.ReadImageFrom(Stream stream)
at Mono.Cecil.ModuleDefinition.ReadModule(Stream stream, ReaderParameters parameters)
at Mono.Cecil.ModuleDefinition.ReadModule(String fileName, ReaderParameters parameters)
at Mono.Cecil.AssemblyDefinition.ReadAssembly(String fileName, ReaderParameters parameters)
at NHtmlUnit.Generator.Program.Transform() in Program.cs:line 48
at NHtmlUnit.Generator.Program.Main(String[] args) in Program.cs:line 26
@asbjornu
Copy link
Author

Aha. Using the NuGet package indeed fixed the problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment