"Ambiguous invocations", "duplicate attribute", "Member with the same signature is already declared"

Hi,

We are using GraphQl server side, and we use the package HotChocolate for this.

For the client, we generate a client library.

For this, I have a .Net core class library that generates the code (using StrawberryShake packages)

<PropertyGroup>
        <TargetFramework>net6.0</TargetFramework>
        <ImplicitUsings>enable</ImplicitUsings>
        <Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
        <PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="6.0.0" />
        <PackageReference Include="Microsoft.Extensions.Http" Version="6.0.0" />
        <PackageReference Include="StrawberryShake.CodeGeneration.CSharp" Version="12.11.0" />
        <PackageReference Include="StrawberryShake.CodeGeneration.CSharp.Analyzers" Version="12.11.0" />
        <PackageReference Include="StrawberryShake.Transport.Http" Version="12.11.0" />
        <PackageReference Include="StrawberryShake.Transport.WebSockets" Version="12.11.0" />
</ItemGroup>

In our console client, using that library, we configure the ServiceCollection, using the generated methods.

But when opening that generated code, Resharper complains a lot. (700 errors or so in total)

While dotnet simply compiles and runs the code correctly.

I checked the duplicate attribute in the generated code - it is not there.

I checked the ambiguous reference in the generated code - there is only one package that has that code - correct, no problem.

All the other stuff is also correct - compiles, and runs fine.

But Resharper sees a lot of problems.

So I wanted to create an issue in YouTrack, reproducing this situation.  Turns out resharper does not complain in the custom solution, while it has the same generated projects ?!

So it seems solution related, right ?

Then I went back to the original solution and cleared the cache of Resharper - still same problems.

Any ideas from the community ?

0
4 comments

Hi Dirk,

thank you for contacting us.

Please try to turn off follow option: ReSharper | Options | Environment | General | Read solution model directly and check the result.

Thank you!

0

Hi Olga, thank you for your suggestion !

Turned off that option, all files were re-analyzed, and same amount of issues (stuff that resharper treats as errors) appear again.

Then turned the option back on, re-analyzed, still same number of issues.

Thx.

0

Hi Dirk,

thank you for the answer.

What version of Visual Studio you have?

Is there any chance to share with us your original solution? You could submit a ticket in YouTrack and set up visibility to JetBrains only.

Thank you!

0

Hi Olga,

thanks for your follow up.

I am on the latest and greatest.  (2022, all up to date)  I also have preview installed, also all up to date.

I have been working on creating a solution to get it to send you, but then it seems that when I open that solution, Resharper has no problems !?  So I don't have anything to send you yet at this time.

(Then again, sending you a solution that references many internal packages would still be hard for you to decipher, I think.)

Meanwhile I found a solution to the problem - setting emitcode in the config to false.  This takes care the generated source code is not available in the project, and is not seen by Resharper as a possible second source of the same code.

0

Please sign in to leave a comment.