Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The type or namespace name 'MessagePack' does not exist in the namespace 'MagicOnion.Serialization' #756

Closed
Nickmiste opened this issue Apr 11, 2024 · 2 comments

Comments

@Nickmiste
Copy link

Nickmiste commented Apr 11, 2024

The Problem

I've been working with MagicOnion in Unity for a while, and I recently updated my project setup to move off of the deprecated version of gRPC. However, I am now seeing the following compiler errors related to source generation. Note that all three errors are identical apart from the line numbers.

Screenshot 2024-04-11 at 10 54 53 AM

Project Setup

The following packages are installed via the Unity package manager:

  • MagicOnion v6.1.2
  • YetAnotherHttpHandler v1.2.1
  • NuGetForUnity v4.1.0

The following packages are installed via NuGetForUnity:

  • MessagePack v2.5.140
  • Grpc.Net.Client v2.62.0
  • System.IO.Pipelines v8.0.0

I am running this on an Apple Silicon Mac.

In player settings, the scripting backend is set to IL2CPP and the api compatibility level is set to .NET Framework.

I have the source generator setup using MagicOnionClientGenerationAttribute. This file, as well as all of my other code, is contained within its own asmdef. As I understand it, this source generation takes the place of moc, but MessagePack still requires its own manual generation step using mpc. The error above is shown regardless of whether the file generated with mpc exists.

I should also mention that the shared service interfaces are stored in the server directory outside of the Unity project, and then the Unity project symlinks to them.

@Nickmiste
Copy link
Author

Removing all asmdefs from my project fixes the compiler errors, but this isn't ideal. Still looking for a more permanent fix.

@Nickmiste
Copy link
Author

Turns out the issue was that I was missing a reference to MagicOnion.Serialization.MessagePack in the asmdef that contained my code. Closing this as resolved!

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

No branches or pull requests

1 participant