Skip to content

System.TypeLoadException in Unity #319

Description

@teremyx

Hi.
I'm using MessagePack in Unity (not using IL2CPP) and also in a standalone c# application (a master server, that sends and receives objects from the (Unity-)client).

Somehow I get this error when trying to serialize an object of class "ClientSetupRequest":
System.TypeLoadException: Could not load type 'MessagePack.Formatters.ClientSetupRequestFormatter1' from assembly ''. at MessagePack.FormatterResolverExtensions.GetFormatterWithVerify[T] (MessagePack.IFormatterResolver resolver) [0x0001b] in <9584f10ef1c54d659bd9587a0a564bad>:0 at MessagePack.MessagePackSerializer.Serialize[T] (T obj, MessagePack.IFormatterResolver resolver) [0x0000a] in <9584f10ef1c54d659bd9587a0a564bad>:0 at MessagePack.MessagePackSerializer.Serialize[T] (T obj) [0x00000] in <9584f10ef1c54d659bd9587a0a564bad>:0 at (wrapper dynamic-method) System.Object.lambda_method(System.Runtime.CompilerServices.Closure,object) at MessagePack.MessagePackSerializer+NonGeneric.Serialize (System.Type type, System.Object obj) [0x00006] in <9584f10ef1c54d659bd9587a0a564bad>:0 at...

The ClientSetupRequest class looks like this:
`using MessagePack;

[MessagePackObject]
public class ClientSetupRequest : GameNetworkEvent
{

[Key(0)]
public string PlayerName;

}
`

The GameNetworkEvent class is just an empty class.

I'm not sure but I think something the exception doesn't occur for some reason...

What's strange is that it says:

from assembly ''.

So the assembly is empty?

I don't know which version I was using before, but I just redownloaded MessagePack (version 1.7.3.4 using nuget) and copied the .dll from the net47 folder to my Unity Project and also referencing it from my standalone c# app.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions