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 560 forks source link

System.ServiceModel.ClientBase is incompatible between System.ServiceModel.Primitives 6.0.0 and 8.0.0 #5400

Open wasker opened 8 months ago

wasker commented 8 months ago

Describe the bug

I'm upgrading our projects from .NET 7 to .NET 8 and decided to upgrade System.ServiceModel.Primitives as well. Doing so resulted in a bunch of compilation bugs like

Error CS1503 Argument 1: cannot convert from 'string' to 'System.ServiceModel.Description.ServiceEndpoint'

In service clients that were generated with previous versions of tools.

        public Xxx()
        {
        }

        // broken
        public Xxx(string endpointConfigurationName) : 
                base(endpointConfigurationName)
        {
        }

        // broken
        public Xxx(string endpointConfigurationName, string remoteAddress) : 
                base(endpointConfigurationName, remoteAddress)
        {
        }

        // broken
        public Xxx(string endpointConfigurationName, System.ServiceModel.EndpointAddress remoteAddress) : 
                base(endpointConfigurationName, remoteAddress)
        {
        }

        public Xxx(System.ServiceModel.Channels.Binding binding, System.ServiceModel.EndpointAddress remoteAddress) : 
                base(binding, remoteAddress)
        {
        }

Expected behavior

Keep legacy ctor definitions to avoid re-generating service clients between upgrades.

schneoka commented 8 months ago

We ran into the same problem.

Using the new dotnet-svcutil instead is not possible, see https://github.com/dotnet/wcf/issues/5404

wasker commented 6 months ago

Any update on that? 6.x has dependencies that are being flagged for vulnerabilities. We can't move to 8.x because it's a breaking change, yet we don't know how long 6.x will be getting updated.

HongGit commented 6 months ago

@wasker this is a break change because the code was written for .NET framework. As WCF Client 8.0 release did break this from WCF Client 6.0 to WCF Client 8.0. dotnet-svcutil has never generated these methods. However, this is due to this code was generated from .NET Framework.

The temporary work around is to simply remove those from your code. We will work to fix #5404 or any other similar issues. Potentially, you could also use svcutil.exe from.NET Framework SDK tool, and run it with dconly, like svcutil.exe /dconly.

mcgolledge commented 5 months ago

I'll just add that the missing constructor is documented to exist at .Net 8

ClientBase(String) Initializes a new instance of the ClientBase class using the configuration information specified in the application configuration file by endpointConfigurationName.

C#

protected ClientBase (string endpointConfigurationName);

jtecsonmri commented 5 months ago

I'll just add that the missing constructor is documented to exist at .Net 8

ClientBase(String) Initializes a new instance of the ClientBase class using the configuration information specified in the application configuration file by endpointConfigurationName.

C#

protected ClientBase (string endpointConfigurationName);

What version will this method signature be available? Thank you!

VrindaRK commented 1 month ago

@wasker this is a break change because the code was written for .NET framework. As WCF Client 8.0 release did break this from WCF Client 6.0 to WCF Client 8.0. dotnet-svcutil has never generated these methods. However, this is due to this code was generated from .NET Framework.

The temporary work around is to simply remove those from your code. We will work to fix #5404 or any other similar issues. Potentially, you could also use svcutil.exe from.NET Framework SDK tool, and run it with dconly, like svcutil.exe /dconly.

Could you please update on fix of this issue.