Closed boris-holmes closed 11 months ago
This looks like a namespace resolution issue. I'll treat it as a bug. Basically, when you specify FlatSharp
in your namespace, then the C# compiler will (by default) look for FlatSharp.Compiler
under MyNamespace.FlatSharp.Compiler
, which doesn't exist. I'll take a bug to try and change all code to be global::FlatSharp
, but in the meantime, you should be able to solve this by changing FlatSharp
to FlatBuffers
in your FBS
definition.
Fixed in 7.4.0
Hi team,
I am using FlatBuffer 7.3.0 (installed via nuget package) in VS 2022 in a .NET 6 library. I created a .fbs file for my schema, and my namespace in there is (not the final namespsace, just trialing at this point):
namespace MyOrganization.FlatSharp;
When building, I get this error:
1>C:\Source\...\obj\Debug\net6.0\FlatSharp.generated.cs(1855,101,1855,109): error CS0234: The type or namespace name 'Compiler' does not exist in the namespace 'MyOrganization.FlatSharp' (are you missing an assembly reference?)
Indeed the generated code I have references to FlatSharp namespace. And the compiler is getting confused, thinking it's referencing MyOrganization.FlatSharp whereas it should reference the FlatSharp namespace from the nugget library.
this.Name = FlatSharp.Compiler.Generated.CloneHelpers_023fb05e442b4a26a5ebcb4bfe3135cf.Clone(source.Name);