Created
December 16, 2011 10:50
-
-
Save asbjornu/1485605 to your computer and use it in GitHub Desktop.
Mono.Cecil throws ArgumentException on AssemblyDefinition.ReadAssembly()
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
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
This in a .net bug which arises when using a Mono.Cecil.dll compiled with a Mono compiler on .net x64. The solution is to recompile it with Microsoft's csc, or use the nugget package.