-
Notifications
You must be signed in to change notification settings - Fork 325
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
bond grpc generate warning CS2002 when have multiple bond files #1050
Comments
I think I understand the bug. As a work around, try changing the csproj like this: --- "D:\\temp\\orig.csproj" 2020-05-29 15:40:12.514273600 -0700
+++ ".\\calculator-service.csproj" 2020-05-29 17:30:32.195659900 -0700
@@ -1,9 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<AssemblyName>CalculatorService</AssemblyName>
- <!-- gRPC needs to be enabled so that code generation will create the
- gRPC .cs files. -->
- <BondOptions>--grpc</BondOptions>
<OutputType>Exe</OutputType>
<ProjectGuid>{E8AB9839-2B85-4A55-AA4A-28E3B666B50A}</ProjectGuid>
<RootNamespace>Bond.Grpc.Examples.Calculator</RootNamespace>
@@ -11,6 +8,9 @@
</PropertyGroup>
<ItemGroup>
+ <BondCodegen Update="*.bond">
+ <Options>--grpc</Options>
+ </BondCodegen>
</ItemGroup>
<ItemGroup> For my notes: I think the bug is because the batching in <_BondGen_Grpc_BondOptions
Include="@(_BondCodegenWithDefaultOptions -> '$(_BondOutputDirectoryNormalized)%(FileName)_grpc.cs')"
Condition="$(BondOptions.Contains('--grpc'))
AND !$(BondOptions.Contains('--grpc=false'))">
<AutoGen>true</AutoGen>
<DependentUpon>%(BondCodegen.Identity)</DependentUpon>
</_BondGen_Grpc_BondOptions> |
Thank you. Added msbuild diag log portion
|
When a project has multiple .bond files in `@BondCodegen` and specified `--grpc` in `$BondOptions`, the C# code generation targets erroneously added the generated files to the `@Compile` item multiple times. This was caused because the `@_BondGen_Grpc_BondOptions` item incorrectly used `%(BondCodegen.Identity)` when populating `%DependentUpon`. Since `@_BondGen_Grpc_BondOptions` and `@BondCodegen` are different items, this multiplied them together. A mapping was intended instead, so the fix is to use `%_BondGen_Grpc_BondOptions.Identity`. (This was likely a copy/paste bug when `--grpc` support was added to the targets.) Fixes microsoft#1050
When a project has multiple .bond files in `@BondCodegen` and specified `--grpc` in `$BondOptions`, the C# code generation targets erroneously added the generated files to the `@Compile` item multiple times. This was caused because the `@_BondGen_Grpc_BondOptions` item incorrectly used `%(BondCodegen.Identity)` when populating `%DependentUpon`. Since `@_BondGen_Grpc_BondOptions` and `@BondCodegen` are different items, this multiplied them together. A mapping was intended instead, so the fix is to use `%_BondGen_Grpc_BondOptions.Identity`. (This was likely a copy/paste bug when `--grpc` support was added to the targets.) Fixes #1050
Fixed in the master branch. Thanks for the report. |
Take sample project https://github.com/microsoft/bond-grpc-examples.
Move bond file into project and move the Result into separate bond and import in service bond.
Compile and cs2002 warning shows up. Cannot be suppressed by NoWarn.
Interesting it is only complains about *_grpc.cs but not *_types.cs
grpc_cs2002_warning.zip
Actually doesn't need to use import. Just have two bond files will also trigger the warnings.
The text was updated successfully, but these errors were encountered: