dotnet / wcf

This repo contains the client-oriented WCF libraries that enable applications built on .NET Core to communicate with WCF services.
MIT License
1.7k stars 559 forks source link

CS0108 in generated client code #5595

Open dan-olsen opened 2 months ago

dan-olsen commented 2 months ago

Describe the bug While generating a client from a WSDL with dotnet-svcutil (version 2.1.0) we are seeing a CS0108 error.

error CS0108: 'OurServiceNameClient.CloseAsync()' hides inherited member 'ClientBase.CloseAsync()'. Use the new keyword if hiding was intended.

This is in a project that targets netstandard2.0 and net8.0.

Additional context This issue was previously marked fixed in 2.1.0 see #4891

imcarolwang commented 2 months ago

By default, the tool conditionally generates CloseAsync() based on the project's target framework version and the corresponding predefined WCF package versions added to the project. If the referenced WCF package version is updated either before or after the code generation, CloseAsync() may not compile as intended like the error in issue.

Specifically, if the project references a WCF package version equal to or greater than 4.10, CloseAsync() will not be generated. Otherwise, the tool will generate CloseAsync(), and the project should compile without issues.

If this situation does not match your experience, it could indicate other issues related to handling of the project's multi-framework-targets.

Could you please share the .csproj configuration, including the version of the WCF package referenced by the project when you encountered the problem?

Thank you.