wcf: Configure Web Service Reference - Reuse types in referenced assemblies - Still broken
Create a web service reference with a shared assembly. If the DTO has a DataContract that specifies a namespace the type isn’t reused.
This bug was supposed to have been fixed. It appears to be fixed if the DataContract doesn’t have a namespace.
Say we have the shared type
[DataContract]
public class CompositeType
This is reused.
But if we have
[DataContract(Namespace = "nowhere.com")]
public class CompositeType2
it isn’t.
See the attached sample app. WCFTest.zip
Expected behavior I expect shared types to be reused whether they have an explicit namespace or not.
Screenshots
Additional context VS 16.3.0 Preview 1.0
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Reactions: 3
- Comments: 24 (8 by maintainers)
Links to this issue
Commits related to this issue
- Fix issue #3812. — committed to imcarolwang/wcf by imcarolwang 2 years ago
Hey it’s priority 1. Must be fixed soon.
Wait, it’s been priority 1 for a year. Hmmm. Stopped holding breath a long time ago.
We have 12 WCF service which are using shared namespaces. Any workaround for this issue? Thanks
@StephenBonikowsky This isn’t low priority for us. We have 20 WCF services which all use shared types across our code base. If we want to move to .NET Core (which we do because we’re now developing for Xamarin/Android) this is a big problem. Obviously we can get rid of WCF and switch to WebApi or Grpc but really shouldn’t have to.
If you do get around to fixing this don’t forget it’s possible for a WCF service to consume two (or more classes) with the same name disambiguated by namespace, e.g
namespace Company.Project1.Types { [DataContract(namespace="namespace1)] public class AThing {} }
namespace Company.Project2.Types { [DataContract(namespace="namespace2)] public class AThing {} }