I'm getting ambiguity issues when using the auto generated code from the StrawberryShake.CodeGeneration.CSharp.Analyzers
. First time using this package so I might have done something silly. The error message is
CS0121: The call is ambiguous between the following methods or properties ...
Image of error in visual studio CS0121
I've tried reinstalling the nuget package and reinstalling the tool.
For reference my project properties are as follows:
<Project Sdk="Microsoft.NET.Sdk.BlazorWebAssembly">
<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="7.0.0" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="7.0.0" PrivateAssets="all" />
<PackageReference Include="Microsoft.Authentication.WebAssembly.Msal" Version="7.0.0" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="7.0.0" />
<PackageReference Include="Microsoft.Extensions.Http" Version="7.0.0" />
<PackageReference Include="Refit" Version="6.3.2" />
<PackageReference Include="StrawberryShake.CodeGeneration.CSharp.Analyzers" Version="12.15.2" />
<PackageReference Include="StrawberryShake.Transport.Http" Version="12.15.2" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Shared\GrafanaUtilities.Shared.csproj" />
</ItemGroup>
<ItemGroup>
<Folder Include="Generated\" />
</ItemGroup>
<ItemGroup>
<GraphQLConfig Include="Queries\Queries.graphql" />
</ItemGroup>
</Project>
Update: I managed to get arround the error currently by flagging the generated code not to do anything during compile (It appears as though the code is being placed in some temp directory as well as in the "Generated" folder in the project.)
If there is a way to prevent the temp file that would be great to know. For anyone else facing the same issue hope this helps.
I faced the same issue, and it's annoying because when this happens VSCode can not give you IntelliSense, and the generated code is not the most readable.
In fact I don't think it generate any more files than what's in "Generated" folder, but that code is only for us to see. The actual code is generated on the fly.
This is from their getting started guide here: https://chillicream.com/docs/strawberryshake/get-started
Therefore it should be safe to get rid of the code inside the "Generated" folder, everything works still.
You can do this by setting
"emitGeneratedCode": false,
in.graphqlrc.json
file.Boom, then VSCode does not complain about duplicate definitions, and IntelliSense works like a Charm.