Skip to content

The svcutil tool fails when referencing an IXmlSerializable type that uses the XmlSchemaProviderAttribute #5792

@heatonmatthew

Description

@heatonmatthew

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions