glueckkanja / ILStrip

6 stars 2 forks source link

Value cannot be null #2

Open Numsgil opened 7 years ago

Numsgil commented 7 years ago

I'm getting an odd error. I've tracked it down to a specific type, but it's not obvious to me why it's causing problems.

Basically if I run:

Z:\Testing\ilstrip z:\Testing\testbed.exe /out:z:\Testing\testbedstrip.exe /v /keeptypes:MoonSharp,Scintilla,Priority,Sunweaver,Azimuth,Annulus,BotTestbed,System,Lima,Blacklight,Direct3D9,UnitTestSharp,SharpDX,System,UnitTestSharp.Assert,Seshat.DataDefinitions.ContextTypeDefinition,FlagsEnumTypeConverter,Seshat.CodeGenerator,Seshat.InstanceCodeGenerator,Seshat.TableCodeGenerator,Seshat.DataDefinitions.ContextTypeDefinition,Seshat.DynamicArrayMalloc,Seshat.SimulationLoop,Seshat.Virtual

I get a crash:

Unhandled Exception: System.ArgumentNullException: Value cannot be null. at Mono.Cecil.MetadataBuilder.LookupToken(IMetadataTokenProvider provider) at Mono.Cecil.Cil.CodeReader.PatchRawCode(ByteBuffer buffer, Int32 code_size, CodeWriter writer) at Mono.Cecil.Cil.CodeReader.PatchRawFatMethod(ByteBuffer buffer, MethodSymbols symbols, CodeWriter writer, Metad ataToken& local_var_token) at Mono.Cecil.Cil.CodeReader.PatchRawMethodBody(MethodDefinition method, CodeWriter writer, MethodSymbols& symbol s) at Mono.Cecil.Cil.CodeWriter.WriteUnresolvedMethodBody(MethodDefinition method) at Mono.Cecil.Cil.CodeWriter.WriteMethodBody(MethodDefinition method) at Mono.Cecil.MetadataBuilder.AddMethod(MethodDefinition method) at Mono.Cecil.MetadataBuilder.AddMethods(TypeDefinition type) 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.b_0(MetadataBuilder builder, MetadataReader ) at Mono.Cecil.ModuleDefinition.Read[TItem,TRet](TItem item, Func`3 read) 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(Stream stream, WriterParameters parameters) at Mono.Cecil.ModuleDefinition.Write(String fileName, WriterParameters parameters) at GK.ILStrip.Execute() at GK.Program.Main(String[] args)

Not very helpful. If I change the command line to:

ilstrip z:\Testing\testbed.exe /out:z:\Testing\testbedstrip.exe /v /keeptypes:MoonSharp,Scintilla, Priority,Sunweaver,Azimuth,Annulus,BotTestbed,System,Lima,Blacklight,Direct3D9,UnitTestSharp,SharpDX,System,UnitTestSharp.Assert,Seshat.DataDefinitions.ContextTypeDefinition,FlagsEnumTypeConverter,Seshat.CodeGenerator,Seshat.InstanceCodeGenerator,Seshat.TableCodeGenerator,Seshat.DataDefinitions.ContextTypeDefinition,Seshat.DynamicArrayMalloc,Seshat.SimulationLoop,Seshat.Virtual,Seshat.LuaDefinitions.LuaExecutor

I don't get a crash. The only difference between these lines is the addition of ,Seshat.LuaDefinitions.LuaExecutor at the end.

So something about Seshat.LuaDefinitions.LuaExecutor is causing problems. The code for it is here: http://svn.darwinbots.com/Darwinbots3/Trunk/Modules/Seshat/Seshat/LuaDefinitions/LuaExecutor.cs

I don't think I'm doing anything too crazy in there, but who knows. I've also attached the testbed.exe binary. testbed.zip

i00 commented 5 years ago

I have the same error with this stack:

Unhandled Exception: System.ArgumentNullException: Value cannot be null. Parameter name: method at Mono.Cecil.MethodSpecification..ctor(MethodReference method) at Mono.Cecil.MetadataReader.ReadMethodSpecSignature(UInt32 signature, MethodReference method) at Mono.Cecil.MetadataReader.GetMethodSpecification(UInt32 rid) at Mono.Cecil.MetadataReader.LookupToken(MetadataToken token) at Mono.Cecil.Cil.CodeReader.PatchRawCode(ByteBuffer buffer, Int32 code_size, CodeWriter writer) at Mono.Cecil.Cil.CodeReader.PatchRawFatMethod(ByteBuffer buffer, MethodSymbols symbols, CodeWriter writer, MetadataToken& local_var_token) at Mono.Cecil.Cil.CodeReader.PatchRawMethodBody(MethodDefinition method, CodeWriter writer, MethodSymbols& symbols) at Mono.Cecil.Cil.CodeWriter.WriteUnresolvedMethodBody(MethodDefinition method) at Mono.Cecil.Cil.CodeWriter.WriteMethodBody(MethodDefinition method) at Mono.Cecil.MetadataBuilder.AddMethod(MethodDefinition method) at Mono.Cecil.MetadataBuilder.AddMethods(TypeDefinition type) 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.b_0(MetadataBuilder builder, MetadataReader ) at Mono.Cecil.ModuleDefinition.Read[TItem,TRet](TItem item, Func`3 read) at Mono.Cecil.ModuleWriter.WriteModuleTo(ModuleDefinition module, Stream stream, WriterParameters parameters) at Mono.Cecil.ModuleDefinition.Write(String fileName, WriterParameters parameters) at GK.ILStrip.Execute() at GK.Program.Main(String[] args)

Kris

lander-vanhaverbeke-skyline commented 2 years ago

Same exception:
System.ArgumentNullException HResult=0x80004003 Message=Value cannot be null. Source=Mono.Cecil StackTrace: at Mono.Cecil.MetadataBuilder.LookupToken(IMetadataTokenProvider provider)

at ILStrip.Save