Skip to content
This repository has been archived by the owner on May 16, 2022. It is now read-only.

Bad IL Format. #129

Open
axelriet opened this issue Oct 28, 2021 · 1 comment
Open

Bad IL Format. #129

axelriet opened this issue Oct 28, 2021 · 1 comment

Comments

@axelriet
Copy link

Hi,

I'm hitting an exception during Serialize in .NET 5.0 on Windows running the sample code from the intro page on this repo. Any idea?

System.BadImageFormatException
HResult=0x8007000B
Message=Bad IL format.
Source=ZeroFormatter.DynamicObjectSegments
StackTrace:
at ZeroFormatter.DynamicObjectSegments.ZeroFormatter_Formatters_DefaultResolver.Program.MyClass$Formatter.Serialize(Byte[]& , Int32 , MyClass )
at ZeroFormatter.ZeroFormatterSerializer.CustomSerializer1.Serialize[T](Byte[]& buffer, Int32 offset, T obj) at ZeroFormatter.ZeroFormatterSerializer.CustomSerializer1.Serialize[T](T obj)
at ZeroFormatter.ZeroFormatterSerializer.Serialize[T](T obj)
at Program.Main(String[] args) in Program.cs:line 62

@SeymourRu
Copy link

Due to some .Net internal optimisations, ZeroFormatter will no longer work on 3.0,3.1, 5.0, etc.
Now you have multiple options:

  • Switch to other library (i.e MessagePack from same author)
  • Find fixed fork of ZeroFormatter and use library from there
  • Fix it yourself

Decide what is more suitable to you and do it :)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants