[S.R.Serialization] switch to referencesources.
authorAtsushi Eno <atsushieno@gmail.com>
Mon, 30 Mar 2015 18:22:28 +0000 (03:22 +0900)
committerAtsushi Eno <atsushieno@gmail.com>
Fri, 24 Apr 2015 05:36:50 +0000 (14:36 +0900)
It builds on net_4_5 and monodroid so far.

We still need to eliminate dynamic code generation to make it work on iOS.

13 files changed:
mcs/class/System.Runtime.Serialization/Makefile
mcs/class/System.Runtime.Serialization/ReferenceSource.common.sources [new file with mode: 0644]
mcs/class/System.Runtime.Serialization/ReferenceSource.desktop.sources [new file with mode: 0644]
mcs/class/System.Runtime.Serialization/ReferenceSources/DiagnosticUtility.cs [new file with mode: 0644]
mcs/class/System.Runtime.Serialization/ReferenceSources/FxTrace.cs [new file with mode: 0644]
mcs/class/System.Runtime.Serialization/ReferenceSources/SR.cs [new file with mode: 0644]
mcs/class/System.Runtime.Serialization/ReferenceSources/SR_missing.cs [new file with mode: 0644]
mcs/class/System.Runtime.Serialization/ReferenceSources/SchemaExporter_mobile.cs [new file with mode: 0644]
mcs/class/System.Runtime.Serialization/ReferenceSources/SimplifiedCodeTypeReference.cs [new file with mode: 0644]
mcs/class/System.Runtime.Serialization/ReferenceSources/XmlExceptionHelper.cs [new file with mode: 0644]
mcs/class/System.Runtime.Serialization/System.Runtime.Serialization.dll.sources
mcs/class/System.Runtime.Serialization/mobile_System.Runtime.Serialization.dll.sources
mcs/class/System.Runtime.Serialization/net_4_5_System.Runtime.Serialization.dll.sources

index 88da7618a64f7487fa837b6d2003fc4bf790c560..d02bf4a50d7359bd8c87051d3e5f3601f6498b6e 100644 (file)
@@ -2,21 +2,20 @@ thisdir = class/System.Runtime.Serialization
 SUBDIRS = 
 include ../../build/rules.make
 
-RESOURCE_FILES = \
-       resources/mstypes.schema
+RESOURCE_FILES =
 
 LIBRARY = System.Runtime.Serialization.dll
-LIB_REFS = System System.Xml System.Core
+LIB_REFS = System System.Xml System.Core System.ServiceModel.Internals SMDiagnostics
 LIB_MCS_FLAGS = \
                -unsafe \
                /nowarn:168,169,219,414 \
                $(RESOURCE_FILES:%=/resource:%)
 
-RESOURCE_STRINGS = ../../../external/referencesource/System.Runtime.Serialization/System.Runtime.Serialization.txt
-
 ifneq (2.1, $(FRAMEWORK_VERSION))
 LIB_REFS += System.Data System.Configuration
 LIB_MCS_FLAGS += /d:NET_3_0
+else
+LIB_MCS_FLAGS += /d:NO_CONFIGURATION /d:NO_SECURITY_ATTRIBUTES /d:NO_CODEDOM /d:NO_DESKTOP_SECURITY
 endif
 
 TEST_RESOURCE_FILES = \
