-
Notifications
You must be signed in to change notification settings - Fork 571
Description
Describe the bug
I have a WCF service that uses two DLLs with base types. Once we reference that base types, the data contract will throw the ReferencedTypeDoesNotMatch.
There must be a difference to older versions, where the Reference.cs has been written / even the referenced types are not used and therefore generated as duplicates.
The WSDL File is generated right before creating the service - so I assume that this is correct.
The strange thing this is, that this is only one service that is not working - other WSDL files in our project can be used without any hassle.
To Reproduce
Steps to reproduce the behavior:
- I created a .NET Solution that produces the error with the current svc-util v8.0.0
- You have to run the build.ps1 file
- It crahes on CodeExporter.GetReferencedType
When serializing the object it throws a null reference exception
---> System.NullReferenceException: Object reference not set to an instance of an object.
at System.Runtime.Serialization.DataMember.CriticalHelper.get_MemberType() in C:\Github\wcf\src\dotnet-svcutil\lib\src\FrameworkFork\System.Runtime.Serialization\System\Runtime\Serialization\DataMember.cs:line 264
at System.Runtime.Serialization.DataMember.get_MemberType() in C:\Github\wcf\src\dotnet-svcutil\lib\src\FrameworkFork\System.Runtime.Serialization\System\Runtime\Serialization\DataMember.cs:line 142
Fix
The fix is to change to comparison in CodeExporter.GetReferencedType (Line 563)
from: if (referencedContract.Equals(dataContract))
to: if (referencedContract.StableName.Equals(dataContract.StableName))
Expected behavior
That the Reference.cs will be created with respect to the referenced data types.
Screenshots
If applicable, add screenshots to help explain your problem.