dbolin / Apex.Serialization

High performance contract-less binary serializer for .NET
MIT License
86 stars 13 forks source link

Without a hitch in the program's functioning, you run into a BadImageFormatException error! #244

Open mbtolou opened 1 month ago

mbtolou commented 1 month ago

Hi. Without a hitch in the program's functioning, you run into a BadImageFormatException error!

System.BadImageFormatException: Format of the executable (.exe) or library (.dll) is invalid.
   at Mono.Cecil.PE.ImageReader.ReadOptionalHeaders(UInt16& subsystem, UInt16& dll_characteristics)
   at Mono.Cecil.PE.ImageReader.ReadOptionalHeaders(UInt16& subsystem, UInt16& dll_characteristics)
FirstChanceException Message:Format of the executable (.exe) or library (.dll) is invalid.
System.BadImageFormatException: Format of the executable (.exe) or library (.dll) is invalid.
   at Mono.Cecil.PE.ImageReader.ReadOptionalHeaders(UInt16& subsystem, UInt16& dll_characteristics)
   at Mono.Cecil.PE.ImageReader.ReadImage()
   at Mono.Cecil.PE.ImageReader.ReadImage(Disposable`1 stream, String file_name)
   at Mono.Cecil.ModuleDefinition.ReadModule(Disposable`1 stream, String fileName, ReaderParameters parameters)
   at Mono.Cecil.ModuleDefinition.ReadModule(String fileName, ReaderParameters parameters)
   at Mono.Cecil.PE.ImageReader.ReadOptionalHeaders(UInt16& subsystem, UInt16& dll_characteristics)
   at Mono.Cecil.PE.ImageReader.ReadImage()
   at Mono.Cecil.PE.ImageReader.ReadImage(Disposable`1 stream, String file_name)
   at Mono.Cecil.ModuleDefinition.ReadModule(Disposable`1 stream, String fileName, ReaderParameters parameters)
   at Mono.Cecil.ModuleDefinition.ReadModule(String fileName, ReaderParameters parameters)
FirstChanceException Message:Method Apex.Serialization.Binary`2[Apex.Serialization.Internal.BufferedStream,Settings_1970620903_2b432a96-90c5-4404-81c7-cb21e8ecad32].WriteValuesArray1: type argument 'System.Nullable`1[System.Int64]' violates the constraint of type parameter 'T'.
System.Security.VerificationException: Method Apex.Serialization.Binary`2[Apex.Serialization.Internal.BufferedStream,Settings_1970620903_2b432a96-90c5-4404-81c7-cb21e8ecad32].WriteValuesArray1: type argument 'System.Nullable`1[System.Int64]' violates the constraint of type parameter 'T'.
   at System.RuntimeMethodHandle.GetStubIfNeeded(RuntimeMethodHandleInternal method, RuntimeType declaringType, RuntimeType[] methodInstantiation)
   at System.Reflection.RuntimeMethodInfo.MakeGenericMethod(Type[] methodInstantiation)
   at System.RuntimeMethodHandle.GetStubIfNeeded(RuntimeMethodHandleInternal method, RuntimeType declaringType, RuntimeType[] methodInstantiation)
   at System.Reflection.RuntimeMethodInfo.MakeGenericMethod(Type[] methodInstantiation)
FirstChanceException Message:GenericArguments[0], 'System.Nullable`1[System.Int64]', on 'Void WriteValuesArray1[T](T[], Int32)' violates the constraint of type 'T'.
System.ArgumentException: GenericArguments[0], 'System.Nullable`1[System.Int64]', on 'Void WriteValuesArray1[T](T[], Int32)' violates the constraint of type 'T'.
 ---> System.Security.VerificationException: Method Apex.Serialization.Binary`2[Apex.Serialization.Internal.BufferedStream,Settings_1970620903_2b432a96-90c5-4404-81c7-cb21e8ecad32].WriteValuesArray1: type argument 'System.Nullable`1[System.Int64]' violates the constraint of type parameter 'T'.
   at System.RuntimeMethodHandle.GetStubIfNeeded(RuntimeMethodHandleInternal method, RuntimeType declaringType, RuntimeType[] methodInstantiation)
   at System.Reflection.RuntimeMethodInfo.MakeGenericMethod(Type[] methodInstantiation)
   --- End of inner exception stack trace ---
   at System.RuntimeType.ValidateGenericArguments(MemberInfo definition, RuntimeType[] genericArguments, Exception e)
   at System.RuntimeType.ValidateGenericArguments(MemberInfo definition, RuntimeType[] genericArguments, Exception e)
dbolin commented 1 month ago

These are not uncaught exceptions, right?

These occur because there's no good way to tell without trying whether those operations will succeed, but as you mentioned these should not impact the functionality.