diff --git a/mcs/class/System.Runtime.Serialization/ReferenceSource.common.sources b/mcs/class/System.Runtime.Serialization/ReferenceSource.common.sources
new file mode 100644 (file)
index 0000000..8adfd32
--- /dev/null
@@ -0,0 +1,133 @@
+
+../../../external/referencesource/System.Runtime.Serialization/System/Runtime/Serialization/AppSettings.cs
+../../../external/referencesource/System.Runtime.Serialization/System/Runtime/Serialization/Attributes.cs
+../../../external/referencesource/System.Runtime.Serialization/System/Runtime/Serialization/BitFlagsGenerator.cs
+../../../external/referencesource/System.Runtime.Serialization/System/Runtime/Serialization/ClassDataContract.cs
+../../../external/referencesource/System.Runtime.Serialization/System/Runtime/Serialization/CodeGenerator.cs
+../../../external/referencesource/System.Runtime.Serialization/System/Runtime/Serialization/CollectionDataContractAttribute.cs
+../../../external/referencesource/System.Runtime.Serialization/System/Runtime/Serialization/CollectionDataContract.cs
+../../../external/referencesource/System.Runtime.Serialization/System/Runtime/Serialization/ContractNamespaceAttribute.cs
+../../../external/referencesource/System.Runtime.Serialization/System/Runtime/Serialization/DataContractAttribute.cs
+../../../external/referencesource/System.Runtime.Serialization/System/Runtime/Serialization/DataContract.cs
+../../../external/referencesource/System.Runtime.Serialization/System/Runtime/Serialization/DataContractResolver.cs
+../../../external/referencesource/System.Runtime.Serialization/System/Runtime/Serialization/DataContractSerializer.cs
+../../../external/referencesource/System.Runtime.Serialization/System/Runtime/Serialization/DataContractSerializerSettings.cs
+../../../external/referencesource/System.Runtime.Serialization/System/Runtime/Serialization/DataContractSet.cs
+../../../external/referencesource/System.Runtime.Serialization/System/Runtime/Serialization/DataMemberAttribute.cs
+../../../external/referencesource/System.Runtime.Serialization/System/Runtime/Serialization/DataMember.cs
+../../../external/referencesource/System.Runtime.Serialization/System/Runtime/Serialization/DateTimeFormat.cs
+../../../external/referencesource/System.Runtime.Serialization/System/Runtime/Serialization/DateTimeOffsetAdapter.cs
+../../../external/referencesource/System.Runtime.Serialization/System/Runtime/Serialization/Diagnostics/TraceCode.cs
+../../../external/referencesource/System.Runtime.Serialization/System/Runtime/Serialization/Diagnostics/TraceUtility.cs
+../../../external/referencesource/System.Runtime.Serialization/System/Runtime/Serialization/DictionaryGlobals.cs
+../../../external/referencesource/System.Runtime.Serialization/System/Runtime/Serialization/EmitTypeInformation.cs
+../../../external/referencesource/System.Runtime.Serialization/System/Runtime/Serialization/EnumDataContract.cs
+../../../external/referencesource/System.Runtime.Serialization/System/Runtime/Serialization/EnumMemberAttribute.cs
+../../../external/referencesource/System.Runtime.Serialization/System/Runtime/Serialization/ExportOptions.cs
+../../../external/referencesource/System.Runtime.Serialization/System/Runtime/Serialization/ExtensionDataObject.cs
+../../../external/referencesource/System.Runtime.Serialization/System/Runtime/Serialization/ExtensionDataReader.cs
+../../../external/referencesource/System.Runtime.Serialization/System/Runtime/Serialization/GenericParameterDataContract.cs
+../../../external/referencesource/System.Runtime.Serialization/System/Runtime/Serialization/Globals.cs
+../../../external/referencesource/System.Runtime.Serialization/System/Runtime/Serialization/HybridObjectCache.cs
+../../../external/referencesource/System.Runtime.Serialization/System/Runtime/Serialization/IDataContractSurrogate.cs
+../../../external/referencesource/System.Runtime.Serialization/System/Runtime/Serialization/IExtensibleDataObject.cs
+../../../external/referencesource/System.Runtime.Serialization/System/Runtime/Serialization/IgnoreDataMemberAttribute.cs
+../../../external/referencesource/System.Runtime.Serialization/System/Runtime/Serialization/InvalidDataContractException.cs
+../../../external/referencesource/System.Runtime.Serialization/System/Runtime/Serialization/Json/ByteArrayHelperWithString.cs
+../../../external/referencesource/System.Runtime.Serialization/System/Runtime/Serialization/Json/DataContractJsonSerializer.cs
+../../../external/referencesource/System.Runtime.Serialization/System/Runtime/Serialization/Json/DataContractJsonSerializerSettings.cs
+../../../external/referencesource/System.Runtime.Serialization/System/Runtime/Serialization/Json/IXmlJsonReaderInitializer.cs
+../../../external/referencesource/System.Runtime.Serialization/System/Runtime/Serialization/Json/IXmlJsonWriterInitializer.cs
+../../../external/referencesource/System.Runtime.Serialization/System/Runtime/Serialization/Json/JsonByteArrayDataContract.cs
+../../../external/referencesource/System.Runtime.Serialization/System/Runtime/Serialization/Json/JsonClassDataContract.cs
+../../../external/referencesource/System.Runtime.Serialization/System/Runtime/Serialization/Json/JsonCollectionDataContract.cs
+../../../external/referencesource/System.Runtime.Serialization/System/Runtime/Serialization/Json/JsonDataContract.cs
+../../../external/referencesource/System.Runtime.Serialization/System/Runtime/Serialization/Json/JsonEncodingStreamWrapper.cs
+../../../external/referencesource/System.Runtime.Serialization/System/Runtime/Serialization/Json/JsonEnumDataContract.cs
+../../../external/referencesource/System.Runtime.Serialization/System/Runtime/Serialization/Json/JsonFormatGeneratorStatics.cs
+../../../external/referencesource/System.Runtime.Serialization/System/Runtime/Serialization/Json/JsonFormatReaderGenerator.cs
+../../../external/referencesource/System.Runtime.Serialization/System/Runtime/Serialization/Json/JsonFormatWriterGenerator.cs
+../../../external/referencesource/System.Runtime.Serialization/System/Runtime/Serialization/Json/JsonGlobals.cs
+../../../external/referencesource/System.Runtime.Serialization/System/Runtime/Serialization/Json/JsonNodeType.cs
+../../../external/referencesource/System.Runtime.Serialization/System/Runtime/Serialization/Json/JsonObjectDataContract.cs
+../../../external/referencesource/System.Runtime.Serialization/System/Runtime/Serialization/Json/JsonQNameDataContract.cs
+../../../external/referencesource/System.Runtime.Serialization/System/Runtime/Serialization/Json/JsonReaderDelegator.cs
+../../../external/referencesource/System.Runtime.Serialization/System/Runtime/Serialization/Json/JsonReaderWriterFactory.cs
+../../../external/referencesource/System.Runtime.Serialization/System/Runtime/Serialization/Json/JsonStringDataContract.cs
+../../../external/referencesource/System.Runtime.Serialization/System/Runtime/Serialization/Json/JsonUriDataContract.cs
+../../../external/referencesource/System.Runtime.Serialization/System/Runtime/Serialization/Json/JsonWriterDelegator.cs
+../../../external/referencesource/System.Runtime.Serialization/System/Runtime/Serialization/Json/JsonXmlDataContract.cs
+../../../external/referencesource/System.Runtime.Serialization/System/Runtime/Serialization/Json/XmlJsonReader.cs
+../../../external/referencesource/System.Runtime.Serialization/System/Runtime/Serialization/Json/XmlJsonWriter.cs
+../../../external/referencesource/System.Runtime.Serialization/System/Runtime/Serialization/Json/XmlObjectSerializerReadContextComplexJson.cs
+../../../external/referencesource/System.Runtime.Serialization/System/Runtime/Serialization/Json/XmlObjectSerializerWriteContextComplexJson.cs
+../../../external/referencesource/System.Runtime.Serialization/System/Runtime/Serialization/KnownTypeAttribute.cs
+../../../external/referencesource/System.Runtime.Serialization/System/Runtime/Serialization/KnownTypeDataContractResolver.cs
+../../../external/referencesource/System.Runtime.Serialization/System/Runtime/Serialization/NetDataContractSerializer.cs
+../../../external/referencesource/System.Runtime.Serialization/System/Runtime/Serialization/ObjectReferenceStack.cs
+../../../external/referencesource/System.Runtime.Serialization/System/Runtime/Serialization/ObjectToIdCache.cs
+../../../external/referencesource/System.Runtime.Serialization/System/Runtime/Serialization/PrimitiveDataContract.cs
+../../../external/referencesource/System.Runtime.Serialization/System/Runtime/Serialization/ScopedKnownTypes.cs
+../../../external/referencesource/System.Runtime.Serialization/System/Runtime/Serialization/SerializationMode.cs
+../../../external/referencesource/System.Runtime.Serialization/System/Runtime/Serialization/SerializationPermissionNotRequiredAttribute.cs
+../../../external/referencesource/System.Runtime.Serialization/System/Runtime/Serialization/SerializationTrace.cs
+../../../external/referencesource/System.Runtime.Serialization/System/Runtime/Serialization/SpecialTypeDataContract.cs
+../../../external/referencesource/System.Runtime.Serialization/System/Runtime/Serialization/SurrogateDataContract.cs
+../../../external/referencesource/System.Runtime.Serialization/System/Runtime/Serialization/TypeInformation.cs
+../../../external/referencesource/System.Runtime.Serialization/System/Runtime/Serialization/XmlDataContract.cs
+../../../external/referencesource/System.Runtime.Serialization/System/Runtime/Serialization/XmlFormatGeneratorStatics.cs
+../../../external/referencesource/System.Runtime.Serialization/System/Runtime/Serialization/XmlFormatReaderGenerator.cs
+../../../external/referencesource/System.Runtime.Serialization/System/Runtime/Serialization/XmlFormatWriterGenerator.cs
+../../../external/referencesource/System.Runtime.Serialization/System/Runtime/Serialization/XmlObjectSerializerContext.cs
+../../../external/referencesource/System.Runtime.Serialization/System/Runtime/Serialization/XmlObjectSerializer.cs
+../../../external/referencesource/System.Runtime.Serialization/System/Runtime/Serialization/XmlObjectSerializerReadContextComplex.cs
+../../../external/referencesource/System.Runtime.Serialization/System/Runtime/Serialization/XmlObjectSerializerReadContext.cs
+../../../external/referencesource/System.Runtime.Serialization/System/Runtime/Serialization/XmlObjectSerializerWriteContextComplex.cs
+../../../external/referencesource/System.Runtime.Serialization/System/Runtime/Serialization/XmlObjectSerializerWriteContext.cs
+../../../external/referencesource/System.Runtime.Serialization/System/Runtime/Serialization/XmlReaderDelegator.cs
+../../../external/referencesource/System.Runtime.Serialization/System/Runtime/Serialization/XmlSerializableReader.cs
+../../../external/referencesource/System.Runtime.Serialization/System/Runtime/Serialization/XmlSerializableServices.cs
+../../../external/referencesource/System.Runtime.Serialization/System/Runtime/Serialization/XmlSerializableWriter.cs
+../../../external/referencesource/System.Runtime.Serialization/System/Runtime/Serialization/XmlWriterDelegator.cs
+../../../external/referencesource/System.Runtime.Serialization/System/Runtime/Serialization/XPathQueryGenerator.cs
+../../../external/referencesource/System.Runtime.Serialization/System/Text/Base64Encoding.cs
+../../../external/referencesource/System.Runtime.Serialization/System/Text/BinHexEncoding.cs
+../../../external/referencesource/System.Runtime.Serialization/System/Text/SurrogateChar.cs
+../../../external/referencesource/System.Runtime.Serialization/System/Xml/ArrayHelper.cs
+../../../external/referencesource/System.Runtime.Serialization/System/Xml/EncodingStreamWrapper.cs
+../../../external/referencesource/System.Runtime.Serialization/System/Xml/IFragmentCapableXmlDictionaryWriter.cs
+../../../external/referencesource/System.Runtime.Serialization/System/Xml/IStreamProvider.cs
+../../../external/referencesource/System.Runtime.Serialization/System/Xml/IXmlDictionary.cs
+../../../external/referencesource/System.Runtime.Serialization/System/Xml/PrefixHandle.cs
+../../../external/referencesource/System.Runtime.Serialization/System/Xml/StringHandle.cs
+../../../external/referencesource/System.Runtime.Serialization/System/Xml/UniqueID.cs
+../../../external/referencesource/System.Runtime.Serialization/System/Xml/ValueHandle.cs
+../../../external/referencesource/System.Runtime.Serialization/System/Xml/XmlBaseReader.cs
+../../../external/referencesource/System.Runtime.Serialization/System/Xml/XmlBaseWriter.cs
+../../../external/referencesource/System.Runtime.Serialization/System/Xml/XmlBinaryNodeType.cs
+../../../external/referencesource/System.Runtime.Serialization/System/Xml/XmlBinaryReader.cs
+../../../external/referencesource/System.Runtime.Serialization/System/Xml/XmlBinaryReaderSession.cs
+../../../external/referencesource/System.Runtime.Serialization/System/Xml/XmlBinaryWriter.cs
+../../../external/referencesource/System.Runtime.Serialization/System/Xml/XmlBinaryWriterSession.cs
+../../../external/referencesource/System.Runtime.Serialization/System/Xml/XmlBufferReader.cs
+../../../external/referencesource/System.Runtime.Serialization/System/Xml/XmlC14NWriter.cs
+../../../external/referencesource/System.Runtime.Serialization/System/Xml/XmlConverter.cs
+../../../external/referencesource/System.Runtime.Serialization/System/Xml/XmlDelegatedReader.cs
+../../../external/referencesource/System.Runtime.Serialization/System/Xml/XmlDelegatedWriter.cs
+../../../external/referencesource/System.Runtime.Serialization/System/Xml/XmlDictionary.cs
+../../../external/referencesource/System.Runtime.Serialization/System/Xml/XmlDictionaryReader.cs
+../../../external/referencesource/System.Runtime.Serialization/System/Xml/XmlDictionaryReaderQuotas.cs
+../../../external/referencesource/System.Runtime.Serialization/System/Xml/XmlDictionaryString.cs
+../../../external/referencesource/System.Runtime.Serialization/System/Xml/XmlDictionaryWriter.cs
+# ../../../external/referencesource/System.Runtime.Serialization/System/Xml/XmlExceptionHelper.cs
+../../../external/referencesource/System.Runtime.Serialization/System/Xml/XmlMtomReader.cs
+../../../external/referencesource/System.Runtime.Serialization/System/Xml/XmlMtomWriter.cs
+../../../external/referencesource/System.Runtime.Serialization/System/Xml/XmlNodeWriter.cs
+../../../external/referencesource/System.Runtime.Serialization/System/Xml/XmlNodeWriterWriteBase64TextArgs.cs
+../../../external/referencesource/System.Runtime.Serialization/System/Xml/XmlSigningNodeWriter.cs
+../../../external/referencesource/System.Runtime.Serialization/System/Xml/XmlStreamNodeWriter.cs
+../../../external/referencesource/System.Runtime.Serialization/System/Xml/XmlUTF8TextReader.cs
+../../../external/referencesource/System.Runtime.Serialization/System/Xml/XmlUTF8TextWriter.cs
+../../../external/referencesource/System.Runtime.Serialization/System/Xml/XmlWriteBase64AsyncArgs.cs
+../../../external/referencesource/System.Runtime.Serialization/TD.Designer.cs
+
diff --git a/mcs/class/System.Runtime.Serialization/ReferenceSource.desktop.sources b/mcs/class/System.Runtime.Serialization/ReferenceSource.desktop.sources
new file mode 100644 (file)
index 0000000..8cc95f1
--- /dev/null
@@ -0,0 +1,29 @@
+
+#include ReferenceSource.common.sources
+
+../../../external/referencesource/System.Runtime.Serialization/System/Runtime/Serialization/Configuration/ConfigurationStrings.cs
+../../../external/referencesource/System.Runtime.Serialization/System/Runtime/Serialization/Configuration/DataContractSerializerSection.cs
+../../../external/referencesource/System.Runtime.Serialization/System/Runtime/Serialization/Configuration/DeclaredTypeElementCollection.cs
+../../../external/referencesource/System.Runtime.Serialization/System/Runtime/Serialization/Configuration/DeclaredTypeElement.cs
+../../../external/referencesource/System.Runtime.Serialization/System/Runtime/Serialization/Configuration/DeclaredTypeValidatorAttribute.cs
+../../../external/referencesource/System.Runtime.Serialization/System/Runtime/Serialization/Configuration/DeclaredTypeValidator.cs
+../../../external/referencesource/System.Runtime.Serialization/System/Runtime/Serialization/Configuration/NetDataContractSerializerSection.cs
+../../../external/referencesource/System.Runtime.Serialization/System/Runtime/Serialization/Configuration/ParameterElementCollection.cs
+../../../external/referencesource/System.Runtime.Serialization/System/Runtime/Serialization/Configuration/ParameterElement.cs
+../../../external/referencesource/System.Runtime.Serialization/System/Runtime/Serialization/Configuration/Properties.cs
+../../../external/referencesource/System.Runtime.Serialization/System/Runtime/Serialization/Configuration/SerializationSectionGroup.cs
+../../../external/referencesource/System.Runtime.Serialization/System/Runtime/Serialization/Configuration/TypeElementCollection.cs
+../../../external/referencesource/System.Runtime.Serialization/System/Runtime/Serialization/Configuration/TypeElement.cs
+
+../../../external/referencesource/System.Runtime.Serialization/System/Runtime/Serialization/CodeExporter.cs
+../../../external/referencesource/System.Runtime.Serialization/System/Runtime/Serialization/ContractCodeDomInfo.cs
+
+../../../external/referencesource/System.Runtime.Serialization/System/Runtime/Serialization/ExportOptions.cs
+../../../external/referencesource/System.Runtime.Serialization/System/Runtime/Serialization/ImportOptions.cs
+../../../external/referencesource/System.Runtime.Serialization/System/Runtime/Serialization/SchemaExporter.cs
+../../../external/referencesource/System.Runtime.Serialization/System/Runtime/Serialization/SchemaHelper.cs
+../../../external/referencesource/System.Runtime.Serialization/System/Runtime/Serialization/SchemaImporter.cs
+../../../external/referencesource/System.Runtime.Serialization/System/Runtime/Serialization/XsdDataContractExporter.cs
+../../../external/referencesource/System.Runtime.Serialization/System/Runtime/Serialization/XsdDataContractImporter.cs
+
+
diff --git a/mcs/class/System.Runtime.Serialization/ReferenceSources/DiagnosticUtility.cs b/mcs/class/System.Runtime.Serialization/ReferenceSources/DiagnosticUtility.cs
new file mode 100644 (file)
index 0000000..bcde2c4
--- /dev/null
@@ -0,0 +1,61 @@
+using System.Diagnostics;
+
+namespace System.Runtime.Serialization {
+
+       internal static class DiagnosticUtility {
+               internal static bool ShouldTraceError = true;
+               internal static bool ShouldTraceWarning;
+               internal static bool ShouldTraceInformation;
+               internal static bool ShouldTraceVerbose = true;
+
+               internal static class DiagnosticTrace {
+                       internal static void TraceEvent (params object [] args)
+                       {
+                       }
+                       
+               }
+               
+               internal static class ExceptionUtility {
+                       internal static Exception ThrowHelperError (Exception e)
+                       {
+                               return ThrowHelper (e, TraceEventType.Error);
+                       }
+
+                       internal static Exception ThrowHelperCallback (string msg, Exception e)
+                       {
+                               return new CallbackException (msg, e);
+                       }
+
+                       internal static Exception ThrowHelperCallback (Exception e)
+                       {
+                               return new CallbackException ("Callback exception", e);
+                       }
+
+                       internal static Exception ThrowHelper (Exception e, TraceEventType type)
+                       {
+                               return e;
+                       }
+
+                       internal static Exception ThrowHelperArgument (string arg)
+                       {
+                               return new ArgumentException (arg);
+                       }
+
+                       internal static Exception ThrowHelperArgument (string arg, string message)
+                       {
+                               return new ArgumentException (message, arg);
+                       }
+
+                       internal static Exception ThrowHelperArgumentNull (string arg)
+                       {
+                               return new ArgumentNullException (arg);
+                       }
+
+                       internal static Exception ThrowHelperFatal (string msg, Exception e)
+                       {
+                               return new FatalException (msg, e);
+                       }
+               }
+       }
+}
+
diff --git a/mcs/class/System.Runtime.Serialization/ReferenceSources/FxTrace.cs b/mcs/class/System.Runtime.Serialization/ReferenceSources/FxTrace.cs
new file mode 100644 (file)
index 0000000..72e7f97
--- /dev/null
@@ -0,0 +1,36 @@
+//
+// bare-bones based implementation based on the references
+// from the Microsoft reference source code to get things to build
+//
+using System.Runtime;
+using System.Runtime.Diagnostics;
+
+namespace System.Runtime.Serialization {
+       internal static class FxTrace {
+               public static EtwDiagnosticTrace Trace {
+                       get {
+                               return Fx.Trace;
+                       }
+               }
+
+               public static bool ShouldTraceError = true;
+               public static bool ShouldTraceVerbose = true;
+
+               static ExceptionTrace exception;
+               public static ExceptionTrace Exception {
+                       get {
+                               if (exception == null)
+                                       return new ExceptionTrace ("System.Runtime.Serialization", Trace);
+                               return exception;
+                       }
+               }
+
+               public static bool IsEventEnabled (int index)
+               {
+                       return false;
+               }
+
+               public static void UpdateEventDefinitions (EventDescriptor [] ed, ushort [] events) {}
+       }
+}
+
diff --git a/mcs/class/System.Runtime.Serialization/ReferenceSources/SR.cs b/mcs/class/System.Runtime.Serialization/ReferenceSources/SR.cs
new file mode 100644 (file)
index 0000000..ae10d9f
--- /dev/null
@@ -0,0 +1,371 @@
+using System.Globalization;
+
+#region "copy of ../../build/common/SR.cs"
+
+namespace System.Runtime.Serialization
+{
+       static partial class SR 
+       {
+
+        internal static string GetString(string name, params object[] args)
+        {
+                return GetString (CultureInfo.InvariantCulture, name, args);
+        }
+
+        internal static string GetString(CultureInfo culture, string name, params object[] args) {
+                return string.Format (culture, name, args);
+        }
+
+        internal static string GetString(string name)
+        {
+                return name;
+        }
+
+        internal static string GetString(CultureInfo culture, string name)
+        {
+                return name;
+        }
+}
+}
+
+/*
+namespace System.Text
+{
+       static partial class SR
+       {
+        internal static string GetString(string name, params object[] args)
+        {
+                return GetString (CultureInfo.InvariantCulture, name, args);
+        }
+
+        internal static string GetString(CultureInfo culture, string name, params object[] args) {
+                return string.Format (culture, name, args);
+        }
+
+        internal static string GetString(string name)
+        {
+                return name;
+        }
+
+        internal static string GetString(CultureInfo culture, string name)
+        {
+                return name;
+        }
+}
+}
+
+namespace System.Xml
+{
+       static partial class SR
+       {
+        internal static string GetString(string name, params object[] args)
+        {
+                return GetString (CultureInfo.InvariantCulture, name, args);
+        }
+
+        internal static string GetString(CultureInfo culture, string name, params object[] args) {
+                return string.Format (culture, name, args);
+        }
+
+        internal static string GetString(string name)
+        {
+                return name;
+        }
+
+        internal static string GetString(CultureInfo culture, string name)
+        {
+                return name;
+        }
+}
+}
+*/
+#endregion
+
+
+#region "retrieved string resources"
+
+namespace System.Runtime.Serialization
+{
+       static partial class SR {
+
+
+public const string ArrayExceededSize = @"Array length '{0}' provided by the get-only collection of type '{1}' is less than the number of array elements found in the input stream.  Consider increasing the length of the array.";
+public const string ArrayExceededSizeAttribute = @"Array length '{0}' provided by Size attribute is not equal to the number of array elements '{1}' from namespace '{2}' found.";
+public const string ArrayTypeIsNotSupported = @"An internal error has occurred. '{0}[]' is not supported when generating code for serialization.";
+public const string CannotDeserializeRefAtTopLevel = @"Cannot deserialize since root element references unrecognized object with id '{0}'.";
+public const string CannotLoadMemberType = @"Cannot load member type '{0}'.";
+public const string CannotSerializeObjectWithCycles = @"Object graph for type '{0}' contains cycles and cannot be serialized if references are not tracked. Consider using the DataContractAttribute with the IsReference property set to true.";
+public const string CanOnlyStoreIntoArgOrLocGot0 = @"An internal error has occurred. Data can only be stored into ArgBuilder or LocalBuilder. Got: {0}.";
+public const string CharIsInvalidPrimitive = @"An internal error has occurred. Char is not a valid schema primitive and should be treated as int in DataContract.";
+public const string CallbackMustReturnVoid = @"Serialization Callback '{1}' in type '{0}' must return void. ";
+public const string CallbackParameterInvalid = @"Serialization Callback '{1}' in type '{0}' must have a single parameter of type '{2}'. ";
+public const string CallbacksCannotBeVirtualMethods = @"Virtual Method '{0}' of type '{1}' cannot be marked with '{2}' attribute. ";
+public const string CollectionMustHaveAddMethod = @"Collection type '{0}' does not have a valid Add method.";
+public const string CollectionMustHaveGetEnumeratorMethod = @"Collection type '{0}' does not have a valid GetEnumerator method.";
+public const string CollectionMustHaveItemType = @"Collection type '{0}' must have a non-null item type.";
+public const string CollectionTypeCannotBeBuiltIn = @"{0} is a built-in type and cannot be a collection.";
+public const string CollectionTypeCannotHaveDataContract = @"{0} has DataContractAttribute attribute.";
+public const string CollectionTypeDoesNotHaveAddMethod = @"{0} does not have a valid Add method with parameter of type '{1}'.";
+public const string CollectionTypeDoesNotHaveDefaultCtor = @"{0} does not have a default constructor.";
+public const string CollectionTypeHasMultipleDefinitionsOfInterface = @"{0} has multiple definitions of interface '{1}'.";
+public const string CollectionTypeIsNotIEnumerable = @"{0} does not implement IEnumerable interface.";
+public const string DataContractCacheOverflow = @"An internal error has occurred. DataContract cache overflow.";
+public const string DataContractNamespaceAlreadySet = @"ContractNamespaceAttribute attribute maps CLR namespace '{2}' to multiple data contract namespaces '{0}' and '{1}'. You can map a CLR namespace to only one data contract namespace.";
+public const string DataContractNamespaceIsNotValid = @"DataContract namespace '{0}' is not a valid URI.";
+public const string DataContractNamespaceReserved = @"DataContract namespace '{0}' cannot be specified since it is reserved.";
+public const string DataMemberOnEnumField = @"Member '{0}.{1}' has DataMemberAttribute attribute. Use EnumMemberAttribute attribute instead.";
+public const string DcTypeNotFoundOnDeserialize = @"Element '{2}:{3}' contains data of the '{0}:{1}' data contract. The deserializer has no knowledge of any type that maps to this contract. Add the type corresponding to '{1}' to the list of known types - for example, by using the KnownTypeAttribute attribute or by adding it to the list of known types passed to DataContractSerializer.";
+public const string DcTypeNotFoundOnSerialize = @"Type '{0}' with data contract name '{1}:{2}' is not expected. Add any types not known statically to the list of known types - for example, by using the KnownTypeAttribute attribute or by adding them to the list of known types passed to DataContractSerializer.";
+public const string DcTypeNotResolvedOnDeserialize = @"Element '{2}:{3}' contains data from a type that maps to the name '{0}:{1}'. The deserializer has no knowledge of any type that maps to this name. Consider changing the implementation of the ResolveName method on your DataContractResolver to return a non-null value for name '{1}' and namespace '{0}'.";
+public const string DeserializedObjectWithIdNotFound = @"Deserialized object with reference id '{0}' not found in stream.";
+public const string DupContractInKnownTypes = @"Type '{0}' cannot be added to list of known types since another type '{1}' with the same data contract name '{2}:{3}' is already present.";
+public const string DupKeyValueName = @"The collection data contract type '{0}' specifies the same value '{1}' for both the KeyName and the ValueName properties. This is not allowed. Consider changing either the KeyName or the ValueName property.";
+public const string DupEnumMemberValue = @"Type '{2}' contains two members '{0}' 'and '{1}' with the same name '{3}'. Multiple members with the same name in one type are not supported. Consider changing one of the member names using EnumMemberAttribute attribute.";
+public const string DupMemberName = @"Type '{2}' contains two members '{0}' 'and '{1}' with the same data member name '{3}'. Multiple members with the same name in one type are not supported. Consider changing one of the member names using DataMemberAttribute attribute.";
+public const string DuplicateAttribute = @"Invalid Callback. Method '{3}' in type '{2}' has both '{0}' and '{1}'. ";
+public const string DuplicateCallback = @"Invalid attribute. Both '{0}' and '{1}' in type '{2}' have '{3}'. ";
+public const string EncounteredWithNameNamespace = @"{0}. Encountered '{1}'  with name '{2}', namespace '{3}'.";
+public const string EnumTypeCannotHaveIsReference = @"Enum type '{0}' cannot have the IsReference setting of '{1}'. Either change the setting to '{2}', or remove it completely.";
+public const string ErrorDeserializing = @"There was an error deserializing the object {0}. {1}";
+public const string ErrorInLine = @"Error in line {0} position {1}.";
+public const string ErrorIsStartObject = @"There was an error checking start element of object {0}. {1}";
+public const string ErrorSerializing = @"There was an error serializing the object {0}. {1}";
+public const string ErrorTypeInfo = @"of type {0}";
+public const string ErrorWriteEndObject = @"There was an error writing end element of object {0}. {1}";
+public const string ErrorWriteStartObject = @"There was an error writing start element of object {0}. {1}";
+public const string ExceededMaxItemsQuota = @"Maximum number of items that can be serialized or deserialized in an object graph is '{0}'.";
+public const string ExpectingElement = @"Expecting element '{1}' from namespace '{0}'.";
+public const string ExpectingElementAtDeserialize = @"Expecting state '{0}' when ReadObject is called.";
+public const string ExpectingEnd = @"Expecting End'{0}'.";
+public const string ExpectingState = @"Expecting state '{0}'.";
+public const string GenericNameBraceMismatch = @"The data contract name '{0}' for type '{1}' has a curly brace '{{' that is not matched with a closing curly brace. Curly braces have special meaning in data contract names - they are used to customize the naming of data contracts for generic types.";
+public const string GenericParameterNotValid = @"In the data contract name for type '{1}', there are curly braces with '{0}' inside, which is an invalid value. Curly braces have special meaning in data contract names - they are used to customize the naming of data contracts for generic types. Based on the number of generic parameters this type has, the contents of the curly braces must either be a number between 0 and '{2}' to insert the name of the generic parameter at that index or the '#' symbol to insert a digest of the generic parameter namespaces.";
+public const string InconsistentIsReference = @"The IsReference setting for type '{0}' is '{1}', but the same setting for its parent class '{2}' is '{3}'. Derived types must have the same value for IsReference as the base type. Change the setting on type '{0}' to '{3}', or on type '{2}' to '{1}', or do not set IsReference explicitly.";
+public const string IndexedPropertyCannotBeSerialized = @"Property '{1}' in type '{0}' cannot be serialized because serialization of indexed properties is not supported.";
+public const string InterfaceTypeCannotBeCreated = @"Interface type '{0}' cannot be created. Consider replacing with a non-interface serializable type.";
+public const string InvalidCollectionContractItemName = @"Type '{0}' cannot have CollectionDataContractAttribute attribute ItemName set to null or empty string.";
+public const string InvalidCollectionContractKeyName = @"Type '{0}' cannot have CollectionDataContractAttribute attribute KeyName set to null or empty string.";
+public const string InvalidCollectionContractKeyNoDictionary = @"The collection data contract type '{0}' specifies '{1}' for the KeyName property. This is not allowed since the type is not IDictionary. Remove the setting for the KeyName property.";
+public const string InvalidCollectionContractName = @"Type '{0}' cannot have CollectionDataContractAttribute attribute Name set to null or empty string.";
+public const string InvalidCollectionContractNamespace = @"Type '{0}' cannot have CollectionDataContractAttribute attribute Namespace set to null.";
+public const string InvalidCollectionContractValueName = @"Type '{0}' cannot have CollectionDataContractAttribute attribute ValueName set to null or empty string.";
+public const string InvalidCollectionContractValueNoDictionary = @"The collection data contract type '{0}' specifies '{1}' for the ValueName property. This is not allowed since the type is not IDictionary. Remove the setting for the ValueName property.";
+public const string InvalidCollectionDataContract = @"Type '{0}' with CollectionDataContractAttribute attribute is an invalid collection type since it";
+public const string InvalidCollectionType = @"Type '{0}' is an invalid collection type since it";
+public const string InvalidDataContractName = @"Type '{0}' cannot have DataContractAttribute attribute Name set to null or empty string.";
+public const string InvalidDataContractNamespace = @"Type '{0}' cannot have DataContractAttribute attribute Namespace set to null.";
+public const string InvalidDataMemberName = @"Member '{0}' in type '{1}' cannot have DataMemberAttribute attribute Name set to null or empty string.";
+public const string InvalidEnumMemberValue = @"'{0}' in type '{1}' cannot have EnumMemberAttribute attribute Value set to null or empty string.";
+public const string InvalidEnumValueOnRead = @"Invalid enum value '{0}' cannot be deserialized into type '{1}'. Ensure that the necessary enum values are present and are marked with EnumMemberAttribute attribute if the type has DataContractAttribute attribute.";
+public const string InvalidEnumValueOnWrite = @"Enum value '{0}' is invalid for type '{1}' and cannot be serialized. Ensure that the necessary enum values are present and are marked with EnumMemberAttribute attribute if the type has DataContractAttribute attribute.";
+public const string InvalidGetSchemaMethod = @"Type '{0}' cannot have MethodName on XmlSchemaProviderAttribute attribute set to null or empty string. ";
+public const string InvalidGlobalDataContractNamespace = @"CLR namespace '{0}' cannot have ContractNamespace set to null.";
+public const string InvalidMember = @"Member '{0}.{1}' cannot be serialized since it is neither a field nor a property, and therefore cannot be marked with the DataMemberAttribute attribute. Remove the DataMemberAttribute attribute from the '{1}' member.";
+public const string InvalidNonNullReturnValueByIsAny = @"Method '{0}.{1}()' returns a non-null value. The return value must be null since IsAny=true.";
+public const string InvalidPrimitiveType = @"Type '{0}' is not a valid serializable type.";
+public const string InvalidReturnTypeOnGetSchemaMethod = @"Method '{0}.{1}()' returns '{2}'. The return type must be compatible with '{3}'.";
+public const string InvalidSizeDefinition = @"Invalid Size '{0}'. Must be non-negative integer.";
+public const string InvalidXmlDataContractName = @"XML data contract Name for type '{0}' cannot be set to null or empty string.";
+public const string InvalidXsIdDefinition = @"Invalid Id '{0}'. Must not be null or empty.";
+public const string InvalidXsRefDefinition = @"Invalid Ref '{0}'. Must not be null or empty.";
+public const string IsAnyCannotBeNull = @"A null value cannot be serialized at the top level for IXmlSerializable root type '{0}' since its IsAny setting is 'true'. This type must write all its contents including the root element. Verify that the IXmlSerializable implementation is correct.";
+public const string IsAnyCannotBeSerializedAsDerivedType = @"An object of type '{0}' cannot be serialized at the top level for IXmlSerializable root type '{1}' since its IsAny setting is 'true'. This type must write all its contents including the root element. Verify that the IXmlSerializable implementation is correct.";
+public const string IsAnyCannotHaveXmlRoot = @"Type '{0}' cannot specify an XmlRootAttribute attribute because its IsAny setting is 'true'. This type must write all its contents including the root element. Verify that the IXmlSerializable implementation is correct.";
+public const string IsNotAssignableFrom = @"An internal error has occurred. '{0}' is not assignable from '{1}' - error generating code for serialization.";
+public const string IsRequiredDataMemberOnIsReferenceDataContractType = @"'{0}.{1}' has the IsRequired setting of '{2}. However, '{0}' has the IsReference setting of '{2}', because either it is set explicitly, or it is derived from a base class. Set IsRequired on '{0}.{1}' to false, or disable IsReference on '{0}'.";
+public const string IXmlSerializableCannotHaveCollectionDataContract = @"Type '{0}' cannot be IXmlSerializable and have CollectionDataContractAttribute attribute.";
+public const string IXmlSerializableCannotHaveDataContract = @"Type '{0}' cannot be IXmlSerializable and have DataContractAttribute attribute.";
+public const string IXmlSerializableIllegalOperation = @"This method cannot be called from IXmlSerializable implementations.";
+public const string IXmlSerializableMissingEndElements = @"IXmlSerializable.WriteXml method of type '{0}' did not close all open tags. Verify that the IXmlSerializable implementation is correct.";
+public const string IXmlSerializableMustHaveDefaultConstructor = @"IXmlSerializable Type '{0}' must have default constructor.";
+public const string IXmlSerializableWritePastSubTree = @"IXmlSerializable.WriteXml method of type '{0}' attempted to close too many tags.  Verify that the IXmlSerializable implementation is correct.";
+public const string KnownTypeAttributeEmptyString = @"Method name specified by KnownTypeAttribute attribute on type '{0}' cannot be the empty string.";
+public const string KnownTypeAttributeUnknownMethod = @"KnownTypeAttribute attribute on type '{1}' specifies a method named '{0}' to provide known types. Static method '{0}()' was not found on this type. Ensure that the method exists and is marked as static.";
+public const string KnownTypeAttributeReturnType = @"KnownTypeAttribute attribute on type '{0}' specifies a method named '{1}' to provide known types. The return type of this method is invalid because it is not assignable to IEnumerable<Type>. Ensure that the method exists and has a valid signature.";
+public const string KnownTypeAttributeOneScheme = @"Type '{0}': If a KnownTypeAttribute attribute specifies a method it must be the only KnownTypeAttribute attribute on that type.";
+public const string KnownTypeAttributeNoType = @"KnownTypeAttribute attribute on type '{0}' contains no Type.";
+public const string KnownTypeConfigClosedGenericDeclared = @"Declared type '{0}' in config cannot be a closed or partial generic type.";
+public const string KnownTypeAttributeValidMethodTypes = @"Method specified by KnownTypeAttribute attribute on type '{0}' does not expose valid types.";
+public const string KnownTypeAttributeNoData = @"KnownTypeAttribute attribute on type '{0}' contains no data.";
+public const string KnownTypeAttributeMethodNull = @"Method specified by KnownTypeAttribute attribute on type '{0}' returned null.";
+public const string MaxArrayLengthExceeded = @"The maximum array length ({0}) has been exceeded while reading XML data for array of type '{1}'.";
+public const string MissingGetSchemaMethod = @"Type '{0}' does not have a static method '{1}' that takes a parameter of type 'System.Xml.Schema.XmlSchemaSet' as specified by the XmlSchemaProviderAttribute attribute.";
+public const string MultipleIdDefinition = @"Invalid XML encountered. The same Id value '{0}' is defined more than once. Multiple objects cannot be deserialized using the same Id.";
+public const string NoConversionPossibleTo = @"An internal error has occurred. No conversion is possible to '{0}' - error generating code for serialization.";
+public const string NoGetMethodForProperty = @"No get method for property '{1}' in type '{0}'.";
+public const string NoSetMethodForProperty = @"No set method for property '{1}' in type '{0}'.";
+public const string NullKnownType = @"One of the known types provided to the serializer via '{0}' argument was invalid because it was null. All known types specified must be non-null values.";
+public const string NullValueReturnedForGetOnlyCollection = @"The get-only collection of type '{0}' returned a null value.  The input stream contains collection items which cannot be added if the instance is null.  Consider initializing the collection either in the constructor of the the object or in the getter.";
+public const string ObjectTableOverflow = @"An internal error has occurred. Object table overflow. This could be caused by serializing or deserializing extremely large object graphs.";
+public const string OrderCannotBeNegative = @"Property 'Order' in DataMemberAttribute attribute cannot be a negative number.";
+public const string ParameterCountMismatch = @"Invalid number of parameters to call method '{0}'. Expected '{1}' parameters, but '{2}' were provided.";
+public const string PartialTrustCollectionContractAddMethodNotPublic = @"The collection data contract type '{0}' cannot be deserialized because the method '{1}' is not public. Making the method public will fix this error. Alternatively, you can make it internal, and use the InternalsVisibleToAttribute attribute on your assembly in order to enable serialization of internal members - see documentation for more details. Be aware that doing so has certain security implications.";
+public const string PartialTrustCollectionContractNoPublicConstructor = @"The collection data contract type '{0}' cannot be deserialized because it does not have a public parameterless constructor. Adding a public parameterless constructor will fix this error. Alternatively, you can make it internal, and use the InternalsVisibleToAttribute attribute on your assembly in order to enable serialization of internal members - see documentation for more details. Be aware that doing so has certain security implications.";
+public const string PartialTrustCollectionContractTypeNotPublic = @"The collection data contract type '{0}' cannot be deserialized because it does not have a public parameterless constructor. Adding a public parameterless constructor will fix this error. Alternatively, you can make it internal, and use the InternalsVisibleToAttribute attribute on your assembly in order to enable serialization of internal members - see documentation for more details. Be aware that doing so has certain security implications.";
+public const string PartialTrustDataContractOnSerializingNotPublic = @"The data contract type '{0}' cannot be serialized because the OnSerializing method '{1}' is not public. Making the method public will fix this error. Alternatively, you can make it internal, and use the InternalsVisibleToAttribute attribute on your assembly in order to enable serialization of internal members - see documentation for more details. Be aware that doing so has certain security implications.";
+public const string PartialTrustDataContractOnSerializedNotPublic = @"The data contract type '{0}' cannot be serialized because the OnSerialized method '{1}' is not public. Making the method public will fix this error. Alternatively, you can make it internal, and use the InternalsVisibleToAttribute attribute on your assembly in order to enable serialization of internal members - see documentation for more details. Be aware that doing so has certain security implications.";
+public const string PartialTrustDataContractOnDeserializingNotPublic = @"The data contract type '{0}' cannot be deserialized because the OnDeserializing method '{1}' is not public. Making the method public will fix this error. Alternatively, you can make it internal, and use the InternalsVisibleToAttribute attribute on your assembly in order to enable serialization of internal members - see documentation for more details. Be aware that doing so has certain security implications.";
+public const string PartialTrustDataContractOnDeserializedNotPublic = @"The data contract type '{0}' cannot be deserialized because the OnDeserialized method '{1}' is not public. Making the method public will fix this error. Alternatively, you can make it internal, and use the InternalsVisibleToAttribute attribute on your assembly in order to enable serialization of internal members - see documentation for more details. Be aware that doing so has certain security implications.";
+public const string PartialTrustDataContractFieldGetNotPublic = @"The data contract type '{0}' cannot be serialized because the member '{1}' is not public. Making the member public will fix this error. Alternatively, you can make it internal, and use the InternalsVisibleToAttribute attribute on your assembly in order to enable serialization of internal members - see documentation for more details. Be aware that doing so has certain security implications.";
+public const string PartialTrustDataContractFieldSetNotPublic = @"The data contract type '{0}' cannot be deserialized because the member '{1}' is not public. Making the member public will fix this error. Alternatively, you can make it internal, and use the InternalsVisibleToAttribute attribute on your assembly in order to enable serialization of internal members - see documentation for more details. Be aware that doing so has certain security implications.";
+public const string PartialTrustDataContractPropertyGetNotPublic = @"The data contract type '{0}' cannot be serialized because the property '{1}' does not have a public getter. Adding a public getter will fix this error. Alternatively, you can make it internal, and use the InternalsVisibleToAttribute attribute on your assembly in order to enable serialization of internal members - see documentation for more details. Be aware that doing so has certain security implications.";
+public const string PartialTrustDataContractPropertySetNotPublic = @"The data contract type '{0}' cannot be deserialized because the property '{1}' does not have a public setter. Adding a public setter will fix this error. Alternatively, you can make it internal, and use the InternalsVisibleToAttribute attribute on your assembly in order to enable serialization of internal members - see documentation for more details. Be aware that doing so has certain security implications.";
+public const string PartialTrustDataContractTypeNotPublic = @"The data contract type '{0}' is not serializable because it is not public. Making the type public will fix this error. Alternatively, you can make it internal, and use the InternalsVisibleToAttribute attribute on your assembly in order to enable serialization of internal members - see documentation for more details. Be aware that doing so has certain security implications.";
+public const string PartialTrustNonAttributedSerializableTypeNoPublicConstructor = @"The type '{0}' cannot be deserialized because it does not have a public parameterless constructor. Alternatively, you can make it internal, and use the InternalsVisibleToAttribute attribute on your assembly in order to enable serialization of internal members - see documentation for more details. Be aware that doing so has certain security implications.";
+public const string PartialTrustIXmlSerializableTypeNotPublic = @"The IXmlSerializable type '{0}' is not serializable in partial trust because it is not public. Adding a public parameterless constructor will fix this error. Alternatively, you can make it internal, and use the InternalsVisibleToAttribute attribute on your assembly in order to enable serialization of internal members - see documentation for more details. Be aware that doing so has certain security implications.";
+public const string PartialTrustIXmlSerialzableNoPublicConstructor = @"The IXmlSerializable type '{0}' cannot be deserialized because it does not have a public parameterless constructor. Adding a public parameterless constructor will fix this error. Alternatively, you can make it internal, and use the InternalsVisibleToAttribute attribute on your assembly in order to enable serialization of internal members - see documentation for more details. Be aware that doing so has certain security implications.";
+public const string NonAttributedSerializableTypesMustHaveDefaultConstructor = @"The Type '{0}' must have a parameterless constructor.";
+public const string AttributedTypesCannotInheritFromNonAttributedSerializableTypes = @"Type '{0}' cannot inherit from a type that is not marked with DataContractAttribute or SerializableAttribute.  Consider marking the base type '{1}' with DataContractAttribute or SerializableAttribute, or removing them from the derived type.";
+public const string GetOnlyCollectionsNotSupported = @"Get-only collection properties are not supported.  Consider adding a public setter to property '{0}.{1}' or marking the it with the IgnoreDataMemberAttribute. ";
+public const string QuotaMustBePositive = @"Quota must be a positive value.";
+public const string QuotaIsReadOnly = @"The '{0}' quota is readonly.";
+public const string QuotaCopyReadOnly = @"Cannot copy XmlDictionaryReaderQuotas. Target is readonly.";
+public const string RequiredMemberMustBeEmitted = @"Member {0} in type {1} cannot be serialized. This exception is usually caused by trying to use a null value where a null value is not allowed. The '{0}' member is set to its default value (usually null or zero). The member's EmitDefault setting is 'false', indicating that the member should not be serialized. However, the member's IsRequired setting is 'true', indicating that it must be serialized. This conflict cannot be resolved.  Consider setting '{0}' to a non-default value. Alternatively, you can change the EmitDefaultValue property on the DataMemberAttribute attribute to true, or changing the IsRequired property to false.";
+public const string ResolveTypeReturnedFalse = @"An object of type '{0}' which derives from DataContractResolver returned false from its TryResolveType method when attempting to resolve the name for an object of type '{1}', indicating that the resolution failed. Change the TryResolveType implementation to return true.";
+public const string ResolveTypeReturnedNull = @"An object of type '{0}' which derives from DataContractResolver returned a null typeName or typeNamespace but not both from its TryResolveType method when attempting to resolve the name for an object of type '{1}'. Change the TryResolveType implementation to return non-null values, or to return null values for both typeName and typeNamespace in order to serialize as the declared type.";
+public const string SupportForMultidimensionalArraysNotPresent = @"Multi-dimensional arrays are not supported.";
+public const string TooManyCollectionContracts = @"Type '{0}' has more than one CollectionDataContractAttribute attribute.";
+public const string TooManyDataContracts = @"Type '{0}' has more than one DataContractAttribute attribute.";
+public const string TooManyDataMembers = @"Member '{0}.{1}' has more than one DataMemberAttribute attribute.";
+public const string TooManyEnumMembers = @"Member '{0}.{1}' has more than one EnumMemberAttribute attribute.";
+public const string TooManyIgnoreDataMemberAttributes = @"Member '{0}.{1}' has more than one IgnoreDataMemberAttribute attribute.";
+public const string TypeMustBeConcrete = @"Error while getting known types for Type '{0}'. The type must not be an open or partial generic class.";
+public const string TypeNotSerializable = @"Type '{0}' cannot be serialized. Consider marking it with the DataContractAttribute attribute, and marking all of its members you want serialized with the DataMemberAttribute attribute. Alternatively, you can ensure that the type is public and has a parameterless constructor - all public members of the type will then be serialized, and no attributes will be required.";
+public const string UnexpectedContractType = @"An internal error has occurred. Unexpected contract type '{0}' for type '{1}' encountered.";
+public const string UnexpectedElementExpectingElements = @"'{0}' '{1}' from namespace '{2}' is not expected. Expecting element '{3}'.";
+public const string UnexpectedEndOfFile = @"Unexpected end of file.";
+public const string UnknownConstantType = @"Unrecognized constant type '{0}'.";
+public const string UnsupportedIDictionaryAsDataMemberType = @"Cannot deserialize one of the DataMember because it is an IDictionary. Use IDictionary<K,V> instead.";
+public const string ValueMustBeNonNegative = @"The value of this argument must be non-negative.";
+public const string ValueTypeCannotBeNull = @"ValueType '{0}' cannot be null.";
+public const string ValueTypeCannotHaveBaseType = @"Data contract '{0}' from namespace '{1}' is a value type and cannot have base contract '{2}' from namespace '{3}'.";
+public const string ValueTypeCannotHaveId = @"ValueType '{0}' cannot have id.";
+public const string ValueTypeCannotHaveIsReference = @"Value type '{0}' cannot have the IsReference setting of '{1}'. Either change the setting to '{2}', or remove it completely. ";
+public const string ValueTypeCannotHaveRef = @"ValueType '{0}' cannot have ref to another object.";
+public const string XmlElementAttributes = @"Only Element nodes have attributes.";
+public const string XmlForObjectCannotHaveContent = @"Element {0} from namespace {1} cannot have child contents to be deserialized as an object. Please use XElement to deserialize this pattern of XML.";
+public const string XmlInvalidConversion = @"The value '{0}' cannot be parsed as the type '{1}'.";
+public const string XmlInvalidConversionWithoutValue = @"The value cannot be parsed as the type '{0}'.";
+public const string XmlStartElementExpected = @"Start element expected. Found {0}.";
+public const string XmlWriterMustBeInElement = @"WriteState '{0}' not valid. Caller must write start element before serializing in contentOnly mode.";
+
+       }
+}
+
+namespace System.Runtime.Serialization
+{
+       static partial class SR {
+
+public const string OffsetExceedsBufferSize = @"The specified offset exceeds the buffer size ({0} bytes).";
+public const string SizeExceedsRemainingBufferSpace = @"The specified size exceeds the remaining buffer space ({0} bytes).";
+public const string ValueMustBeInRange = @"The value of this argument must fall within the range {0} to {1}.";
+public const string XmlArrayTooSmallOutput = @"Array too small.  Must be able to hold at least {0}.";
+public const string XmlInvalidBase64Length = @"Base64 sequence length ({0}) not valid. Must be a multiple of 4.";
+public const string XmlInvalidBase64Sequence = @"The characters '{0}' at offset {1} are not a valid Base64 sequence.";
+public const string XmlInvalidBinHexLength = @"BinHex sequence length ({0}) not valid. Must be a multiple of 2.";
+public const string XmlInvalidBinHexSequence = @"The characters '{0}' at offset {1} are not a valid BinHex sequence.";
+public const string XmlInvalidHighSurrogate = @"High surrogate char '0x{0}' not valid. High surrogate chars range from 0xD800 to 0xDBFF.";
+public const string XmlInvalidLowSurrogate = @"Low surrogate char '0x{0}' not valid. Low surrogate chars range from 0xDC00 to 0xDFFF.";
+public const string XmlInvalidSurrogate = @"Surrogate char '0x{0}' not valid. Surrogate chars range from 0x10000 to 0x10FFFF.";
+
+       }
+}
+
+namespace System.Runtime.Serialization
+{
+       static partial class SR {
+
+public const string CombinedPrefixNSLength = @"The combined length of the prefix and namespace must not be greater than {0}.";
+public const string InvalidInclusivePrefixListCollection = @"The inclusive namespace prefix collection cannot contain null as one of the items.";
+public const string InvalidLocalNameEmpty = @"The empty string is not a valid local name.";
+public const string XmlArrayTooSmall = @"Array too small.";
+public const string XmlArrayTooSmallInput = @"Array too small.  Length of available data must be at least {0}.";
+public const string XmlBadBOM = @"Unrecognized Byte Order Mark.";
+public const string XmlBase64DataExpected = @"Base64 encoded data expected. Found {0}.";
+public const string XmlCDATAInvalidAtTopLevel = @"CData elements not valid at top level of an XML document.";
+public const string XmlCloseCData = @"']]>' not valid in text node content.";
+public const string XmlConversionOverflow = @"The value '{0}' cannot be represented with the type '{1}'.";
+public const string XmlDeclarationRequired = @"An XML declaration with an encoding is required for all non-UTF8 documents.";
+public const string XmlDeclMissingVersion = @"Version not found in XML declaration.";
+public const string XmlDeclMissing = @"An XML declaration is required for all non-UTF8 documents.";
+public const string XmlDeclNotFirst = @"No characters can appear before the XML declaration.";
+public const string XmlDictionaryStringIDRange = @"XmlDictionaryString IDs must be in the range from {0} to {1}.";
+public const string XmlDictionaryStringIDUndefinedSession = @"XmlDictionaryString ID {0} not defined in the XmlBinaryReaderSession.";
+public const string XmlDictionaryStringIDUndefinedStatic = @"XmlDictionaryString ID {0} not defined in the static dictionary.";
+public const string XmlDuplicateAttribute = @"Duplicate attribute found. Both '{0}' and '{1}' are from the namespace '{2}'.";
+public const string XmlEmptyNamespaceRequiresNullPrefix = @"The empty namespace requires a null or empty prefix.";
+public const string XmlEncodingMismatch = @"The encoding in the declaration '{0}' does not match the encoding of the document '{1}'.";
+public const string XmlEncodingNotSupported = @"XML encoding not supported.";
+public const string XmlEndElementExpected = @"End element '{0}' from namespace '{1}' expected. Found {2}.";
+public const string XmlEndElementNoOpenNodes = @"No corresponding start element is open.";
+public const string XmlExpectedEncoding = @"The expected encoding '{0}' does not match the actual encoding '{1}'.";
+public const string XmlFoundCData = @"cdata '{0}'";
+public const string XmlFoundComment = @"comment '{0}'";
+public const string XmlFoundElement = @"element '{0}' from namespace '{1}'";
+public const string XmlFoundEndElement = @"end element '{0}' from namespace '{1}'";
+public const string XmlFoundEndOfFile = @"end of file";
+public const string XmlFoundNodeType = @"node {0}";
+public const string XmlFoundText = @"text '{0}'";
+public const string XmlFullStartElementExpected = @"Non-empty start element expected. Found {0}.";
+public const string XmlFullStartElementLocalNameNsExpected = @"Non-empty start element '{0}' from namespace '{1}' expected. Found {2}.";
+public const string XmlFullStartElementNameExpected = @"Non-empty start element '{0}' expected. Found {1}.";
+public const string XmlIDDefined = @"ID already defined.";
+public const string XmlKeyAlreadyExists = @"The specified key already exists in the dictionary.";
+public const string XmlIllegalOutsideRoot = @"Text cannot be written outside the root element.";
+public const string XmlInvalidBytes = @"Invalid byte encoding.";
+public const string XmlInvalidCharRef = @"Character reference not valid.";
+public const string XmlInvalidCommentChars = @"XML comments cannot contain '--' or end with '-'.";
+public const string XmlInvalidDeclaration = @"XML declaration can only be written at the beginning of the document.";
+public const string XmlInvalidDepth = @"Cannot call '{0}' while Depth is '{1}'.";
+public const string XmlInvalidEncoding = @"XML encoding must be 'UTF-8'.";
+public const string XmlInvalidFFFE = @"Characters with hexadecimal values 0xFFFE and 0xFFFF are not valid.";
+public const string XmlInvalidFormat = @"The input source is not correctly formatted.";
+public const string XmlInvalidID = @"ID must be >= 0.";
+public const string XmlInvalidOperation = @"The reader cannot be advanced.";
+public const string XmlInvalidPrefixState = @"A prefix cannot be defined while WriteState is '{0}'.";
+public const string XmlInvalidQualifiedName = @"Expected XML qualified name. Found '{0}'.";
+public const string XmlInvalidRootData = @"The data at the root level is invalid.";
+public const string XmlInvalidStandalone = @"'standalone' value in declaration must be 'yes' or 'no'.";
+public const string XmlInvalidStream = @"Stream returned by IStreamProvider cannot be null.";
+public const string XmlInvalidUniqueId = @"UniqueId cannot be zero length.";
+public const string XmlInvalidUTF8Bytes = @"'{0}' contains invalid UTF8 bytes.";
+public const string XmlInvalidVersion = @"XML version must be '1.0'.";
+public const string XmlInvalidWriteState = @"'{0}' cannot be called while WriteState is '{1}'.";
+public const string XmlInvalidXmlByte = @"The byte 0x{0} is not valid at this location.";
+public const string XmlInvalidXmlSpace = @"'{0}' is not a valid xml:space value. Valid values are 'default' and 'preserve'.";
+public const string XmlLineInfo = @"Line {0}, position {1}.";
+public const string XmlMalformedDecl = @"Malformed XML declaration.";
+public const string XmlMaxArrayLengthExceeded = @"The maximum array length quota ({0}) has been exceeded while reading XML data. This quota may be increased by changing the MaxArrayLength property on the XmlDictionaryReaderQuotas object used when creating the XML reader.";
+
+
+public const string XmlMaxNameTableCharCountExceeded = @"The maximum nametable character count quota ({0}) has been exceeded while reading XML data. The nametable is a data structure used to store strings encountered during XML processing - long XML documents with non-repeating element names, attribute names and attribute values may trigger this quota. This quota may be increased by changing the MaxNameTableCharCount property on the XmlDictionaryReaderQuotas object used when creating the XML reader.";
+
+public const string XmlMethodNotSupported = @"This XmlWriter implementation does not support the '{0}' method.";
+public const string XmlMissingLowSurrogate = @"The surrogate pair is invalid. Missing a low surrogate character.";
+public const string XmlMultipleRootElements = @"There are multiple root elements.";
+public const string XmlNamespaceNotFound = @"The namespace '{0}' is not defined.";
+public const string XmlNestedArraysNotSupported = @"Nested arrays are not supported.";
+public const string XmlNoRootElement = @"The document does not have a root element.";
+public const string XmlOnlyOneRoot = @"Only one root element is permitted per document.";
+public const string XmlOnlyWhitespace = @"Only white space characters can be written with this method.";
+public const string XmlOnlySingleValue = @"Only a single typed value may be written inside an attribute or content.";
+public const string XmlPrefixBoundToNamespace = @"The prefix '{0}' is bound to the namespace '{1}' and cannot be changed to '{2}'.";
+public const string XmlProcessingInstructionNotSupported = @"Processing instructions (other than the XML declaration) and DTDs are not supported.";
+public const string XmlReservedPrefix = @"Prefixes beginning with ""xml"" (regardless of casing) are reserved for use by XML.";
+public const string XmlSpaceBetweenAttributes = @"Whitespace must appear between attributes.";
+public const string XmlSpecificBindingNamespace = @"The namespace '{1}' can only be bound to the prefix '{0}'.";
+public const string XmlSpecificBindingPrefix = @"The prefix '{0}' can only be bound to the namespace '{1}'.";
+public const string XmlStartElementLocalNameNsExpected = @"Start element '{0}' from namespace '{1}' expected. Found {2}.";
+public const string XmlStartElementNameExpected = @"Start element '{0}' expected. Found {1}.";
+public const string XmlTagMismatch = @"Start element '{0}' does not match end element '{1}'.";
+public const string XmlTokenExpected = @"The token '{0}' was expected but found '{1}'.";
+public const string XmlUndefinedPrefix = @"The prefix '{0}' is not defined.";
+public const string XmlUnexpectedEndElement = @"No matching start tag for end element.";
+public const string XmlUnexpectedEndOfFile = @"Unexpected end of file. Following elements are not closed: {0}.";
+public const string XmlWriterClosed = @"The XmlWriter is closed.";
+public const string Xml_InvalidNmToken = @"Invalid NmToken value '{0}'.";
+
+       }
+}
+
+#endregion
diff --git a/mcs/class/System.Runtime.Serialization/ReferenceSources/SR_missing.cs b/mcs/class/System.Runtime.Serialization/ReferenceSources/SR_missing.cs
new file mode 100644 (file)
index 0000000..d64d884
--- /dev/null
@@ -0,0 +1,297 @@
+namespace System.Runtime.Serialization
+{
+       static partial class SR
+       {
+
+#region MissingInStrings.txt
+
+//
+// This was retrieved as follows:
+//
+// 1. mcs ReferenceSources/SR.cs -t:library -out:existing.dll
+// 2. mcs {https://raw.githubusercontent.com/mono/mono/wip-serialization-halfway/mcs/class/System.Runtime.Serialization/ReferenceSource/SR.cs} -t:library -out:full.dll
+// 3. csharp -e "System.IO.File.WriteAllLines ("existing.txt", System.Reflection.Assembly.ReflectionOnlyLoadFrom ("existing.dll").GetTypes ().SelectMany (t => t.GetFields ()).Select (f => f.Name).ToArray ())"
+// 4. csharp -e "System.IO.File.WriteAllLines ("full.txt", System.Reflection.Assembly.ReflectionOnlyLoadFrom ("full.dll").GetTypes ().SelectMany (t => t.GetFields ()).Select (f => f.Name).ToArray ())"
+// 5. csharp
+//     var existing = System.IO.File.ReadAllLines ("existing.txt");
+//     var full = System.IO.File.ReadAllLines ("full.txt");
+//  var missing = full.Where (f => !existing.Contains (f));
+//  System.IO.File.WriteAllLines ("missing.cs", missing.Select (m => "public const string " + m + " = @\"" + m + "\";").ToArray ())
+// 6. copy missing.cs contents here.
+//
+
+public const string AbstractElementNotSupported = @"AbstractElementNotSupported";
+public const string AbstractTypeNotSupported = @"AbstractTypeNotSupported";
+public const string AmbiguousReferencedCollectionTypes1 = @"AmbiguousReferencedCollectionTypes1";
+public const string AmbiguousReferencedCollectionTypes3 = @"AmbiguousReferencedCollectionTypes3";
+public const string AmbiguousReferencedTypes1 = @"AmbiguousReferencedTypes1";
+public const string AmbiguousReferencedTypes3 = @"AmbiguousReferencedTypes3";
+public const string AnnotationAttributeNotFound = @"AnnotationAttributeNotFound";
+public const string AnonymousTypeNotSupported = @"AnonymousTypeNotSupported";
+public const string AnyAttributeNotSupported = @"AnyAttributeNotSupported";
+public const string ArrayItemFormMustBe = @"ArrayItemFormMustBe";
+public const string ArraySizeAttributeIncorrect = @"ArraySizeAttributeIncorrect";
+public const string ArraySizeXmlMismatch = @"ArraySizeXmlMismatch";
+public const string ArrayTypeCannotBeImported = @"ArrayTypeCannotBeImported";
+public const string AssemblyNotFound = @"AssemblyNotFound";
+public const string AttributeNotFound = @"AttributeNotFound";
+public const string BaseTypeNotISerializable = @"BaseTypeNotISerializable";
+public const string CannotComputeUniqueName = @"CannotComputeUniqueName";
+public const string CannotDeriveFromSealedReferenceType = @"CannotDeriveFromSealedReferenceType";
+public const string CannotDeserializeForwardedType = @"CannotDeserializeForwardedType";
+public const string CannotExportNullAssembly = @"CannotExportNullAssembly";
+public const string CannotExportNullKnownType = @"CannotExportNullKnownType";
+public const string CannotExportNullType = @"CannotExportNullType";
+public const string CannotHaveDuplicateAttributeNames = @"CannotHaveDuplicateAttributeNames";
+public const string CannotHaveDuplicateElementNames = @"CannotHaveDuplicateElementNames";
+public const string CannotImportInvalidSchemas = @"CannotImportInvalidSchemas";
+public const string CannotImportNullDataContractName = @"CannotImportNullDataContractName";
+public const string CannotImportNullSchema = @"CannotImportNullSchema";
+public const string CannotSetMembersForReferencedType = @"CannotSetMembersForReferencedType";
+public const string CannotSetNamespaceForReferencedType = @"CannotSetNamespaceForReferencedType";
+public const string CannotUseGenericTypeAsBase = @"CannotUseGenericTypeAsBase";
+public const string ChangingFullTypeNameNotSupported = @"ChangingFullTypeNameNotSupported";
+public const string CircularTypeReference = @"CircularTypeReference";
+public const string ClassDataContractReturnedForGetOnlyCollection = @"ClassDataContractReturnedForGetOnlyCollection";
+public const string CLRNamespaceMappedMultipleTimes = @"CLRNamespaceMappedMultipleTimes";
+public const string ClrTypeNotFound = @"ClrTypeNotFound";
+public const string CollectionAssignedToIncompatibleInterface = @"CollectionAssignedToIncompatibleInterface";
+public const string ComplexTypeRestrictionNotSupported = @"ComplexTypeRestrictionNotSupported";
+public const string ConfigDataContractSerializerSectionLoadError = @"ConfigDataContractSerializerSectionLoadError";
+public const string ConfigIndexOutOfRange = @"ConfigIndexOutOfRange";
+public const string ConfigMustOnlyAddParamsWithType = @"ConfigMustOnlyAddParamsWithType";
+public const string ConfigMustOnlySetTypeOrIndex = @"ConfigMustOnlySetTypeOrIndex";
+public const string ConfigMustSetTypeOrIndex = @"ConfigMustSetTypeOrIndex";
+public const string CouldNotReadSerializationSchema = @"CouldNotReadSerializationSchema";
+public const string DefaultOnElementNotSupported = @"DefaultOnElementNotSupported";
+public const string DerivedTypeNotISerializable = @"DerivedTypeNotISerializable";
+public const string DupContractInDataContractSet = @"DupContractInDataContractSet";
+public const string DuplicateExtensionDataSetMethod = @"DuplicateExtensionDataSetMethod";
+public const string DupMemberValue = @"DupMemberValue";
+public const string DupTypeContractInDataContractSet = @"DupTypeContractInDataContractSet";
+public const string ElementMaxOccursMustBe = @"ElementMaxOccursMustBe";
+public const string ElementMinOccursMustBe = @"ElementMinOccursMustBe";
+public const string ElementRefOnLocalElementNotSupported = @"ElementRefOnLocalElementNotSupported";
+public const string EnumEnumerationFacetsMustHaveValue = @"EnumEnumerationFacetsMustHaveValue";
+public const string EnumListInAnonymousTypeNotSupported = @"EnumListInAnonymousTypeNotSupported";
+public const string EnumListMustContainAnonymousType = @"EnumListMustContainAnonymousType";
+public const string EnumOnlyEnumerationFacetsSupported = @"EnumOnlyEnumerationFacetsSupported";
+public const string EnumRestrictionInvalid = @"EnumRestrictionInvalid";
+public const string EnumTypeCannotBeImported = @"EnumTypeCannotBeImported";
+public const string EnumTypeNotSupportedByDataContractJsonSerializer = @"EnumTypeNotSupportedByDataContractJsonSerializer";
+public const string EnumUnionInAnonymousTypeNotSupported = @"EnumUnionInAnonymousTypeNotSupported";
+public const string ExtensionDataSetMustReturnVoid = @"ExtensionDataSetMustReturnVoid";
+public const string ExtensionDataSetParameterInvalid = @"ExtensionDataSetParameterInvalid";
+public const string FactoryObjectContainsSelfReference = @"FactoryObjectContainsSelfReference";
+public const string FactoryTypeNotISerializable = @"FactoryTypeNotISerializable";
+public const string FixedOnElementNotSupported = @"FixedOnElementNotSupported";
+public const string FlushBufferAlreadyInUse = @"FlushBufferAlreadyInUse";
+public const string FormMustBeQualified = @"FormMustBeQualified";
+public const string GenericAnnotationAttributeNotFound = @"GenericAnnotationAttributeNotFound";
+public const string GenericAnnotationForNestedLevelMustBeIncreasing = @"GenericAnnotationForNestedLevelMustBeIncreasing";
+public const string GenericAnnotationHasInvalidAttributeValue = @"GenericAnnotationHasInvalidAttributeValue";
+public const string GenericAnnotationHasInvalidElement = @"GenericAnnotationHasInvalidElement";
+public const string GenericTypeNameMismatch = @"GenericTypeNameMismatch";
+public const string GenericTypeNotExportable = @"GenericTypeNotExportable";
+public const string GetOnlyCollectionMustHaveAddMethod = @"GetOnlyCollectionMustHaveAddMethod";
+public const string GetRealObjectReturnedNull = @"GetRealObjectReturnedNull";
+public const string InvalidAnnotationExpectingText = @"InvalidAnnotationExpectingText";
+public const string InvalidAssemblyFormat = @"InvalidAssemblyFormat";
+public const string InvalidCharacterEncountered = @"InvalidCharacterEncountered";
+public const string InvalidClassDerivation = @"InvalidClassDerivation";
+public const string InvalidClrNameGeneratedForISerializable = @"InvalidClrNameGeneratedForISerializable";
+public const string InvalidClrNamespaceGeneratedForISerializable = @"InvalidClrNamespaceGeneratedForISerializable";
+public const string InvalidDataNode = @"InvalidDataNode";
+public const string InvalidEmitDefaultAnnotation = @"InvalidEmitDefaultAnnotation";
+public const string InvalidEnumBaseType = @"InvalidEnumBaseType";
+public const string InvalidISerializableDerivation = @"InvalidISerializableDerivation";
+public const string InvalidKeyValueType = @"InvalidKeyValueType";
+public const string InvalidKeyValueTypeNamespace = @"InvalidKeyValueTypeNamespace";
+public const string InvalidNodeType = @"InvalidNodeType";
+public const string InvalidReturnSchemaOnGetSchemaMethod = @"InvalidReturnSchemaOnGetSchemaMethod";
+public const string InvalidStateInExtensionDataReader = @"InvalidStateInExtensionDataReader";
+public const string InvalidXmlDeserializingExtensionData = @"InvalidXmlDeserializingExtensionData";
+public const string IsAnyNotSupportedByNetDataContractSerializer = @"IsAnyNotSupportedByNetDataContractSerializer";
+public const string IsDictionaryFormattedIncorrectly = @"IsDictionaryFormattedIncorrectly";
+public const string ISerializableAssemblyNameSetToZero = @"ISerializableAssemblyNameSetToZero";
+public const string ISerializableCannotHaveDataContract = @"ISerializableCannotHaveDataContract";
+public const string ISerializableContainsMoreThanOneItems = @"ISerializableContainsMoreThanOneItems";
+public const string ISerializableDerivedContainsOneOrMoreItems = @"ISerializableDerivedContainsOneOrMoreItems";
+public const string ISerializableDoesNotContainAny = @"ISerializableDoesNotContainAny";
+public const string ISerializableMustRefFactoryTypeAttribute = @"ISerializableMustRefFactoryTypeAttribute";
+public const string ISerializableTypeCannotBeImported = @"ISerializableTypeCannotBeImported";
+public const string ISerializableWildcardMaxOccursMustBe = @"ISerializableWildcardMaxOccursMustBe";
+public const string ISerializableWildcardMinOccursMustBe = @"ISerializableWildcardMinOccursMustBe";
+public const string ISerializableWildcardNamespaceInvalid = @"ISerializableWildcardNamespaceInvalid";
+public const string ISerializableWildcardProcessContentsInvalid = @"ISerializableWildcardProcessContentsInvalid";
+public const string IsReferenceGetOnlyCollectionsNotSupported = @"IsReferenceGetOnlyCollectionsNotSupported";
+public const string IsValueTypeFormattedIncorrectly = @"IsValueTypeFormattedIncorrectly";
+public const string JsonAttributeAlreadyWritten = @"JsonAttributeAlreadyWritten";
+public const string JsonAttributeMustHaveElement = @"JsonAttributeMustHaveElement";
+public const string JsonCannotWriteStandaloneTextAfterQuotedText = @"JsonCannotWriteStandaloneTextAfterQuotedText";
+public const string JsonCannotWriteTextAfterNonTextAttribute = @"JsonCannotWriteTextAfterNonTextAttribute";
+public const string JsonDateTimeOutOfRange = @"JsonDateTimeOutOfRange";
+public const string JsonDuplicateMemberInInput = @"JsonDuplicateMemberInInput";
+public const string JsonDuplicateMemberNames = @"JsonDuplicateMemberNames";
+public const string JsonEncodingNotSupported = @"JsonEncodingNotSupported";
+public const string JsonEncounteredUnexpectedCharacter = @"JsonEncounteredUnexpectedCharacter";
+public const string JsonEndElementNoOpenNodes = @"JsonEndElementNoOpenNodes";
+public const string JsonExpectedEncoding = @"JsonExpectedEncoding";
+public const string JsonInvalidBytes = @"JsonInvalidBytes";
+public const string JsonInvalidDataTypeSpecifiedForServerType = @"JsonInvalidDataTypeSpecifiedForServerType";
+public const string JsonInvalidDateTimeString = @"JsonInvalidDateTimeString";
+public const string JsonInvalidFFFE = @"JsonInvalidFFFE";
+public const string JsonInvalidItemNameForArrayElement = @"JsonInvalidItemNameForArrayElement";
+public const string JsonInvalidLocalNameEmpty = @"JsonInvalidLocalNameEmpty";
+public const string JsonInvalidMethodBetweenStartEndAttribute = @"JsonInvalidMethodBetweenStartEndAttribute";
+public const string JsonInvalidRootElementName = @"JsonInvalidRootElementName";
+public const string JsonInvalidStartElementCall = @"JsonInvalidStartElementCall";
+public const string JsonInvalidWriteState = @"JsonInvalidWriteState";
+public const string JsonMethodNotSupported = @"JsonMethodNotSupported";
+public const string JsonMultipleRootElementsNotAllowedOnWriter = @"JsonMultipleRootElementsNotAllowedOnWriter";
+public const string JsonMustSpecifyDataType = @"JsonMustSpecifyDataType";
+public const string JsonMustUseWriteStringForWritingAttributeValues = @"JsonMustUseWriteStringForWritingAttributeValues";
+public const string JsonNamespaceMustBeEmpty = @"JsonNamespaceMustBeEmpty";
+public const string JsonNestedArraysNotSupported = @"JsonNestedArraysNotSupported";
+public const string JsonNodeTypeArrayOrObjectNotSpecified = @"JsonNodeTypeArrayOrObjectNotSpecified";
+public const string JsonNoMatchingStartAttribute = @"JsonNoMatchingStartAttribute";
+public const string JsonOffsetExceedsBufferSize = @"JsonOffsetExceedsBufferSize";
+public const string JsonOneRequiredMemberNotFound = @"JsonOneRequiredMemberNotFound";
+public const string JsonOnlyWhitespace = @"JsonOnlyWhitespace";
+public const string JsonOpenAttributeMustBeClosedFirst = @"JsonOpenAttributeMustBeClosedFirst";
+public const string JsonPrefixMustBeNullOrEmpty = @"JsonPrefixMustBeNullOrEmpty";
+public const string JsonRequiredMembersNotFound = @"JsonRequiredMembersNotFound";
+public const string JsonServerTypeSpecifiedForInvalidDataType = @"JsonServerTypeSpecifiedForInvalidDataType";
+public const string JsonSizeExceedsRemainingBufferSpace = @"JsonSizeExceedsRemainingBufferSpace";
+public const string JsonTypeNotSupportedByDataContractJsonSerializer = @"JsonTypeNotSupportedByDataContractJsonSerializer";
+public const string JsonUnexpectedAttributeLocalName = @"JsonUnexpectedAttributeLocalName";
+public const string JsonUnexpectedAttributeValue = @"JsonUnexpectedAttributeValue";
+public const string JsonUnexpectedEndOfFile = @"JsonUnexpectedEndOfFile";
+public const string JsonUnsupportedForIsReference = @"JsonUnsupportedForIsReference";
+public const string JsonWriteArrayNotSupported = @"JsonWriteArrayNotSupported";
+public const string JsonWriterClosed = @"JsonWriterClosed";
+public const string JsonXmlInvalidDeclaration = @"JsonXmlInvalidDeclaration";
+public const string JsonXmlProcessingInstructionNotSupported = @"JsonXmlProcessingInstructionNotSupported";
+public const string KeyTypeCannotBeParsedInSimpleDictionary = @"KeyTypeCannotBeParsedInSimpleDictionary";
+public const string KnownTypeConfigGenericParamMismatch = @"KnownTypeConfigGenericParamMismatch";
+public const string KnownTypeConfigIndexOutOfBounds = @"KnownTypeConfigIndexOutOfBounds";
+public const string KnownTypeConfigIndexOutOfBoundsZero = @"KnownTypeConfigIndexOutOfBoundsZero";
+public const string KnownTypeConfigObject = @"KnownTypeConfigObject";
+public const string MaxMimePartsExceeded = @"MaxMimePartsExceeded";
+public const string MimeContentTypeHeaderInvalid = @"MimeContentTypeHeaderInvalid";
+public const string MimeHeaderInvalidCharacter = @"MimeHeaderInvalidCharacter";
+public const string MimeMessageGetContentStreamCalledAlready = @"MimeMessageGetContentStreamCalledAlready";
+public const string MimeReaderHeaderAlreadyExists = @"MimeReaderHeaderAlreadyExists";
+public const string MimeReaderMalformedHeader = @"MimeReaderMalformedHeader";
+public const string MimeReaderResetCalledBeforeEOF = @"MimeReaderResetCalledBeforeEOF";
+public const string MimeReaderTruncated = @"MimeReaderTruncated";
+public const string MimeVersionHeaderInvalid = @"MimeVersionHeaderInvalid";
+public const string MimeWriterInvalidStateForClose = @"MimeWriterInvalidStateForClose";
+public const string MimeWriterInvalidStateForContent = @"MimeWriterInvalidStateForContent";
+public const string MimeWriterInvalidStateForHeader = @"MimeWriterInvalidStateForHeader";
+public const string MimeWriterInvalidStateForStartPart = @"MimeWriterInvalidStateForStartPart";
+public const string MimeWriterInvalidStateForStartPreface = @"MimeWriterInvalidStateForStartPreface";
+public const string MissingSchemaType = @"MissingSchemaType";
+public const string MixedContentNotSupported = @"MixedContentNotSupported";
+public const string MtomBoundaryInvalid = @"MtomBoundaryInvalid";
+public const string MtomBufferQuotaExceeded = @"MtomBufferQuotaExceeded";
+public const string MtomContentTransferEncodingNotPresent = @"MtomContentTransferEncodingNotPresent";
+public const string MtomContentTransferEncodingNotSupported = @"MtomContentTransferEncodingNotSupported";
+public const string MtomContentTypeInvalid = @"MtomContentTypeInvalid";
+public const string MtomDataMustNotContainXopInclude = @"MtomDataMustNotContainXopInclude";
+public const string MtomExceededMaxSizeInBytes = @"MtomExceededMaxSizeInBytes";
+public const string MtomInvalidCIDUri = @"MtomInvalidCIDUri";
+public const string MtomInvalidEmptyURI = @"MtomInvalidEmptyURI";
+public const string MtomInvalidStartUri = @"MtomInvalidStartUri";
+public const string MtomInvalidTransferEncodingForMimePart = @"MtomInvalidTransferEncodingForMimePart";
+public const string MtomMessageContentTypeNotFound = @"MtomMessageContentTypeNotFound";
+public const string MtomMessageInvalidContent = @"MtomMessageInvalidContent";
+public const string MtomMessageInvalidContentInMimePart = @"MtomMessageInvalidContentInMimePart";
+public const string MtomMessageInvalidMimeVersion = @"MtomMessageInvalidMimeVersion";
+public const string MtomMessageNotApplicationXopXml = @"MtomMessageNotApplicationXopXml";
+public const string MtomMessageNotMultipart = @"MtomMessageNotMultipart";
+public const string MtomMessageRequiredParamNotSpecified = @"MtomMessageRequiredParamNotSpecified";
+public const string MtomMimePartReferencedMoreThanOnce = @"MtomMimePartReferencedMoreThanOnce";
+public const string MtomPartNotFound = @"MtomPartNotFound";
+public const string MtomRootContentTypeNotFound = @"MtomRootContentTypeNotFound";
+public const string MtomRootNotApplicationXopXml = @"MtomRootNotApplicationXopXml";
+public const string MtomRootPartNotFound = @"MtomRootPartNotFound";
+public const string MtomRootRequiredParamNotSpecified = @"MtomRootRequiredParamNotSpecified";
+public const string MtomRootUnexpectedCharset = @"MtomRootUnexpectedCharset";
+public const string MtomRootUnexpectedType = @"MtomRootUnexpectedType";
+public const string MtomXopIncludeHrefNotSpecified = @"MtomXopIncludeHrefNotSpecified";
+public const string MtomXopIncludeInvalidXopAttributes = @"MtomXopIncludeInvalidXopAttributes";
+public const string MtomXopIncludeInvalidXopElement = @"MtomXopIncludeInvalidXopElement";
+public const string MustContainOnlyLocalElements = @"MustContainOnlyLocalElements";
+public const string NoAsyncWritePending = @"NoAsyncWritePending";
+public const string NonOptionalFieldMemberOnIsReferenceSerializableType = @"NonOptionalFieldMemberOnIsReferenceSerializableType";
+public const string OnlyDataContractTypesCanHaveExtensionData = @"OnlyDataContractTypesCanHaveExtensionData";
+public const string OutParametersMustBeByRefTypeReceived = @"OutParametersMustBeByRefTypeReceived";
+public const string PartialTrustISerializableNoPublicConstructor = @"PartialTrustISerializableNoPublicConstructor";
+public const string QueryGeneratorPathToMemberNotFound = @"QueryGeneratorPathToMemberNotFound";
+public const string ReadNotSupportedOnStream = @"ReadNotSupportedOnStream";
+public const string ReadOnlyClassDeserialization = @"ReadOnlyClassDeserialization";
+public const string ReadOnlyCollectionDeserialization = @"ReadOnlyCollectionDeserialization";
+public const string RecursiveCollectionType = @"RecursiveCollectionType";
+public const string RedefineNotSupported = @"RedefineNotSupported";
+public const string ReferencedBaseTypeDoesNotExist = @"ReferencedBaseTypeDoesNotExist";
+public const string ReferencedCollectionTypesCannotContainNull = @"ReferencedCollectionTypesCannotContainNull";
+public const string ReferencedTypeDoesNotMatch = @"ReferencedTypeDoesNotMatch";
+public const string ReferencedTypeMatchingMessage = @"ReferencedTypeMatchingMessage";
+public const string ReferencedTypeNotMatchingMessage = @"ReferencedTypeNotMatchingMessage";
+public const string ReferencedTypesCannotContainNull = @"ReferencedTypesCannotContainNull";
+public const string RequiresClassDataContractToSetIsISerializable = @"RequiresClassDataContractToSetIsISerializable";
+public const string RootParticleMustBeSequence = @"RootParticleMustBeSequence";
+public const string RootSequenceMaxOccursMustBe = @"RootSequenceMaxOccursMustBe";
+public const string RootSequenceMustBeRequired = @"RootSequenceMustBeRequired";
+public const string SeekNotSupportedOnStream = @"SeekNotSupportedOnStream";
+public const string SerializationInfo_ConstructorNotFound = @"SerializationInfo_ConstructorNotFound";
+public const string SimpleContentNotSupported = @"SimpleContentNotSupported";
+public const string SimpleTypeRestrictionDoesNotSpecifyBase = @"SimpleTypeRestrictionDoesNotSpecifyBase";
+public const string SimpleTypeUnionNotSupported = @"SimpleTypeUnionNotSupported";
+public const string SpecifiedTypeNotFoundInSchema = @"SpecifiedTypeNotFoundInSchema";
+public const string SubstitutionGroupOnElementNotSupported = @"SubstitutionGroupOnElementNotSupported";
+public const string SurrogatesWithGetOnlyCollectionsNotSupported = @"SurrogatesWithGetOnlyCollectionsNotSupported";
+public const string SurrogatesWithGetOnlyCollectionsNotSupportedSerDeser = @"SurrogatesWithGetOnlyCollectionsNotSupportedSerDeser";
+public const string TopLevelElementRepresentsDifferentType = @"TopLevelElementRepresentsDifferentType";
+public const string TraceCodeElementIgnored = @"TraceCodeElementIgnored";
+public const string TraceCodeFactoryTypeNotFound = @"TraceCodeFactoryTypeNotFound";
+public const string TraceCodeObjectWithLargeDepth = @"TraceCodeObjectWithLargeDepth";
+public const string TraceCodeReadObjectBegin = @"TraceCodeReadObjectBegin";
+public const string TraceCodeReadObjectEnd = @"TraceCodeReadObjectEnd";
+public const string TraceCodeWriteObjectBegin = @"TraceCodeWriteObjectBegin";
+public const string TraceCodeWriteObjectContentBegin = @"TraceCodeWriteObjectContentBegin";
+public const string TraceCodeWriteObjectContentEnd = @"TraceCodeWriteObjectContentEnd";
+public const string TraceCodeWriteObjectEnd = @"TraceCodeWriteObjectEnd";
+public const string TraceCodeXsdExportAnnotationFailed = @"TraceCodeXsdExportAnnotationFailed";
+public const string TraceCodeXsdExportBegin = @"TraceCodeXsdExportBegin";
+public const string TraceCodeXsdExportDupItems = @"TraceCodeXsdExportDupItems";
+public const string TraceCodeXsdExportEnd = @"TraceCodeXsdExportEnd";
+public const string TraceCodeXsdExportError = @"TraceCodeXsdExportError";
+public const string TraceCodeXsdImportAnnotationFailed = @"TraceCodeXsdImportAnnotationFailed";
+public const string TraceCodeXsdImportBegin = @"TraceCodeXsdImportBegin";
+public const string TraceCodeXsdImportEnd = @"TraceCodeXsdImportEnd";
+public const string TraceCodeXsdImportError = @"TraceCodeXsdImportError";
+public const string TypeCannotBeForwardedFrom = @"TypeCannotBeForwardedFrom";
+public const string TypeCannotBeImported = @"TypeCannotBeImported";
+public const string TypeCannotBeImportedHowToFix = @"TypeCannotBeImportedHowToFix";
+public const string TypeHasNotBeenImported = @"TypeHasNotBeenImported";
+public const string TypeMustBeIXmlSerializable = @"TypeMustBeIXmlSerializable";
+public const string TypeMustNotBeOpenGeneric = @"TypeMustNotBeOpenGeneric";
+public const string TypeShouldNotContainAttributes = @"TypeShouldNotContainAttributes";
+public const string UnknownXmlType = @"UnknownXmlType";
+public const string ValueTypeMismatchInSurrogatedType = @"ValueTypeMismatchInSurrogatedType";
+public const string WriteBufferOverflow = @"WriteBufferOverflow";
+public const string WriteNotSupportedOnStream = @"WriteNotSupportedOnStream";
+public const string XmlCanonicalizationNotStarted = @"XmlCanonicalizationNotStarted";
+public const string XmlCanonicalizationStarted = @"XmlCanonicalizationStarted";
+public const string XmlFunctionRequiredNodeType = @"XmlFunctionRequiredNodeType";
+public const string XmlMaxArrayLengthOrMaxItemsQuotaExceeded = @"XmlMaxArrayLengthOrMaxItemsQuotaExceeded";
+public const string XmlMaxBytesPerReadExceeded = @"XmlMaxBytesPerReadExceeded";
+public const string XmlMaxDepthExceeded = @"XmlMaxDepthExceeded";
+public const string XmlMaxStringContentLengthExceeded = @"XmlMaxStringContentLengthExceeded";
+public const string XmlObjectAssignedToIncompatibleInterface = @"XmlObjectAssignedToIncompatibleInterface";
+
+#endregion
+       }
+}
diff --git a/mcs/class/System.Runtime.Serialization/ReferenceSources/SchemaExporter_mobile.cs b/mcs/class/System.Runtime.Serialization/ReferenceSources/SchemaExporter_mobile.cs
new file mode 100644 (file)
index 0000000..aa55440
--- /dev/null
@@ -0,0 +1,223 @@
+
+namespace System.Runtime.Serialization
+{
+       using System;
+       using System.Collections;
+       using System.Collections.Generic;
+       using System.Collections.ObjectModel;
+       using System.Diagnostics;
+       using System.Globalization;
+       using System.IO;
+       using System.Reflection;
+       using System.Runtime.Diagnostics;
+       using System.ServiceModel.Diagnostics;
+       using System.Security;
+       using System.Xml;
+       using System.Xml.Schema;
+       using System.Xml.Serialization;
+       using System.Runtime.Serialization.Diagnostics;
+
+       class SchemaExporter
+       {
+        internal static void GetXmlTypeInfo(Type type, out XmlQualifiedName stableName, out XmlSchemaType xsdType, out bool hasRoot)
+        {
+            if (IsSpecialXmlType(type, out stableName, out xsdType, out hasRoot))
+                return;
+            XmlSchemaSet schemas = new XmlSchemaSet();
+            schemas.XmlResolver = null;
+            InvokeSchemaProviderMethod(type, schemas, out stableName, out xsdType, out hasRoot);
+            if (stableName.Name == null || stableName.Name.Length == 0)
+                throw System.Runtime.Serialization.DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidDataContractException(SR.GetString(SR.InvalidXmlDataContractName, DataContract.GetClrTypeFullName(type))));
+        }
+
+        internal static bool IsSpecialXmlType(Type type, out XmlQualifiedName typeName, out XmlSchemaType xsdType, out bool hasRoot)
+        {
+            xsdType = null;
+            hasRoot = true;
+            if (type == Globals.TypeOfXmlElement || type == Globals.TypeOfXmlNodeArray)
+            {
+                string name = null;
+                if (type == Globals.TypeOfXmlElement)
+                {
+                    xsdType = CreateAnyElementType();
+                    name = "XmlElement";
+                    hasRoot = false;
+                }
+                else
+                {
+                    xsdType = CreateAnyType();
+                    name = "ArrayOfXmlNode";
+                    hasRoot = true;
+                }
+                typeName = new XmlQualifiedName(name, DataContract.GetDefaultStableNamespace(type));
+                return true;
+            }
+            typeName = null;
+            return false;
+        }
+
+        static bool InvokeSchemaProviderMethod(Type clrType, XmlSchemaSet schemas, out XmlQualifiedName stableName, out XmlSchemaType xsdType, out bool hasRoot)
+        {
+            xsdType = null;
+            hasRoot = true;
+            object[] attrs = clrType.GetCustomAttributes(Globals.TypeOfXmlSchemaProviderAttribute, false);
+            if (attrs == null || attrs.Length == 0)
+            {
+                stableName = DataContract.GetDefaultStableName(clrType);
+                return false;
+            }
+
+            XmlSchemaProviderAttribute provider = (XmlSchemaProviderAttribute)attrs[0];
+            if (provider.IsAny)
+            {
+                xsdType = CreateAnyElementType();
+                hasRoot = false;
+            }
+            string methodName = provider.MethodName;
+            if (methodName == null || methodName.Length == 0)
+            {
+                if (!provider.IsAny)
+                    throw System.Runtime.Serialization.DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidDataContractException(SR.GetString(SR.InvalidGetSchemaMethod, DataContract.GetClrTypeFullName(clrType))));
+                stableName = DataContract.GetDefaultStableName(clrType);
+            }
+            else
+            {
+                MethodInfo getMethod = clrType.GetMethod(methodName,  /*BindingFlags.DeclaredOnly |*/ BindingFlags.Static | BindingFlags.NonPublic | BindingFlags.Public, null, new Type[] { typeof(XmlSchemaSet) }, null);
+                if (getMethod == null)
+                    throw System.Runtime.Serialization.DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidDataContractException(SR.GetString(SR.MissingGetSchemaMethod, DataContract.GetClrTypeFullName(clrType), methodName)));
+
+                if (!(Globals.TypeOfXmlQualifiedName.IsAssignableFrom(getMethod.ReturnType)) && !(Globals.TypeOfXmlSchemaType.IsAssignableFrom(getMethod.ReturnType)))
+                    throw System.Runtime.Serialization.DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidDataContractException(SR.GetString(SR.InvalidReturnTypeOnGetSchemaMethod, DataContract.GetClrTypeFullName(clrType), methodName, DataContract.GetClrTypeFullName(getMethod.ReturnType), DataContract.GetClrTypeFullName(Globals.TypeOfXmlQualifiedName), typeof(XmlSchemaType))));
+
+                object typeInfo = getMethod.Invoke(null, new object[] { schemas });
+
+                if (provider.IsAny)
+                {
+                    if (typeInfo != null)
+                        throw System.Runtime.Serialization.DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidDataContractException(SR.GetString(SR.InvalidNonNullReturnValueByIsAny, DataContract.GetClrTypeFullName(clrType), methodName)));
+                    stableName = DataContract.GetDefaultStableName(clrType);
+                }
+                else if (typeInfo == null)
+                {
+                    xsdType = CreateAnyElementType();
+                    hasRoot = false;
+                    stableName = DataContract.GetDefaultStableName(clrType);
+                }
+                else
+                {
+                    XmlSchemaType providerXsdType = typeInfo as XmlSchemaType;
+                    if (providerXsdType != null)
+                    {
+                        string typeName = providerXsdType.Name;
+                        string typeNs = null;
+                        if (typeName == null || typeName.Length == 0)
+                        {
+                            DataContract.GetDefaultStableName(DataContract.GetClrTypeFullName(clrType), out typeName, out typeNs);
+                            stableName = new XmlQualifiedName(typeName, typeNs);
+                            providerXsdType.Annotation = GetSchemaAnnotation(ExportActualType(stableName, new XmlDocument()));
+                            xsdType = providerXsdType;
+                        }
+                        else
+                        {
+                            foreach (XmlSchema schema in schemas.Schemas())
+                            {
+                                foreach (XmlSchemaObject schemaItem in schema.Items)
+                                {
+                                    if ((object)schemaItem == (object)providerXsdType)
+                                    {
+                                        typeNs = schema.TargetNamespace;
+                                        if (typeNs == null)
+                                            typeNs = String.Empty;
+                                        break;
+                                    }
+                                }
+                                if (typeNs != null)
+                                    break;
+                            }
+                            if (typeNs == null)
+                                throw System.Runtime.Serialization.DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidDataContractException(SR.GetString(SR.MissingSchemaType, typeName, DataContract.GetClrTypeFullName(clrType))));
+                            stableName = new XmlQualifiedName(typeName, typeNs);
+                        }
+                    }
+                    else
+                        stableName = (XmlQualifiedName)typeInfo;
+                }
+            }
+            return true;
+        }
+
+        static XmlSchemaComplexType CreateAnyElementType()
+        {
+            XmlSchemaComplexType anyElementType = new XmlSchemaComplexType();
+            anyElementType.IsMixed = false;
+            anyElementType.Particle = new XmlSchemaSequence();
+            XmlSchemaAny any = new XmlSchemaAny();
+            any.MinOccurs = 0;
+            any.ProcessContents = XmlSchemaContentProcessing.Lax;
+            ((XmlSchemaSequence)anyElementType.Particle).Items.Add(any);
+            return anyElementType;
+        }
+
+        static XmlSchemaAnnotation GetSchemaAnnotation(params XmlNode[] nodes)
+        {
+            if (nodes == null || nodes.Length == 0)
+                return null;
+            bool hasAnnotation = false;
+            for (int i = 0; i < nodes.Length; i++)
+                if (nodes[i] != null)
+                {
+                    hasAnnotation = true;
+                    break;
+                }
+            if (!hasAnnotation)
+                return null;
+
+            XmlSchemaAnnotation annotation = new XmlSchemaAnnotation();
+            XmlSchemaAppInfo appInfo = new XmlSchemaAppInfo();
+            annotation.Items.Add(appInfo);
+            appInfo.Markup = nodes;
+            return annotation;
+        }
+
+        static XmlSchemaComplexType CreateAnyType()
+        {
+            XmlSchemaComplexType anyType = new XmlSchemaComplexType();
+            anyType.IsMixed = true;
+            anyType.Particle = new XmlSchemaSequence();
+            XmlSchemaAny any = new XmlSchemaAny();
+            any.MinOccurs = 0;
+            any.MaxOccurs = Decimal.MaxValue;
+            any.ProcessContents = XmlSchemaContentProcessing.Lax;
+            ((XmlSchemaSequence)anyType.Particle).Items.Add(any);
+            anyType.AnyAttribute = new XmlSchemaAnyAttribute();
+            return anyType;
+        }
+
+        static XmlElement ExportActualType(XmlQualifiedName typeName, XmlDocument xmlDoc)
+        {
+            XmlElement actualTypeElement = xmlDoc.CreateElement(ActualTypeAnnotationName.Name, ActualTypeAnnotationName.Namespace);
+
+            XmlAttribute nameAttribute = xmlDoc.CreateAttribute(Globals.ActualTypeNameAttribute);
+            nameAttribute.Value = typeName.Name;
+            actualTypeElement.Attributes.Append(nameAttribute);
+
+            XmlAttribute nsAttribute = xmlDoc.CreateAttribute(Globals.ActualTypeNamespaceAttribute);
+            nsAttribute.Value = typeName.Namespace;
+            actualTypeElement.Attributes.Append(nsAttribute);
+
+            return actualTypeElement;
+        }
+
+        static XmlQualifiedName actualTypeAnnotationName;
+        internal static XmlQualifiedName ActualTypeAnnotationName
+        {
+            get
+            {
+                if (actualTypeAnnotationName == null)
+                    actualTypeAnnotationName = new XmlQualifiedName(Globals.ActualTypeLocalName, Globals.SerializationNamespace);
+                return actualTypeAnnotationName;
+            }
+        }
+       }
+}
+
diff --git a/mcs/class/System.Runtime.Serialization/ReferenceSources/SimplifiedCodeTypeReference.cs b/mcs/class/System.Runtime.Serialization/ReferenceSources/SimplifiedCodeTypeReference.cs
new file mode 100644 (file)
index 0000000..6fdb45d
--- /dev/null
@@ -0,0 +1,398 @@
+// This is a revised source code from CodeDom.
+
+//------------------------------------------------------------------------------
+// <copyright file="CodeTypeReference.cs" company="Microsoft">
+// 
+// <OWNER>[....]</OWNER>
+//     Copyright (c) Microsoft Corporation.  All rights reserved.
+// </copyright>                                                                
+//------------------------------------------------------------------------------
+
+namespace System.Runtime.Serialization {
+
+    using System.Diagnostics;
+    using System;
+    using Microsoft.Win32;
+    using System.Collections;
+    using System.Collections.Generic;
+    using System.Runtime.InteropServices;
+    using System.Runtime.Serialization;
+    using System.Globalization;
+    
+    enum CodeTypeReferenceOptions {
+        GlobalReference =  0x00000001,
+        GenericTypeParameter = 0x00000002
+    }
+
+    class CodeTypeReference {
+        private string baseType;
+        [OptionalField] 
+        private bool isInterface;
+        private int arrayRank;
+        private CodeTypeReference arrayElementType;
+        [OptionalField] 
+        private List<CodeTypeReference> typeArguments;
+        [OptionalField]
+        private CodeTypeReferenceOptions referenceOptions;
+        [OptionalField]
+        private bool needsFixup = false;
+        
+        public CodeTypeReference() {
+            baseType = string.Empty;
+            this.arrayRank = 0;
+            this.arrayElementType = null;            
+        }
+
+        public CodeTypeReference(Type type) {
+            if (type == null)
+                throw new ArgumentNullException("type");
+            
+            if (type.IsArray) {
+                this.arrayRank = type.GetArrayRank();
+                this.arrayElementType = new CodeTypeReference(type.GetElementType());
+                this.baseType = null;
+            } else {
+                InitializeFromType(type);
+                this.arrayRank = 0;
+                this.arrayElementType = null;
+            }
+
+            this.isInterface = type.IsInterface;
+        }
+
+        public CodeTypeReference (Type type, CodeTypeReferenceOptions codeTypeReferenceOption) : this(type) {
+            referenceOptions = codeTypeReferenceOption;
+        }
+        
+        public CodeTypeReference (String typeName, CodeTypeReferenceOptions codeTypeReferenceOption) {
+            Initialize(typeName, codeTypeReferenceOption);
+        }
+
+        /// <devdoc>
+        ///    <para>[To be supplied.]</para>
+        /// </devdoc>
+
+        // We support the reflection format for generice type name.
+        // The format is like:
+        //
+        public CodeTypeReference(string typeName) {
+            Initialize(typeName);
+        }
+
+        private void InitializeFromType(Type type) {
+            baseType = type.Name;
+            if (!type.IsGenericParameter) {
+                Type currentType = type;
+                while (currentType.IsNested) {
+                    currentType = currentType.DeclaringType;
+                    baseType = currentType.Name + "+" + baseType;
+                }
+                if (!String.IsNullOrEmpty(type.Namespace))
+                    baseType = type.Namespace + "." + baseType;
+            }
+
+            // pick up the type arguments from an instantiated generic type but not an open one    
+            if (type.IsGenericType && !type.ContainsGenericParameters) {
+                Type[] genericArgs = type.GetGenericArguments();
+                for (int i = 0; i < genericArgs.Length; i++) {
+                    TypeArguments.Add(new CodeTypeReference(genericArgs[i]));
+                }
+            }
+            else if (!type.IsGenericTypeDefinition) 
+            {
+                // if the user handed us a non-generic type, but later
+                // appends generic type arguments, we'll pretend
+                // it's a generic type for their sake - this is good for
+                // them if they pass in System.Nullable class when they
+                // meant the System.Nullable<T> value type.
+                needsFixup = true;
+            }
+        }
+
+        private void Initialize(string typeName) {
+            Initialize(typeName, this.referenceOptions);
+        }
+
+        private void Initialize(string typeName, CodeTypeReferenceOptions options)
+        {
+            Options = options;
+            if (typeName == null || typeName.Length == 0) {
+                typeName = typeof(void).FullName;            
+                this.baseType = typeName;
+                this.arrayRank = 0;
+                this.arrayElementType = null;
+                return;                
+            }
+
+            typeName = RipOffAssemblyInformationFromTypeName(typeName);
+            
+            int end = typeName.Length -1;
+            int current = end;
+            needsFixup = true;      // default to true, and if we find arity or generic type args, we'll clear the flag.
+            
+            // Scan the entire string for valid array tails and store ranks for array tails
+            // we found in a queue.
+            Queue q = new Queue();
+            while(current >= 0) {
+                int rank = 1;
+                if( typeName[current--] == ']') {
+                    while(current >=0 && typeName[current] == ',') {
+                        rank++;
+                        current--;
+                    }
+
+                    if( current>=0 && typeName[current] == '[') { // found a valid array tail
+                        q.Enqueue(rank); 
+                        current--;   
+                        end = current; 
+                        continue;
+                    }
+                }
+                break;
+            }
+            
+            // Try find generic type arguments
+            current = end;
+            ArrayList typeArgumentList = new ArrayList();
+            Stack subTypeNames = new Stack();
+            if( current > 0 && typeName[current--] == ']') {
+                needsFixup = false;
+                int unmatchedRightBrackets = 1;
+                int subTypeNameEndIndex = end;
+                
+                // Try find the matching '[', if we can't find it, we will not try to parse the string
+                while(current >= 0) {
+                    if( typeName[current] == '[' ) {      
+                        // break if we found matched brackets
+                        if( --unmatchedRightBrackets == 0) break;
+                    }
+                    else if( typeName[current] == ']' ) {                   
+                        ++unmatchedRightBrackets;
+                    }
+                    else if( typeName[current] == ',' && unmatchedRightBrackets == 1) {
+                        //
+                        // Type name can contain nested generic types. Following is an example:
+                        // System.Collections.Generic.Dictionary`2[[System.String, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089], 
+                        //          [System.Collections.Generic.List`1[[System.Int32, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]], 
+                        //           mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]
+                        // 
+                        // Spliltting by ',' won't work. We need to do first-level split by ','. 
+                        //
+                        if( current + 1 < subTypeNameEndIndex) {
+                            subTypeNames.Push(typeName.Substring(current+1 , subTypeNameEndIndex - current - 1));                            
+                        }
+
+                        subTypeNameEndIndex = current;
+                        
+                    }    
+                    --current;
+                }
+            
+                if( current > 0 && (end - current - 1) > 0) { 
+                    // push the last generic type argument name if there is any
+                    if( current + 1 < subTypeNameEndIndex) {
+                        subTypeNames.Push(typeName.Substring(current+1 , subTypeNameEndIndex - current - 1));                                                    
+                    }
+                        
+                    // we found matched brackets and the brackets contains some characters.                    
+                    while( subTypeNames.Count > 0) {
+                        String name = RipOffAssemblyInformationFromTypeName((string)subTypeNames.Pop());                         
+                        typeArgumentList.Add(new CodeTypeReference(name));
+                    }
+                    end = current - 1;
+                }
+            }
+
+            if( end < 0) {  // this can happen if we have some string like "[...]"
+                this.baseType = typeName;
+                return;
+            }
+
+            if (q.Count > 0 ) {             
+                
+                CodeTypeReference type = new CodeTypeReference(typeName.Substring(0, end + 1), Options);
+
+                for(int i = 0; i < typeArgumentList.Count; i++) {
+                    type.TypeArguments.Add((CodeTypeReference)typeArgumentList[i]);
+                }
+
+                while( q.Count > 1) {
+                    type = new CodeTypeReference( type, (int)q.Dequeue());  
+                } 
+                
+                // we don't need to create a new CodeTypeReference for the last one.
+                Debug.Assert(q.Count == 1 , "We should have one and only one in the rank queue.");                                
+                this.baseType = null;
+                this.arrayRank = (int)q.Dequeue();
+                this.arrayElementType = type;
+            }
+            else if( typeArgumentList.Count > 0 ) {
+                for( int i = 0; i < typeArgumentList.Count; i++) {
+                    TypeArguments.Add((CodeTypeReference)typeArgumentList[i]);
+                }
+
+                this.baseType = typeName.Substring(0, end + 1);
+            }
+            else{
+                this.baseType = typeName;
+            }
+
+            // Now see if we have some arity.  baseType could be null if this is an array type. 
+            if (baseType != null && baseType.IndexOf('`') != -1)
+                needsFixup = false;
+            
+        }
+
+        public CodeTypeReference(string typeName, params CodeTypeReference[] typeArguments) : this(typeName){
+            if( typeArguments != null && typeArguments.Length > 0) {
+                TypeArguments.AddRange(typeArguments);
+            }
+        }
+
+        /// <devdoc>
+        ///    <para>[To be supplied.]</para>
+        /// </devdoc>
+        public CodeTypeReference(string baseType, int rank) {
+            this.baseType = null;
+            this.arrayRank = rank;
+            this.arrayElementType = new CodeTypeReference(baseType);
+        }
+
+        /// <devdoc>
+        ///    <para>[To be supplied.]</para>
+        /// </devdoc>
+        public CodeTypeReference(CodeTypeReference arrayType, int rank) {
+            this.baseType = null;
+            this.arrayRank = rank;
+            this.arrayElementType = arrayType;
+        }
+        /// <devdoc>
+        ///    <para>[To be supplied.]</para>
+        /// </devdoc>
+        public CodeTypeReference ArrayElementType {
+            get {
+                return arrayElementType;
+            }
+            set {
+                arrayElementType = value;
+            }
+        }
+
+        /// <devdoc>
+        ///    <para>[To be supplied.]</para>
+        /// </devdoc>
+        public int ArrayRank {
+            get {
+                return arrayRank;
+            }
+            set {
+                arrayRank = value;
+            }
+        }
+
+        internal int NestedArrayDepth {
+            get {
+                
+                if (arrayElementType == null)
+                    return 0;
+
+                return 1 + arrayElementType.NestedArrayDepth;
+            }
+        }
+
+        /// <devdoc>
+        ///    <para>[To be supplied.]</para>
+        /// </devdoc>
+        public string BaseType {
+            get {
+                if (arrayRank > 0 && arrayElementType != null) {
+                    return arrayElementType.BaseType;
+                }
+                if (String.IsNullOrEmpty(baseType)) 
+                    return string.Empty;
+                
+                string returnType = baseType;
+                if (needsFixup && TypeArguments.Count > 0)
+                    returnType = returnType + '`' + TypeArguments.Count.ToString(CultureInfo.InvariantCulture);
+
+                return returnType;
+                
+            }
+            set {
+                baseType = value;
+                Initialize(baseType);
+            }
+        }
+
+        [System.Runtime.InteropServices.ComVisible(false)]
+        public CodeTypeReferenceOptions Options {
+            get { return referenceOptions;}
+            set { referenceOptions = value;}            
+        }
+
+        [System.Runtime.InteropServices.ComVisible(false)]        
+        public List<CodeTypeReference> TypeArguments{ 
+            get {
+                if (arrayRank > 0 && arrayElementType != null) {
+                    return arrayElementType.TypeArguments;
+                }
+
+                if( typeArguments == null) {
+                    typeArguments = new List<CodeTypeReference>();
+                }
+                return typeArguments;
+            }
+        }
+
+        internal bool IsInterface {
+            get {
+                // Note that this only works correctly if the Type ctor was used. Otherwise, it's always false.
+                return this.isInterface;
+            }
+        }
+
+        //
+        // The string for generic type argument might contain assembly information and square bracket pair.
+        // There might be leading spaces in front the type name.
+        // Following function will rip off assembly information and brackets 
+        // Following is an example:
+        // " [System.Collections.Generic.List[[System.String, mscorlib, Version=2.0.0.0, Culture=neutral,
+        //   PublicKeyToken=b77a5c561934e089]], mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]"
+        //
+        private string RipOffAssemblyInformationFromTypeName(string typeName) {
+            int start = 0;
+            int end = typeName.Length - 1;
+            string result = typeName;
+            
+            // skip white space in the beginning
+            while( start < typeName.Length && Char.IsWhiteSpace(typeName[start])) start++;
+            while( end >= 0 && Char.IsWhiteSpace(typeName[end])) end--;
+                    
+            if(start < end) {
+                if (typeName[start] =='[' && typeName[end] == ']') {  
+                    start++;
+                    end--;
+                }
+
+                // if we still have a ] at the end, there's no assembly info. 
+                if (typeName[end] != ']') {
+                    int commaCount = 0;                            
+                    for(int index = end; index >= start; index--) {
+                        if( typeName[index] == ',') {
+                            commaCount++;
+                            if( commaCount == 4) {
+                                result = typeName.Substring( start, index - start); 
+                                break;
+                            }
+                        }
+                    }
+                }
+            }
+
+            return result;
+        }
+    }
+}
+    
+
diff --git a/mcs/class/System.Runtime.Serialization/ReferenceSources/XmlExceptionHelper.cs b/mcs/class/System.Runtime.Serialization/ReferenceSources/XmlExceptionHelper.cs
new file mode 100644 (file)
index 0000000..f088bf5
--- /dev/null
@@ -0,0 +1,288 @@
+//------------------------------------------------------------
+// Copyright (c) Microsoft Corporation.  All rights reserved.
+//------------------------------------------------------------
+using System.Runtime.Serialization;
+////using System.ServiceModel.Channels;
+using System.Globalization;
+using System.Runtime.Serialization.Diagnostics.Application;
+
+using SR_ = System.Runtime.Serialization.SR;
+
+namespace System.Xml
+{
+    static class XmlExceptionHelper
+    {
+        static void ThrowXmlException(XmlDictionaryReader reader, string res)
+        {
+            ThrowXmlException(reader, res, null);
+        }
+
+        static void ThrowXmlException(XmlDictionaryReader reader, string res, string arg1)
+        {
+            ThrowXmlException(reader, res, arg1, null);
+        }
+
+        static void ThrowXmlException(XmlDictionaryReader reader, string res, string arg1, string arg2)
+        {
+            ThrowXmlException(reader, res, arg1, arg2, null);
+        }
+
+        static void ThrowXmlException(XmlDictionaryReader reader, string res, string arg1, string arg2, string arg3)
+        {
+            string s = SR_.GetString(res, arg1, arg2, arg3);
+            IXmlLineInfo lineInfo = reader as IXmlLineInfo;
+            if (lineInfo != null && lineInfo.HasLineInfo())
+            {
+                s += " " + SR_.GetString(SR_.XmlLineInfo, lineInfo.LineNumber, lineInfo.LinePosition);
+            }
+
+            if (TD.ReaderQuotaExceededIsEnabled())
+            {
+                TD.ReaderQuotaExceeded(s);
+            }
+
+            throw System.Runtime.Serialization.DiagnosticUtility.ExceptionUtility.ThrowHelperError(new XmlException(s));
+        }
+
+        static public void ThrowXmlException(XmlDictionaryReader reader, XmlException exception)
+        {
+            string s = exception.Message;
+            IXmlLineInfo lineInfo = reader as IXmlLineInfo;
+            if (lineInfo != null && lineInfo.HasLineInfo())
+            {
+                s += " " + SR_.GetString(SR_.XmlLineInfo, lineInfo.LineNumber, lineInfo.LinePosition);
+            }
+            throw System.Runtime.Serialization.DiagnosticUtility.ExceptionUtility.ThrowHelperError(new XmlException(s));
+        }
+
+        static string GetName(string prefix, string localName)
+        {
+            if (prefix.Length == 0)
+                return localName;
+            else
+                return string.Concat(prefix, ":", localName);
+        }
+
+        static string GetWhatWasFound(XmlDictionaryReader reader)
+        {
+            if (reader.EOF)
+                return SR_.GetString(SR_.XmlFoundEndOfFile);
+            switch (reader.NodeType)
+            {
+                case XmlNodeType.Element:
+                    return SR_.GetString(SR_.XmlFoundElement, GetName(reader.Prefix, reader.LocalName), reader.NamespaceURI);
+                case XmlNodeType.EndElement:
+                    return SR_.GetString(SR_.XmlFoundEndElement, GetName(reader.Prefix, reader.LocalName), reader.NamespaceURI);
+                case XmlNodeType.Text:
+                case XmlNodeType.Whitespace:
+                case XmlNodeType.SignificantWhitespace:
+                    return SR_.GetString(SR_.XmlFoundText, reader.Value);
+                case XmlNodeType.Comment:
+                    return SR_.GetString(SR_.XmlFoundComment, reader.Value);
+                case XmlNodeType.CDATA:
+                    return SR_.GetString(SR_.XmlFoundCData, reader.Value);
+            }
+            return SR_.GetString(SR_.XmlFoundNodeType, reader.NodeType);
+        }
+
+        static public void ThrowStartElementExpected(XmlDictionaryReader reader)
+        {
+            ThrowXmlException(reader, SR_.XmlStartElementExpected, GetWhatWasFound(reader));
+        }
+
+        static public void ThrowStartElementExpected(XmlDictionaryReader reader, string name)
+        {
+            ThrowXmlException(reader, SR_.XmlStartElementNameExpected, name, GetWhatWasFound(reader));
+        }
+
+        static public void ThrowStartElementExpected(XmlDictionaryReader reader, string localName, string ns)
+        {
+            ThrowXmlException(reader, SR_.XmlStartElementLocalNameNsExpected, localName, ns, GetWhatWasFound(reader));
+        }
+
+        static public void ThrowStartElementExpected(XmlDictionaryReader reader, XmlDictionaryString localName, XmlDictionaryString ns)
+        {
+            ThrowStartElementExpected(reader, XmlDictionaryString.GetString(localName), XmlDictionaryString.GetString(ns));
+        }
+
+        static public void ThrowFullStartElementExpected(XmlDictionaryReader reader)
+        {
+            ThrowXmlException(reader, SR_.XmlFullStartElementExpected, GetWhatWasFound(reader));
+        }
+
+        static public void ThrowFullStartElementExpected(XmlDictionaryReader reader, string name)
+        {
+            ThrowXmlException(reader, SR_.XmlFullStartElementNameExpected, name, GetWhatWasFound(reader));
+        }
+
+        static public void ThrowFullStartElementExpected(XmlDictionaryReader reader, string localName, string ns)
+        {
+            ThrowXmlException(reader, SR_.XmlFullStartElementLocalNameNsExpected, localName, ns, GetWhatWasFound(reader));
+        }
+
+        static public void ThrowFullStartElementExpected(XmlDictionaryReader reader, XmlDictionaryString localName, XmlDictionaryString ns)
+        {
+            ThrowFullStartElementExpected(reader, XmlDictionaryString.GetString(localName), XmlDictionaryString.GetString(ns));
+        }
+
+        static public void ThrowEndElementExpected(XmlDictionaryReader reader, string localName, string ns)
+        {
+            ThrowXmlException(reader, SR_.XmlEndElementExpected, localName, ns, GetWhatWasFound(reader));
+        }
+
+        static public void ThrowMaxStringContentLengthExceeded(XmlDictionaryReader reader, int maxStringContentLength)
+        {
+            ThrowXmlException(reader, SR_.XmlMaxStringContentLengthExceeded, maxStringContentLength.ToString(NumberFormatInfo.CurrentInfo));
+        }
+
+        static public void ThrowMaxArrayLengthExceeded(XmlDictionaryReader reader, int maxArrayLength)
+        {
+            ThrowXmlException(reader, SR_.XmlMaxArrayLengthExceeded, maxArrayLength.ToString(NumberFormatInfo.CurrentInfo));
+        }
+
+        static public void ThrowMaxArrayLengthOrMaxItemsQuotaExceeded(XmlDictionaryReader reader, int maxQuota)
+        {
+            ThrowXmlException(reader, SR_.XmlMaxArrayLengthOrMaxItemsQuotaExceeded, maxQuota.ToString(NumberFormatInfo.CurrentInfo));
+        }
+
+        static public void ThrowMaxDepthExceeded(XmlDictionaryReader reader, int maxDepth)
+        {
+            ThrowXmlException(reader, SR_.XmlMaxDepthExceeded, maxDepth.ToString(NumberFormatInfo.CurrentInfo));
+        }
+
+        static public void ThrowMaxBytesPerReadExceeded(XmlDictionaryReader reader, int maxBytesPerRead)
+        {
+            ThrowXmlException(reader, SR_.XmlMaxBytesPerReadExceeded, maxBytesPerRead.ToString(NumberFormatInfo.CurrentInfo));
+        }
+
+        static public void ThrowMaxNameTableCharCountExceeded(XmlDictionaryReader reader, int maxNameTableCharCount)
+        {
+            ThrowXmlException(reader, SR_.XmlMaxNameTableCharCountExceeded, maxNameTableCharCount.ToString(NumberFormatInfo.CurrentInfo));
+        }
+
+        static public void ThrowBase64DataExpected(XmlDictionaryReader reader)
+        {
+            ThrowXmlException(reader, SR_.XmlBase64DataExpected, GetWhatWasFound(reader));
+        }
+
+        static public void ThrowUndefinedPrefix(XmlDictionaryReader reader, string prefix)
+        {
+            ThrowXmlException(reader, SR_.XmlUndefinedPrefix, prefix);
+        }
+
+        static public void ThrowProcessingInstructionNotSupported(XmlDictionaryReader reader)
+        {
+            ThrowXmlException(reader, SR_.XmlProcessingInstructionNotSupported);
+        }
+
+        static public void ThrowInvalidXml(XmlDictionaryReader reader, byte b)
+        {
+            ThrowXmlException(reader, SR_.XmlInvalidXmlByte, b.ToString("X2", CultureInfo.InvariantCulture));
+        }
+
+        static public void ThrowUnexpectedEndOfFile(XmlDictionaryReader reader)
+        {
+            ThrowXmlException(reader, SR_.XmlUnexpectedEndOfFile, ((XmlBaseReader)reader).GetOpenElements());
+        }
+
+        static public void ThrowUnexpectedEndElement(XmlDictionaryReader reader)
+        {
+            ThrowXmlException(reader, SR_.XmlUnexpectedEndElement);
+        }
+
+        static public void ThrowTokenExpected(XmlDictionaryReader reader, string expected, char found)
+        {
+            ThrowXmlException(reader, SR_.XmlTokenExpected, expected, found.ToString());
+        }
+
+        static public void ThrowTokenExpected(XmlDictionaryReader reader, string expected, string found)
+        {
+            ThrowXmlException(reader, SR_.XmlTokenExpected, expected, found);
+        }
+
+        static public void ThrowInvalidCharRef(XmlDictionaryReader reader)
+        {
+            ThrowXmlException(reader, SR_.XmlInvalidCharRef);
+        }
+
+        static public void ThrowTagMismatch(XmlDictionaryReader reader, string expectedPrefix, string expectedLocalName, string foundPrefix, string foundLocalName)
+        {
+            ThrowXmlException(reader, SR_.XmlTagMismatch, GetName(expectedPrefix, expectedLocalName), GetName(foundPrefix, foundLocalName));
+        }
+
+        static public void ThrowDuplicateXmlnsAttribute(XmlDictionaryReader reader, string localName, string ns)
+        {
+            string name;
+            if (localName.Length == 0)
+                name = "xmlns";
+            else
+                name = "xmlns:" + localName;
+            ThrowXmlException(reader, SR_.XmlDuplicateAttribute, name, name, ns);
+        }
+
+        static public void ThrowDuplicateAttribute(XmlDictionaryReader reader, string prefix1, string prefix2, string localName, string ns)
+        {
+            ThrowXmlException(reader, SR_.XmlDuplicateAttribute, GetName(prefix1, localName), GetName(prefix2, localName), ns);
+        }
+
+        static public void ThrowInvalidBinaryFormat(XmlDictionaryReader reader)
+        {
+            ThrowXmlException(reader, SR_.XmlInvalidFormat);
+        }
+
+        static public void ThrowInvalidRootData(XmlDictionaryReader reader)
+        {
+            ThrowXmlException(reader, SR_.XmlInvalidRootData);
+        }
+
+        static public void ThrowMultipleRootElements(XmlDictionaryReader reader)
+        {
+            ThrowXmlException(reader, SR_.XmlMultipleRootElements);
+        }
+
+        static public void ThrowDeclarationNotFirst(XmlDictionaryReader reader)
+        {
+            ThrowXmlException(reader, SR_.XmlDeclNotFirst);
+        }
+
+        static public void ThrowConversionOverflow(XmlDictionaryReader reader, string value, string type)
+        {
+            ThrowXmlException(reader, SR_.XmlConversionOverflow, value, type);
+        }
+
+        static public void ThrowXmlDictionaryStringIDOutOfRange(XmlDictionaryReader reader)
+        {
+            ThrowXmlException(reader, SR_.XmlDictionaryStringIDRange, XmlDictionaryString.MinKey.ToString(NumberFormatInfo.CurrentInfo), XmlDictionaryString.MaxKey.ToString(NumberFormatInfo.CurrentInfo));
+        }
+
+        static public void ThrowXmlDictionaryStringIDUndefinedStatic(XmlDictionaryReader reader, int key)
+        {
+            ThrowXmlException(reader, SR_.XmlDictionaryStringIDUndefinedStatic, key.ToString(NumberFormatInfo.CurrentInfo));
+        }
+
+        static public void ThrowXmlDictionaryStringIDUndefinedSession(XmlDictionaryReader reader, int key)
+        {
+            ThrowXmlException(reader, SR_.XmlDictionaryStringIDUndefinedSession, key.ToString(NumberFormatInfo.CurrentInfo));
+        }
+
+        static public void ThrowEmptyNamespace(XmlDictionaryReader reader)
+        {
+            ThrowXmlException(reader, SR_.XmlEmptyNamespaceRequiresNullPrefix);
+        }
+
+        static public XmlException CreateConversionException(string value, string type, Exception exception)
+        {
+            return new XmlException(SR_.GetString(SR_.XmlInvalidConversion, value, type), exception);
+        }
+
+        static public XmlException CreateEncodingException(byte[] buffer, int offset, int count, Exception exception)
+        {
+            return CreateEncodingException(new System.Text.UTF8Encoding(false, false).GetString(buffer, offset, count), exception);
+        }
+
+        static public XmlException CreateEncodingException(string value, Exception exception)
+        {
+            return new XmlException(SR_.GetString(SR_.XmlInvalidUTF8Bytes, value), exception);
+        }
+    }
+}
index 580a0bb94822a89956f89accac7352ed969b4394..1ff345362c7c62518f161a589af5bec11cb0536d 100644 (file)
@@ -2,66 +2,11 @@
 ../../build/common/Locale.cs
 ../../build/common/MonoTODOAttribute.cs
 Assembly/AssemblyInfo.cs
