protobuf icon indicating copy to clipboard operation
protobuf copied to clipboard

Protobuff Duplicate enum value warning causes run time exception. Any way to suppress?

Open mongoDynamo opened this issue 3 years ago • 1 comments

At the moment running into this warning with protobuff in .NET for generating C# files :

[libprotobuf WARNING ......\third_party\protobuf\src\google\protobuf\compiler\csharp\csharp_enum.cc : error : 74] Dup licate enum value enumName (originally OtherEnumName) in ArtifactAssemblyMethodType; adding unders core to distinguish [E:\sourcecode2\src\Services\Contracts.csproj]

The above warning results in an error being bubbled up and the build fails. I tried ignoring all warnings in the csproj file, but this isn't a direct warning, its internal and then surfaces as an error. I'm trying to figure out how this can be suppressed.

Also this failure occurs during file generation, once the files are generated consecutive builds succeed. So this seems to be a warning that can be ignored if possible.

This is the csproj file being used where a duplicate enum exists :

<ItemGroup>
    <Protobuf Include="..\content\protobuf\fileName.proto" GrpcServices="None" />
</ItemGroup>

I'm wondering if there's any settings to disable warnings from protobuff.

Similar issue : https://github.com/grpc/grpc/issues/24533

mongoDynamo avatar Dec 14 '22 19:12 mongoDynamo

Was able to use a work around by using exec instead of direct protobuff plugin. E.g. :

<Target Name="GenerateProto" BeforeTargets="CoreCompile">
    <Message Importance="high" Text="Generating proto" />
    <Exec Command="$(Protobuf_ProtocFullPath) --csharp_out=$(IntermediateOutputPath) --proto_path $(PkgNodeServiceContractsPath)\content\protobuf\ fileName.proto" />
  </Target>

mongoDynamo avatar Dec 15 '22 19:12 mongoDynamo

We triage inactive PRs and issues in order to make it easier to find active work. If this issue should remain active or becomes active again, please add a comment.

This issue is labeled inactive because the last activity was over 90 days ago.

github-actions[bot] avatar Dec 26 '23 10:12 github-actions[bot]

We triage inactive PRs and issues in order to make it easier to find active work. If this issue should remain active or becomes active again, please reopen it.

This issue was closed and archived because there has been no new activity in the 14 days since the inactive label was added.

github-actions[bot] avatar Jan 10 '24 10:01 github-actions[bot]