-
Notifications
You must be signed in to change notification settings - Fork 571
Description
Describe the bug
When referencing an assembly containing an IXmlSerializable
type that needs to match a WSDL declared type in a custom namespace, use of the standard System.Xml.Serialization.XmlSchemaProviderAttribute
doesn't enable the dotnet-svcutil
tool to correctly match the type in the referenced assembly. Instead, a new type is generated in the output code.
This prevents us from having a single implementation of types that are used across several web-services.
Cause
I've spent time debugging and found that the cause is in the SchemaExporter.cs
file inside the InvokeSchemaProviderMethod
where the implementation is searching for the XmlSchemaProviderAttribute
type contained in the FrameworkFork
. That is, it's searching for Microsoft.Xml.Serialization.XmlSchemaProviderAttribute
rather than System.Xml.Serialization.XmlSchemaProviderAttribute
.
This is similar to the bug that @imcarolwang fixed in #5746 regarding the IXmlSerializable
interface. The fix is slightly more involved than the one in #5746 as additional types within the InvokeSchemaProviderMethod
also need to be swapped to refer to the standard framework types rather than the FrameworkFork types.
I'm happy to provide a PR with my proposed fix.
Expected behavior
The dotnet-svcutil
tool would find and use the System.Xml.Serialization.XmlSchemaProviderAttribute
to resolve the custom namespace declaration and match the type in the referenced assembly to the WSDL type.