-System.Runtime.Serialization.Configuration/DataContractSerializerSection.cs
-System.Runtime.Serialization.Configuration/DeclaredTypeElement.cs
-System.Runtime.Serialization.Configuration/DeclaredTypeElementCollection.cs
-System.Runtime.Serialization.Configuration/ParameterElement.cs
-System.Runtime.Serialization.Configuration/ParameterElementCollection.cs
-System.Runtime.Serialization.Configuration/SerializationSectionGroup.cs
-System.Runtime.Serialization.Configuration/TypeElement.cs
-System.Runtime.Serialization.Configuration/TypeElementCollection.cs
-../../../external/referencesource/System.Runtime.Serialization/System/Runtime/Serialization/CollectionDataContractAttribute.cs
-../../../external/referencesource/System.Runtime.Serialization/System/Runtime/Serialization/ContractNamespaceAttribute.cs
-../../../external/referencesource/System.Runtime.Serialization/System/Runtime/Serialization/DataContractAttribute.cs
-System.Runtime.Serialization/DataContractResolver.cs
-System.Runtime.Serialization/DataContractSerializer.cs
-System.Runtime.Serialization/DataMemberAttribute.cs
-System.Runtime.Serialization/EnumMemberAttribute.cs
-System.Runtime.Serialization/ExportOptions.cs
-System.Runtime.Serialization/ExtensionDataObject.cs
-System.Runtime.Serialization/IDataContractSurrogate.cs
-System.Runtime.Serialization/IExtensibleDataObject.cs
-System.Runtime.Serialization/IgnoreDataMemberAttribute.cs
-System.Runtime.Serialization/ImportOptions.cs
-System.Runtime.Serialization/InvalidDataContractException.cs
-System.Runtime.Serialization/KnownTypeAttribute.cs
-System.Runtime.Serialization/KnownTypeCollection.cs
-System.Runtime.Serialization/NetDataContractSerializer.cs
-System.Runtime.Serialization/SerializationMap.cs
-System.Runtime.Serialization/SerializationMap.XsdExporter.cs
-System.Runtime.Serialization/XmlFormatterDeserializer.cs
-System.Runtime.Serialization/XmlFormatterSerializer.cs
-System.Runtime.Serialization/XmlObjectSerializer.cs
-System.Runtime.Serialization/XmlSerializableServices.cs
-System.Runtime.Serialization/XsdDataContractExporter.cs
-System.Runtime.Serialization/XsdDataContractImporter.cs
-System.Xml/IFragmentCapableXmlDictionaryWriter.cs
-System.Xml/IStreamProvider.cs
-System.Xml/IXmlBinaryReaderInitializer.cs
-System.Xml/IXmlBinaryWriterInitializer.cs
-System.Xml/IXmlDictionary.cs
-System.Xml/IXmlMtomReaderInitializer.cs
-System.Xml/IXmlMtomWriterInitializer.cs
-System.Xml/IXmlUTF8ReaderInitializer.cs
-System.Xml/IXmlUTF8WriterInitializer.cs
-System.Xml/OnXmlDictionaryReaderClose.cs
-System.Xml/UniqueId.cs
-System.Xml/XmlBinaryDictionaryReader.cs
-System.Xml/XmlBinaryDictionaryWriter.cs
-System.Xml/XmlBinaryDictionaryWriterAutoGen.cs
-System.Xml/XmlBinaryFormat.cs
-System.Xml/XmlBinaryReaderSession.cs
-System.Xml/XmlBinaryWriterSession.cs
-System.Xml/XmlC14NWriter.cs
-System.Xml/XmlCanonicalWriter.cs
-System.Xml/XmlDictionary.cs
-System.Xml/XmlDictionaryReader.cs
-System.Xml/XmlDictionaryReaderAutoGen.cs
-System.Xml/XmlDictionaryReaderQuotas.cs
-System.Xml/XmlDictionaryString.cs
-System.Xml/XmlDictionaryWriter.cs
-System.Xml/XmlDictionaryWriterAutoGen.cs
-System.Xml/XmlMtomDictionaryReader.cs
-System.Xml/XmlMtomDictionaryWriter.cs
-System.Xml/XmlSimpleDictionaryReader.cs
-System.Xml/XmlSimpleDictionaryWriter.cs
+
+ReferenceSources/DiagnosticUtility.cs
+ReferenceSources/FxTrace.cs
+ReferenceSources/SR.cs
+ReferenceSources/SR_missing.cs
+ReferenceSources/XmlExceptionHelper.cs
+
+
index 3946206a0bf0d9fcce0ceb38e65f0eff62039ec5..c0c73b07ad060fd22023aa3448912020fa0071df 100644 (file)
@@ -1,63 +1,5 @@
-Assembly/AssemblyInfo.cs
-../System.ServiceModel.Web/System.Runtime.Serialization.Json/DataContractJsonSerializer.cs
-../System.ServiceModel.Web/System.Runtime.Serialization.Json/DataContractJsonSerializerSettings.cs
-../System.ServiceModel.Web/System.Runtime.Serialization.Json/IXmlJsonReaderInitializer.cs
-../System.ServiceModel.Web/System.Runtime.Serialization.Json/IXmlJsonWriterInitializer.cs
-../System.ServiceModel.Web/System.Runtime.Serialization.Json/JavaScriptReader.cs
-../System.ServiceModel.Web/System.Runtime.Serialization.Json/JsonReader.cs
-../System.ServiceModel.Web/System.Runtime.Serialization.Json/JsonReaderWriterFactory.cs
-../System.ServiceModel.Web/System.Runtime.Serialization.Json/JsonSerializationReader.cs
-../System.ServiceModel.Web/System.Runtime.Serialization.Json/JsonSerializationWriter.cs
-../System.ServiceModel.Web/System.Runtime.Serialization.Json/JsonWriter.cs
-../System.ServiceModel.Web/System.Runtime.Serialization.Json/TypeMap.cs
-../../../external/referencesource/System.Runtime.Serialization/System/Runtime/Serialization/CollectionDataContractAttribute.cs
-../../../external/referencesource/System.Runtime.Serialization/System/Runtime/Serialization/ContractNamespaceAttribute.cs
-../../../external/referencesource/System.Runtime.Serialization/System/Runtime/Serialization/DataContractAttribute.cs
-System.Runtime.Serialization/DataContractResolver.cs
-System.Runtime.Serialization/DataContractSerializer.cs
-System.Runtime.Serialization/DataContractSerializerSettings.cs
-System.Runtime.Serialization/DataMemberAttribute.cs
-System.Runtime.Serialization/DateTimeFormat.cs
-System.Runtime.Serialization/EmitTypeInformation.cs
-System.Runtime.Serialization/EnumMemberAttribute.cs
-System.Runtime.Serialization/ExportOptions.cs
-System.Runtime.Serialization/ExtensionDataObject.cs
-System.Runtime.Serialization/IDataContractSurrogate.cs
-System.Runtime.Serialization/IExtensibleDataObject.cs
-System.Runtime.Serialization/IgnoreDataMemberAttribute.cs
-System.Runtime.Serialization/InvalidDataContractException.cs
-System.Runtime.Serialization/KnownTypeAttribute.cs
-System.Runtime.Serialization/KnownTypeCollection.cs
-System.Runtime.Serialization/NetDataContractSerializer.cs
-System.Runtime.Serialization/SerializationMap.cs
-System.Runtime.Serialization/XmlFormatterDeserializer.cs
-System.Runtime.Serialization/XmlFormatterSerializer.cs
-System.Runtime.Serialization/XmlObjectSerializer.cs
-System.Xml/IStreamProvider.cs
-System.Xml/IXmlBinaryReaderInitializer.cs
-System.Xml/IXmlBinaryWriterInitializer.cs
-System.Xml/IXmlDictionary.cs
-System.Xml/IXmlMtomReaderInitializer.cs
-System.Xml/IXmlMtomWriterInitializer.cs
-System.Xml/IXmlUTF8ReaderInitializer.cs
-System.Xml/IXmlUTF8WriterInitializer.cs
-System.Xml/OnXmlDictionaryReaderClose.cs
-System.Xml/UniqueId.cs
-System.Xml/XmlBinaryDictionaryReader.cs
-System.Xml/XmlBinaryDictionaryWriter.cs
-System.Xml/XmlBinaryDictionaryWriterAutoGen.cs
-System.Xml/XmlBinaryFormat.cs
-System.Xml/XmlBinaryReaderSession.cs
-System.Xml/XmlBinaryWriterSession.cs
-System.Xml/XmlC14NWriter.cs
-System.Xml/XmlCanonicalWriter.cs
-System.Xml/XmlDictionary.cs
-System.Xml/XmlDictionaryReader.cs
-System.Xml/XmlDictionaryReaderAutoGen.cs
-System.Xml/XmlDictionaryReaderQuotas.cs
-System.Xml/XmlDictionaryString.cs
-System.Xml/XmlDictionaryWriter.cs
-System.Xml/XmlDictionaryWriterAutoGen.cs
-System.Xml/XmlSimpleDictionaryReader.cs
-System.Xml/XmlSimpleDictionaryWriter.cs
-System.Xml/OnXmlDictionaryReaderClose.cs
+#include System.Runtime.Serialization.dll.sources
+#include ReferenceSource.common.sources
+
+ReferenceSources/SchemaExporter_mobile.cs
+ReferenceSources/SimplifiedCodeTypeReference.cs
index be9e8242268f4e377083e0fac77b3e4da22d1ccc..a26b31febb036df6edf76204afba107eee1426f4 100644 (file)
@@ -1,5 +1,3 @@
-#include net_4_0_System.Runtime.Serialization.dll.sources
-System.Runtime.Serialization/DateTimeFormat.cs
-System.Runtime.Serialization/EmitTypeInformation.cs
-../System.ServiceModel.Web/System.Runtime.Serialization.Json/DataContractJsonSerializerSettings.cs
-System.Runtime.Serialization/DataContractSerializerSettings.cs
+#include System.Runtime.Serialization.dll.sources
+#include ReferenceSource.common.sources
+#include ReferenceSource.desktop.sources