grpc / grpc-dotnet

gRPC for .NET
Apache License 2.0
4.17k stars 768 forks source link

Grpc.AspNetCore.Server.Reflection doesn't work with shared proto file. #2462

Open plombaer opened 3 months ago

plombaer commented 3 months ago

Dear I've shared assembly containing a proto file. The project look like this :

  <ItemGroup>
    <Protobuf Include="protos\test.proto" />
    <!-- Set visible to false so the file doesn't show up in solution explorer twice -->
    <Content Include="protos\test.proto" Pack="true" Visible="false" />
  </ItemGroup>

The server project :

<PackageReference Include="blabla" Version="1.0.0" GeneratePathProperty="true" />
  <ItemGroup>
    <Protobuf Include="Protos\stuff.proto" AdditionalImportDirs="$(Pkg...)\content\Protos" />
  </ItemGroup>

When I use gRPCUI I get the following error : Failed to compute set of methods to expose: Symbol not found: test caused by: File not found: test.proto

Is there a way to make it work with reflection ? Thanks

JamesNK commented 3 months ago

I think this is the same as https://github.com/grpc/grpc-dotnet/issues/1946

plombaer commented 3 months ago

I think in the case described the shared proto/assembly is in the same solution. I'm using the following technique to share proto file. how-to-share-grpc-proto-definitions-of-custom-types-via-nuget