jamescourtney / FlatSharp

Fast, idiomatic C# implementation of Flatbuffers

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Generated C# from fbs file compiler issues with namespaces

joejo-unity opened this issue · comments

All binaries are latest from NuGet.

The generated C# errors out on FlatSharp.Compiler and FlatSharp.FlatBufferDeserializationOption generated code. Slapping global:: in front of them to pick up the context previously generated in the file seems to resolve that. Example:

public FlatSharp.FlatBufferDeserializationOption DeserializationOption => FlatSharp.FlatBufferDeserializationOption.GreedyMutable;

changed to --->

public global::FlatSharp.FlatBufferDeserializationOption DeserializationOption => global::FlatSharp.FlatBufferDeserializationOption.GreedyMutable;

Can you share some more details?

  • Are you compiling in Unity? Does Unity support global:: for fully-qualified namespaces?
  • What version of FlatSharp worked well? What version is now broken (6.1.x, I assume?)
  • Anything else you think is relevant for me to reproduce.

Thanks!

Thanks for posting that FBS file; I've requested access that you'll probably need to approve before I can actually see it.

That helps a ton, thank you. So the word FlatSharp is part of your namespace, so the resolution gets confused. I've been gradually trying to shift to using global:: in more places, though I'm clearly not done yet :) There are just a lot of places in the generated code where FlatSharp needs to emit a type name.

I'm going to mark this as a bug though I'm not sure about the timeline for addressing it. In the meantime, you should be able to work around this by using anything besides FlatSharp in your namespaces.