-1

I am trying to migrate some legacy code from .NET 4 to .NET 4.8.

I've got a WCF Service that is used by a web application (referenced in the web project as a service reference). I have a class library projects of common object types that are used by both the WCF Service, and the web application. Everything was working fine --- I was able to compile the web application and have the object types be resolved correctly.

However, since I converted to .NET 4.8, I'm getting a compiler error indicating that Service object cannot be converted to the web object. Again, this did work in previous versions of .NET with the code, and there have been no programmatic changes.

I have verified that the service reference is configured to re-use types in all assemblies and the radio button is selected for re-using types in all assemblies. I have also the other option of re-using objects in selected assemblies and highlight the appropriate shared assemblies that pertain to just my problem.

Is there something I missed or is different now in .NET 4.8?

Small code sample (hopefully this helps):


In my web page (with MainWCFService included via a Service Reference):

CommonLibrary.User user = null;

user = MainWCFService.GetUser()


Error: Cannot implicitly convert type 'MainWebProject.MainWCFService.User' to 'CommonLibrary.User'

Note: on the WCF Service side, the function "GetUser" also returns a variable of type "CommonLibrary.User"


Follow up: the issue definitely appears to be related to 4.8. When I upgraded the project to 4.7.2, the references resolved as expected and my project compiled with the service reference as it did in previous version.

The Birdman
  • 59
  • 1
  • 6
  • Any chance you could share a [mcve] showing the code that doesn't compile, or at the minimum, give the full text of the compilation error(s)? – dbc Aug 10 '23 at 16:45
  • Bugs were fixed in Net 4.8 and what worked in Net 4.0 may not work in Net 4.8. – jdweng Aug 10 '23 at 16:59
  • The WCF service reference in your project should be deleted and recreated in Visual Studio. Note that in the wizard you should also ask it to reuse existing assemblies. That's a very common issue people reported during upgrading. – Lex Li Aug 10 '23 at 19:09
  • Lex - thanks for the suggestion; however, it did not work. – The Birdman Aug 10 '23 at 20:00
  • Have you changed your web.config file if you have any? – Suhel Patel Aug 10 '23 at 20:12
  • Suhel - I have not changed either the web.config of the web project or the WCF project. – The Birdman Aug 10 '23 at 20:16
  • Since you didn't provide the code, we can only make assumptions. I think it's possible that some classes support Framework 4.0 but not Framework 4.8. – QI You Aug 11 '23 at 09:29

0 Answers0