diff --git a/src/dotnet-svcutil/lib/src/FrameworkFork/System.Runtime.Serialization/System/Runtime/Serialization/Globals.cs b/src/dotnet-svcutil/lib/src/FrameworkFork/System.Runtime.Serialization/System/Runtime/Serialization/Globals.cs
index b6e258c2fc5..db5cee73e96 100644
--- a/src/dotnet-svcutil/lib/src/FrameworkFork/System.Runtime.Serialization/System/Runtime/Serialization/Globals.cs
+++ b/src/dotnet-svcutil/lib/src/FrameworkFork/System.Runtime.Serialization/System/Runtime/Serialization/Globals.cs
@@ -514,7 +514,7 @@ internal static Type TypeOfXmlSchemaProviderAttribute
get
{
if (s_typeOfXmlSchemaProviderAttribute == null)
- s_typeOfXmlSchemaProviderAttribute = typeof(XmlSchemaProviderAttribute);
+ s_typeOfXmlSchemaProviderAttribute = typeof(System.Xml.Serialization.XmlSchemaProviderAttribute);
return s_typeOfXmlSchemaProviderAttribute;
}
}
diff --git a/src/dotnet-svcutil/lib/src/FrameworkFork/System.Runtime.Serialization/System/Runtime/Serialization/SchemaExporter.cs b/src/dotnet-svcutil/lib/src/FrameworkFork/System.Runtime.Serialization/System/Runtime/Serialization/SchemaExporter.cs
index b20c2e3d940..a7bf864c118 100644
--- a/src/dotnet-svcutil/lib/src/FrameworkFork/System.Runtime.Serialization/System/Runtime/Serialization/SchemaExporter.cs
+++ b/src/dotnet-svcutil/lib/src/FrameworkFork/System.Runtime.Serialization/System/Runtime/Serialization/SchemaExporter.cs
@@ -40,7 +40,7 @@ private static bool InvokeSchemaProviderMethod(Type clrType, XmlSchemaSet schema
return false;
}
- XmlSchemaProviderAttribute provider = (XmlSchemaProviderAttribute)attrs[0];
+ System.Xml.Serialization.XmlSchemaProviderAttribute provider = (System.Xml.Serialization.XmlSchemaProviderAttribute)attrs[0];
if (provider.IsAny)
{
xsdType = CreateAnyElementType();
@@ -55,11 +55,11 @@ private static bool InvokeSchemaProviderMethod(Type clrType, XmlSchemaSet schema
}
else
{
- MethodInfo getMethod = clrType.GetMethod(methodName, /*BindingFlags.DeclaredOnly |*/ BindingFlags.Static | BindingFlags.NonPublic | BindingFlags.Public, new Type[] { typeof(XmlSchemaSet) });
+ MethodInfo getMethod = clrType.GetMethod(methodName, /*BindingFlags.DeclaredOnly |*/ BindingFlags.Static | BindingFlags.NonPublic | BindingFlags.Public, new Type[] { typeof(System.Xml.Schema.XmlSchemaSet) });
if (getMethod == null)
throw /*System.Runtime.Serialization.*/DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidDataContractException(string.Format(SRSerialization.MissingGetSchemaMethod, DataContract.GetClrTypeFullName(clrType), methodName)));
- if (!(Globals.TypeOfXmlQualifiedName.IsAssignableFrom(getMethod.ReturnType)))
+ if (!typeof(System.Xml.XmlQualifiedName).IsAssignableFrom(getMethod.ReturnType))
throw /*System.Runtime.Serialization.*/DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidDataContractException(string.Format(SRSerialization.InvalidReturnTypeOnGetSchemaMethod, DataContract.GetClrTypeFullName(clrType), methodName, DataContract.GetClrTypeFullName(getMethod.ReturnType), DataContract.GetClrTypeFullName(Globals.TypeOfXmlQualifiedName))));
object typeInfo = getMethod.Invoke(null, new object[] { schemas });
@@ -78,7 +78,8 @@ private static bool InvokeSchemaProviderMethod(Type clrType, XmlSchemaSet schema
}
else
{
- stableName = (XmlQualifiedName)typeInfo;
+ var systemName = (System.Xml.XmlQualifiedName)typeInfo;
+ stableName = new XmlQualifiedName(systemName.Name, systemName.Namespace);
}
}
return true;
diff --git a/src/dotnet-svcutil/lib/tests/Baselines/ReuseIXmlSerializableType/ReuseIXmlSerializableType/ServiceReference/dotnet-svcutil.params.json b/src/dotnet-svcutil/lib/tests/Baselines/ReuseIXmlSerializableType/ReuseIXmlSerializableType/ServiceReference/dotnet-svcutil.params.json
index e0cc04dd28f..66789fa45c5 100644
--- a/src/dotnet-svcutil/lib/tests/Baselines/ReuseIXmlSerializableType/ReuseIXmlSerializableType/ServiceReference/dotnet-svcutil.params.json
+++ b/src/dotnet-svcutil/lib/tests/Baselines/ReuseIXmlSerializableType/ReuseIXmlSerializableType/ServiceReference/dotnet-svcutil.params.json
@@ -3,14 +3,14 @@
"version": "99.99.99",
"options": {
"inputs": [
- "../../../../../../src/dotnet-svcutil/lib/tests/TestCases/TypeReuse/TypeReuseIXmlSerializable.wsdl"
+ "../../../../../../src/dotnet-svcutil/lib/tests/TestCases/ReuseIXmlSerializableType/TypeReuseIXmlSerializable.wsdl"
],
"namespaceMappings": [
"*, ReuseIXmlSerializableType_NS"
],
"outputFile": "Reference.cs",
"references": [
- "$testCasesPath$//TypeReuse//CommonTypes.dll"
+ "$testCasesPath$//ReuseIXmlSerializableType//CommonTypes//CommonTypes.csproj"
],
"targetFramework": "N.N",
"typeReuseMode": "Specified"
diff --git a/src/dotnet-svcutil/lib/tests/TestCases/ReuseIXmlSerializableType/CommonTypes/AnotherSharedType.cs b/src/dotnet-svcutil/lib/tests/TestCases/ReuseIXmlSerializableType/CommonTypes/AnotherSharedType.cs
new file mode 100644
index 00000000000..7552128ab8c
--- /dev/null
+++ b/src/dotnet-svcutil/lib/tests/TestCases/ReuseIXmlSerializableType/CommonTypes/AnotherSharedType.cs
@@ -0,0 +1,17 @@
+using System.Runtime.Serialization;
+
+namespace CommonTypes
+{
+ [DataContract]
+ public struct AnotherSharedType
+ {
+ [DataMember]
+ public int SomeProperty { get; set; }
+
+ [DataMember]
+ public CustomSerializableType SomeXmlSerializableType { get; set; }
+
+ [DataMember]
+ public CustomSerializableTypeWithNs SomeXmlSerializableTypeWithNs { get; set; }
+ }
+}
diff --git a/src/dotnet-svcutil/lib/tests/TestCases/ReuseIXmlSerializableType/CommonTypes/CommonTypes.csproj b/src/dotnet-svcutil/lib/tests/TestCases/ReuseIXmlSerializableType/CommonTypes/CommonTypes.csproj
new file mode 100644
index 00000000000..fd1b5c006a3
--- /dev/null
+++ b/src/dotnet-svcutil/lib/tests/TestCases/ReuseIXmlSerializableType/CommonTypes/CommonTypes.csproj
@@ -0,0 +1,11 @@
+
+
+
+ netstandard2.0
+
+
+
+
+
+
+
diff --git a/src/dotnet-svcutil/lib/tests/TestCases/ReuseIXmlSerializableType/CommonTypes/CustomSerializableType.cs b/src/dotnet-svcutil/lib/tests/TestCases/ReuseIXmlSerializableType/CommonTypes/CustomSerializableType.cs
new file mode 100644
index 00000000000..eff5a121880
--- /dev/null
+++ b/src/dotnet-svcutil/lib/tests/TestCases/ReuseIXmlSerializableType/CommonTypes/CustomSerializableType.cs
@@ -0,0 +1,48 @@
+using System;
+using System.Globalization;
+using System.Numerics;
+using System.Xml;
+using System.Xml.Schema;
+using System.Xml.Serialization;
+
+namespace CommonTypes
+{
+ public struct CustomSerializableType : IXmlSerializable
+ {
+ public BigInteger TestValue { get; set; }
+
+ public XmlSchema GetSchema()
+ {
+ XmlSchema schema = new XmlSchema()
+ {
+ Id = "CustomSerializableTypeSchema"
+ };
+ XmlSchemaSimpleType schemaSimpleType1 = new XmlSchemaSimpleType();
+ schemaSimpleType1.Name = "BigIntegerString";
+ XmlSchemaSimpleType schemaSimpleType2 = schemaSimpleType1;
+ XmlSchemaSimpleTypeRestriction simpleTypeRestriction = new XmlSchemaSimpleTypeRestriction()
+ {
+ BaseTypeName = new XmlQualifiedName("string", "http://www.w3.org/2001/XMLSchema")
+ };
+ schemaSimpleType2.Content = (XmlSchemaSimpleTypeContent) simpleTypeRestriction;
+ schema.Items.Add((XmlSchemaObject) schemaSimpleType2);
+ return schema;
+ }
+
+ public void ReadXml(XmlReader reader)
+ {
+ reader.ReadStartElement();
+ reader.ReadStartElement();
+ this.TestValue = BigInteger.Parse(reader.ReadContentAsString());
+ reader.ReadEndElement();
+ reader.ReadEndElement();
+ }
+
+ public void WriteXml(XmlWriter writer)
+ {
+ writer.WriteStartElement("BigIntegerString");
+ writer.WriteValue(this.TestValue.ToString((IFormatProvider) CultureInfo.InvariantCulture));
+ writer.WriteEndElement();
+ }
+ }
+}
diff --git a/src/dotnet-svcutil/lib/tests/TestCases/ReuseIXmlSerializableType/CommonTypes/CustomSerializableTypeWithNs.cs b/src/dotnet-svcutil/lib/tests/TestCases/ReuseIXmlSerializableType/CommonTypes/CustomSerializableTypeWithNs.cs
new file mode 100644
index 00000000000..fdbfae4654b
--- /dev/null
+++ b/src/dotnet-svcutil/lib/tests/TestCases/ReuseIXmlSerializableType/CommonTypes/CustomSerializableTypeWithNs.cs
@@ -0,0 +1,57 @@
+using System;
+using System.Globalization;
+using System.Numerics;
+using System.Xml;
+using System.Xml.Schema;
+using System.Xml.Serialization;
+
+namespace CommonTypes
+{
+ [XmlSchemaProvider("GetXmlSchema")]
+ public struct CustomSerializableTypeWithNs : IXmlSerializable
+ {
+ public BigInteger TestValue { get; set; }
+
+ // This method is defined by the XmlSchemaProvider attributes and
+ // called by the SchemaExporter::InvokeSchemaProviderMethod to get
+ // the custom Xml Qualified name for the type mapping.
+ public static XmlQualifiedName GetXmlSchema(XmlSchemaSet xss)
+ {
+ return new XmlQualifiedName("CustomSerializableTypeWithNs", "http://www.example.com/Schemas/CommonTypes");
+ }
+
+ public XmlSchema GetSchema()
+ {
+ XmlSchema schema = new XmlSchema()
+ {
+ Id = "CustomSerializableTypeSchema"
+ };
+ XmlSchemaSimpleType schemaSimpleType1 = new XmlSchemaSimpleType();
+ schemaSimpleType1.Name = "BigIntegerString";
+ XmlSchemaSimpleType schemaSimpleType2 = schemaSimpleType1;
+ XmlSchemaSimpleTypeRestriction simpleTypeRestriction = new XmlSchemaSimpleTypeRestriction()
+ {
+ BaseTypeName = new XmlQualifiedName("string", "http://www.w3.org/2001/XMLSchema")
+ };
+ schemaSimpleType2.Content = (XmlSchemaSimpleTypeContent)simpleTypeRestriction;
+ schema.Items.Add((XmlSchemaObject)schemaSimpleType2);
+ return schema;
+ }
+
+ public void ReadXml(XmlReader reader)
+ {
+ reader.ReadStartElement();
+ reader.ReadStartElement();
+ this.TestValue = BigInteger.Parse(reader.ReadContentAsString());
+ reader.ReadEndElement();
+ reader.ReadEndElement();
+ }
+
+ public void WriteXml(XmlWriter writer)
+ {
+ writer.WriteStartElement("BigIntegerString");
+ writer.WriteValue(this.TestValue.ToString((IFormatProvider)CultureInfo.InvariantCulture));
+ writer.WriteEndElement();
+ }
+ }
+}
diff --git a/src/dotnet-svcutil/lib/tests/TestCases/ReuseIXmlSerializableType/CommonTypes/SomeSharedType.cs b/src/dotnet-svcutil/lib/tests/TestCases/ReuseIXmlSerializableType/CommonTypes/SomeSharedType.cs
new file mode 100644
index 00000000000..a2319d3806b
--- /dev/null
+++ b/src/dotnet-svcutil/lib/tests/TestCases/ReuseIXmlSerializableType/CommonTypes/SomeSharedType.cs
@@ -0,0 +1,11 @@
+using System.Runtime.Serialization;
+
+namespace CommonTypes
+{
+ [DataContract]
+ public struct SomeSharedType
+ {
+ [DataMember]
+ public int SomeProperty { get; set; }
+ }
+}
diff --git a/src/dotnet-svcutil/lib/tests/TestCases/TypeReuse/TypeReuseIXmlSerializable.wsdl b/src/dotnet-svcutil/lib/tests/TestCases/ReuseIXmlSerializableType/TypeReuseIXmlSerializable.wsdl
similarity index 89%
rename from src/dotnet-svcutil/lib/tests/TestCases/TypeReuse/TypeReuseIXmlSerializable.wsdl
rename to src/dotnet-svcutil/lib/tests/TestCases/ReuseIXmlSerializableType/TypeReuseIXmlSerializable.wsdl
index a85a089353a..739cab9e126 100644
--- a/src/dotnet-svcutil/lib/tests/TestCases/TypeReuse/TypeReuseIXmlSerializable.wsdl
+++ b/src/dotnet-svcutil/lib/tests/TestCases/ReuseIXmlSerializableType/TypeReuseIXmlSerializable.wsdl
@@ -93,7 +93,7 @@
-
+
@@ -115,6 +115,7 @@
+
@@ -130,6 +131,20 @@
+
+
+
+
+
+ true
+
+
+
+
+
+
+
+
diff --git a/src/dotnet-svcutil/lib/tests/TestCases/TypeReuse/CommonTypes.dll b/src/dotnet-svcutil/lib/tests/TestCases/TypeReuse/CommonTypes.dll
deleted file mode 100644
index c3d81b2a2c9..00000000000
Binary files a/src/dotnet-svcutil/lib/tests/TestCases/TypeReuse/CommonTypes.dll and /dev/null differ
diff --git a/src/dotnet-svcutil/lib/tests/src/GlobalToolTests.cs b/src/dotnet-svcutil/lib/tests/src/GlobalToolTests.cs
index be683bb7a8a..40a9c973360 100644
--- a/src/dotnet-svcutil/lib/tests/src/GlobalToolTests.cs
+++ b/src/dotnet-svcutil/lib/tests/src/GlobalToolTests.cs
@@ -215,9 +215,10 @@ public void ReuseIXmlSerializableType()
TestFixture();
InitializeGlobal(this_TestCaseName);
- var uri = Path.Combine(g_TestCasesDir, "TypeReuse", "TypeReuseIXmlSerializable.wsdl");
- var refs = Path.Combine(g_TestCasesDir, "TypeReuse", "CommonTypes.dll");
+ var uri = Path.Combine(g_TestCasesDir, "ReuseIXmlSerializableType", "TypeReuseIXmlSerializable.wsdl");
+ var refs = Path.Combine(g_TestCasesDir, "ReuseIXmlSerializableType", "CommonTypes", "CommonTypes.csproj");
var options = $"{uri} -r {refs} -nl -v minimal -n \"\"*,{this_TestCaseName}_NS\"\"";
+
TestGlobalSvcutil(options);
}
}