Merge pull request #1573 from akoeplinger/msbuild-import-empty
authorMarek Safar <marek.safar@gmail.com>
Sat, 21 Feb 2015 12:22:01 +0000 (13:22 +0100)
committerMarek Safar <marek.safar@gmail.com>
Sat, 21 Feb 2015 12:22:01 +0000 (13:22 +0100)
[Microsoft.Build.Engine] Ignore import with empty project attribute when condition is false

160 files changed:
.gitignore
configure.ac
external/ikdasm
external/ikvm
external/referencesource
mcs/build/library.make
mcs/build/rules.make
mcs/class/I18N/CJK/CP932.cs
mcs/class/I18N/Common/DefaultEncoder.cs [new file with mode: 0644]
mcs/class/I18N/Common/I18N.dll.sources
mcs/class/I18N/Common/MonoEncoding.cs
mcs/class/Microsoft.Build.Tasks/Microsoft.Build.Tasks/Copy.cs
mcs/class/Microsoft.Build.Tasks/Test/Microsoft.Build.Tasks/CopyTest.cs
mcs/class/System.ComponentModel.DataAnnotations/Makefile
mcs/class/System.Configuration/System.Configuration/ConfigurationSectionCollection.cs
mcs/class/System.Core/Makefile
mcs/class/System.Data.Entity/Makefile
mcs/class/System.Data/Makefile
mcs/class/System.Data/System.Data/XmlSchemaDataImporter.cs
mcs/class/System.Data/Test/System.Data/DataSetReadXmlTest.cs
mcs/class/System.Numerics/Makefile
mcs/class/System.Runtime.Serialization/Makefile
mcs/class/System.Runtime.Serialization/System.Xml/XmlDictionaryWriter.cs
mcs/class/System.Runtime.Serialization/System.Xml/XmlMtomDictionaryWriter.cs
mcs/class/System.Runtime.Serialization/Test/System.Xml/XmlMtomDictionaryWriterTest.cs
mcs/class/System.Runtime.Serialization/resources/mstypes.schema
mcs/class/System.Security/Test/System.Security.Cryptography.Xml/XmlDsigXsltTransformTest.cs
mcs/class/System.ServiceModel.Web/System.ServiceModel.Syndication/Atom10FeedFormatter.cs
mcs/class/System.ServiceModel.Web/System.ServiceModel.Syndication/Atom10ItemFormatter.cs
mcs/class/System.ServiceModel.Web/System/UriTemplate.cs
mcs/class/System.ServiceModel.Web/Test/System/UriTemplateTest.cs
mcs/class/System.ServiceModel/System.ServiceModel.Channels/Message.cs
mcs/class/System.ServiceModel/System.ServiceModel.Channels/ReplyChannelBase.cs
mcs/class/System.ServiceModel/System.ServiceModel.Description/CustomPolicyConversionContext.cs
mcs/class/System.ServiceModel/System.ServiceModel.Description/MetadataSectionSerializerBase.cs
mcs/class/System.ServiceModel/System.ServiceModel.Dispatcher/BaseRequestProcessor.cs
mcs/class/System.ServiceModel/System.ServiceModel.Dispatcher/ChannelDispatcher.cs
mcs/class/System.ServiceModel/Test/System.ServiceModel.Security/WSSecurityTokenSerializerTest.cs
mcs/class/System.Web/Test/System.Web.UI.WebControls/WizardTest.cs
mcs/class/System.XML/System.Xml.Serialization/XmlSchemaImporter.cs
mcs/class/System.XML/System.Xml.Serialization/XmlSerializationReader.cs
mcs/class/System.Xaml/System.Xaml/XamlWriterInternalBase.cs
mcs/class/System.Xaml/System.Xaml/XamlXmlWriter.cs
mcs/class/System.Xml.Linq/System.Xml.Schema/Extensions.cs
mcs/class/System/Makefile
mcs/class/System/System.Configuration/CustomizableFileSettingsProvider.cs
mcs/class/System/System.IO.Compression/GZipStream.cs
mcs/class/System/Test/System.Configuration/ApplicationSettingsBaseTest.cs
mcs/class/WindowsBase/System.Windows/Vector.cs
mcs/class/corlib/Makefile
mcs/class/corlib/ReferenceSources/AppDomain.cs
mcs/class/corlib/ReferenceSources/BCLDebug.cs
mcs/class/corlib/ReferenceSources/CompatibilitySwitches.cs
mcs/class/corlib/ReferenceSources/EncodingDataItem.cs [new file with mode: 0644]
mcs/class/corlib/ReferenceSources/EncodingTable.cs [new file with mode: 0644]
mcs/class/corlib/ReferenceSources/Environment.cs
mcs/class/corlib/ReferenceSources/__ConsoleStream.cs [new file with mode: 0644]
mcs/class/corlib/ReferenceSources/mscorlib.txt.cs [deleted file]
mcs/class/corlib/System.IO/BinaryReader.cs
mcs/class/corlib/System.IO/BinaryWriter.cs
mcs/class/corlib/System.IO/BufferedStream.cs [deleted file]
mcs/class/corlib/System.IO/File.cs
mcs/class/corlib/System.IO/FileStream.cs
mcs/class/corlib/System.IO/MemoryStream.cs [deleted file]
mcs/class/corlib/System.IO/Path.cs
mcs/class/corlib/System.IO/Stream.cs [deleted file]
mcs/class/corlib/System.IO/StreamReader.cs [deleted file]
mcs/class/corlib/System.IO/StreamWriter.cs [deleted file]
mcs/class/corlib/System.IO/StringReader.cs [deleted file]
mcs/class/corlib/System.IO/StringWriter.cs [deleted file]
mcs/class/corlib/System.IO/TextReader.cs [deleted file]
mcs/class/corlib/System.IO/TextWriter.cs [deleted file]
mcs/class/corlib/System.IO/UnexceptionalStreamWriter.cs
mcs/class/corlib/System.IO/UnmanagedMemoryStream.cs
mcs/class/corlib/System.Reflection/Assembly.cs
mcs/class/corlib/System.Resources/ResourceReader.cs
mcs/class/corlib/System.Security.Permissions/FileIOPermission.cs
mcs/class/corlib/System.Text/EncodingHelper.cs [new file with mode: 0644]
mcs/class/corlib/System.Text/Latin1Encoding.cs
mcs/class/corlib/System/Buffer.cs
mcs/class/corlib/System/CStreamWriter.cs
mcs/class/corlib/System/Console.cs
mcs/class/corlib/System/String.cs
mcs/class/corlib/System/TermInfoDriver.cs
mcs/class/corlib/Test/System.IO/BinaryWriterTest.cs
mcs/class/corlib/Test/System.Reflection/VisibilityTest.cs [new file with mode: 0644]
mcs/class/corlib/Test/System.Text/ASCIIEncodingTest.cs
mcs/class/corlib/Test/System.Text/EncodingInfoTest.cs
mcs/class/corlib/Test/System.Text/UTF32EncodingTest.cs
mcs/class/corlib/Test/System.Text/UTF7EncodingTest.cs
mcs/class/corlib/Test/System.Text/UTF8EncodingTest.cs
mcs/class/corlib/Test/System.Threading.Tasks/TaskFactoryTest.cs
mcs/class/corlib/corlib.dll.sources
mcs/class/corlib/corlib_test.dll.sources
mcs/errors/cs0135-2.cs [deleted file]
mcs/errors/cs0135-3.cs [deleted file]
mcs/errors/cs0135-4.cs [deleted file]
mcs/errors/cs0135-5.cs [deleted file]
mcs/errors/cs0135-6.cs [deleted file]
mcs/errors/cs0135-7.cs [deleted file]
mcs/errors/cs0135.cs [deleted file]
mcs/errors/cs0573-3.cs [new file with mode: 0644]
mcs/mcs/constant.cs
mcs/mcs/cs-parser.jay
mcs/mcs/driver.cs
mcs/mcs/ecore.cs
mcs/mcs/expression.cs
mcs/mcs/ikvm.cs
mcs/mcs/modifiers.cs
mcs/mcs/module.cs
mcs/mcs/property.cs
mcs/mcs/settings.cs
mcs/tests/gtest-autoproperty-16.cs [new file with mode: 0644]
mcs/tests/test-914.cs [new file with mode: 0644]
mcs/tests/test-915.cs [new file with mode: 0644]
mcs/tests/test-916.cs [new file with mode: 0644]
mcs/tests/test-917.cs [new file with mode: 0644]
mcs/tests/test-918.cs [new file with mode: 0644]
mcs/tests/test-anon-174.cs [new file with mode: 0644]
mcs/tests/test-anon-175.cs [new file with mode: 0644]
mcs/tests/test-dictinit-04.cs [new file with mode: 0644]
mcs/tests/ver-il-net_4_5.xml
mcs/tools/xbuild/targets/Microsoft.Portable.Core.targets
mono/dis/Makefile.am
mono/metadata/gc-internal.h
mono/metadata/icall-def.h
mono/metadata/icall.c
mono/metadata/marshal.c
mono/metadata/mono-debug.c
mono/metadata/object-offsets.h
mono/metadata/sgen-alloc.c
mono/metadata/sgen-bridge.h
mono/metadata/sgen-gc.h
mono/metadata/sgen-os-win32.c
mono/mini/Makefile.am.in
mono/mini/aot-compiler.c
mono/mini/aot-runtime.c
mono/mini/aot_dump.c [deleted file]
mono/mini/driver.c
mono/mini/dwarfwriter.c
mono/mini/dwarfwriter.h
mono/mini/emitnunit.pl [new file with mode: 0755]
mono/mini/gshared.cs
mono/mini/liveness.c
mono/mini/method-to-ir.c
mono/mini/mini-arm.c
mono/mini/mini-codegen.c
mono/mini/mini-llvm.c
mono/mini/mini.h
mono/mini/test_op_il_seq_point.sh
mono/mini/test_op_il_seq_point_headerfooter.sh [new file with mode: 0755]
mono/mini/xdebug.c
mono/profiler/Makefile.am
mono/utils/Makefile.am
mono/utils/json.c [new file with mode: 0644]
mono/utils/json.h [new file with mode: 0644]
mono/utils/mono-compiler.h
mono/utils/mono-threads.h
msvc/libmonoutils.vcxproj
msvc/scripts/genproj.cs

index 55a955ec624e0e86ba27aba53940285245c10261..4d01e37cc2acc0c7bbff799a6cf5fb8b99a33c46 100644 (file)
@@ -109,6 +109,10 @@ GRTAGS
 GSYMS
 GTAGS
 
+# Doxygen
+docs/doxygen*
+docs/perlmod*
+
 
 ##############################################################################
 # Mono-specific patterns
index abed4c36cdec1f12dcb0d453193bf2ac365b0863..799581b35270a3a26023ff0b76596344bdb37844 100644 (file)
@@ -540,18 +540,10 @@ if test x"$GCC" = xyes; then
                CFLAGS="$CFLAGS -fwrapv"
 
                CFLAGS="$CFLAGS -DMONO_DLL_EXPORT"
-
-               ORIG_CFLAGS=$CFLAGS
-               CFLAGS="$CFLAGS -Wdeclaration-after-statement"
-               AC_MSG_CHECKING(for -Wdeclaration-after-statement option to gcc)
-               AC_TRY_COMPILE([],[
-                               return 0;
-               ], [
-                  AC_MSG_RESULT(yes)
-               ], [
-                  AC_MSG_RESULT(no)
-                  CFLAGS=$ORIG_CFLAGS
-               ])
+               # Don't export any symbols by default
+               SHARED_CFLAGS="-fvisibility=hidden"
+               CFLAGS_FOR_EGLIB="$CFLAGS_FOR_EGLIB -fvisibility=hidden"
+               CXXFLAGS="$CXXFLAGS -fvisibility=hidden"
 
                ORIG_CFLAGS=$CFLAGS
                # Check for the normal version, since gcc ignores unknown -Wno options
@@ -683,6 +675,7 @@ if test x$werror_flag = xyes; then
        WERROR_CFLAGS="-Werror"
 fi
 AC_SUBST([WERROR_CFLAGS])
+AC_SUBST([SHARED_CFLAGS])
 
 ac_configure_args="$ac_configure_args \"CPPFLAGS_FOR_EGLIB=$EGLIB_CPPFLAGS\" \"CFLAGS_FOR_EGLIB=$CFLAGS_FOR_EGLIB\""
 AC_CONFIG_SUBDIRS(eglib)
index 7ded4decb9c39446be634d42a575fda9bc3d945c..a3de8ec435d47292363b3012e76e2bc05e412d6d 160000 (submodule)
@@ -1 +1 @@
-Subproject commit 7ded4decb9c39446be634d42a575fda9bc3d945c
+Subproject commit a3de8ec435d47292363b3012e76e2bc05e412d6d
index 7e0b99936bf92502f7f63d43865cbbe771d3873b..d589df6e8a206e28b84304a75917006a0e076c29 160000 (submodule)
@@ -1 +1 @@
-Subproject commit 7e0b99936bf92502f7f63d43865cbbe771d3873b
+Subproject commit d589df6e8a206e28b84304a75917006a0e076c29
index 60bc10400db3a04f633a3c5aefb50266e9ffa1ce..1becd4f88f6d0999aa864e819484daa285acbd0e 160000 (submodule)
@@ -1 +1 @@
-Subproject commit 60bc10400db3a04f633a3c5aefb50266e9ffa1ce
+Subproject commit 1becd4f88f6d0999aa864e819484daa285acbd0e
index 56b8470a328c1bb1689d7475bcf465277109b810..63bf1263681ded8be2172efc791cb99401ccc985 100644 (file)
@@ -66,6 +66,12 @@ else
 the_libdir_base = $(topdir)/class/$(lib_dir)/$(PROFILE)/
 endif
 
+ifdef RESOURCE_STRINGS
+ifdef BOOTSTRAP_PROFILE
+MCS_FLAGS_INTERNAL += $(RESOURCE_STRINGS:%=--getresourcestrings:%)
+endif
+endif
+
 #
 # The bare directory contains the plain versions of System and System.Xml
 #
index 645a90d7dc9adca539659d8dc3db14d1ebc3f740..0f1393afdd8a854b9bde93fb8e9b270fe0ea773e 100644 (file)
@@ -28,7 +28,7 @@ ifndef BUILD_TOOLS_PROFILE
 BUILD_TOOLS_PROFILE = build
 endif
 
-USE_MCS_FLAGS = /codepage:$(CODEPAGE) $(LOCAL_MCS_FLAGS) $(PLATFORM_MCS_FLAGS) $(PROFILE_MCS_FLAGS) $(MCS_FLAGS)
+USE_MCS_FLAGS = /codepage:$(CODEPAGE) $(LOCAL_MCS_FLAGS) $(PLATFORM_MCS_FLAGS) $(PROFILE_MCS_FLAGS) $(MCS_FLAGS) $(MCS_FLAGS_INTERNAL)
 USE_MBAS_FLAGS = /codepage:$(CODEPAGE) $(LOCAL_MBAS_FLAGS) $(PLATFORM_MBAS_FLAGS) $(PROFILE_MBAS_FLAGS) $(MBAS_FLAGS)
 USE_CFLAGS = $(LOCAL_CFLAGS) $(CFLAGS) $(CPPFLAGS)
 CSCOMPILE = $(Q_MCS) $(MCS) $(USE_MCS_FLAGS)
index cbb65741c764688beed9b5efda8ca6d73c10355e..296bb7aa029b3604161913d09d370899f03d13c2 100644 (file)
@@ -712,6 +712,14 @@ namespace I18N.CJK
                public override int WindowsCodePage {
                        get { return SHIFTJIS_CODE_PAGE; }
                }
+               
+               // FIXME: This doesn't make sense, but without declaring this override
+               // System.XML regresses at Encoder.Convert() in
+               // MonoTests.System.Xml.XmlWriterSettingsTests.EncodingTest.
+               public override Encoder GetEncoder ()
+               {
+                       return new MonoEncodingDefaultEncoder (this);
+               }
 
        }; // class CP932
 
diff --git a/mcs/class/I18N/Common/DefaultEncoder.cs b/mcs/class/I18N/Common/DefaultEncoder.cs
new file mode 100644 (file)
index 0000000..225f549
--- /dev/null
@@ -0,0 +1,148 @@
+// This is partially copied source from referencesource/mscorlib/system/text/encoding.cs, modifying a bit.
+
+// ==++==
+//
+//   Copyright (c) Microsoft Corporation.  All rights reserved.
+//
+// ==--==
+
+
+using System;
+using System.Diagnostics.CodeAnalysis;
+using System.Diagnostics.Contracts;
+using System.Runtime.InteropServices;
+using System.Runtime.Serialization;
+using System.Text;
+
+namespace I18N.Common
+{
+        [Serializable]
+        public class ReferenceSourceDefaultEncoder : Encoder, IObjectReference
+        {
+            private Encoding m_encoding;
+            [NonSerialized] private bool m_hasInitializedEncoding;
+
+            [NonSerialized] internal char charLeftOver;
+
+            public ReferenceSourceDefaultEncoder(Encoding encoding)
+            {
+                m_encoding = encoding;
+                m_hasInitializedEncoding = true;
+            }
+
+            // Constructor called by serialization, have to handle deserializing from Everett
+            internal ReferenceSourceDefaultEncoder(SerializationInfo info, StreamingContext context)
+            {
+                if (info==null) throw new ArgumentNullException("info");
+                Contract.EndContractBlock();
+
+                // All we have is our encoding
+                this.m_encoding = (Encoding)info.GetValue("encoding", typeof(Encoding));
+
+                try 
+                {
+                    //this.m_fallback     = (EncoderFallback) info.GetValue("m_fallback",   typeof(EncoderFallback));
+                    this.charLeftOver   = (Char)            info.GetValue("charLeftOver", typeof(Char));
+                }
+                catch (SerializationException)
+                {
+                }
+            }
+
+            // Just get it from GetEncoding
+            [System.Security.SecurityCritical]  // auto-generated
+            public Object GetRealObject(StreamingContext context)
+            {
+                // upon deserialization since the DefaultEncoder implement IObjectReference the 
+                // serialization code tries to do the fixup. The fixup returns another 
+                // IObjectReference (the DefaultEncoder) class and hence so on and on. 
+                // Finally the deserialization logics fails after following maximum references
+                // unless we short circuit with the following
+                if (m_hasInitializedEncoding)
+                {
+                    return this;
+                }
+
+                Encoder encoder = m_encoding.GetEncoder();
+                /*
+                if (m_fallback != null)
+                    encoder.m_fallback = m_fallback;
+                if (charLeftOver != (char) 0)
+                {
+                    EncoderNLS encoderNls = encoder as EncoderNLS;
+                    if (encoderNls != null)
+                        encoderNls.charLeftOver = charLeftOver;
+                }
+                */
+                return encoder;
+            }
+
+#if FEATURE_SERIALIZATION
+            // ISerializable implementation, get data for this object
+            [System.Security.SecurityCritical]  // auto-generated_required
+            void ISerializable.GetObjectData(SerializationInfo info, StreamingContext context)
+            {
+                // Any info?
+                if (info==null) throw new ArgumentNullException("info");
+                Contract.EndContractBlock();
+
+                // All we have is our encoding
+                info.AddValue("encoding", this.m_encoding);
+            }
+#endif
+
+            // Returns the number of bytes the next call to GetBytes will
+            // produce if presented with the given range of characters and the given
+            // value of the flush parameter. The returned value takes into
+            // account the state in which the encoder was left following the last call
+            // to GetBytes. The state of the encoder is not affected by a call
+            // to this method.
+            //
+
+            public override int GetByteCount(char[] chars, int index, int count, bool flush)
+            {
+                return m_encoding.GetByteCount(chars, index, count);
+            }
+
+            [System.Security.SecurityCritical]  // auto-generated
+            [SuppressMessage("Microsoft.Contracts", "CC1055")]  // Skip extra error checking to avoid *potential* AppCompat problems.
+            public unsafe override int GetByteCount(char* chars, int count, bool flush)
+            {
+                return m_encoding.GetByteCount(chars, count);
+            }
+
+            // Encodes a range of characters in a character array into a range of bytes
+            // in a byte array. The method encodes charCount characters from
+            // chars starting at index charIndex, storing the resulting
+            // bytes in bytes starting at index byteIndex. The encoding
+            // takes into account the state in which the encoder was left following the
+            // last call to this method. The flush parameter indicates whether
+            // the encoder should flush any shift-states and partial characters at the
+            // end of the conversion. To ensure correct termination of a sequence of
+            // blocks of encoded bytes, the last call to GetBytes should specify
+            // a value of true for the flush parameter.
+            //
+            // An exception occurs if the byte array is not large enough to hold the
+            // complete encoding of the characters. The GetByteCount method can
+            // be used to determine the exact number of bytes that will be produced for
+            // a given range of characters. Alternatively, the GetMaxByteCount
+            // method of the Encoding that produced this encoder can be used to
+            // determine the maximum number of bytes that will be produced for a given
+            // number of characters, regardless of the actual character values.
+            //
+
+            public override int GetBytes(char[] chars, int charIndex, int charCount,
+                                          byte[] bytes, int byteIndex, bool flush)
+            {
+                return m_encoding.GetBytes(chars, charIndex, charCount, bytes, byteIndex);
+            }
+
+            [System.Security.SecurityCritical]  // auto-generated
+            [SuppressMessage("Microsoft.Contracts", "CC1055")]  // Skip extra error checking to avoid *potential* AppCompat problems.
+            public unsafe override int GetBytes(char* chars, int charCount,
+                                                 byte* bytes, int byteCount, bool flush)
+            {
+                return m_encoding.GetBytes(chars, charCount, bytes, byteCount);
+            }
+        }
+}
index 6ea2d3791a6bf755c2df50097048f10f4888443a..bfdcd311d6448e5e9d674f37e8d8d4182dee02db 100755 (executable)
@@ -6,4 +6,5 @@ Handlers.cs
 Manager.cs
 MonoEncoding.cs
 MonoSafeEncoding.cs
+DefaultEncoder.cs
 Strings.cs
index e891cd12c5d5405a760228ea989d82c487059c56..2c736c600e1bb3b7f7a7624eed5ce23a1e0b170f 100644 (file)
@@ -210,6 +210,11 @@ namespace I18N.Common
                //[CLSCompliant (false)]
                public unsafe abstract int GetBytesImpl (char* chars, int charCount,
                        byte* bytes, int byteCount);
+               
+               public override Encoder GetEncoder ()
+               {
+                       return new MonoEncodingDefaultEncoder (this);
+               }
        }
 
                public abstract class MonoEncoder : Encoder
@@ -304,4 +309,76 @@ namespace I18N.Common
                                        bytes, ref byteIndex, ref byteCount, null);
                        }*/
                }
+
+       public class MonoEncodingDefaultEncoder : ReferenceSourceDefaultEncoder
+       {
+               public MonoEncodingDefaultEncoder (Encoding encoding)
+                       : base (encoding)
+               {
+               }
+
+               [CLSCompliant (false)]
+               [ComVisible (false)]
+               public unsafe override void Convert (
+                       char* chars, int charCount,
+                       byte* bytes, int byteCount, bool flush,
+                       out int charsUsed, out int bytesUsed, out bool completed)
+               {
+                       CheckArguments (chars, charCount, bytes, byteCount);
+
+                       charsUsed = charCount;
+                       while (true) {
+                               bytesUsed = GetByteCount (chars, charsUsed, flush);
+                               if (bytesUsed <= byteCount)
+                                       break;
+                               flush = false;
+                               charsUsed >>= 1;
+                       }
+                       completed = charsUsed == charCount;
+                       bytesUsed = GetBytes (chars, charsUsed, bytes, byteCount, flush);
+               }
+
+               [ComVisible (false)]
+               public override void Convert (
+                       char [] chars, int charIndex, int charCount,
+                       byte [] bytes, int byteIndex, int byteCount, bool flush,
+                       out int charsUsed, out int bytesUsed, out bool completed)
+               {
+                       if (chars == null)
+                               throw new ArgumentNullException ("chars");
+                       if (bytes == null)
+                               throw new ArgumentNullException ("bytes");
+                       if (charIndex < 0)
+                               throw new ArgumentOutOfRangeException ("charIndex");
+                       if (charCount < 0 || chars.Length < charIndex + charCount)
+                               throw new ArgumentOutOfRangeException ("charCount");
+                       if (byteIndex < 0)
+                               throw new ArgumentOutOfRangeException ("byteIndex");
+                       if (byteCount < 0 || bytes.Length < byteIndex + byteCount)
+                               throw new ArgumentOutOfRangeException ("byteCount");
+
+                       charsUsed = charCount;
+                       while (true) {
+                               bytesUsed = GetByteCount (chars, charIndex, charsUsed, flush);
+                               if (bytesUsed <= byteCount)
+                                       break;
+                               flush = false;
+                               charsUsed >>= 1;
+                       }
+                       completed = charsUsed == charCount;
+                       bytesUsed = GetBytes (chars, charIndex, charsUsed, bytes, byteIndex, flush);
+               }
+
+               unsafe void CheckArguments (char* chars, int charCount, byte* bytes, int byteCount)
+               {
+                       if (chars == null)
+                               throw new ArgumentNullException ("chars");
+                       if (bytes == null)
+                               throw new ArgumentNullException ("bytes");
+                       if (charCount < 0)
+                               throw new ArgumentOutOfRangeException ("charCount");
+                       if (byteCount < 0)
+                               throw new ArgumentOutOfRangeException ("byteCount");
+               }
+       }
 }
index d8711247996fd724951f0dbc17c9bf18a88b0eb2..2b619caa12da418065f9e698f5eb6f2aa8e0c749 100644 (file)
@@ -29,6 +29,7 @@ using System;
 using System.Collections;
 using System.Collections.Generic;
 using System.IO;
+using System.Threading;
 using Microsoft.Build.Framework;
 using Microsoft.Build.Utilities;
 
@@ -41,7 +42,10 @@ namespace Microsoft.Build.Tasks {
                bool            skipUnchangedFiles;
                ITaskItem[]     sourceFiles;
                bool            overwriteReadOnlyFiles;
-               
+               int                     retries;
+               int                     retryDelayMilliseconds;
+               bool            useHardlinksIfPossible;
+
                public Copy ()
                {
                }
@@ -79,7 +83,7 @@ namespace Microsoft.Build.Tasks {
                                                }
 
                                                if (!skipUnchangedFiles || HasFileChanged (sourceFile, destinationFile))
-                                                       CopyFile (sourceFile, destinationFile, true);
+                                                       CopyFileWithRetries (sourceFile, destinationFile, true);
 
                                                sourceItem.CopyMetadataTo (destinationItem);
                                                temporaryCopiedFiles.Add (destinationItem);
@@ -102,7 +106,7 @@ namespace Microsoft.Build.Tasks {
 
                                                if (!skipUnchangedFiles || directoryCreated ||
                                                        HasFileChanged (sourceFile, destinationFile))
-                                                       CopyFile (sourceFile, destinationFile, false);
+                                                       CopyFileWithRetries (sourceFile, destinationFile, false);
 
                                                temporaryCopiedFiles.Add (new TaskItem (
                                                                Path.Combine (destinationFolder.GetMetadata ("Identity"), filename),
@@ -172,6 +176,34 @@ namespace Microsoft.Build.Tasks {
                        }
                }
 
+               public int Retries {
+                       get {
+                               return retries;
+                       }
+                       set {
+                               retries = value;
+                       }
+               }
+
+               public int RetryDelayMilliseconds {
+                       get {
+                               return retryDelayMilliseconds;
+                       }
+                       set {
+                               retryDelayMilliseconds = value;
+                       }
+               }
+
+               [MonoTODO ("Not implemented yet.")]
+               public bool UseHardlinksIfPossible {
+                       get {
+                               return useHardlinksIfPossible;
+                       }
+                       set {
+                               useHardlinksIfPossible = value;
+                       }
+               }
+
                [Required]
                public ITaskItem[] SourceFiles {
                        get {
@@ -193,6 +225,23 @@ namespace Microsoft.Build.Tasks {
                        return true;
                }
 
+               void CopyFileWithRetries (string source, string dest, bool create_dir)
+               {
+                       for (int i = retries; i >= 0; i--) {
+                               try {
+                                       CopyFile (source, dest, create_dir);
+                               }
+                               catch (Exception ex) {
+                                       Log.LogMessage ("Copying failed. Retries left: {0}.", i);
+
+                                       if (i == 0)
+                                               throw;
+
+                                       Thread.Sleep (retryDelayMilliseconds);
+                               }
+                       }
+               }
+
                void CopyFile (string source, string dest, bool create_dir)
                {
                        if (create_dir)
index 2b9ce4ecae7d864e812ac776020c37a13d1d2500..ad7ca03ba5a6ebb9b3fcb611f695492d0a673a3e 100644 (file)
@@ -30,6 +30,7 @@ using System.IO;
 using Microsoft.Build.BuildEngine;
 using NUnit.Framework;
 using System.Text;
+using System.Threading;
 using Microsoft.Build.Tasks;
 using Microsoft.Build.Framework;
 using Microsoft.Build.Utilities;
@@ -396,6 +397,61 @@ namespace MonoTests.Microsoft.Build.Tasks {
                        File.SetAttributes (target_file, FileAttributes.Normal);
                }
 
+               [Test]
+               public void TestCopy_Retries ()
+               {
+                       Engine engine;
+                       Project project;
+                       string file_path = Path.Combine (source_path, "copyretries.txt");
+                       string target_file = Path.Combine (target_path, "copyretries.txt");                     
+
+                       using (File.CreateText (file_path)) { }
+                       using (File.CreateText (target_file)) { }
+
+                       File.SetAttributes (target_file, FileAttributes.ReadOnly);
+                       Assert.AreEqual (FileAttributes.ReadOnly, File.GetAttributes (target_file), "A1");
+
+                       string documentString = @"
+                               <Project xmlns=""http://schemas.microsoft.com/developer/msbuild/2003"">
+                                       <PropertyGroup><DestFile>" + target_file + @"</DestFile></PropertyGroup>
+                                       <ItemGroup>
+                                               <SFiles Include='" + file_path + @"'><Md>1</Md></SFiles>
+                                               <DFiles Include='$(DestFile)'><Mde>2</Mde></DFiles>
+                                       </ItemGroup>
+                                       <Target Name='1'>
+                                               <Copy SourceFiles='@(SFiles)' DestinationFiles='@(DFiles)' Retries='3' RetryDelayMilliseconds='2000'>
+                                                       <Output TaskParameter='CopiedFiles' ItemName='I0'/>
+                                                       <Output TaskParameter='DestinationFiles' ItemName='I1'/>
+                                               </Copy>
+                                               <Message Text=""I0 : @(I0), I1: @(I1)""/>
+                                       </Target>
+                               </Project>
+                       ";
+
+                       engine = new Engine (Consts.BinPath);
+                       project = engine.CreateNewProject ();
+
+                       TestMessageLogger testLogger = new TestMessageLogger ();
+                       engine.RegisterLogger (testLogger);
+
+                       project.LoadXml (documentString);
+
+                       // remove the read-only flag from the file after a few secs,
+                       // so copying works after retries
+                       new Thread ( () => {
+                               Thread.Sleep (3000);
+                               File.SetAttributes (target_file, FileAttributes.Normal);
+                       }).Start ();
+
+                       if (!project.Build ("1")) {
+                               var sb = new StringBuilder ();
+                               testLogger.DumpMessages (sb);
+                               Assert.Fail ("Build failed " + sb.ToString ());
+                       }
+
+                       testLogger.CheckLoggedAny ("Copying failed. Retries left: 3.", MessageImportance.Normal, "A2");
+               }
+
                void CheckCopyBuildItems (Project project, string [] source_files, string destination_folder, string prefix)
                {
                        int num = source_files.Length;
index 2f99958413be205f37337bea0e3be04794aef64b..cd722af91ee9cfe47ea236481c5d30e52da82d0b 100644 (file)
@@ -11,13 +11,6 @@ LIB_MCS_FLAGS = \
 
 TEST_MCS_FLAGS = $(LIB_MCS_FLAGS)
 
-# This is a .NET 3.5+ assembly
-VALID_PROFILE := $(filter net_4_5 monotouch monodroid xammac mobile mobile_static, $(PROFILE))
-ifndef VALID_PROFILE
-LIBRARY_NAME = dummy-System.ComponentModel.DataAnnotations.dll
-NO_INSTALL = yes
-NO_SIGN_ASSEMBLY = yes
-NO_TEST = yes
-endif
+RESOURCE_STRINGS = ../../../external/referencesource/System.ComponentModel.DataAnnotations/System.ComponentModel.DataAnnotations.txt
 
 include ../../build/library.make
index 5b0f531e55d587d0fd1baeb8d20826a7bd236cc7..925fb547ebaa3301bfac873cac6ecdd495f2febd 100644 (file)
@@ -39,7 +39,8 @@ namespace System.Configuration
        {
                SectionGroupInfo group;
                Configuration config;
-               
+               static readonly object lockObject = new object();
+                
                internal ConfigurationSectionCollection (Configuration config, SectionGroupInfo group)
                        : base (StringComparer.Ordinal)
                {
@@ -60,15 +61,17 @@ namespace System.Configuration
                public ConfigurationSection this [string name]
                {
                        get {
-                               ConfigurationSection sec = BaseGet (name) as ConfigurationSection;
-                               if (sec == null) {
-                                       SectionInfo secData = group.Sections [name] as SectionInfo;
-                                       if (secData == null) return null;
-                                       sec = config.GetSectionInstance (secData, true);
-                                       if (sec == null) return null;
-                                       BaseSet (name, sec);
+                               lock(lockObject) {
+                                       ConfigurationSection sec = BaseGet (name) as ConfigurationSection;
+                                       if (sec == null) {
+                                               SectionInfo secData = group.Sections [name] as SectionInfo;
+                                               if (secData == null) return null;
+                                               sec = config.GetSectionInstance (secData, true);
+                                               if (sec == null) return null;
+                                               BaseSet (name, sec);
+                                       }
+                                       return sec;
                                }
-                               return sec;
                        }
                }
        
index 5e21343f14a0be002e4ed21506aed9bf3b9a9304..29ab2f6c231d36f8751b07ceddc466d510e6ab5a 100644 (file)
@@ -6,6 +6,7 @@ LIBRARY = System.Core.dll
 
 REFERENCE_SOURCES_FLAGS = -d:FEATURE_PAL,PFX_LEGACY_3_5
 LIB_MCS_FLAGS = $(REFERENCE_SOURCES_FLAGS) -d:INSIDE_SYSCORE -d:LIBC /r:System.dll -unsafe
+RESOURCE_STRINGS = ../../../external/referencesource/System.Core/System.Core.txt
 
 ifneq (2.1, $(FRAMEWORK_VERSION))
 LIB_MCS_FLAGS += -d:NET_3_5 -nowarn:1720
index d3617e41f920a3213e897206374e072640d35353..be8e132366a7acb80eaf8bec9a6512aabd3a55e7 100644 (file)
@@ -7,4 +7,6 @@ LIB_MCS_FLAGS = -r:System.dll -r:System.Core.dll -r:System.Data.dll -r:System.Xm
                                -r:System.Runtime.Serialization.dll -r:System.ComponentModel.DataAnnotations.dll -r:System.Configuration.dll \
                                -warn:2
 
+RESOURCE_STRINGS = ../../../external/referencesource/System.Data.Entity/System.Data.Entity.txt
+
 include ../../build/library.make
index b9dd3113fcb3f9ab90d96e7247a104e0d3051e58..d2fdfba105b4634be763f00ff5fad4bf8ffce18b 100644 (file)
@@ -24,6 +24,8 @@ LIB_MCS_FLAGS += \
        -r:System.Transactions.dll
 endif
 
+RESOURCE_STRINGS = ../../../external/referencesource/System.Data/system.data.txt
+
 TEST_MCS_FLAGS = $(LIB_MCS_FLAGS) -r:System.Core.dll -r:Mono.Data.Sqlite.dll -nowarn:618,169,612,219,168
 
 TEST_MONO_PATH = .
index 3bdd75ca15ce819b030fc565846dfa38c0951a18..141ac9eace54dc610bd269c836d6dca77ec477e2 100644 (file)
@@ -507,9 +507,9 @@ namespace System.Data
                                                useCurrent = true;
 
                                        if (attr.NamespaceURI == XmlConstants.MspropNamespace && 
-                                           !dataset.ExtendedProperties.ContainsKey(attr.Name))
+                                           !dataset.ExtendedProperties.ContainsKey(attr.LocalName))
                                        {
-                                               dataset.ExtendedProperties.Add (attr.Name, attr.Value);
+                                               dataset.ExtendedProperties.Add (attr.LocalName, attr.Value);
                                                continue;
                                        }
                                        
@@ -564,7 +564,7 @@ namespace System.Data
 
                                        if (attr.NamespaceURI == XmlConstants.MspropNamespace)
                                        {
-                                               table.ExtendedProperties.Add (attr.Name, attr.Value);
+                                               table.ExtendedProperties.Add (attr.LocalName, attr.Value);
                                                continue;
                                        }
 
@@ -744,7 +744,7 @@ namespace System.Data
                                foreach (XmlAttribute attr in obj.UnhandledAttributes) {
                                        if (attr.NamespaceURI == XmlConstants.MspropNamespace)
                                        {
-                                               col.ExtendedProperties.Add (attr.Name, attr.Value);
+                                               col.ExtendedProperties.Add (attr.LocalName, attr.Value);
                                                continue;
                                        }
 
index f879fae5b27c2702bc4b8f0e9dca2ffa851cb3b0..d478b31468b7087c72cd1eab4e70a7ad3b24e9a8 100644 (file)
@@ -763,9 +763,8 @@ namespace MonoTests.System.Data
                        DataTable table = new DataTable("TABLE1");\r
                        table.ExtendedProperties.Add("T1", "extended1");\r
                        table.Columns.Add("C1", typeof(int));\r
-                       table.Columns[0].MaxLength = 10;\r
                        table.Columns.Add("C2", typeof(string));\r
-                       table.Columns[0].MaxLength = 20;\r
+                       table.Columns[1].MaxLength = 20;\r
                        table.Columns[0].ExtendedProperties.Add("C1Ext1", "extended2");\r
                        table.Columns[1].ExtendedProperties.Add("C2Ext1", "extended3");\r
                        dataSet1.Tables.Add(table);\r
index 916b805337ba9970dcbc1abc84a159c03577ba88..543eb96d22247118d5804e2979220e39e3105b63 100644 (file)
@@ -6,15 +6,8 @@ LIBRARY = System.Numerics.dll
 LIB_MCS_FLAGS = -r:System.dll /unsafe -d:MONO
 TEST_MCS_FLAGS = $(LIB_MCS_FLAGS)
 
-EXTRA_DISTFILES =
-
-VALID_PROFILE := $(filter 4, $(FRAMEWORK_VERSION_MAJOR)) $(filter 2.1, $(FRAMEWORK_VERSION))
+RESOURCE_STRINGS = ../../../external/referencesource/System.Numerics/System.Numerics.txt
 
-ifndef VALID_PROFILE
-LIBRARY_NAME = dummy-System.Numerics.dll
-NO_INSTALL = yes
-NO_SIGN_ASSEMBLY = yes
-NO_TEST = yes
-endif
+EXTRA_DISTFILES =
 
 include ../../build/library.make
index f902ef98998f571d61ef3e1010f99063eac1fd50..a11b3e30994faf152c076be93a6d963ec288dab0 100644 (file)
@@ -14,6 +14,8 @@ LIB_MCS_FLAGS = \
                /r:System.Core.dll \
                $(RESOURCE_FILES:%=/resource:%)
 
+RESOURCE_STRINGS = ../../../external/referencesource/System.Runtime.Serialization/System.Runtime.Serialization.txt
+
 ifneq (2.1, $(FRAMEWORK_VERSION))
 LIB_MCS_FLAGS += /d:NET_3_0 /r:System.Data.dll /r:System.Configuration.dll
 endif
@@ -30,12 +32,4 @@ EXTRA_DISTFILES = $(RESOURCE_FILES) $(TEST_RESOURCE_FILES) \
        Test/Resources/Schemas/*.xsd \
        Test/System.Runtime.Serialization/one.xml
 
-VALID_PROFILE := $(filter 2 4, $(FRAMEWORK_VERSION_MAJOR))
-ifndef VALID_PROFILE
-LIBRARY_NAME = dummy-System.Runtime.Serialization.dll
-NO_INSTALL = yes
-NO_SIGN_ASSEMBLY = yes
-NO_TEST = yes
-endif
-
 include ../../build/library.make
index 5f4695d19321c776d97417504310c1499d2296ef..6e909a8f3644cc81b40a03db3c672d2e23e71ff3 100644 (file)
@@ -190,6 +190,9 @@ namespace System.Xml
                        if (reader == null)
                                throw new ArgumentNullException ("reader");
 
+                       if (reader.ReadState == ReadState.Initial)
+                               reader.Read ();
+                       
                        switch (reader.NodeType) {
                        case XmlNodeType.Element:
                                // gratuitously copied from System.XML/System.Xml/XmlWriter.cs:WriteNode(XmlReader,bool)
index 301c5275607da0ede7fc4844626f6d54e8fe986c..0d1a08115296864abaa11e989b92e06969d413a8 100644 (file)
@@ -44,6 +44,8 @@ namespace System.Xml
                        var settings = new XmlWriterSettings ();
                        settings.Encoding = encoding;
                        settings.OmitXmlDeclaration = true;
+                       settings.ConformanceLevel = ConformanceLevel.Fragment;
+                       settings.NewLineChars = "\r\n";
                        xml_writer_settings = settings;
 
                        // FIXME: actually it does not likely use ContentType.ToString() but writes those header items by own.
@@ -134,7 +136,8 @@ namespace System.Xml
 
                public override void WriteEndDocument ()
                {
-                       w.WriteEndDocument ();
+                       // We don't call w.WriteEndElement() because that causes state error
+                       // (which is correct; MTOM writer just does not expect it).
                }
 
                public override void WriteEndElement ()
@@ -182,13 +185,15 @@ namespace System.Xml
                public override void WriteStartDocument ()
                {
                        CheckState ();
-                       w.WriteStartDocument ();
+                       // We don't call w.WriteStartDocument() because that causes state error
+                       // (which is correct; MTOM writer just does not expect it).
                }
 
                public override void WriteStartDocument (bool standalone)
                {
                        CheckState ();
-                       w.WriteStartDocument (standalone);
+                       // We don't call w.WriteStartDocument() because that causes state error
+                       // (which is correct; MTOM writer just does not expect it).
                }
 
                public override void WriteStartElement (string prefix, string localName, string namespaceURI)
@@ -206,16 +211,21 @@ namespace System.Xml
                        get { return w.WriteState; }
                }
 
+               static readonly char [] eol_chars = "\r\n".ToCharArray ();
+
                public override void WriteString (string text)
                {
                        CheckState ();
 
                        int i1, i2 = 0;
                        do {
-                               i1 = text.IndexOf ('\r', i2);
+                               i1 = text.IndexOfAny (eol_chars, i2);
                                if (i1 >= 0) {
                                        w.WriteString (text.Substring (i2, i1 - i2));
-                                       WriteCharEntity ('\r');
+                                       if (text [i1] == '\r')
+                                               w.WriteCharEntity ('\r');
+                                       else
+                                               w.WriteRaw ("\r\n");
                                        i2 = i1 + 1;
                                } else {
                                        w.WriteString (text.Substring (i2));
@@ -248,12 +258,14 @@ namespace System.Xml
                {
                        if (w == null && write_headers)
                                WriteMimeHeaders ();
+                       
                        if (w == null || w.WriteState == WriteState.Closed || w.WriteState == WriteState.Error)
                                w = CreateWriter ();
                }
 
                void WriteMimeHeaders ()
                {
+                       w.Flush ();
                        writer.Write ("MIME-Version: 1.0\r\n");
                        writer.Write ("Content-Type: ");
                        writer.Write (content_type.ToString ());
@@ -293,6 +305,7 @@ namespace System.Xml
                        if (section_count > 1)
                                return;
 
+                       w.Flush ();
                        writer.Write ("\r\n");
                        writer.Write ("--");
                        writer.Write (content_type.Boundary);
index d22c6ffdb62d480ff8b6024bf4e73d4203d55784..d57dbb698d0f77fa0cf3a27c6b932573c684404f 100644 (file)
@@ -47,6 +47,7 @@ namespace MonoTests.System.Xml
                {
                        MemoryStream ms = new MemoryStream ();
                        var w = XmlDictionaryWriter.CreateMtomWriter (ms, Encoding.UTF8, 10000, "sTaRt", "myboundary", "urn:foo", false, false);
+                       w.WriteStartDocument ();
                        w.WriteStartElement ("root");
                        w.WriteRaw ("RAW");
                        w.WriteStartElement ("foo");
index aa19c2c0f5d63c4b6f9fc744723c3d40f58f2b1b..d5677f6b46f2be7d6178d82b9a4948bfc03be8e3 100644 (file)
@@ -37,4 +37,6 @@
                </xs:restriction>
        </xs:simpleType>
        <xs:attribute name="FactoryType" type="xs:QName" />
+       <xs:attribute name="Id" type="xs:ID" />
+       <xs:attribute name="Ref" type="xs:IDREF" />
 </xs:schema>
index cc44b12d4c509032082f2cacd47028204553bb94..03b4f215b84c4530d73abb8f5d26f75ccfe2efb6 100644 (file)
@@ -10,6 +10,7 @@
 //
 
 using System;
+using System.Collections;
 using System.IO;
 using System.Security.Cryptography;
 using System.Security.Cryptography.Xml;
@@ -243,7 +244,19 @@ namespace MonoTests.System.Security.Cryptography.Xml {
                        XmlDocument doc = GetXslDoc ();
                        transform.LoadInnerXml (doc.DocumentElement.ChildNodes);
                        XmlNodeList xnl = transform.UnprotectedGetInnerXml ();
-                       Assert.AreEqual (doc.DocumentElement.ChildNodes, xnl, "LoadInnerXml");
+                       AssertNodeListEqual (doc.DocumentElement.ChildNodes, xnl, "LoadInnerXml");
+               }
+               
+               void AssertNodeListEqual (XmlNodeList nl1, XmlNodeList nl2, string label)
+               {
+                       Assert.AreEqual (nl1.Count, nl2.Count, label + ": node count");
+                       IEnumerator e1, e2;
+                       int i;
+                       for (i = 0, e1 = nl1.GetEnumerator (), e2 = nl2.GetEnumerator (); e1.MoveNext (); i++) {
+                               Assert.IsTrue (e2.MoveNext (), label + " : nl2.MoveNext");
+                               Assert.AreEqual (e1.Current, e2.Current, label + " : node at " + i);
+                       }
+                       Assert.IsFalse (e2.MoveNext (), label + " : nl2 has extras");
                }
 
                [Test]
index 5cf086e73b8cba9a2d6cd3e2e6bf7828c2b938b1..85fca596d80c107217269f04e942afaab57baa3f 100644 (file)
@@ -411,10 +411,10 @@ namespace System.ServiceModel.Syndication
                                writer.WriteStartElement ("feed", AtomNamespace);
 
                        if (Feed.BaseUri != null)
-                               writer.WriteAttributeString ("xml:base", Feed.BaseUri.ToString ());
+                               writer.WriteAttributeString ("xml", "base", null, Feed.BaseUri.ToString ());
 
                        if (Feed.Language != null)
-                               writer.WriteAttributeString ("xml:lang", Feed.Language);
+                               writer.WriteAttributeString ("xml", "lang", null, Feed.Language);
 
                        // atom:feed elements MUST contain exactly one atom:title element.
                        (Feed.Title ?? new TextSyndicationContent (String.Empty)).WriteTo (writer, "title", AtomNamespace);
index 3af44ddf3db6da8322be461642376f8c7539106a..0c181289d2562c2b98b505d3c5f9ab117ab3e69d 100644 (file)
@@ -408,7 +408,7 @@ namespace System.ServiceModel.Syndication
                                writer.WriteStartElement ("entry", AtomNamespace);
 
                        if (Item.BaseUri != null)
-                               writer.WriteAttributeString ("xml:base", Item.BaseUri.ToString ());
+                               writer.WriteAttributeString ("xml", "base", null, Item.BaseUri.ToString ());
 
                        // atom:entry elements MUST contain exactly one atom:id element.
                        writer.WriteElementString ("id", AtomNamespace, Item.Id ?? new UniqueId ().ToString ());
index 875acb2117ec61a67808e9e4c99958795ec84a7f..b72c14c4324db300f91f9bdaa6ca2837d0294564 100644 (file)
@@ -321,11 +321,15 @@ namespace System
                        string [] parameters = Uri.UnescapeDataString (candidate.Query.Substring (1)).Split ('&'); // chop first '?'
                        foreach (string parameter in parameters) {
                                string [] pair = parameter.Split ('=');
-                               m.QueryParameters.Add (pair [0], pair [1]);
-                               if (!query_params.ContainsKey (pair [0]))
-                                       continue;
-                               string templateName = query_params [pair [0]];
-                               vc.Add (templateName, pair [1]);
+                               if (pair.Length > 0) {
+                                       m.QueryParameters.Add (pair [0], pair.Length == 2 ? pair [1] : null);
+                                       if (!query_params.ContainsKey (pair [0]))
+                                               continue;
+                                       if (pair.Length > 1) {
+                                               string templateName = query_params [pair [0]];
+                                               vc.Add (templateName, pair [1]);
+                                       }
+                               }
                        }
 
                        return m;
index 24ec92861d82a1bc9d6f8e4a8202a6f6dd9ec5b0..361921ddcfcbbfc17d6959310ab30975201a115e 100644 (file)
@@ -461,6 +461,14 @@ namespace MonoTests.System
                        Assert.AreEqual ("qqq", m.WildcardPathSegments [2], "#5");
                }
 
+               [Test]
+               public void MatchIgnoreQueryParamNoValue ()
+               {
+                       var t = new UriTemplate ("/{a}/*", true);
+                       var m = t.Match (new Uri ("http://s"), new Uri ("http://s/a/b?foo"));
+                       Assert.AreEqual (1, m.QueryParameters.Keys.Count, "#1");
+               }
+
                [Test]
                public void IgnoreTrailingSlash ()
                {
index 2ef669295029a94fead287c2677747eeea4b107c..92caf27498e852338bb13d1a3239dd5b3b1c92c9 100644 (file)
@@ -168,7 +168,8 @@ namespace System.ServiceModel.Channels
                        if (!IsEmpty) {
                                if (copied_message != null)
                                        copied_message.WriteBodyContents (writer);
-                               OnWriteBodyContents (writer);
+                               else
+                                       OnWriteBodyContents (writer);
                        }
                        else if (Version.Envelope == EnvelopeVersion.None)
                                WriteXsiNil (writer);
index 01d85a20b5d9f26215fd814c0dcde9f1bd8e9143..d73b0866495cf0a32fe3ef8b2796ea619e8a36f2 100644 (file)
@@ -29,11 +29,13 @@ using System;
 using System.Collections.Generic;
 using System.IO;
 using System.Net;
+using System.Net.Sockets;
 using System.Net.Security;
 using System.ServiceModel;
 using System.ServiceModel.Description;
 using System.ServiceModel.Security;
 using System.Threading;
+using System.Xml;
 
 namespace System.ServiceModel.Channels
 {
@@ -124,12 +126,29 @@ namespace System.ServiceModel.Channels
                                        }
                                        try {
                                                return TryReceiveRequest (tout, out ctx);
+                                       } catch (XmlException ex) {
+                                               Console.WriteLine ("Xml Exception (Dropped Connection?):" + ex.Message);
+                                               //on dropped connection, 
+                                               //whatever you do don't crash
+                                               //the whole app.  Ignore for now
+                                       } catch (SocketException ex) {
+                                               Console.WriteLine ("Socket Exception (Dropped Connection?):" + ex.Message);
+                                               //on dropped connection, 
+                                               //whatever you do don't crash
+                                               //the whole app.  Ignore for now
+                                       } catch (IOException ex) {
+                                               Console.WriteLine ("I/O Exception (Dropped Connection?):" + ex.Message);
+                                               //on dropped connection, 
+                                               //whatever you do don't crash
+                                               //the whole app.  Ignore for now
                                        } finally {
                                                lock (async_result_lock) {
                                                        CurrentAsyncResult = null;
                                                        CurrentAsyncThread = null;
                                                }
                                        }
+                                       ctx = null;
+                                       return false;
                                        });
                        RequestContext dummy;
                        IAsyncResult result;
index 1e40ee7d49cb3570dc450036e931394eb43fe25b..2876a0465d9c2ad50f9defd6fba3c19ff9388a9c 100644 (file)
@@ -96,7 +96,7 @@ namespace System.ServiceModel.Description {
                         * 
                         */
 
-                       var exactlyOne = element.FirstChild as XmlElement;
+                       var exactlyOne = element.SelectSingleNode ("*") as XmlElement;
                        if (exactlyOne == null) {
                                // OOPS
                                return;
index 54d003c5f26c06e481a1bc21519d62e4d31d2c2c..6efd313def44116d929f42672f0dadaff634ae03 100644 (file)
@@ -46,7 +46,7 @@ namespace System.ServiceModel.Description
                                else if (Reader.LocalName == "Identifier" && Reader.NamespaceURI == "") {
                                        ob.@Identifier = Reader.Value;
                                }
-                               else if (IsXmlnsAttribute (Reader.Name)) {
+                               else if (IsXmlnsAttribute (Reader.LocalName)) {
                                }
                                else {
                                        System.Xml.XmlAttribute attr = (System.Xml.XmlAttribute) Document.ReadNode(Reader);
@@ -325,13 +325,13 @@ namespace System.ServiceModel.Description
                        if (ob.@DocumentationElement != null) {
                                XmlNode o14 = ob.@DocumentationElement;
                                if (o14 is XmlElement) {
-                               if ((o14.Name == "documentation" && o14.NamespaceURI == "http://schemas.xmlsoap.org/wsdl/")) {
+                               if ((o14.LocalName == "documentation" && o14.NamespaceURI == "http://schemas.xmlsoap.org/wsdl/")) {
                                        }
                                        else o14.WriteTo (Writer);
                                        WriteElementLiteral (o14, "", "", false, true);
                                }
                                else
-                                       throw CreateUnknownAnyElementException (o14.Name, o14.NamespaceURI);
+                                       throw CreateUnknownAnyElementException (o14.LocalName, o14.NamespaceURI);
                        }
                        if (writeWrappingElem) WriteEndElement (ob);
                }
@@ -368,13 +368,13 @@ namespace System.ServiceModel.Description
                        if (ob.@DocumentationElement != null) {
                                XmlNode o17 = ob.@DocumentationElement;
                                if (o17 is XmlElement) {
-                               if ((o17.Name == "documentation" && o17.NamespaceURI == "http://schemas.xmlsoap.org/wsdl/")) {
+                               if ((o17.LocalName == "documentation" && o17.NamespaceURI == "http://schemas.xmlsoap.org/wsdl/")) {
                                        }
                                        else o17.WriteTo (Writer);
                                        WriteElementLiteral (o17, "", "", false, true);
                                }
                                else
-                                       throw CreateUnknownAnyElementException (o17.Name, o17.NamespaceURI);
+                                       throw CreateUnknownAnyElementException (o17.LocalName, o17.NamespaceURI);
                        }
                        if (ob.@Schemas != null) {
                                for (int n18 = 0; n18 < ob.@Schemas.Count; n18++) {
@@ -418,13 +418,13 @@ namespace System.ServiceModel.Description
                        if (ob.@DocumentationElement != null) {
                                XmlNode o21 = ob.@DocumentationElement;
                                if (o21 is XmlElement) {
-                               if ((o21.Name == "documentation" && o21.NamespaceURI == "http://schemas.xmlsoap.org/wsdl/")) {
+                               if ((o21.LocalName == "documentation" && o21.NamespaceURI == "http://schemas.xmlsoap.org/wsdl/")) {
                                        }
                                        else o21.WriteTo (Writer);
                                        WriteElementLiteral (o21, "", "", false, true);
                                }
                                else
-                                       throw CreateUnknownAnyElementException (o21.Name, o21.NamespaceURI);
+                                       throw CreateUnknownAnyElementException (o21.LocalName, o21.NamespaceURI);
                        }
                        if (ob.@Parts != null) {
                                for (int n22 = 0; n22 < ob.@Parts.Count; n22++) {
@@ -468,13 +468,13 @@ namespace System.ServiceModel.Description
                        if (ob.@DocumentationElement != null) {
                                XmlNode o25 = ob.@DocumentationElement;
                                if (o25 is XmlElement) {
-                               if ((o25.Name == "documentation" && o25.NamespaceURI == "http://schemas.xmlsoap.org/wsdl/")) {
+                               if ((o25.LocalName == "documentation" && o25.NamespaceURI == "http://schemas.xmlsoap.org/wsdl/")) {
                                        }
                                        else o25.WriteTo (Writer);
                                        WriteElementLiteral (o25, "", "", false, true);
                                }
                                else
-                                       throw CreateUnknownAnyElementException (o25.Name, o25.NamespaceURI);
+                                       throw CreateUnknownAnyElementException (o25.LocalName, o25.NamespaceURI);
                        }
                        if (ob.@Operations != null) {
                                for (int n26 = 0; n26 < ob.@Operations.Count; n26++) {
@@ -519,13 +519,13 @@ namespace System.ServiceModel.Description
                        if (ob.@DocumentationElement != null) {
                                XmlNode o29 = ob.@DocumentationElement;
                                if (o29 is XmlElement) {
-                               if ((o29.Name == "documentation" && o29.NamespaceURI == "http://schemas.xmlsoap.org/wsdl/")) {
+                               if ((o29.LocalName == "documentation" && o29.NamespaceURI == "http://schemas.xmlsoap.org/wsdl/")) {
                                        }
                                        else o29.WriteTo (Writer);
                                        WriteElementLiteral (o29, "", "", false, true);
                                }
                                else
-                                       throw CreateUnknownAnyElementException (o29.Name, o29.NamespaceURI);
+                                       throw CreateUnknownAnyElementException (o29.LocalName, o29.NamespaceURI);
                        }
                        if (ob.@Operations != null) {
                                for (int n30 = 0; n30 < ob.@Operations.Count; n30++) {
@@ -569,13 +569,13 @@ namespace System.ServiceModel.Description
                        if (ob.@DocumentationElement != null) {
                                XmlNode o33 = ob.@DocumentationElement;
                                if (o33 is XmlElement) {
-                               if ((o33.Name == "documentation" && o33.NamespaceURI == "http://schemas.xmlsoap.org/wsdl/")) {
+                               if ((o33.LocalName == "documentation" && o33.NamespaceURI == "http://schemas.xmlsoap.org/wsdl/")) {
                                        }
                                        else o33.WriteTo (Writer);
                                        WriteElementLiteral (o33, "", "", false, true);
                                }
                                else
-                                       throw CreateUnknownAnyElementException (o33.Name, o33.NamespaceURI);
+                                       throw CreateUnknownAnyElementException (o33.LocalName, o33.NamespaceURI);
                        }
                        if (ob.@Ports != null) {
                                for (int n34 = 0; n34 < ob.@Ports.Count; n34++) {
@@ -621,13 +621,13 @@ namespace System.ServiceModel.Description
                        if (ob.@DocumentationElement != null) {
                                XmlNode o37 = ob.@DocumentationElement;
                                if (o37 is XmlElement) {
-                               if ((o37.Name == "documentation" && o37.NamespaceURI == "http://schemas.xmlsoap.org/wsdl/")) {
+                               if ((o37.LocalName == "documentation" && o37.NamespaceURI == "http://schemas.xmlsoap.org/wsdl/")) {
                                        }
                                        else o37.WriteTo (Writer);
                                        WriteElementLiteral (o37, "", "", false, true);
                                }
                                else
-                                       throw CreateUnknownAnyElementException (o37.Name, o37.NamespaceURI);
+                                       throw CreateUnknownAnyElementException (o37.LocalName, o37.NamespaceURI);
                        }
                        if (writeWrappingElem) WriteEndElement (ob);
                }
@@ -669,13 +669,13 @@ namespace System.ServiceModel.Description
                        if (ob.@DocumentationElement != null) {
                                XmlNode o40 = ob.@DocumentationElement;
                                if (o40 is XmlElement) {
-                               if ((o40.Name == "documentation" && o40.NamespaceURI == "http://schemas.xmlsoap.org/wsdl/")) {
+                               if ((o40.LocalName == "documentation" && o40.NamespaceURI == "http://schemas.xmlsoap.org/wsdl/")) {
                                        }
                                        else o40.WriteTo (Writer);
                                        WriteElementLiteral (o40, "", "", false, true);
                                }
                                else
-                                       throw CreateUnknownAnyElementException (o40.Name, o40.NamespaceURI);
+                                       throw CreateUnknownAnyElementException (o40.LocalName, o40.NamespaceURI);
                        }
                        if (ob.@Faults != null) {
                                for (int n41 = 0; n41 < ob.@Faults.Count; n41++) {
@@ -731,13 +731,13 @@ namespace System.ServiceModel.Description
                        if (ob.@DocumentationElement != null) {
                                XmlNode o45 = ob.@DocumentationElement;
                                if (o45 is XmlElement) {
-                               if ((o45.Name == "documentation" && o45.NamespaceURI == "http://schemas.xmlsoap.org/wsdl/")) {
+                               if ((o45.LocalName == "documentation" && o45.NamespaceURI == "http://schemas.xmlsoap.org/wsdl/")) {
                                        }
                                        else o45.WriteTo (Writer);
                                        WriteElementLiteral (o45, "", "", false, true);
                                }
                                else
-                                       throw CreateUnknownAnyElementException (o45.Name, o45.NamespaceURI);
+                                       throw CreateUnknownAnyElementException (o45.LocalName, o45.NamespaceURI);
                        }
                        if (ob.@Faults != null) {
                                for (int n46 = 0; n46 < ob.@Faults.Count; n46++) {
@@ -784,13 +784,13 @@ namespace System.ServiceModel.Description
                        if (ob.@DocumentationElement != null) {
                                XmlNode o49 = ob.@DocumentationElement;
                                if (o49 is XmlElement) {
-                               if ((o49.Name == "documentation" && o49.NamespaceURI == "http://schemas.xmlsoap.org/wsdl/")) {
+                               if ((o49.LocalName == "documentation" && o49.NamespaceURI == "http://schemas.xmlsoap.org/wsdl/")) {
                                        }
                                        else o49.WriteTo (Writer);
                                        WriteElementLiteral (o49, "", "", false, true);
                                }
                                else
-                                       throw CreateUnknownAnyElementException (o49.Name, o49.NamespaceURI);
+                                       throw CreateUnknownAnyElementException (o49.LocalName, o49.NamespaceURI);
                        }
                        if (writeWrappingElem) WriteEndElement (ob);
                }
@@ -830,13 +830,13 @@ namespace System.ServiceModel.Description
                        if (ob.@DocumentationElement != null) {
                                XmlNode o52 = ob.@DocumentationElement;
                                if (o52 is XmlElement) {
-                               if ((o52.Name == "documentation" && o52.NamespaceURI == "http://schemas.xmlsoap.org/wsdl/")) {
+                               if ((o52.LocalName == "documentation" && o52.NamespaceURI == "http://schemas.xmlsoap.org/wsdl/")) {
                                        }
                                        else o52.WriteTo (Writer);
                                        WriteElementLiteral (o52, "", "", false, true);
                                }
                                else
-                                       throw CreateUnknownAnyElementException (o52.Name, o52.NamespaceURI);
+                                       throw CreateUnknownAnyElementException (o52.LocalName, o52.NamespaceURI);
                        }
                        if (writeWrappingElem) WriteEndElement (ob);
                }
@@ -876,13 +876,13 @@ namespace System.ServiceModel.Description
                        if (ob.@DocumentationElement != null) {
                                XmlNode o55 = ob.@DocumentationElement;
                                if (o55 is XmlElement) {
-                               if ((o55.Name == "documentation" && o55.NamespaceURI == "http://schemas.xmlsoap.org/wsdl/")) {
+                               if ((o55.LocalName == "documentation" && o55.NamespaceURI == "http://schemas.xmlsoap.org/wsdl/")) {
                                        }
                                        else o55.WriteTo (Writer);
                                        WriteElementLiteral (o55, "", "", false, true);
                                }
                                else
-                                       throw CreateUnknownAnyElementException (o55.Name, o55.NamespaceURI);
+                                       throw CreateUnknownAnyElementException (o55.LocalName, o55.NamespaceURI);
                        }
                        if (writeWrappingElem) WriteEndElement (ob);
                }
@@ -922,13 +922,13 @@ namespace System.ServiceModel.Description
                        if (ob.@DocumentationElement != null) {
                                XmlNode o58 = ob.@DocumentationElement;
                                if (o58 is XmlElement) {
-                               if ((o58.Name == "documentation" && o58.NamespaceURI == "http://schemas.xmlsoap.org/wsdl/")) {
+                               if ((o58.LocalName == "documentation" && o58.NamespaceURI == "http://schemas.xmlsoap.org/wsdl/")) {
                                        }
                                        else o58.WriteTo (Writer);
                                        WriteElementLiteral (o58, "", "", false, true);
                                }
                                else
-                                       throw CreateUnknownAnyElementException (o58.Name, o58.NamespaceURI);
+                                       throw CreateUnknownAnyElementException (o58.LocalName, o58.NamespaceURI);
                        }
                        if (writeWrappingElem) WriteEndElement (ob);
                }
@@ -967,13 +967,13 @@ namespace System.ServiceModel.Description
                        if (ob.@DocumentationElement != null) {
                                XmlNode o61 = ob.@DocumentationElement;
                                if (o61 is XmlElement) {
-                               if ((o61.Name == "documentation" && o61.NamespaceURI == "http://schemas.xmlsoap.org/wsdl/")) {
+                               if ((o61.LocalName == "documentation" && o61.NamespaceURI == "http://schemas.xmlsoap.org/wsdl/")) {
                                        }
                                        else o61.WriteTo (Writer);
                                        WriteElementLiteral (o61, "", "", false, true);
                                }
                                else
-                                       throw CreateUnknownAnyElementException (o61.Name, o61.NamespaceURI);
+                                       throw CreateUnknownAnyElementException (o61.LocalName, o61.NamespaceURI);
                        }
                        if (writeWrappingElem) WriteEndElement (ob);
                }
@@ -1012,13 +1012,13 @@ namespace System.ServiceModel.Description
                        if (ob.@DocumentationElement != null) {
                                XmlNode o64 = ob.@DocumentationElement;
                                if (o64 is XmlElement) {
-                               if ((o64.Name == "documentation" && o64.NamespaceURI == "http://schemas.xmlsoap.org/wsdl/")) {
+                               if ((o64.LocalName == "documentation" && o64.NamespaceURI == "http://schemas.xmlsoap.org/wsdl/")) {
                                        }
                                        else o64.WriteTo (Writer);
                                        WriteElementLiteral (o64, "", "", false, true);
                                }
                                else
-                                       throw CreateUnknownAnyElementException (o64.Name, o64.NamespaceURI);
+                                       throw CreateUnknownAnyElementException (o64.LocalName, o64.NamespaceURI);
                        }
                        if (writeWrappingElem) WriteEndElement (ob);
                }
@@ -1057,13 +1057,13 @@ namespace System.ServiceModel.Description
                        if (ob.@DocumentationElement != null) {
                                XmlNode o67 = ob.@DocumentationElement;
                                if (o67 is XmlElement) {
-                               if ((o67.Name == "documentation" && o67.NamespaceURI == "http://schemas.xmlsoap.org/wsdl/")) {
+                               if ((o67.LocalName == "documentation" && o67.NamespaceURI == "http://schemas.xmlsoap.org/wsdl/")) {
                                        }
                                        else o67.WriteTo (Writer);
                                        WriteElementLiteral (o67, "", "", false, true);
                                }
                                else
-                                       throw CreateUnknownAnyElementException (o67.Name, o67.NamespaceURI);
+                                       throw CreateUnknownAnyElementException (o67.LocalName, o67.NamespaceURI);
                        }
                        if (writeWrappingElem) WriteEndElement (ob);
                }
index fe05194d15b9e2054b90e581a3e7bdb55ea01ab3..1fcb4e2c413219142c6373d833efc88a60b68263 100644 (file)
@@ -5,6 +5,9 @@ using System.ServiceModel.Channels;
 using System.ServiceModel.Security;
 using System.ServiceModel.Security.Tokens;
 using System.Text;
+using System.IO;
+using System.Xml;
+using System.Net.Sockets;
 
 namespace System.ServiceModel.Dispatcher
 {
@@ -24,8 +27,34 @@ namespace System.ServiceModel.Dispatcher
                        using (new OperationContextScope (mrc.OperationContext)) {
                                try {
                                        process_handlers_chain.ProcessRequestChain (mrc);
-                               }
-                               catch (Exception e) {
+                               } catch (IOException e) {
+                                       // FIXME?: On dropped connection do not
+                                       // dump a stacktrace, but should be safe
+                                       // to dump a console message as in
+                                       // default exception handler and 
+                                       // call error_handlers_chain
+                                       Console.WriteLine ("I/O Error (Dropped Connection?): " + e.Message);
+                                       mrc.ProcessingException = e;
+                                       error_handlers_chain.ProcessRequestChain (mrc);
+                               } catch (SocketException e) {
+                                       // FIXME?: On dropped connection do not
+                                       // dump a stacktrace, but should be safe
+                                       // to dump a console message as in
+                                       // default exception handler and 
+                                       // call error_handlers_chain
+                                       Console.WriteLine ("SocketExcpetion (Dropped Connection?): " + e.Message);
+                                       mrc.ProcessingException = e;
+                                       error_handlers_chain.ProcessRequestChain (mrc);
+                               } catch (XmlException e) {
+                                       // FIXME?: On dropped connection do not
+                                       // dump a stacktrace, but should be safe
+                                       // to dump a console message as in
+                                       // default exception handler and 
+                                       // call error_handlers_chain
+                                       Console.WriteLine ("XmlException (Dropped Connection?): " + e.Message);
+                                       mrc.ProcessingException = e;
+                                       error_handlers_chain.ProcessRequestChain (mrc);                         
+                               } catch (Exception e) {
                                        // FIXME: this is not really expected use of ChannelDispatcher.ErrorHandlers.
                                        // They are now correctly used in process_handler_chain (namely OperationInvokerHandler).
                                        // For this kind of "outsider" exceptions are actually left thrown
index 15731e65a3a594d4909d5bdf3a59236debb2f5ab..ca5e2e34c81bbd40723ec97a1865f59a52b58207 100644 (file)
@@ -35,6 +35,9 @@ using System.Threading;
 using System.Transactions;
 using System.ServiceModel;
 using System.ServiceModel.Description;
+using System.Net.Sockets;
+using System.Xml;
+using System.IO;
 
 namespace System.ServiceModel.Dispatcher
 {
@@ -598,7 +601,10 @@ namespace System.ServiceModel.Dispatcher
                                        if (ProcessErrorWithHandlers (reply, ex, out res))
                                                return;
 
-                                       rc.Reply (res);
+                                       if ((!(ex is SocketException)) && 
+                                           (!(ex is XmlException)) &&
+                                           (!(ex is IOException)))
+                                               rc.Reply (res);
                                        
                                        reply.Close (owner.DefaultCloseTimeout); // close the channel
                                } finally {
index 05e07afab2b6271f4fc3649de17a22cc478b0a85..ba5cbc29e9b1aad772092021c8bb486f69df3cdf 100644 (file)
@@ -251,8 +251,8 @@ namespace MonoTests.System.ServiceModel.Security
                        sw = new StringWriter ();
                        using (XmlWriter w = XmlWriter.Create (sw, GetWriterSettings ())) {
                                new WSSecurityTokenSerializer (SecurityVersion.WSSecurity10).WriteKeyIdentifierClause (w, ic);
-                       Assert.AreEqual (expected, sw.ToString (), "WSS1.0");
                        }
+                       Assert.AreEqual (expected, sw.ToString (), "WSS1.0");
                }
 
                [Test]
index 45b3d356a676e6eb257d9a2ffea922174024f272..03a3921653f9278630c5eea8a1416fa633a7b61f 100644 (file)
@@ -1576,7 +1576,7 @@ namespace MonoTests.System.Web.UI.WebControls
 #if DOT_NET
                        string origHtml = "<table id=\"MyWizard_SideBarList\" cellspacing=\"0\" style=\"border-collapse:collapse;\">\r\n\t<tr>\r\n\t\t<td style=\"font-weight:bold;\"><a id=\"MyWizard_SideBarList_SideBarButton_0\" href=\"javascript:__doPostBack(&#39;MyWizard$SideBarList$ctl00$SideBarButton&#39;,&#39;&#39;)\">step1</a></td>\r\n\t</tr>\r\n</table><table cellspacing=\"5\" cellpadding=\"5\">\r\n\t<tr>\r\n\t\t<td align=\"right\"><input type=\"submit\" name=\"MyWizard$StepNavigationTemplateContainerID$StepPreviousButton\" value=\"Previous\" id=\"MyWizard_StepNavigationTemplateContainerID_StepPreviousButton\" /></td><td align=\"right\"><input type=\"submit\" name=\"MyWizard$StepNavigationTemplateContainerID$StepNextButton\" value=\"Next\" id=\"MyWizard_StepNavigationTemplateContainerID_StepNextButton\" /></td>\r\n\t</tr>\r\n</table>Step";
 #else
-                       string origHtml = "<table id=\"MyWizard_SideBarList\" cellspacing=\"0\" style=\"border-collapse:collapse;\">\r\n\t<tr>\r\n\t\t<td style=\"font-weight:bold;\"><a id=\"MyWizard_SideBarList_ctl00_SideBarButton_0\" href=\"javascript:__doPostBack(&#39;MyWizard$SideBarList$ctl00$SideBarButton&#39;,&#39;&#39;)\">step1</a></td>\r\n\t</tr>\r\n</table><table cellspacing=\"5\" cellpadding=\"5\">\r\n\t<tr>\r\n\t\t<td align=\"right\"><input type=\"submit\" name=\"MyWizard$StepNavigationTemplateContainerID$StepPreviousButton\" value=\"Previous\" id=\"MyWizard_StepNavigationTemplateContainerID_StepPreviousButton\" /></td><td align=\"right\"><input type=\"submit\" name=\"MyWizard$StepNavigationTemplateContainerID$StepNextButton\" value=\"Next\" id=\"MyWizard_StepNavigationTemplateContainerID_StepNextButton\" /></td>\r\n\t</tr>\r\n</table>Step";
+                       string origHtml = "<table id=\"MyWizard_SideBarList\" cellspacing=\"0\" style=\"border-collapse:collapse;\">\r\n\t<tr>\r\n\t\t<td style=\"font-weight:bold;\"><a id=\"MyWizard_SideBarList_ctl00_SideBarButton_0\" href=\"javascript:__doPostBack(&#39;MyWizard$SideBarList$ctl00$SideBarButton&#39;,&#39;&#39;)\">step1</a></td>\n\t</tr>\n</table><table cellspacing=\"5\" cellpadding=\"5\">\r\n\t<tr>\r\n\t\t<td align=\"right\"><input type=\"submit\" name=\"MyWizard$StepNavigationTemplateContainerID$StepPreviousButton\" value=\"Previous\" id=\"MyWizard_StepNavigationTemplateContainerID_StepPreviousButton\" /></td><td align=\"right\"><input type=\"submit\" name=\"MyWizard$StepNavigationTemplateContainerID$StepNextButton\" value=\"Next\" id=\"MyWizard_StepNavigationTemplateContainerID_StepNextButton\" /></td>\n\t</tr>\n</table>Step";
 #endif
                        string renderedHtml = HtmlDiff.GetControlFromPageHtml (result);
                        Console.WriteLine (origHtml);
@@ -1608,14 +1608,14 @@ namespace MonoTests.System.Web.UI.WebControls
                        WebTest t = new WebTest (PageInvoker.CreateOnInit (LayoutTemplateRender));
                        t.UserData = "RenderHeader";
                        string result = t.Run ();
-                       string origHtml = "Header<table cellspacing=\"5\" cellpadding=\"5\">\r\n\t<tr>\r\n\t\t<td align=\"right\"><input type=\"submit\" name=\"MyWizard$StepNavigationTemplateContainerID$StepPreviousButton\" value=\"Previous\" id=\"MyWizard_StepNavigationTemplateContainerID_StepPreviousButton\" /></td><td align=\"right\"><input type=\"submit\" name=\"MyWizard$StepNavigationTemplateContainerID$StepNextButton\" value=\"Next\" id=\"MyWizard_StepNavigationTemplateContainerID_StepNextButton\" /></td>\r\n\t</tr>\r\n</table>Step";
+                       string origHtml = "Header<table cellspacing=\"5\" cellpadding=\"5\">\r\n\t<tr>\r\n\t\t<td align=\"right\"><input type=\"submit\" name=\"MyWizard$StepNavigationTemplateContainerID$StepPreviousButton\" value=\"Previous\" id=\"MyWizard_StepNavigationTemplateContainerID_StepPreviousButton\" /></td><td align=\"right\"><input type=\"submit\" name=\"MyWizard$StepNavigationTemplateContainerID$StepNextButton\" value=\"Next\" id=\"MyWizard_StepNavigationTemplateContainerID_StepNextButton\" /></td>\n\t</tr>\n</table>Step";
                        string renderedHtml = HtmlDiff.GetControlFromPageHtml (result);
 
                        Assert.AreEqual (origHtml, renderedHtml, "#A1");
 
                        t.UserData = "RenderHeader_InSpan";
                        result = t.Run ();
-                       origHtml = "Header<table cellspacing=\"5\" cellpadding=\"5\">\r\n\t<tr>\r\n\t\t<td align=\"right\"><input type=\"submit\" name=\"MyWizard$StepNavigationTemplateContainerID$StepPreviousButton\" value=\"Previous\" id=\"MyWizard_StepNavigationTemplateContainerID_StepPreviousButton\" /></td><td align=\"right\"><input type=\"submit\" name=\"MyWizard$StepNavigationTemplateContainerID$StepNextButton\" value=\"Next\" id=\"MyWizard_StepNavigationTemplateContainerID_StepNextButton\" /></td>\r\n\t</tr>\r\n</table>Step";
+                       origHtml = "Header<table cellspacing=\"5\" cellpadding=\"5\">\r\n\t<tr>\r\n\t\t<td align=\"right\"><input type=\"submit\" name=\"MyWizard$StepNavigationTemplateContainerID$StepPreviousButton\" value=\"Previous\" id=\"MyWizard_StepNavigationTemplateContainerID_StepPreviousButton\" /></td><td align=\"right\"><input type=\"submit\" name=\"MyWizard$StepNavigationTemplateContainerID$StepNextButton\" value=\"Next\" id=\"MyWizard_StepNavigationTemplateContainerID_StepNextButton\" /></td>\n\t</tr>\n</table>Step";
                        renderedHtml = HtmlDiff.GetControlFromPageHtml (result);
                        Assert.AreEqual (origHtml, renderedHtml, "#A2");
                }
index 892c5c9efee5e48d3cb2d38e99ee472d7cf69243..5f1d98cac4b4a730e019f8929becddc16e92afaf 100644 (file)
@@ -504,7 +504,7 @@ namespace System.Xml.Serialization
                                stype = elem.SchemaType;
                                qname = elem.QualifiedName;
                        }
-                       else if (elem.ElementType == XmlSchemaComplexType.AnyType)
+                       else if (elem.ElementSchemaType == XmlSchemaComplexType.AnyType)
                        {
                                qname = anyType;
                                return true;
index cac80bc25e23e5378d7389b55179504ce27c1546..15eefabd83e417de7bf315d85a68f249bedb25e7 100644 (file)
@@ -797,7 +797,7 @@ namespace System.Xml.Serialization
                        if (wrapped)
                                reader.ReadStartElement ();
                        reader.MoveToContent ();
-                       XmlDocument doc = new XmlDocument ();
+                       XmlDocument doc = new XmlDocument (reader.NameTable);
                        XmlNode node = doc.ReadNode (reader);
                        doc.AppendChild (node);
                        
index 0dad3a2fc9387b07d08c35054849ca1ada83af63..5a384918413d0c9e4118055e2fe0e18e3a544d69 100644 (file)
@@ -241,6 +241,8 @@ namespace System.Xaml
                        // change XamlXmlReader too if we change here.
                        if ((value as string) == String.Empty) // FIXME: there could be some escape syntax.
                                return "\"\"";
+                       if (value is string)
+                               return (string) value;
 
                        var xt = value == null ? XamlLanguage.Null : sctx.GetXamlType (value.GetType ());
                        var vs = xm.ValueSerializer ?? xt.ValueSerializer;
index e048c99d92294095230345a0a2f8c995dce75753..4d2a6571d95c795539c7cde22ede9ec74f0ce4a5 100755 (executable)
@@ -119,6 +119,7 @@ namespace System.Xaml
 
                        intl.CloseAll ();
 
+                       w.Flush ();
                        if (settings.CloseOutput)
                                w.Close ();
                }
index 7aa0bb9f00981753e626665aa9c179e2ab634866..4c167d8094a73e45e8e4ec8ccc04a1320ffdc166 100644 (file)
@@ -84,15 +84,27 @@ namespace System.Xml.Schema
                        while (xr.Read ()) {
                                if (addSchemaInfo) {
                                        if (xr.NodeType == XmlNodeType.Element) {
-                                               xsource.CurrentNode.AddAnnotation (xr.SchemaInfo);
+                                               xsource.CurrentNode.AddAnnotation (CopySchemaInfo (xr.SchemaInfo));
                                                while (xr.MoveToNextAttribute ())
                                                        if (xr.NamespaceURI != XUtil.XmlnsNamespace)
-                                                               xsource.GetCurrentAttribute ().AddAnnotation (xr.SchemaInfo);
+                                                               xsource.GetCurrentAttribute ().AddAnnotation (CopySchemaInfo (xr.SchemaInfo));
                                                xr.MoveToElement ();
                                        }
                                }
                        }
                }
+               
+               static XmlSchemaInfo CopySchemaInfo (IXmlSchemaInfo src)
+               {
+                       return new XmlSchemaInfo () {
+                               IsDefault = src.IsDefault,
+                               IsNil = src.IsNil,
+                               MemberType = src.MemberType,
+                               SchemaAttribute = src.SchemaAttribute,
+                               SchemaElement = src.SchemaElement,
+                               SchemaType = src.SchemaType,
+                               Validity = src.Validity };
+               }
 
                [MonoTODO]
                public static void Validate (this XElement source, XmlSchemaObject partialValidationType, XmlSchemaSet schemas, ValidationEventHandler validationEventHandler)
index f5aa6a975018768f067e2fab5b79084c20bab36c..85236a2dc27e54b18320a6882d62ea018e7f7c00 100644 (file)
@@ -27,6 +27,8 @@ LIB_MCS_FLAGS = -nowarn:618 -d:CONFIGURATION_2_0 $(REFERENCE_SOURCES_FLAGS) -uns
 TEST_MCS_FLAGS += -r:System.Configuration
 PROFILE_ANY_MOBILE := $(filter monotouch monotouch_runtime monodroid xammac mobile mobile_static, $(PROFILE))
 
+RESOURCE_STRINGS = ../../../external/referencesource/System/System.txt
+
 ifeq (2.1, $(FRAMEWORK_VERSION))
 LIB_MCS_FLAGS += -d:INSIDE_SYSTEM
 endif
index 02f2087cc422e29df21c4a1999a5041318332727..4b69010b975f59370e4afc85cabae0f96640dcfd 100644 (file)
@@ -706,7 +706,7 @@ namespace System.Configuration
                                        value.SerializedValue = element.Value.ValueXml.InnerXml;
                                        break;
                                case SettingsSerializeAs.String:
-                                       value.SerializedValue = element.Value.ValueXml.InnerText;
+                                       value.SerializedValue = element.Value.ValueXml.InnerText.Trim ();
                                        break;
                                case SettingsSerializeAs.Binary:
                                        value.SerializedValue = Convert.FromBase64String (element.Value.ValueXml.InnerText);
index fdfca13559ba1920f668b54c88359f1379ad64f1..88f774ad099edd5bf6a599438616d72972063f2b 100644 (file)
@@ -40,12 +40,12 @@ namespace System.IO.Compression {
        {
                private DeflateStream deflateStream;
 
-               public GZipStream (Stream compressedStream, CompressionMode mode) :
-                       this (compressedStream, mode, false) {
+               public GZipStream (Stream stream, CompressionMode mode) :
+                       this (stream, mode, false) {
                }
 
-               public GZipStream (Stream compressedStream, CompressionMode mode, bool leaveOpen) {
-                       this.deflateStream = new DeflateStream (compressedStream, mode, leaveOpen, true);
+               public GZipStream (Stream stream, CompressionMode mode, bool leaveOpen) {
+                       this.deflateStream = new DeflateStream (stream, mode, leaveOpen, true);
                }
                
                
index 8acf7ad25445a29a9f0ba2a9c4ca9475c6640dbe..f6837b0e114d1014b371573904a941dcda2ee71b 100644 (file)
@@ -400,19 +400,19 @@ namespace MonoTests.System.Configuration {
                        var holder = new Bug8592ConfHolder ();
                        holder.Reset ();
                        holder.Save ();
-                       Assert.AreEqual ("", holder.TestKey1OnHolder);
+                       Assert.AreEqual ("", holder.TestKey1OnHolder, "#1");
                        holder.TestKey1OnHolder = "candy";
-                       Assert.AreEqual ("candy", holder.TestKey1OnHolder);
+                       Assert.AreEqual ("candy", holder.TestKey1OnHolder, "#2");
                        holder.Reload ();
-                       Assert.AreEqual ("", holder.TestKey1OnHolder);
+                       Assert.AreEqual ("", holder.TestKey1OnHolder, "#3");
                        holder.TestKey1OnHolder = "candy";
-                       Assert.AreEqual ("candy", holder.TestKey1OnHolder);
+                       Assert.AreEqual ("candy", holder.TestKey1OnHolder, "#4");
                        holder.Save ();
-                       Assert.AreEqual ("candy", holder.TestKey1OnHolder);
+                       Assert.AreEqual ("candy", holder.TestKey1OnHolder, "#5");
                        holder.Reload ();
-                       Assert.AreEqual ("candy", holder.TestKey1OnHolder);
+                       Assert.AreEqual ("candy", holder.TestKey1OnHolder, "#6");
                        holder.Reset ();
-                       Assert.AreEqual ("", holder.TestKey1OnHolder);
+                       Assert.AreEqual ("", holder.TestKey1OnHolder, "#7");
                }
 
                class Bug8533ConfHolder1 : ApplicationSettingsBase {
@@ -453,19 +453,22 @@ namespace MonoTests.System.Configuration {
                public void TestBug8533ConfHandlerWronglyMixedUp ()
                {
                        var holder1 = new Bug8533ConfHolder1 ();
-                       var holder2 = new Bug8533ConfHolder2 ();
                        holder1.TestKey1OnHolder1 = "candy";
-                       holder2.TestKey1OnHolder2 = "donut";
                        holder1.TestKey = "eclair";
+                       Assert.AreEqual ("", holder1.TestKey1OnHolder2, "#-1");
                        holder1.Save ();
-                       holder2.Save ();
+                       Assert.AreEqual ("", holder1.TestKey1OnHolder2, "#0");
                        holder1.Reload ();
+                       
+                       var holder2 = new Bug8533ConfHolder2 ();
+                       holder2.TestKey1OnHolder2 = "donut";
+                       Assert.AreEqual ("", holder1.TestKey1OnHolder2, "#1");
+                       holder2.Save ();
                        holder2.Reload();
-                       Assert.AreEqual ("", holder1.TestKey1OnHolder2);
-                       Assert.AreEqual ("candy", holder1.TestKey1OnHolder1);
-                       Assert.AreEqual ("donut", holder2.TestKey1OnHolder2);
-                       Assert.AreEqual ("eclair", holder1.TestKey);
-                       Assert.AreEqual ("", holder2.TestKey);
+                       Assert.AreEqual ("candy", holder1.TestKey1OnHolder1, "#2");
+                       Assert.AreEqual ("donut", holder2.TestKey1OnHolder2, "#3");
+                       Assert.AreEqual ("eclair", holder1.TestKey, "#4");
+                       Assert.AreEqual ("", holder2.TestKey, "#5");
                }
        }
 }
index 606f38b820a09242e7f9d5a94522c4c6a1d4774c..794f6b8309c60a4c5ddd3bb62b5e665f7347f566 100644 (file)
@@ -60,8 +60,9 @@ namespace System.Windows {
                        throw new NotImplementedException ();
                }
 
-               string IFormattable.ToString(string format, IFormatProvider formatProvider) {
-                       throw new NotImplementedException ();
+               string IFormattable.ToString (string format, IFormatProvider provider)
+               {
+                       return string.Format (provider, "{0:" + format + "},{1:" + format + "}", x, y);
                }
 
                public static bool Equals (Vector vector1, Vector vector2)
index 2df448645d71441cbae9355130111fe6d0b47ad9..1c17c8088614de06c7097dad9783b7fdd1df4991 100644 (file)
@@ -6,7 +6,7 @@ export __SECURITY_BOOTSTRAP_DB=$(topdir)/class/corlib
 LIBRARY = corlib.dll
 LIBRARY_NAME = mscorlib.dll
 
-REFERENCE_SOURCES_FLAGS = -d:FEATURE_PAL,PFX_LEGACY_3_5 -d:MONO
+REFERENCE_SOURCES_FLAGS = -d:FEATURE_PAL,PFX_LEGACY_3_5 -d:MONO -d:MONO_HYBRID_ENCODING_SUPPORT
 LIB_MCS_FLAGS = $(REFERENCE_SOURCES_FLAGS) $(RESOURCE_FILES:%=-resource:%)
 
 #LIBRARY_USE_INTERMEDIATE_FILE = yes
@@ -21,6 +21,8 @@ $(error Unknown framework version)
 endif
 endif
 
+RESOURCE_STRINGS = ../../../external/referencesource/mscorlib/mscorlib.txt
+
 LIBRARY_COMPILE = $(BOOT_COMPILE)
 LIBRARY_INSTALL_DIR = $(mono_libdir)/mono/$(FRAMEWORK_VERSION)
 
@@ -34,7 +36,14 @@ RESOURCE_FILES = \
        resources/collation.cjkKO.bin \
        resources/collation.cjkKOlv2.bin
 
-REFERENCE_SOURCES_FLAGS = -d:FEATURE_PAL,GENERICS_WORK,FEATURE_LIST_PREDICATES,FEATURE_SERIALIZATION
+REFERENCE_SOURCES_FLAGS = -d:FEATURE_PAL,GENERICS_WORK,FEATURE_LIST_PREDICATES,FEATURE_SERIALIZATION,FEATURE_ASCII,FEATURE_LATIN1,FEATURE_UTF7,FEATURE_UTF32,MONO_HYBRID_ENCODING_SUPPORT,FEATURE_ASYNC_IO,NEW_EXPERIMENTAL_ASYNC_IO,FEATURE_UTF32
+
+MOBILE_STATIC := $(filter mobile_static monotouch monotouch_runtime, $(PROFILE))
+
+ifndef MOBILE_STATIC
+REFERENCE_SOURCES_FLAGS += -d:FEATURE_REMOTING
+endif
+
 LOCAL_MCS_FLAGS = -unsafe -nostdlib -nowarn:612,618 -d:INSIDE_CORLIB,MONO_CULTURE_DATA -d:LIBC $(REFERENCE_SOURCES_FLAGS)
 DEFAULT_REFERENCES =
 
index 3a8ceb9ca3ee8a7ff850137d694423bcbbf9f854..a2962277268d29f626127c4d5653d4148b8234cf 100644 (file)
@@ -1,4 +1,3 @@
-
 using System.Reflection;
 using System.Security;
 using System.Runtime.Versioning;
@@ -11,5 +10,15 @@ namespace System {
                {
                        return ".NETFramework,Version=v4.5";
                }
+
+               internal static bool IsAppXModel ()
+               {
+                       return false;
+               }
+
+               internal static bool IsAppXDesignMode ()
+               {
+                       return false;
+               }
        }
 }
index 753bc2d25a99d21c01250924a3774c302ae6e2e6..06cead9120747bc60aba536c396f181b60bf2b6e 100644 (file)
@@ -2,6 +2,14 @@ using System.Diagnostics;
 
 namespace System
 {
+    internal enum LogLevel {
+        Trace  = 0,
+        Status = 20,
+        Warning= 40,
+        Error  = 50,
+        Panic  = 100,
+    }
+
        static class BCLDebug
        {
                [Conditional("_DEBUG")]
@@ -18,5 +26,20 @@ namespace System
                static public void Log (string message)
                {
                }
+
+               [Conditional("_DEBUG")]
+               static public void Log (string switchName, string message)
+               {
+               }
+
+               [Conditional("_DEBUG")]
+               public static void Log (string switchName, LogLevel level, params object[] messages)
+               {
+               }
+
+               [Conditional("_DEBUG")]
+               internal static void Perf (bool expr, string msg)
+               {
+               }
        }
-}
\ No newline at end of file
+}
index e21e6d04240dc02c793fc5e1de54c0b2758c933f..ba5dba8e652eb1008f7f6b1745c06f540135ff1f 100644 (file)
@@ -31,5 +31,6 @@ namespace System
        static class CompatibilitySwitches
        {
                public const bool IsAppEarlierThanSilverlight4 = false;
+               public const bool IsAppEarlierThanWindowsPhone8 = false;
        }
 }
\ No newline at end of file
diff --git a/mcs/class/corlib/ReferenceSources/EncodingDataItem.cs b/mcs/class/corlib/ReferenceSources/EncodingDataItem.cs
new file mode 100644 (file)
index 0000000..448bbcd
--- /dev/null
@@ -0,0 +1,123 @@
+// ==++==
+// 
+//   Copyright (c) Microsoft Corporation.  All rights reserved.
+// 
+// ==--==
+namespace System.Globalization {
+    using System.Text;
+    using System.Runtime.Remoting;
+    using System;
+    using System.Security;
+
+    //
+    // Data item for EncodingTable.  Along with EncodingTable, they are used by 
+    // System.Text.Encoding.
+    // 
+    // This class stores a pointer to the internal data and the index into that data
+    // where our required information is found.  We load the code page, flags and uiFamilyCodePage
+    // immediately because they don't require creating an object.  Creating any of the string
+    // names is delayed until somebody actually asks for them and the names are then cached.
+    
+    [Serializable]
+    internal class CodePageDataItem
+    {
+        internal int    m_dataIndex;
+        internal int    m_uiFamilyCodePage;
+        internal String m_webName;
+        internal String m_headerName;
+        internal String m_bodyName;
+        internal uint   m_flags;
+    
+        [SecurityCritical]
+        unsafe internal CodePageDataItem(int dataIndex) {
+            m_dataIndex = dataIndex;
+            m_uiFamilyCodePage = EncodingTable.codePageDataPtr[dataIndex].uiFamilyCodePage;
+            m_flags = EncodingTable.codePageDataPtr[dataIndex].flags;
+        }
+
+               static readonly char [] sep = {'|'};
+
+        [System.Security.SecurityCritical]
+        unsafe internal static String CreateString(string pStrings, uint index)
+        {
+            if (pStrings[0] == '|') // |str1|str2|str3
+            {
+                               return pStrings.Split (sep, StringSplitOptions.RemoveEmptyEntries) [index];
+                               /*
+                int start = 1;
+                
+                for (int i = 1; true; i ++)
+                {
+                    sbyte ch = pStrings[i];
+
+                    if ((ch == '|') || (ch == 0))
+                    {
+                        if (index == 0)
+                        {
+                            return new String(pStrings, start, i - start);
+                        }
+
+                        index --;
+                        start = i + 1;
+
+                        if (ch == 0)
+                        {
+                            break;
+                        }
+                    }
+                }
+
+                throw new ArgumentException("pStrings");
+                */
+            }
+            else
+            {
+                               return pStrings;
+                //return new String(pStrings);
+            }
+        }
+
+        unsafe public String WebName {
+            [System.Security.SecuritySafeCritical]  // auto-generated
+            get {
+                if (m_webName==null) {
+                    m_webName = CreateString(EncodingTable.codePageDataPtr[m_dataIndex].Names, 0);
+                }
+                return m_webName;
+            }
+        }
+    
+        public virtual int UIFamilyCodePage {
+            get {
+                return m_uiFamilyCodePage;
+            }
+        }
+    
+        unsafe public String HeaderName {
+            [System.Security.SecuritySafeCritical]  // auto-generated
+            get {
+                if (m_headerName==null) {
+                    m_headerName = CreateString(EncodingTable.codePageDataPtr[m_dataIndex].Names, 1);
+                }
+                return m_headerName;
+            }
+        }
+    
+        unsafe public String BodyName {
+            [System.Security.SecuritySafeCritical]  // auto-generated
+            get {
+                if (m_bodyName==null) {
+                    m_bodyName = CreateString(EncodingTable.codePageDataPtr[m_dataIndex].Names, 2);
+                }
+                return m_bodyName;
+            }
+        }    
+
+        unsafe public uint Flags {
+            get {
+                return (m_flags);
+            }
+        }
+    }
+}
+
diff --git a/mcs/class/corlib/ReferenceSources/EncodingTable.cs b/mcs/class/corlib/ReferenceSources/EncodingTable.cs
new file mode 100644 (file)
index 0000000..4f768cf
--- /dev/null
@@ -0,0 +1,957 @@
+// Copyright (c) Microsoft. All rights reserved.
+// Licensed under the MIT license. See LICENSE file in the project root for full license information.
+
+namespace System.Globalization
+{
+    using System;
+    using System.Text;
+    using System.Collections;
+    using System.Collections.Generic;
+    using System.Runtime.CompilerServices;
+    using System.Runtime.InteropServices;
+    using System.Runtime.Versioning;
+    using System.Security;
+    using System.Threading;
+    using System.Diagnostics.Contracts;
+
+
+       internal static partial class EncodingTable
+       {
+        static int GetNumEncodingItems ()
+        {
+                       return encodingDataPtr.Length;
+               }
+               
+#region "from coreclr/src/classlibnative/nls/encodingdata.cpp"
+// as of d921298
+
+       static InternalEncodingDataItem ENC (string name, ushort cp) { return new InternalEncodingDataItem () { webName = name, codePage = cp }; }
+       
+        internal static InternalEncodingDataItem [] encodingDataPtr = new InternalEncodingDataItem [] {
+#if FEATURE_CORECLR
+    // encoding name, codepage.
+    ENC ("ANSI_X3.4-1968", 20127 ),
+    ENC ("ANSI_X3.4-1986", 20127 ),
+    ENC ("ascii", 20127 ),
+    ENC ("cp367", 20127 ),
+    ENC ("cp819", 28591 ),
+    ENC ("csASCII", 20127 ),
+    ENC ("csISOLatin1", 28591 ),
+    ENC ("csUnicode11UTF7", 65000 ),
+    ENC ("IBM367", 20127 ),
+    ENC ("ibm819", 28591 ),
+    ENC ("ISO-10646-UCS-2", 1200 ),
+    ENC ("iso-8859-1", 28591 ),
+    ENC ("iso-ir-100", 28591 ),
+    ENC ("iso-ir-6", 20127 ),
+    ENC ("ISO646-US", 20127 ),
+    ENC ("iso8859-1", 28591 ),
+    ENC ("ISO_646.irv:1991", 20127 ),
+    ENC ("iso_8859-1", 28591 ),
+    ENC ("iso_8859-1:1987", 28591 ),
+    ENC ("l1", 28591 ),
+    ENC ("latin1", 28591 ),
+    ENC ("ucs-2", 1200 ),
+    ENC ("unicode", 1200), 
+    ENC ("unicode-1-1-utf-7", 65000 ),
+    ENC ("unicode-1-1-utf-8", 65001 ),
+    ENC ("unicode-2-0-utf-7", 65000 ),
+    ENC ("unicode-2-0-utf-8", 65001 ),
+    // People get confused about the FFFE here.  We can't change this because it'd break existing apps.
+    // This has been this way for a long time, including in Mlang.
+    ENC ("unicodeFFFE", 1201),             // Big Endian, BOM seems backwards, think of the BOM in little endian order.
+    ENC ("us", 20127 ),
+    ENC ("us-ascii", 20127 ),
+    ENC ("utf-16", 1200 ),
+    ENC ("UTF-16BE", 1201), 
+    ENC ("UTF-16LE", 1200),        
+    ENC ("utf-32", 12000 ),
+    ENC ("UTF-32BE", 12001 ),
+    ENC ("UTF-32LE", 12000 ),
+    ENC ("utf-7", 65000 ),
+    ENC ("utf-8", 65001 ),
+    ENC ("x-unicode-1-1-utf-7", 65000 ),
+    ENC ("x-unicode-1-1-utf-8", 65001 ),
+    ENC ("x-unicode-2-0-utf-7", 65000 ),
+    ENC ("x-unicode-2-0-utf-8", 65001 ),
+#else
+ // Total Items: 455
+// encoding name, codepage.
+ENC ("437", 437), 
+ENC ("ANSI_X3.4-1968", 20127), 
+ENC ("ANSI_X3.4-1986", 20127), 
+// ENC (L"_autodetect", 50932), 
+// ENC (L"_autodetect_all", 50001), 
+// ENC (L"_autodetect_kr", 50949), 
+ENC ("arabic", 28596), 
+ENC ("ascii", 20127), 
+ENC ("ASMO-708", 708), 
+ENC ("Big5", 950), 
+ENC ("Big5-HKSCS", 950), 
+ENC ("CCSID00858", 858), 
+ENC ("CCSID00924", 20924), 
+ENC ("CCSID01140", 1140), 
+ENC ("CCSID01141", 1141), 
+ENC ("CCSID01142", 1142), 
+ENC ("CCSID01143", 1143), 
+ENC ("CCSID01144", 1144), 
+ENC ("CCSID01145", 1145), 
+ENC ("CCSID01146", 1146), 
+ENC ("CCSID01147", 1147), 
+ENC ("CCSID01148", 1148), 
+ENC ("CCSID01149", 1149), 
+ENC ("chinese", 936), 
+ENC ("cn-big5", 950), 
+ENC ("CN-GB", 936), 
+ENC ("CP00858", 858), 
+ENC ("CP00924", 20924), 
+ENC ("CP01140", 1140), 
+ENC ("CP01141", 1141), 
+ENC ("CP01142", 1142), 
+ENC ("CP01143", 1143), 
+ENC ("CP01144", 1144), 
+ENC ("CP01145", 1145), 
+ENC ("CP01146", 1146), 
+ENC ("CP01147", 1147), 
+ENC ("CP01148", 1148), 
+ENC ("CP01149", 1149), 
+ENC ("cp037", 37), 
+ENC ("cp1025", 21025), 
+ENC ("CP1026", 1026), 
+ENC ("cp1256", 1256), 
+ENC ("CP273", 20273), 
+ENC ("CP278", 20278), 
+ENC ("CP280", 20280), 
+ENC ("CP284", 20284), 
+ENC ("CP285", 20285), 
+ENC ("cp290", 20290), 
+ENC ("cp297", 20297), 
+ENC ("cp367", 20127), 
+ENC ("cp420", 20420), 
+ENC ("cp423", 20423), 
+ENC ("cp424", 20424), 
+ENC ("cp437", 437), 
+ENC ("CP500", 500), 
+ENC ("cp50227", 50227), 
+    //ENC (L"cp50229", 50229), 
+ENC ("cp819", 28591), 
+ENC ("cp850", 850), 
+ENC ("cp852", 852), 
+ENC ("cp855", 855), 
+ENC ("cp857", 857), 
+ENC ("cp858", 858), 
+ENC ("cp860", 860), 
+ENC ("cp861", 861), 
+ENC ("cp862", 862), 
+ENC ("cp863", 863), 
+ENC ("cp864", 864), 
+ENC ("cp865", 865), 
+ENC ("cp866", 866), 
+ENC ("cp869", 869), 
+ENC ("CP870", 870), 
+ENC ("CP871", 20871), 
+ENC ("cp875", 875), 
+ENC ("cp880", 20880), 
+ENC ("CP905", 20905), 
+//ENC (L"cp930", 50930), 
+//ENC (L"cp933", 50933), 
+//ENC (L"cp935", 50935), 
+//ENC (L"cp937", 50937), 
+//ENC (L"cp939", 50939), 
+ENC ("csASCII", 20127), 
+ENC ("csbig5", 950), 
+ENC ("csEUCKR", 51949), 
+ENC ("csEUCPkdFmtJapanese", 51932), 
+ENC ("csGB2312", 936), 
+ENC ("csGB231280", 936), 
+ENC ("csIBM037", 37), 
+ENC ("csIBM1026", 1026), 
+ENC ("csIBM273", 20273), 
+ENC ("csIBM277", 20277), 
+ENC ("csIBM278", 20278), 
+ENC ("csIBM280", 20280), 
+ENC ("csIBM284", 20284), 
+ENC ("csIBM285", 20285), 
+ENC ("csIBM290", 20290), 
+ENC ("csIBM297", 20297), 
+ENC ("csIBM420", 20420), 
+ENC ("csIBM423", 20423), 
+ENC ("csIBM424", 20424), 
+ENC ("csIBM500", 500), 
+ENC ("csIBM870", 870), 
+ENC ("csIBM871", 20871), 
+ENC ("csIBM880", 20880), 
+ENC ("csIBM905", 20905), 
+ENC ("csIBMThai", 20838), 
+ENC ("csISO2022JP", 50221), 
+ENC ("csISO2022KR", 50225), 
+ENC ("csISO58GB231280", 936), 
+ENC ("csISOLatin1", 28591), 
+ENC ("csISOLatin2", 28592), 
+ENC ("csISOLatin3", 28593), 
+ENC ("csISOLatin4", 28594), 
+ENC ("csISOLatin5", 28599), 
+ENC ("csISOLatin9", 28605), 
+ENC ("csISOLatinArabic", 28596), 
+ENC ("csISOLatinCyrillic", 28595), 
+ENC ("csISOLatinGreek", 28597), 
+ENC ("csISOLatinHebrew", 28598), 
+ENC ("csKOI8R", 20866), 
+ENC ("csKSC56011987", 949), 
+ENC ("csPC8CodePage437", 437), 
+ENC ("csShiftJIS", 932), 
+ENC ("csUnicode11UTF7", 65000), 
+ENC ("csWindows31J", 932), 
+ENC ("cyrillic", 28595), 
+ENC ("DIN_66003", 20106), 
+ENC ("DOS-720", 720), 
+ENC ("DOS-862", 862), 
+ENC ("DOS-874", 874), 
+ENC ("ebcdic-cp-ar1", 20420), 
+ENC ("ebcdic-cp-be", 500), 
+ENC ("ebcdic-cp-ca", 37), 
+ENC ("ebcdic-cp-ch", 500), 
+ENC ("EBCDIC-CP-DK", 20277), 
+ENC ("ebcdic-cp-es", 20284), 
+ENC ("ebcdic-cp-fi", 20278), 
+ENC ("ebcdic-cp-fr", 20297), 
+ENC ("ebcdic-cp-gb", 20285), 
+ENC ("ebcdic-cp-gr", 20423), 
+ENC ("ebcdic-cp-he", 20424), 
+ENC ("ebcdic-cp-is", 20871), 
+ENC ("ebcdic-cp-it", 20280), 
+ENC ("ebcdic-cp-nl", 37), 
+ENC ("EBCDIC-CP-NO", 20277), 
+ENC ("ebcdic-cp-roece", 870), 
+ENC ("ebcdic-cp-se", 20278), 
+ENC ("ebcdic-cp-tr", 20905), 
+ENC ("ebcdic-cp-us", 37), 
+ENC ("ebcdic-cp-wt", 37), 
+ENC ("ebcdic-cp-yu", 870), 
+ENC ("EBCDIC-Cyrillic", 20880), 
+ENC ("ebcdic-de-273+euro", 1141), 
+ENC ("ebcdic-dk-277+euro", 1142), 
+ENC ("ebcdic-es-284+euro", 1145), 
+ENC ("ebcdic-fi-278+euro", 1143), 
+ENC ("ebcdic-fr-297+euro", 1147), 
+ENC ("ebcdic-gb-285+euro", 1146), 
+ENC ("ebcdic-international-500+euro", 1148), 
+ENC ("ebcdic-is-871+euro", 1149), 
+ENC ("ebcdic-it-280+euro", 1144), 
+ENC ("EBCDIC-JP-kana", 20290), 
+ENC ("ebcdic-Latin9--euro", 20924), 
+ENC ("ebcdic-no-277+euro", 1142), 
+ENC ("ebcdic-se-278+euro", 1143), 
+ENC ("ebcdic-us-37+euro", 1140), 
+ENC ("ECMA-114", 28596), 
+ENC ("ECMA-118", 28597), 
+ENC ("ELOT_928", 28597), 
+ENC ("euc-cn", 51936), 
+ENC ("euc-jp", 51932), 
+ENC ("euc-kr", 51949), 
+ENC ("Extended_UNIX_Code_Packed_Format_for_Japanese", 51932), 
+ENC ("GB18030", 54936), 
+ENC ("GB2312", 936), 
+ENC ("GB2312-80", 936), 
+ENC ("GB231280", 936), 
+ENC ("GBK", 936), 
+ENC ("GB_2312-80", 936), 
+ENC ("German", 20106), 
+ENC ("greek", 28597), 
+ENC ("greek8", 28597), 
+ENC ("hebrew", 28598), 
+ENC ("hz-gb-2312", 52936), 
+ENC ("IBM-Thai", 20838), 
+ENC ("IBM00858", 858), 
+ENC ("IBM00924", 20924), 
+ENC ("IBM01047", 1047), 
+ENC ("IBM01140", 1140), 
+ENC ("IBM01141", 1141), 
+ENC ("IBM01142", 1142), 
+ENC ("IBM01143", 1143), 
+ENC ("IBM01144", 1144), 
+ENC ("IBM01145", 1145), 
+ENC ("IBM01146", 1146), 
+ENC ("IBM01147", 1147), 
+ENC ("IBM01148", 1148), 
+ENC ("IBM01149", 1149), 
+ENC ("IBM037", 37), 
+ENC ("IBM1026", 1026), 
+ENC ("IBM273", 20273), 
+ENC ("IBM277", 20277), 
+ENC ("IBM278", 20278), 
+ENC ("IBM280", 20280), 
+ENC ("IBM284", 20284), 
+ENC ("IBM285", 20285), 
+ENC ("IBM290", 20290), 
+ENC ("IBM297", 20297), 
+ENC ("IBM367", 20127), 
+ENC ("IBM420", 20420), 
+ENC ("IBM423", 20423), 
+ENC ("IBM424", 20424), 
+ENC ("IBM437", 437), 
+ENC ("IBM500", 500), 
+ENC ("ibm737", 737), 
+ENC ("ibm775", 775), 
+ENC ("ibm819", 28591), 
+ENC ("IBM850", 850), 
+ENC ("IBM852", 852), 
+ENC ("IBM855", 855), 
+ENC ("IBM857", 857), 
+ENC ("IBM860", 860), 
+ENC ("IBM861", 861), 
+ENC ("IBM862", 862), 
+ENC ("IBM863", 863), 
+ENC ("IBM864", 864), 
+ENC ("IBM865", 865), 
+ENC ("IBM866", 866), 
+ENC ("IBM869", 869), 
+ENC ("IBM870", 870), 
+ENC ("IBM871", 20871), 
+ENC ("IBM880", 20880), 
+ENC ("IBM905", 20905), 
+ENC ("irv", 20105), 
+ENC ("ISO-10646-UCS-2", 1200), 
+ENC ("iso-2022-jp", 50220), 
+ENC ("iso-2022-jpeuc", 51932), 
+ENC ("iso-2022-kr", 50225), 
+ENC ("iso-2022-kr-7", 50225), 
+ENC ("iso-2022-kr-7bit", 50225), 
+ENC ("iso-2022-kr-8", 51949), 
+ENC ("iso-2022-kr-8bit", 51949), 
+ENC ("iso-8859-1", 28591), 
+ENC ("iso-8859-11", 874), 
+ENC ("iso-8859-13", 28603), 
+ENC ("iso-8859-15", 28605), 
+ENC ("iso-8859-2", 28592), 
+ENC ("iso-8859-3", 28593), 
+ENC ("iso-8859-4", 28594), 
+ENC ("iso-8859-5", 28595), 
+ENC ("iso-8859-6", 28596), 
+ENC ("iso-8859-7", 28597), 
+ENC ("iso-8859-8", 28598), 
+ENC ("ISO-8859-8 Visual", 28598), 
+ENC ("iso-8859-8-i", 38598), 
+ENC ("iso-8859-9", 28599), 
+ENC ("iso-ir-100", 28591), 
+ENC ("iso-ir-101", 28592), 
+ENC ("iso-ir-109", 28593), 
+ENC ("iso-ir-110", 28594), 
+ENC ("iso-ir-126", 28597), 
+ENC ("iso-ir-127", 28596), 
+ENC ("iso-ir-138", 28598), 
+ENC ("iso-ir-144", 28595), 
+ENC ("iso-ir-148", 28599), 
+ENC ("iso-ir-149", 949), 
+ENC ("iso-ir-58", 936), 
+ENC ("iso-ir-6", 20127), 
+ENC ("ISO646-US", 20127), 
+ENC ("iso8859-1", 28591), 
+ENC ("iso8859-2", 28592), 
+ENC ("ISO_646.irv:1991", 20127), 
+ENC ("iso_8859-1", 28591), 
+ENC ("ISO_8859-15", 28605), 
+ENC ("iso_8859-1:1987", 28591), 
+ENC ("iso_8859-2", 28592), 
+ENC ("iso_8859-2:1987", 28592), 
+ENC ("ISO_8859-3", 28593), 
+ENC ("ISO_8859-3:1988", 28593), 
+ENC ("ISO_8859-4", 28594), 
+ENC ("ISO_8859-4:1988", 28594), 
+ENC ("ISO_8859-5", 28595), 
+ENC ("ISO_8859-5:1988", 28595), 
+ENC ("ISO_8859-6", 28596), 
+ENC ("ISO_8859-6:1987", 28596), 
+ENC ("ISO_8859-7", 28597), 
+ENC ("ISO_8859-7:1987", 28597), 
+ENC ("ISO_8859-8", 28598), 
+ENC ("ISO_8859-8:1988", 28598), 
+ENC ("ISO_8859-9", 28599), 
+ENC ("ISO_8859-9:1989", 28599), 
+ENC ("Johab", 1361), 
+ENC ("koi", 20866), 
+ENC ("koi8", 20866), 
+ENC ("koi8-r", 20866), 
+ENC ("koi8-ru", 21866), 
+ENC ("koi8-u", 21866), 
+ENC ("koi8r", 20866), 
+ENC ("korean", 949), 
+ENC ("ks-c-5601", 949), 
+ENC ("ks-c5601", 949), 
+ENC ("KSC5601", 949), 
+ENC ("KSC_5601", 949), 
+ENC ("ks_c_5601", 949), 
+ENC ("ks_c_5601-1987", 949), 
+ENC ("ks_c_5601-1989", 949), 
+ENC ("ks_c_5601_1987", 949), 
+ENC ("l1", 28591), 
+ENC ("l2", 28592), 
+ENC ("l3", 28593), 
+ENC ("l4", 28594), 
+ENC ("l5", 28599), 
+ENC ("l9", 28605), 
+ENC ("latin1", 28591), 
+ENC ("latin2", 28592), 
+ENC ("latin3", 28593), 
+ENC ("latin4", 28594), 
+ENC ("latin5", 28599), 
+ENC ("latin9", 28605), 
+ENC ("logical", 28598), 
+ENC ("macintosh", 10000), 
+ENC ("ms_Kanji", 932), 
+ENC ("Norwegian", 20108), 
+ENC ("NS_4551-1", 20108), 
+ENC ("PC-Multilingual-850+euro", 858), 
+ENC ("SEN_850200_B", 20107), 
+ENC ("shift-jis", 932), 
+ENC ("shift_jis", 932), 
+ENC ("sjis", 932), 
+ENC ("Swedish", 20107), 
+ENC ("TIS-620", 874), 
+ENC ("ucs-2", 1200), 
+ENC ("unicode", 1200), 
+ENC ("unicode-1-1-utf-7", 65000), 
+ENC ("unicode-1-1-utf-8", 65001), 
+ENC ("unicode-2-0-utf-7", 65000), 
+ENC ("unicode-2-0-utf-8", 65001), 
+// People get confused about the FFFE here.  We can't change this because it'd break existing apps.
+// This has been this way for a long time, including in Mlang.
+ENC ("unicodeFFFE", 1201),             // Big Endian, BOM seems backwards, think of the BOM in little endian order.
+ENC ("us", 20127), 
+ENC ("us-ascii", 20127), 
+ENC ("utf-16", 1200), 
+ENC ("UTF-16BE", 1201), 
+ENC ("UTF-16LE", 1200),
+ENC ("utf-32", 12000),
+ENC ("UTF-32BE", 12001),
+ENC ("UTF-32LE", 12000),
+ENC ("utf-7", 65000), 
+ENC ("utf-8", 65001),
+ENC ("visual", 28598), 
+ENC ("windows-1250", 1250), 
+ENC ("windows-1251", 1251), 
+ENC ("windows-1252", 1252), 
+ENC ("windows-1253", 1253), 
+ENC ("Windows-1254", 1254), 
+ENC ("windows-1255", 1255), 
+ENC ("windows-1256", 1256), 
+ENC ("windows-1257", 1257), 
+ENC ("windows-1258", 1258), 
+ENC ("windows-874", 874), 
+ENC ("x-ansi", 1252), 
+ENC ("x-Chinese-CNS", 20000), 
+ENC ("x-Chinese-Eten", 20002), 
+ENC ("x-cp1250", 1250), 
+ENC ("x-cp1251", 1251), 
+ENC ("x-cp20001", 20001), 
+ENC ("x-cp20003", 20003), 
+ENC ("x-cp20004", 20004), 
+ENC ("x-cp20005", 20005), 
+ENC ("x-cp20261", 20261), 
+ENC ("x-cp20269", 20269), 
+ENC ("x-cp20936", 20936), 
+ENC ("x-cp20949", 20949),
+ENC ("x-cp50227", 50227), 
+//ENC (L"x-cp50229", 50229), 
+//ENC (L"X-EBCDIC-JapaneseAndUSCanada", 50931), 
+ENC ("X-EBCDIC-KoreanExtended", 20833), 
+ENC ("x-euc", 51932), 
+ENC ("x-euc-cn", 51936), 
+ENC ("x-euc-jp", 51932), 
+ENC ("x-Europa", 29001), 
+ENC ("x-IA5", 20105), 
+ENC ("x-IA5-German", 20106), 
+ENC ("x-IA5-Norwegian", 20108), 
+ENC ("x-IA5-Swedish", 20107), 
+ENC ("x-iscii-as", 57006), 
+ENC ("x-iscii-be", 57003), 
+ENC ("x-iscii-de", 57002), 
+ENC ("x-iscii-gu", 57010), 
+ENC ("x-iscii-ka", 57008), 
+ENC ("x-iscii-ma", 57009), 
+ENC ("x-iscii-or", 57007), 
+ENC ("x-iscii-pa", 57011), 
+ENC ("x-iscii-ta", 57004), 
+ENC ("x-iscii-te", 57005), 
+ENC ("x-mac-arabic", 10004), 
+ENC ("x-mac-ce", 10029), 
+ENC ("x-mac-chinesesimp", 10008), 
+ENC ("x-mac-chinesetrad", 10002), 
+ENC ("x-mac-croatian", 10082), 
+ENC ("x-mac-cyrillic", 10007), 
+ENC ("x-mac-greek", 10006), 
+ENC ("x-mac-hebrew", 10005), 
+ENC ("x-mac-icelandic", 10079), 
+ENC ("x-mac-japanese", 10001), 
+ENC ("x-mac-korean", 10003), 
+ENC ("x-mac-romanian", 10010), 
+ENC ("x-mac-thai", 10021), 
+ENC ("x-mac-turkish", 10081), 
+ENC ("x-mac-ukrainian", 10017), 
+ENC ("x-ms-cp932", 932),
+ENC ("x-sjis", 932), 
+ENC ("x-unicode-1-1-utf-7", 65000), 
+ENC ("x-unicode-1-1-utf-8", 65001), 
+ENC ("x-unicode-2-0-utf-7", 65000), 
+ENC ("x-unicode-2-0-utf-8", 65001), 
+ENC ("x-x-big5", 950), 
+
+#endif // FEATURE_CORECLR
+    
+               };
+
+// Working set optimization: 
+// 1. code page, family code page stored as unsigned short
+// 2. if web/header/body names are the same, only web name is stored; otherwise, we store "|webname|headername|bodyname"
+// 3. Move flags before names to fill gap on 64-bit platforms
+
+       static InternalCodePageDataItem MapCodePageDataItem (UInt16 cp, UInt16 fcp, string names, uint flags) { return new InternalCodePageDataItem () { codePage = cp, uiFamilyCodePage = fcp, flags = flags, Names = names }; }
+//
+// Information about codepages.
+//
+       internal static InternalCodePageDataItem [] codePageDataPtr = new InternalCodePageDataItem [] {
+#if FEATURE_CORECLR
+
+// Total Items: 
+// code page, family code page, web name, header name, body name, flags
+
+    MapCodePageDataItem(  1200,  1200, "utf-16",      MIMECONTF_SAVABLE_BROWSER), // "Unicode"
+    MapCodePageDataItem(  1201,  1200, "utf-16BE",    0), // Big Endian, old FFFE BOM seems backwards, think of the BOM in little endian order.
+    MapCodePageDataItem(  12000, 1200, "utf-32", 0), // "Unicode (UTF-32)"
+    MapCodePageDataItem(  12001, 1200, "utf-32BE", 0), // "Unicode (UTF-32 Big Endian)"
+    MapCodePageDataItem(  20127, 1252, "us-ascii", MIMECONTF_MAILNEWS | MIMECONTF_SAVABLE_MAILNEWS), // "US-ASCII"
+    MapCodePageDataItem(  28591,  1252, "iso-8859-1",  MIMECONTF_MAILNEWS | MIMECONTF_BROWSER | MIMECONTF_SAVABLE_MAILNEWS | MIMECONTF_SAVABLE_BROWSER), // "Western European (ISO)"
+    MapCodePageDataItem(  65000, 1200, "utf-7", MIMECONTF_MAILNEWS | MIMECONTF_SAVABLE_MAILNEWS), // "Unicode (UTF-7)"
+    MapCodePageDataItem(  65001, 1200, "utf-8", MIMECONTF_MAILNEWS | MIMECONTF_BROWSER | MIMECONTF_SAVABLE_MAILNEWS | MIMECONTF_SAVABLE_BROWSER), // "Unicode (UTF-8)"
+
+#else //FEATURE_CORECLR
+
+// Total Items: 146
+// code page, family code page, web name, header name, body name, flags
+
+
+    MapCodePageDataItem(    37,  1252, "IBM037",      0), // "IBM EBCDIC (US-Canada)"
+    MapCodePageDataItem(   437,  1252, "IBM437",      0), // "OEM United States"
+    MapCodePageDataItem(   500,  1252, "IBM500",      0), // "IBM EBCDIC (International)"
+    MapCodePageDataItem(   708,  1256, "ASMO-708",    MIMECONTF_BROWSER | MIMECONTF_SAVABLE_BROWSER), // "Arabic (ASMO 708)"
+//    MapCodePageDataItem(   720,  1256, "DOS-720",     MIMECONTF_BROWSER | MIMECONTF_SAVABLE_BROWSER), // "Arabic (DOS)"
+//    MapCodePageDataItem(   737,  1253, "ibm737",      0), // "Greek (DOS)"
+//    MapCodePageDataItem(   775,  1257, "ibm775",      0), // "Baltic (DOS)"
+    MapCodePageDataItem(   850,  1252, "ibm850",      0), // "Western European (DOS)"
+    MapCodePageDataItem(   852,  1250, "ibm852",      MIMECONTF_BROWSER | MIMECONTF_SAVABLE_BROWSER), // "Central European (DOS)"
+    MapCodePageDataItem(   855,  1252, "IBM855",      0), // "OEM Cyrillic"
+    MapCodePageDataItem(   857,  1254, "ibm857",      0), // "Turkish (DOS)"
+    MapCodePageDataItem(   858,  1252, "IBM00858",    0), // "OEM Multilingual Latin I"
+    MapCodePageDataItem(   860,  1252, "IBM860",      0), // "Portuguese (DOS)"
+    MapCodePageDataItem(   861,  1252, "ibm861",      0), // "Icelandic (DOS)"
+    MapCodePageDataItem(   862,  1255, "DOS-862",     MIMECONTF_BROWSER | MIMECONTF_SAVABLE_BROWSER), // "Hebrew (DOS)"
+    MapCodePageDataItem(   863,  1252, "IBM863",      0), // "French Canadian (DOS)"
+    MapCodePageDataItem(   864,  1256, "IBM864",      0), // "Arabic (864)"
+    MapCodePageDataItem(   865,  1252, "IBM865",      0), // "Nordic (DOS)"
+    MapCodePageDataItem(   866,  1251, "cp866",       MIMECONTF_BROWSER | MIMECONTF_SAVABLE_BROWSER), // "Cyrillic (DOS)"
+    MapCodePageDataItem(   869,  1253, "ibm869",      0), // "Greek, Modern (DOS)"
+    MapCodePageDataItem(   870,  1250, "IBM870",      0), // "IBM EBCDIC (Multilingual Latin-2)"
+    MapCodePageDataItem(   874,   874, "windows-874", MIMECONTF_MAILNEWS | MIMECONTF_BROWSER | MIMECONTF_SAVABLE_MAILNEWS | MIMECONTF_SAVABLE_BROWSER), // "Thai (Windows)"
+    MapCodePageDataItem(   875,  1253, "cp875",       0), // "IBM EBCDIC (Greek Modern)"
+    MapCodePageDataItem(   932,   932, "|shift_jis|iso-2022-jp|iso-2022-jp",   MIMECONTF_MAILNEWS | MIMECONTF_BROWSER | MIMECONTF_SAVABLE_MAILNEWS | MIMECONTF_SAVABLE_BROWSER), // "Japanese (Shift-JIS)"
+    MapCodePageDataItem(   936,   936, "gb2312",      MIMECONTF_MAILNEWS | MIMECONTF_BROWSER | MIMECONTF_SAVABLE_MAILNEWS | MIMECONTF_SAVABLE_BROWSER), // "Chinese Simplified (GB2312)"
+    MapCodePageDataItem(   949,   949, "ks_c_5601-1987", MIMECONTF_MAILNEWS | MIMECONTF_BROWSER | MIMECONTF_SAVABLE_MAILNEWS | MIMECONTF_SAVABLE_BROWSER), // "Korean"
+    MapCodePageDataItem(   950,   950, "big5",        MIMECONTF_MAILNEWS | MIMECONTF_BROWSER | MIMECONTF_SAVABLE_MAILNEWS | MIMECONTF_SAVABLE_BROWSER), // "Chinese Traditional (Big5)"
+    MapCodePageDataItem(  1026,  1254, "IBM1026",     0), // "IBM EBCDIC (Turkish Latin-5)"
+    MapCodePageDataItem(  1047,  1252, "IBM01047",    0), // "IBM Latin-1"
+    MapCodePageDataItem(  1140,  1252, "IBM01140",    0), // "IBM EBCDIC (US-Canada-Euro)"
+    MapCodePageDataItem(  1141,  1252, "IBM01141",    0), // "IBM EBCDIC (Germany-Euro)"
+    MapCodePageDataItem(  1142,  1252, "IBM01142",    0), // "IBM EBCDIC (Denmark-Norway-Euro)"
+    MapCodePageDataItem(  1143,  1252, "IBM01143",    0), // "IBM EBCDIC (Finland-Sweden-Euro)"
+    MapCodePageDataItem(  1144,  1252, "IBM01144",    0), // "IBM EBCDIC (Italy-Euro)"
+    MapCodePageDataItem(  1145,  1252, "IBM01145",    0), // "IBM EBCDIC (Spain-Euro)"
+    MapCodePageDataItem(  1146,  1252, "IBM01146",    0), // "IBM EBCDIC (UK-Euro)"
+    MapCodePageDataItem(  1147,  1252, "IBM01147",    0), // "IBM EBCDIC (France-Euro)"
+    MapCodePageDataItem(  1148,  1252, "IBM01148",    0), // "IBM EBCDIC (International-Euro)"
+    MapCodePageDataItem(  1149,  1252, "IBM01149",    0), // "IBM EBCDIC (Icelandic-Euro)"
+    MapCodePageDataItem(  1200,  1200, "utf-16",      MIMECONTF_SAVABLE_BROWSER), // "Unicode"
+    MapCodePageDataItem(  1201,  1200, "utf-16BE",    0), // Big Endian, old FFFE BOM seems backwards, think of the BOM in little endian order.
+    MapCodePageDataItem(  1250,  1250, "|windows-1250|windows-1250|iso-8859-2", MIMECONTF_MAILNEWS | MIMECONTF_BROWSER | MIMECONTF_SAVABLE_MAILNEWS | MIMECONTF_SAVABLE_BROWSER), // "Central European (Windows)"
+    MapCodePageDataItem(  1251,  1251, "|windows-1251|windows-1251|koi8-r", MIMECONTF_MAILNEWS | MIMECONTF_BROWSER | MIMECONTF_SAVABLE_MAILNEWS | MIMECONTF_SAVABLE_BROWSER), // "Cyrillic (Windows)"
+    MapCodePageDataItem(  1252,  1252, "|Windows-1252|Windows-1252|iso-8859-1", MIMECONTF_MAILNEWS | MIMECONTF_BROWSER | MIMECONTF_SAVABLE_MAILNEWS | MIMECONTF_SAVABLE_BROWSER), // "Western European (Windows)"
+    MapCodePageDataItem(  1253,  1253, "|windows-1253|windows-1253|iso-8859-7", MIMECONTF_MAILNEWS | MIMECONTF_BROWSER | MIMECONTF_SAVABLE_MAILNEWS | MIMECONTF_SAVABLE_BROWSER), // "Greek (Windows)"
+    MapCodePageDataItem(  1254,  1254, "|windows-1254|windows-1254|iso-8859-9", MIMECONTF_MAILNEWS | MIMECONTF_BROWSER | MIMECONTF_SAVABLE_MAILNEWS | MIMECONTF_SAVABLE_BROWSER), // "Turkish (Windows)"
+    MapCodePageDataItem(  1255,  1255, "windows-1255", MIMECONTF_MAILNEWS | MIMECONTF_BROWSER | MIMECONTF_SAVABLE_MAILNEWS | MIMECONTF_SAVABLE_BROWSER), // "Hebrew (Windows)"
+    MapCodePageDataItem(  1256,  1256, "windows-1256", MIMECONTF_MAILNEWS | MIMECONTF_BROWSER | MIMECONTF_SAVABLE_MAILNEWS | MIMECONTF_SAVABLE_BROWSER), // "Arabic (Windows)"
+    MapCodePageDataItem(  1257,  1257, "windows-1257", MIMECONTF_MAILNEWS | MIMECONTF_BROWSER | MIMECONTF_SAVABLE_MAILNEWS | MIMECONTF_SAVABLE_BROWSER), // "Baltic (Windows)"
+    MapCodePageDataItem(  1258,  1258, "windows-1258", MIMECONTF_MAILNEWS | MIMECONTF_BROWSER | MIMECONTF_SAVABLE_MAILNEWS | MIMECONTF_SAVABLE_BROWSER), // "Vietnamese (Windows)"
+//    MapCodePageDataItem(  1361,   949, "Johab",        0), // "Korean (Johab)"
+    MapCodePageDataItem( 10000,  1252, "macintosh",    0), // "Western European (Mac)"
+/*
+    MapCodePageDataItem( 10001,   932, "x-mac-japanese", 0), // "Japanese (Mac)"
+    MapCodePageDataItem( 10002,   950, "x-mac-chinesetrad",   0), // "Chinese Traditional (Mac)"
+    MapCodePageDataItem( 10003,   949, "x-mac-korean",        0), // "Korean (Mac)"
+    MapCodePageDataItem( 10004,  1256, "x-mac-arabic",        0), // "Arabic (Mac)"
+    MapCodePageDataItem( 10005,  1255, "x-mac-hebrew",        0), // "Hebrew (Mac)"
+    MapCodePageDataItem( 10006,  1253, "x-mac-greek",         0), // "Greek (Mac)"
+    MapCodePageDataItem( 10007,  1251, "x-mac-cyrillic",      0), // "Cyrillic (Mac)"
+    MapCodePageDataItem( 10008,   936, "x-mac-chinesesimp",   0), // "Chinese Simplified (Mac)"
+    MapCodePageDataItem( 10010,  1250, "x-mac-romanian",      0), // "Romanian (Mac)"
+    MapCodePageDataItem( 10017,  1251, "x-mac-ukrainian",     0), // "Ukrainian (Mac)"
+    MapCodePageDataItem( 10021,   874, "x-mac-thai",          0), // "Thai (Mac)"
+    MapCodePageDataItem( 10029,  1250, "x-mac-ce",            0), // "Central European (Mac)"
+*/
+    MapCodePageDataItem( 10079,  1252, "x-mac-icelandic",     0), // "Icelandic (Mac)"
+//    MapCodePageDataItem( 10081,  1254, "x-mac-turkish",       0), // "Turkish (Mac)"
+//    MapCodePageDataItem( 10082,  1250, "x-mac-croatian",      0), // "Croatian (Mac)"
+    MapCodePageDataItem( 12000,  1200, "utf-32",              0), // "Unicode (UTF-32)"
+    MapCodePageDataItem( 12001,  1200, "utf-32BE",            0), // "Unicode (UTF-32 Big Endian)"
+/*
+    MapCodePageDataItem( 20000,   950, "x-Chinese-CNS",       0), // "Chinese Traditional (CNS)"
+    MapCodePageDataItem( 20001,   950, "x-cp20001",           0), // "TCA Taiwan"
+    MapCodePageDataItem( 20002,   950, "x-Chinese-Eten",      0), // "Chinese Traditional (Eten)"
+    MapCodePageDataItem( 20003,   950, "x-cp20003",           0), // "IBM5550 Taiwan"
+    MapCodePageDataItem( 20004,   950, "x-cp20004",           0), // "TeleText Taiwan"
+    MapCodePageDataItem( 20005,   950, "x-cp20005",           0), // "Wang Taiwan"
+    MapCodePageDataItem( 20105,  1252, "x-IA5",               0), // "Western European (IA5)"
+    MapCodePageDataItem( 20106,  1252, "x-IA5-German",        0), // "German (IA5)"
+    MapCodePageDataItem( 20107,  1252, "x-IA5-Swedish",       0), // "Swedish (IA5)"
+    MapCodePageDataItem( 20108,  1252, "x-IA5-Norwegian",     0), // "Norwegian (IA5)"
+*/
+    MapCodePageDataItem( 20127,  1252, "us-ascii",            MIMECONTF_MAILNEWS | MIMECONTF_SAVABLE_MAILNEWS), // "US-ASCII"
+//    MapCodePageDataItem( 20261,  1252, "x-cp20261",           0), // "T.61"
+//    MapCodePageDataItem( 20269,  1252, "x-cp20269",           0), // "ISO-6937"
+    MapCodePageDataItem( 20273,  1252, "IBM273",              0), // "IBM EBCDIC (Germany)"
+    MapCodePageDataItem( 20277,  1252, "IBM277",              0), // "IBM EBCDIC (Denmark-Norway)"
+    MapCodePageDataItem( 20278,  1252, "IBM278",              0), // "IBM EBCDIC (Finland-Sweden)"
+    MapCodePageDataItem( 20280,  1252, "IBM280",              0), // "IBM EBCDIC (Italy)"
+    MapCodePageDataItem( 20284,  1252, "IBM284",              0), // "IBM EBCDIC (Spain)"
+    MapCodePageDataItem( 20285,  1252, "IBM285",              0), // "IBM EBCDIC (UK)"
+    MapCodePageDataItem( 20290,   932, "IBM290",              0), // "IBM EBCDIC (Japanese katakana)"
+    MapCodePageDataItem( 20297,  1252, "IBM297",              0), // "IBM EBCDIC (France)"
+    MapCodePageDataItem( 20420,  1256, "IBM420",              0), // "IBM EBCDIC (Arabic)"
+//    MapCodePageDataItem( 20423,  1253, "IBM423",              0), // "IBM EBCDIC (Greek)"
+    MapCodePageDataItem( 20424,  1255, "IBM424",              0), // "IBM EBCDIC (Hebrew)"
+//    MapCodePageDataItem( 20833,   949, "x-EBCDIC-KoreanExtended", 0), // "IBM EBCDIC (Korean Extended)"
+//    MapCodePageDataItem( 20838,   874, "IBM-Thai",            0), // "IBM EBCDIC (Thai)"
+    MapCodePageDataItem( 20866,  1251, "koi8-r",              MIMECONTF_MAILNEWS | MIMECONTF_BROWSER | MIMECONTF_SAVABLE_MAILNEWS | MIMECONTF_SAVABLE_BROWSER), // "Cyrillic (KOI8-R)"
+    MapCodePageDataItem( 20871,  1252, "IBM871",              0), // "IBM EBCDIC (Icelandic)"
+/*
+    MapCodePageDataItem( 20880,  1251, "IBM880",              0), // "IBM EBCDIC (Cyrillic Russian)"
+    MapCodePageDataItem( 20905,  1254, "IBM905",              0), // "IBM EBCDIC (Turkish)"
+    MapCodePageDataItem( 20924,  1252, "IBM00924",            0), // "IBM Latin-1"
+    MapCodePageDataItem( 20932,   932, "EUC-JP",              0), // "Japanese (JIS 0208-1990 and 0212-1990)"
+    MapCodePageDataItem( 20936,   936, "x-cp20936",           0), // "Chinese Simplified (GB2312-80)"
+    MapCodePageDataItem( 20949,   949, "x-cp20949",           0), // "Korean Wansung"
+*/
+    MapCodePageDataItem( 21025,  1251, "cp1025",              0), // "IBM EBCDIC (Cyrillic Serbian-Bulgarian)"
+    MapCodePageDataItem( 21866,  1251, "koi8-u",              MIMECONTF_MAILNEWS | MIMECONTF_BROWSER | MIMECONTF_SAVABLE_MAILNEWS | MIMECONTF_SAVABLE_BROWSER), // "Cyrillic (KOI8-U)"
+    MapCodePageDataItem( 28591,  1252, "iso-8859-1",          MIMECONTF_MAILNEWS | MIMECONTF_BROWSER | MIMECONTF_SAVABLE_MAILNEWS | MIMECONTF_SAVABLE_BROWSER), // "Western European (ISO)"
+    MapCodePageDataItem( 28592,  1250, "iso-8859-2",          MIMECONTF_MAILNEWS | MIMECONTF_BROWSER | MIMECONTF_SAVABLE_MAILNEWS | MIMECONTF_SAVABLE_BROWSER), // "Central European (ISO)"
+    MapCodePageDataItem( 28593,  1254, "iso-8859-3",          MIMECONTF_MAILNEWS | MIMECONTF_SAVABLE_MAILNEWS), // "Latin 3 (ISO)"
+    MapCodePageDataItem( 28594,  1257, "iso-8859-4",          MIMECONTF_MAILNEWS | MIMECONTF_BROWSER | MIMECONTF_SAVABLE_MAILNEWS | MIMECONTF_SAVABLE_BROWSER), // "Baltic (ISO)"
+    MapCodePageDataItem( 28595,  1251, "iso-8859-5",          MIMECONTF_MAILNEWS | MIMECONTF_BROWSER | MIMECONTF_SAVABLE_MAILNEWS | MIMECONTF_SAVABLE_BROWSER), // "Cyrillic (ISO)"
+    MapCodePageDataItem( 28596,  1256, "iso-8859-6",          MIMECONTF_MAILNEWS | MIMECONTF_BROWSER | MIMECONTF_SAVABLE_MAILNEWS | MIMECONTF_SAVABLE_BROWSER), // "Arabic (ISO)"
+    MapCodePageDataItem( 28597,  1253, "iso-8859-7",          MIMECONTF_MAILNEWS | MIMECONTF_BROWSER | MIMECONTF_SAVABLE_MAILNEWS | MIMECONTF_SAVABLE_BROWSER), // "Greek (ISO)"
+    MapCodePageDataItem( 28598,  1255, "iso-8859-8",          MIMECONTF_BROWSER | MIMECONTF_SAVABLE_BROWSER), // "Hebrew (ISO-Visual)"
+    MapCodePageDataItem( 28599,  1254, "iso-8859-9",          MIMECONTF_MAILNEWS | MIMECONTF_BROWSER | MIMECONTF_SAVABLE_MAILNEWS | MIMECONTF_SAVABLE_BROWSER), // "Turkish (ISO)"
+//    MapCodePageDataItem( 28603,  1257, "iso-8859-13",         MIMECONTF_MAILNEWS | MIMECONTF_SAVABLE_MAILNEWS), // "Estonian (ISO)"
+    MapCodePageDataItem( 28605,  1252, "iso-8859-15",         MIMECONTF_MAILNEWS | MIMECONTF_SAVABLE_MAILNEWS | MIMECONTF_SAVABLE_BROWSER), // "Latin 9 (ISO)"
+//    MapCodePageDataItem( 29001,  1252, "x-Europa",            0), // "Europa"
+    MapCodePageDataItem( 38598,  1255, "iso-8859-8-i",        MIMECONTF_MAILNEWS | MIMECONTF_BROWSER | MIMECONTF_SAVABLE_MAILNEWS | MIMECONTF_SAVABLE_BROWSER), // "Hebrew (ISO-Logical)"
+    MapCodePageDataItem( 50220,   932, "iso-2022-jp",         MIMECONTF_MAILNEWS | MIMECONTF_SAVABLE_MAILNEWS), // "Japanese (JIS)"
+    MapCodePageDataItem( 50221,   932, "|csISO2022JP|iso-2022-jp|iso-2022-jp", MIMECONTF_MAILNEWS | MIMECONTF_SAVABLE_MAILNEWS | MIMECONTF_SAVABLE_BROWSER), // "Japanese (JIS-Allow 1 byte Kana)"
+    MapCodePageDataItem( 50222,   932, "iso-2022-jp",         0), // "Japanese (JIS-Allow 1 byte Kana - SO/SI)"
+//    MapCodePageDataItem( 50225,   949, "|iso-2022-kr|euc-kr|iso-2022-kr", MIMECONTF_MAILNEWS), // "Korean (ISO)"
+//    MapCodePageDataItem( 50227,   936, "x-cp50227",           0), // "Chinese Simplified (ISO-2022)"
+//MapCodePageDataItem( 50229,   950, L"x-cp50229", L"x-cp50229", L"x-cp50229", 0}, // "Chinese Traditional (ISO-2022)"
+//MapCodePageDataItem( 50930,   932, L"cp930", L"cp930", L"cp930", 0}, // "IBM EBCDIC (Japanese and Japanese Katakana)"
+//MapCodePageDataItem( 50931,   932, L"x-EBCDIC-JapaneseAndUSCanada", L"x-EBCDIC-JapaneseAndUSCanada", L"x-EBCDIC-JapaneseAndUSCanada", 0}, // "IBM EBCDIC (Japanese and US-Canada)"
+//MapCodePageDataItem( 50933,   949, L"cp933", L"cp933", L"cp933", 0}, // "IBM EBCDIC (Korean and Korean Extended)"
+//MapCodePageDataItem( 50935,   936, L"cp935", L"cp935", L"cp935", 0}, // "IBM EBCDIC (Simplified Chinese)"
+//MapCodePageDataItem( 50937,   950, L"cp937", L"cp937", L"cp937", 0}, // "IBM EBCDIC (Traditional Chinese)"
+//MapCodePageDataItem( 50939,   932, L"cp939", L"cp939", L"cp939", 0}, // "IBM EBCDIC (Japanese and Japanese-Latin)"
+    MapCodePageDataItem( 51932,   932, "euc-jp",              MIMECONTF_MAILNEWS | MIMECONTF_BROWSER | MIMECONTF_SAVABLE_MAILNEWS | MIMECONTF_SAVABLE_BROWSER), // "Japanese (EUC)"
+//    MapCodePageDataItem( 51936,   936, "EUC-CN",              0), // "Chinese Simplified (EUC)"
+    MapCodePageDataItem( 51949,   949, "euc-kr",              MIMECONTF_MAILNEWS | MIMECONTF_SAVABLE_MAILNEWS), // "Korean (EUC)"
+//    MapCodePageDataItem( 52936,   936, "hz-gb-2312",          MIMECONTF_MAILNEWS | MIMECONTF_BROWSER | MIMECONTF_SAVABLE_MAILNEWS | MIMECONTF_SAVABLE_BROWSER), // "Chinese Simplified (HZ)"
+    MapCodePageDataItem( 54936,   936, "GB18030",             MIMECONTF_MAILNEWS | MIMECONTF_BROWSER | MIMECONTF_SAVABLE_MAILNEWS | MIMECONTF_SAVABLE_BROWSER), // "Chinese Simplified (GB18030)"
+    MapCodePageDataItem( 57002, 57002, "x-iscii-de",          0), // "ISCII Devanagari"
+    MapCodePageDataItem( 57003, 57003, "x-iscii-be",          0), // "ISCII Bengali"
+    MapCodePageDataItem( 57004, 57004, "x-iscii-ta",          0), // "ISCII Tamil"
+    MapCodePageDataItem( 57005, 57005, "x-iscii-te",          0), // "ISCII Telugu"
+    MapCodePageDataItem( 57006, 57006, "x-iscii-as",          0), // "ISCII Assamese"
+    MapCodePageDataItem( 57007, 57007, "x-iscii-or",          0), // "ISCII Oriya"
+    MapCodePageDataItem( 57008, 57008, "x-iscii-ka",          0), // "ISCII Kannada"
+    MapCodePageDataItem( 57009, 57009, "x-iscii-ma",          0), // "ISCII Malayalam"
+    MapCodePageDataItem( 57010, 57010, "x-iscii-gu",          0), // "ISCII Gujarati"
+    MapCodePageDataItem( 57011, 57011, "x-iscii-pa",          0), // "ISCII Punjabi"
+    MapCodePageDataItem( 65000,  1200, "utf-7",               MIMECONTF_MAILNEWS | MIMECONTF_SAVABLE_MAILNEWS), // "Unicode (UTF-7)"
+    MapCodePageDataItem( 65001,  1200, "utf-8",               MIMECONTF_MAILNEWS | MIMECONTF_BROWSER | MIMECONTF_SAVABLE_MAILNEWS | MIMECONTF_SAVABLE_BROWSER), // "Unicode (UTF-8)"
+#endif // FEATURE_CORECLR
+
+    // End of data.
+    MapCodePageDataItem( 0, 0, null, 0),
+
+};
+
+#endregion
+
+#region "from coreclr/src/pal/inc/rt/palrt.h"
+// modified
+
+       const int
+//typedef 
+//enum tagMIMECONTF {
+    MIMECONTF_MAILNEWS  = 0x1,
+    MIMECONTF_BROWSER   = 0x2,
+    MIMECONTF_MINIMAL   = 0x4,
+    MIMECONTF_IMPORT    = 0x8,
+    MIMECONTF_SAVABLE_MAILNEWS  = 0x100,
+    MIMECONTF_SAVABLE_BROWSER   = 0x200,
+    MIMECONTF_EXPORT    = 0x400,
+    MIMECONTF_PRIVCONVERTER = 0x10000,
+    MIMECONTF_VALID = 0x20000,
+    MIMECONTF_VALID_NLS = 0x40000,
+    MIMECONTF_MIME_IE4  = 0x10000000,
+    MIMECONTF_MIME_LATEST   = 0x20000000,
+    MIMECONTF_MIME_REGISTRY = 0x40000000
+//    }   MIMECONTF;
+    ;
+#endregion
+}
+
+#region "from referencesource/mscorlib/system/globalization/encodingtable.cs"
+    //
+    // Data table for encoding classes.  Used by System.Text.Encoding.
+    // This class contains two hashtables to allow System.Text.Encoding
+    // to retrieve the data item either by codepage value or by webName.
+    //
+    
+    // Only statics, does not need to be marked with the serializable attribute
+    internal static partial class EncodingTable
+    {
+
+        //This number is the size of the table in native.  The value is retrieved by
+        //calling the native GetNumEncodingItems().
+        private static int lastEncodingItem = GetNumEncodingItems() - 1;
+
+        //This number is the size of the code page table.  Its generated when we walk the table the first time.
+        private static volatile int lastCodePageItem;
+
+/*        
+        //
+        // This points to a native data table which maps an encoding name to the correct code page.        
+        //
+        [SecurityCritical]
+        unsafe internal static InternalEncodingDataItem* encodingDataPtr = GetEncodingData();
+        //
+        // This points to a native data table which stores the properties for the code page, and
+        // the table is indexed by code page.
+        //
+        [SecurityCritical]
+        unsafe internal static InternalCodePageDataItem* codePageDataPtr = GetCodePageData();
+*/
+        //
+        // This caches the mapping of an encoding name to a code page.
+        //
+        private static Hashtable hashByName = Hashtable.Synchronized(new Hashtable(StringComparer.OrdinalIgnoreCase));
+        //
+        // THe caches the data item which is indexed by the code page value.
+        //
+        private static Hashtable hashByCodePage = Hashtable.Synchronized(new Hashtable());
+
+        [System.Security.SecuritySafeCritical] // static constructors should be safe to call
+        static EncodingTable()
+        { 
+        }
+
+        // Find the data item by binary searching the table that we have in native.
+        // nativeCompareOrdinalWC is an internal-only function.
+        [System.Security.SecuritySafeCritical]  // auto-generated
+        unsafe private static int internalGetCodePageFromName(String name) {
+            int left  = 0;
+            int right = lastEncodingItem;
+            int index;
+            int result;
+    
+            //Binary search the array until we have only a couple of elements left and then
+            //just walk those elements.
+            while ((right - left)>3) {
+                index = ((right - left)/2) + left;
+                
+                result = String.Compare (name, encodingDataPtr[index].webName, StringComparison.OrdinalIgnoreCase);
+    
+                if (result == 0) {
+                    //We found the item, return the associated codepage.
+                    return (encodingDataPtr[index].codePage);
+                } else if (result<0) {
+                    //The name that we're looking for is less than our current index.
+                    right = index;
+                } else {
+                    //The name that we're looking for is greater than our current index
+                    left = index;
+                }
+            }
+    
+            //Walk the remaining elements (it'll be 3 or fewer).
+            for (; left<=right; left++) {
+                if (String.Compare(name, encodingDataPtr[left].webName, StringComparison.OrdinalIgnoreCase) == 0) {
+                    return (encodingDataPtr[left].codePage);
+                }
+            }
+            // The encoding name is not valid.
+            throw new ArgumentException(
+                String.Format(
+                    CultureInfo.CurrentCulture,
+                    Environment.GetResourceString("Argument_EncodingNotSupported"), name), "name");
+        }
+
+        // Return a list of all EncodingInfo objects describing all of our encodings
+        [System.Security.SecuritySafeCritical]  // auto-generated
+        internal static unsafe EncodingInfo[] GetEncodings()
+        {
+            if (lastCodePageItem == 0)
+            {
+                int count;
+                for (count = 0; codePageDataPtr[count].codePage != 0; count++)
+                {
+                    // Count them
+                }
+                lastCodePageItem = count;
+            }
+
+            EncodingInfo[] arrayEncodingInfo = new EncodingInfo[lastCodePageItem];
+
+            int i;
+            for (i = 0; i < lastCodePageItem; i++)
+            {
+                arrayEncodingInfo[i] = new EncodingInfo(codePageDataPtr[i].codePage, CodePageDataItem.CreateString(codePageDataPtr[i].Names, 0),
+                    Environment.GetResourceString("Globalization.cp_" + codePageDataPtr[i].codePage));
+            }
+            
+            return arrayEncodingInfo;
+        }        
+    
+        /*=================================GetCodePageFromName==========================
+        **Action: Given a encoding name, return the correct code page number for this encoding.
+        **Returns: The code page for the encoding.
+        **Arguments:
+        **  name    the name of the encoding
+        **Exceptions:
+        **  ArgumentNullException if name is null.
+        **  internalGetCodePageFromName will throw ArgumentException if name is not a valid encoding name.
+        ============================================================================*/
+        
+        internal static int GetCodePageFromName(String name)
+        {   
+            if (name==null) {
+                throw new ArgumentNullException("name");
+            }
+            Contract.EndContractBlock();
+
+            Object codePageObj;
+
+            //
+            // The name is case-insensitive, but ToLower isn't free.  Check for
+            // the code page in the given capitalization first.
+            //
+            codePageObj = hashByName[name];
+
+            if (codePageObj!=null) {
+                return ((int)codePageObj);
+            }
+
+            //Okay, we didn't find it in the hash table, try looking it up in the 
+            //unmanaged data.
+            int codePage = internalGetCodePageFromName(name);
+
+            hashByName[name] = codePage;
+
+            return codePage;
+        }
+    
+        [System.Security.SecuritySafeCritical]  // auto-generated
+        unsafe internal static CodePageDataItem GetCodePageDataItem(int codepage) {
+            CodePageDataItem dataItem;
+
+            // We synchronize around dictionary gets/sets. There's still a possibility that two threads
+            // will create a CodePageDataItem and the second will clobber the first in the dictionary. 
+            // However, that's acceptable because the contents are correct and we make no guarantees
+            // other than that. 
+
+            //Look up the item in the hashtable.
+            dataItem = (CodePageDataItem)hashByCodePage[codepage];
+            
+            //If we found it, return it.
+            if (dataItem!=null) {
+                return dataItem;
+            }
+
+
+            //If we didn't find it, try looking it up now.
+            //If we find it, add it to the hashtable.
+            //This is a linear search, but we probably won't be doing it very often.
+            //
+            int i = 0;
+            int data;
+            while ((data = codePageDataPtr[i].codePage) != 0) {
+                if (data == codepage) {
+                    dataItem = new CodePageDataItem(i);
+                    hashByCodePage[codepage] = dataItem;
+                    return (dataItem);
+                }
+                i++;
+            }
+        
+            //Nope, we didn't find it.
+            return null;
+        }
+
+/*
+        [System.Security.SecurityCritical]  // auto-generated
+        [MethodImplAttribute(MethodImplOptions.InternalCall)]
+        private unsafe static extern InternalEncodingDataItem *GetEncodingData();
+        
+        //
+        // Return the number of encoding data items.
+        //
+        [System.Security.SecurityCritical]  // auto-generated
+        [MethodImplAttribute(MethodImplOptions.InternalCall)]
+        private static extern int GetNumEncodingItems();
+
+        [System.Security.SecurityCritical]  // auto-generated
+        [MethodImplAttribute(MethodImplOptions.InternalCall)]
+        private unsafe static extern InternalCodePageDataItem* GetCodePageData();
+
+        [System.Security.SecurityCritical]  // auto-generated
+        [MethodImplAttribute(MethodImplOptions.InternalCall)]
+        internal unsafe static extern byte* nativeCreateOpenFileMapping(
+            String inSectionName, int inBytesToAllocate, out IntPtr mappedFileHandle);   
+*/
+    }
+    
+    /*=================================InternalEncodingDataItem==========================
+    **Action: This is used to map a encoding name to a correct code page number. By doing this,
+    ** we can get the properties of this encoding via the InternalCodePageDataItem.
+    **
+    ** We use this structure to access native data exposed by the native side.
+    ============================================================================*/
+    
+    [System.Runtime.InteropServices.StructLayout(LayoutKind.Sequential)]
+    internal struct InternalEncodingDataItem {
+        [SecurityCritical]
+        internal string webName;
+        internal UInt16   codePage;
+    }
+
+    /*=================================InternalCodePageDataItem==========================
+    **Action: This is used to access the properties related to a code page.
+    ** We use this structure to access native data exposed by the native side.
+    ============================================================================*/
+
+    [System.Runtime.InteropServices.StructLayout(LayoutKind.Sequential)]
+    internal struct InternalCodePageDataItem {
+        internal UInt16   codePage;
+        internal UInt16   uiFamilyCodePage;
+        internal uint     flags;
+        [SecurityCritical]
+        internal string Names;
+    }
+#endregion
+}
index 28cc2df6a6c0db9588cc69df2429f96d313b2800..5377cfe5bac255a7071798035fa0125da650be49 100644 (file)
@@ -6,17 +6,16 @@ namespace System
        {
                internal static string GetResourceString (string key)
                {
-                       return Messages.GetMessage (key);
+                       return key;
                }
 
                internal static string GetResourceString (string key, CultureInfo culture)
                {
-                       return GetResourceString (key);
+                       return key;
                }
 
                internal static string GetResourceString (string key, params object[] values)
                {
-                       key = Messages.GetMessage (key);
                        return string.Format (CultureInfo.InvariantCulture, key, values);
                }
        }
diff --git a/mcs/class/corlib/ReferenceSources/__ConsoleStream.cs b/mcs/class/corlib/ReferenceSources/__ConsoleStream.cs
new file mode 100644 (file)
index 0000000..2c34fa8
--- /dev/null
@@ -0,0 +1,6 @@
+namespace System.IO
+{
+       sealed class __ConsoleStream
+       {
+       }
+}
\ No newline at end of file
diff --git a/mcs/class/corlib/ReferenceSources/mscorlib.txt.cs b/mcs/class/corlib/ReferenceSources/mscorlib.txt.cs
deleted file mode 100644 (file)
index 3363402..0000000
+++ /dev/null
@@ -1,3510 +0,0 @@
-/*
-
-Extracted from https://github.com/dotnet/coreclr/blob/master/src/mscorlib/src/mscorlib.txt
-
-       var res = File.ReadAllLines (input_file).Select (l => {
-               if (l.Length == 0 || l.StartsWith ("#"))
-                       return l;
-
-               if (l.StartsWith (";"))
-                       return "// " + l;
-
-               return "case \"" + l.Replace ("\"", "\\\"").Replace ("= ", "=").Replace (" =", "=").Replace ("=", "\": return \"") + "\";";
-       });
-
-*/
-
-#define INCLUDE_RUNTIME
-#define INCLUDE_DEBUG
-#define FEATURE_MACL
-#define FEATURE_IDENTITY_REFERENCE
-#define FEATURE_COMINTEROP
-#define FEATURE_CRYPTO
-#define FEATURE_REMOTING
-#define FEATURE_SERIALIZATION
-
-static class Messages
-{
-       public static string GetMessage (string id) {
-               switch (id) {
-
-// ;==++==
-// ;
-// ;   Copyright (c) Microsoft Corporation.  All rights reserved.
-// ;
-// ;==--==
-// ;
-// ; These are the managed resources for mscorlib.dll.
-// ; See those first three bytes in the file?  This is in UTF-8.  Leave the
-// ; Unicode byte order mark (U+FEFF) written in UTF-8 at the start of this file.
-
-// ; For resource info, see the ResourceManager documentation and the ResGen tool,
-// ; which is a managed app using ResourceWriter.
-// ; ResGen now supports C++ & C# style #ifdef's, like #ifndef FOO and #if BAR
-
-// ; The naming scheme is: [Namespace.] ExceptionName _ Reason
-// ; We'll suppress "System." where possible.
-// ; Examples:
-// ; Argument_Null
-// ; Reflection.TargetInvokation_someReason
-
-// ; Usage Notes:
-// ; * Keep exceptions in alphabetical order by package
-// ; * A single space may exist on either side of the equal sign.
-// ; * Follow the naming conventions.
-// ; * Any lines starting with a '#' or ';' are ignored
-// ; * Equal signs aren't legal characters for keys, but may occur in values.
-// ; * Correctly punctuate all sentences. Most resources should end in a period.
-// ;       Remember, your mother will probably read some of these messages.
-// ; * You may use " (quote), \n and \t. Use \\ for a single '\' character.
-// ; * String inserts work.  i.e., BadNumber_File = Wrong number in file "{0}".
-
-// ; Real words, used by code like Environment.StackTrace
-#if INCLUDE_RUNTIME
-case "Word_At": return "at";
-case "StackTrace_InFileLineNumber": return "in {0}:line {1}";
-case "UnknownError_Num": return "Unknown error \"{0}\".";
-case "AllocatedFrom": return "Allocated from:";
-
-// ; Note this one is special, used as a divider between stack traces!
-case "Exception_EndOfInnerExceptionStack": return "--- End of inner exception stack trace ---";
-case "Exception_WasThrown": return "Exception of type '{0}' was thrown.";
-
-// ; The following are used in the implementation of ExceptionDispatchInfo
-case "Exception_EndStackTraceFromPreviousThrow": return "--- End of stack trace from previous location where exception was thrown ---";
-
-case "Arg_ParamName_Name": return "Parameter name: {0}";
-case "ArgumentOutOfRange_ActualValue": return "Actual value was {0}.";
-
-#endif // INCLUDE_RUNTIME
-
-#if !FEATURE_CORECLR
-case "UnknownError": return "Unknown error.";
-#endif // !FEATURE_CORECLR
-
-#if INCLUDE_DEBUG
-
-// ; For code contracts
-case "AssumptionFailed": return "Assumption failed.";
-case "AssumptionFailed_Cnd": return "Assumption failed: {0}";
-case "AssertionFailed": return "Assertion failed.";
-case "AssertionFailed_Cnd": return "Assertion failed: {0}";
-case "PreconditionFailed": return "Precondition failed.";
-case "PreconditionFailed_Cnd": return "Precondition failed: {0}";
-case "PostconditionFailed": return "Postcondition failed.";
-case "PostconditionFailed_Cnd": return "Postcondition failed: {0}";
-case "PostconditionOnExceptionFailed": return "Postcondition failed after throwing an exception.";
-case "PostconditionOnExceptionFailed_Cnd": return "Postcondition failed after throwing an exception: {0}";
-case "InvariantFailed": return "Invariant failed.";
-case "InvariantFailed_Cnd": return "Invariant failed: {0}";
-#if PLATFORM_UNIX
-case "StackTrace_Stack": return "Stack trace: \n{0}";
-#endif
-#if !PLATFORM_UNIX
-case "StackTrace_Stack": return "Stack trace: \r\n{0}";
-#endif // PLATFORM_UNIX
-case "MustUseCCRewrite": return "An assembly (probably \"{1}\") must be rewritten using the code contracts binary rewriter (CCRewrite) because it is calling Contract.{0} and the CONTRACTS_FULL symbol is defined.  Remove any explicit definitions of the CONTRACTS_FULL symbol from your project and rebuild.";
-
-// ; Access Control
-#if FEATURE_MACL
-case "AccessControl_MustSpecifyContainerAcl": return "The named parameter must be a container ACL.";
-case "AccessControl_MustSpecifyLeafObjectAcl": return "The named parameter must be a non-container ACL.";
-case "AccessControl_AclTooLong": return "Length of the access control list exceed the allowed maximum.";
-case "AccessControl_MustSpecifyDirectoryObjectAcl": return "The named parameter must be a directory-object ACL.";
-case "AccessControl_MustSpecifyNonDirectoryObjectAcl": return "The named parameter must be a non-directory-object ACL.";
-case "AccessControl_InvalidSecurityDescriptorRevision": return "Security descriptor with revision other than '1' are not legal.";
-case "AccessControl_InvalidSecurityDescriptorSelfRelativeForm": return "Security descriptor must be in the self-relative form.";
-case "AccessControl_NoAssociatedSecurity": return "Unable to perform a security operation on an object that has no associated security. This can happen when trying to get an ACL of an anonymous kernel object.";
-case "AccessControl_InvalidHandle": return "The supplied handle is invalid. This can happen when trying to set an ACL on an anonymous kernel object.";
-case "AccessControl_UnexpectedError": return "Method failed with unexpected error code {0}.";
-case "AccessControl_InvalidSidInSDDLString": return "The SDDL string contains an invalid sid or a sid that cannot be translated.";
-case "AccessControl_InvalidOwner": return "The security identifier is not allowed to be the owner of this object.";
-case "AccessControl_InvalidGroup": return "The security identifier is not allowed to be the primary group of this object.";
-case "AccessControl_InvalidAccessRuleType": return "The access rule is not the correct type.";
-case "AccessControl_InvalidAuditRuleType": return "The audit rule is not the correct type.";
-#endif  // FEATURE_MACL
-
-// ; Identity Reference Library
-#if FEATURE_IDENTITY_REFERENCE
-case "IdentityReference_IdentityNotMapped": return "Some or all identity references could not be translated.";
-case "IdentityReference_MustBeIdentityReference": return "The targetType parameter must be of IdentityReference type.";
-case "IdentityReference_AccountNameTooLong": return "Account name is too long.";
-case "IdentityReference_DomainNameTooLong": return "Domain name is too long.";
-case "IdentityReference_InvalidNumberOfSubauthorities": return "The number of sub-authorities must not exceed {0}.";
-case "IdentityReference_IdentifierAuthorityTooLarge": return "The size of the identifier authority must not exceed 6 bytes.";
-case "IdentityReference_InvalidSidRevision": return "SIDs with revision other than '1' are not supported.";
-case "IdentityReference_CannotCreateLogonIdsSid": return "Well-known SIDs of type LogonIdsSid cannot be created.";
-case "IdentityReference_DomainSidRequired": return "The domainSid parameter must be specified for creating well-known SID of type {0}.";
-case "IdentityReference_NotAWindowsDomain": return "The domainSid parameter is not a valid Windows domain SID.";
-#endif // FEATURE_IDENTITY_REFERENCE
-
-// ; AccessException
-case "Acc_CreateGeneric": return "Cannot create a type for which Type.ContainsGenericParameters is true.";
-case "Acc_CreateAbst": return "Cannot create an abstract class.";
-case "Acc_CreateInterface": return "Cannot create an instance of an interface.";
-case "Acc_NotClassInit": return "Type initializer was not callable.";
-case "Acc_CreateGenericEx": return "Cannot create an instance of {0} because Type.ContainsGenericParameters is true.";
-case "Acc_CreateArgIterator": return "Cannot dynamically create an instance of ArgIterator.";
-case "Acc_CreateAbstEx": return "Cannot create an instance of {0} because it is an abstract class.";
-case "Acc_CreateInterfaceEx": return "Cannot create an instance of {0} because it is an interface.";
-case "Acc_CreateVoid": return "Cannot dynamically create an instance of System.Void.";
-case "Acc_ReadOnly": return "Cannot set a constant field.";
-case "Acc_RvaStatic": return "SkipVerification permission is needed to modify an image-based (RVA) static field.";
-case "Access_Void": return "Cannot create an instance of void.";
-
-// ; ArgumentException
-case "Arg_TypedReference_Null": return "The TypedReference must be initialized.";
-case "Argument_AddingDuplicate__": return "Item has already been added. Key in dictionary: '{0}'  Key being added: '{1}'";
-case "Argument_AddingDuplicate": return "An item with the same key has already been added.";
-case "Argument_MethodDeclaringTypeGenericLcg": return "Method '{0}' has a generic declaring type '{1}'. Explicitly provide the declaring type to GetTokenFor. ";
-case "Argument_MethodDeclaringTypeGeneric": return "Cannot resolve method {0} because the declaring type of the method handle {1} is generic. Explicitly provide the declaring type to GetMethodFromHandle. ";
-case "Argument_FieldDeclaringTypeGeneric": return "Cannot resolve field {0} because the declaring type of the field handle {1} is generic. Explicitly provide the declaring type to GetFieldFromHandle.";
-case "Argument_ApplicationTrustShouldHaveIdentity": return "An ApplicationTrust must have an application identity before it can be persisted.";
-case "Argument_ConversionOverflow": return "Conversion buffer overflow.";
-case "Argument_CodepageNotSupported": return "{0} is not a supported code page.";
-case "Argument_CultureNotSupported": return "Culture is not supported.";
-case "Argument_CultureInvalidIdentifier": return "{0} is an invalid culture identifier.";
-case "Argument_OneOfCulturesNotSupported": return "Culture name {0} or {1} is not supported.";
-case "Argument_CultureIetfNotSupported": return "Culture IETF Name {0} is not a recognized IETF name.";
-case "Argument_CultureIsNeutral": return "Culture ID {0} (0x{0:X4}) is a neutral culture; a region cannot be created from it.";
-case "Argument_InvalidNeutralRegionName": return "The region name {0} should not correspond to neutral culture; a specific culture name is required.";
-case "Argument_InvalidGenericInstArray": return "Generic arguments must be provided for each generic parameter and each generic argument must be a RuntimeType.";
-case "Argument_GenericArgsCount": return "The number of generic arguments provided doesn't equal the arity of the generic type definition.";
-case "Argument_CultureInvalidFormat": return "Culture '{0}' is a neutral culture. It cannot be used in formatting and parsing and therefore cannot be set as the thread's current culture.";
-case "Argument_CompareOptionOrdinal": return "CompareOption.Ordinal cannot be used with other options.";
-case "Argument_CustomCultureCannotBePassedByNumber": return "Customized cultures cannot be passed by LCID, only by name.";
-case "Argument_EncodingConversionOverflowChars": return "The output char buffer is too small to contain the decoded characters, encoding '{0}' fallback '{1}'.";
-case "Argument_EncodingConversionOverflowBytes": return "The output byte buffer is too small to contain the encoded data, encoding '{0}' fallback '{1}'.";
-case "Argument_EncoderFallbackNotEmpty": return "Must complete Convert() operation or call Encoder.Reset() before calling GetBytes() or GetByteCount(). Encoder '{0}' fallback '{1}'.";
-case "Argument_EmptyFileName": return "Empty file name is not legal.";
-case "Argument_EmptyPath": return "Empty path name is not legal.";
-case "Argument_EmptyName": return "Empty name is not legal.";
-case "Argument_ImplementIComparable": return "At least one object must implement IComparable.";
-case "Argument_InvalidType": return "The type of arguments passed into generic comparer methods is invalid.";
-case "Argument_InvalidTypeForCA": return "Cannot build type parameter for custom attribute with a type that does not support the AssemblyQualifiedName property. The type instance supplied was of type '{0}'.";
-case "Argument_IllegalEnvVarName": return "Environment variable name cannot contain equal character.";
-case "Argument_IllegalAppId": return "Application identity does not have same number of components as manifest paths.";
-case "Argument_IllegalAppBase": return "The application base specified is not valid.";
-case "Argument_UnableToParseManifest": return "Unexpected error while parsing the specified manifest.";
-case "Argument_IllegalAppIdMismatch": return "Application identity does not match identities in manifests.";
-case "Argument_InvalidAppId": return "Invalid identity: no deployment or application identity specified.";
-case "Argument_InvalidGenericArg": return "The generic type parameter was not valid";
-case "Argument_InvalidArrayLength": return "Length of the array must be {0}.";
-case "Argument_InvalidArrayType": return "Target array type is not compatible with the type of items in the collection.";
-case "Argument_InvalidAppendMode": return "Append access can be requested only in write-only mode.";
-case "Argument_InvalidEnumValue": return "The value '{0}' is not valid for this usage of the type {1}.";
-case "Argument_EnumIsNotIntOrShort": return "The underlying type of enum argument must be Int32 or Int16.";
-case "Argument_InvalidEnum": return "The Enum type should contain one and only one instance field.";
-case "Argument_InvalidKeyStore": return "'{0}' is not a valid KeyStore name. ";
-case "Argument_InvalidFileMode&AccessCombo": return "Combining FileMode: {0} with FileAccess: {1} is invalid.";
-case "Argument_InvalidFileMode&RightsCombo": return "Combining FileMode: {0} with FileSystemRights: {1} is invalid.";
-case "Argument_InvalidFileModeTruncate&RightsCombo": return "Combining FileMode: {0} with FileSystemRights: {1} is invalid. FileMode.Truncate is valid only when used with FileSystemRights.Write.";
-case "Argument_InvalidFlag": return "Value of flags is invalid.";
-case "Argument_InvalidAnyFlag": return "No flags can be set.";
-case "Argument_InvalidHandle": return "The handle is invalid.";
-case "Argument_InvalidRegistryKeyPermissionCheck": return "The specified RegistryKeyPermissionCheck value is invalid.";
-case "Argument_InvalidRegistryOptionsCheck": return "The specified RegistryOptions value is invalid.";
-case "Argument_InvalidRegistryViewCheck": return "The specified RegistryView value is invalid.";
-case "Argument_InvalidSubPath": return "The directory specified, '{0}', is not a subdirectory of '{1}'.";
-case "Argument_NoRegionInvariantCulture": return "There is no region associated with the Invariant Culture (Culture ID: 0x7F).";
-case "Argument_ResultCalendarRange": return "The result is out of the supported range for this calendar. The result should be between {0} (Gregorian date) and {1} (Gregorian date), inclusive.";
-case "Argument_ResultIslamicCalendarRange": return "The date is out of the supported range for the Islamic calendar. The date should be greater than July 18th, 622 AD (Gregorian date).";
-case "Argument_NeverValidGenericArgument": return "The type '{0}' may not be used as a type argument.";
-case "Argument_NotEnoughGenArguments": return "The type or method has {1} generic parameter(s), but {0} generic argument(s) were provided. A generic argument must be provided for each generic parameter.";
-case "Argument_NullFullTrustAssembly": return "A null StrongName was found in the full trust assembly list.";
-case "Argument_GenConstraintViolation": return "GenericArguments[{0}], '{1}', on '{2}' violates the constraint of type '{3}'.";
-case "Argument_InvalidToken": return "Token {0:x} is not valid in the scope of module {1}.";
-case "Argument_InvalidTypeToken": return "Token {0:x} is not a valid Type token.";
-case "Argument_ResolveType": return "Token {0:x} is not a valid Type token in the scope of module {1}.";
-case "Argument_ResolveMethod": return "Token {0:x} is not a valid MethodBase token in the scope of module {1}.";
-case "Argument_ResolveField": return "Token {0:x} is not a valid FieldInfo token in the scope of module {1}.";
-case "Argument_ResolveMember": return "Token {0:x} is not a valid MemberInfo token in the scope of module {1}.";
-case "Argument_ResolveString": return "Token {0:x} is not a valid string token in the scope of module {1}.";
-case "Argument_ResolveModuleType": return "Token {0} resolves to the special module type representing this module.";
-case "Argument_ResolveMethodHandle": return "Type handle '{0}' and method handle with declaring type '{1}' are incompatible. Get RuntimeMethodHandle and declaring RuntimeTypeHandle off the same MethodBase.";
-case "Argument_ResolveFieldHandle": return "Type handle '{0}' and field handle with declaring type '{1}' are incompatible. Get RuntimeFieldHandle and declaring RuntimeTypeHandle off the same FieldInfo.";
-case "Argument_ResourceScopeWrongDirection": return "Resource type in the ResourceScope enum is going from a more restrictive resource type to a more general one.  From: \"{0}\"  To: \"{1}\"";
-case "Argument_BadResourceScopeTypeBits": return "Unknown value for the ResourceScope: {0}  Too many resource type bits may be set.";
-case "Argument_BadResourceScopeVisibilityBits": return "Unknown value for the ResourceScope: {0}  Too many resource visibility bits may be set.";
-case "Argument_WaitHandleNameTooLong": return "The name can be no more than 260 characters in length.";
-case "Argument_EnumTypeDoesNotMatch": return "The argument type, '{0}', is not the same as the enum type '{1}'.";
-case "InvalidOperation_MethodBuilderBaked": return "The signature of the MethodBuilder can no longer be modified because an operation on the MethodBuilder caused the methodDef token to be created. For example, a call to SetCustomAttribute requires the methodDef token to emit the CustomAttribute token.";
-case "InvalidOperation_GenericParametersAlreadySet": return "The generic parameters are already defined on this MethodBuilder.";
-case "Arg_AccessException": return "Cannot access member.";
-case "Arg_AppDomainUnloadedException": return "Attempted to access an unloaded AppDomain.";
-case "Arg_ApplicationException": return "Error in the application.";
-case "Arg_ArgumentOutOfRangeException": return "Specified argument was out of the range of valid values.";
-case "Arg_ArithmeticException": return "Overflow or underflow in the arithmetic operation.";
-case "Arg_ArrayLengthsDiffer": return "Array lengths must be the same.";
-case "Arg_ArrayPlusOffTooSmall": return "Destination array is not long enough to copy all the items in the collection. Check array index and length.";
-case "Arg_ArrayTypeMismatchException": return "Attempted to access an element as a type incompatible with the array.";
-case "Arg_BadImageFormatException": return "Format of the executable (.exe) or library (.dll) is invalid.";
-case "Argument_BadImageFormatExceptionResolve": return "A BadImageFormatException has been thrown while parsing the signature. This is likely due to lack of a generic context. Ensure genericTypeArguments and genericMethodArguments are provided and contain enough context.";
-case "Arg_BufferTooSmall": return "Not enough space available in the buffer.";
-case "Arg_CATypeResolutionFailed": return "Failed to resolve type from string \"{0}\" which was embedded in custom attribute blob.";
-case "Arg_CannotHaveNegativeValue": return "String cannot contain a minus sign if the base is not 10.";
-case "Arg_CannotUnloadAppDomainException": return "Attempt to unload the AppDomain failed.";
-case "Arg_CannotMixComparisonInfrastructure": return "The usage of IKeyComparer and IHashCodeProvider/IComparer interfaces cannot be mixed; use one or the other.";
-case "Arg_ContextMarshalException": return "Attempted to marshal an object across a context boundary.";
-case "Arg_DataMisalignedException": return "A datatype misalignment was detected in a load or store instruction.";
-case "Arg_DevicesNotSupported": return "FileStream will not open Win32 devices such as disk partitions and tape drives. Avoid use of \"\\\\.\\\" in the path.";
-case "Arg_DuplicateWaitObjectException": return "Duplicate objects in argument.";
-case "Arg_EntryPointNotFoundException": return "Entry point was not found.";
-case "Arg_DllNotFoundException": return "Dll was not found.";
-case "Arg_ExecutionEngineException": return "Internal error in the runtime.";
-case "Arg_FieldAccessException": return "Attempted to access a field that is not accessible by the caller.";
-case "Arg_FileIsDirectory_Name": return "The target file \"{0}\" is a directory, not a file.";
-case "Arg_FormatException": return "One of the identified items was in an invalid format.";
-case "Arg_IndexOutOfRangeException": return "Index was outside the bounds of the array.";
-case "Arg_InsufficientExecutionStackException": return "Insufficient stack to continue executing the program safely. This can happen from having too many functions on the call stack or function on the stack using too much stack space.";
-case "Arg_InvalidCastException": return "Specified cast is not valid.";
-case "Arg_InvalidOperationException": return "Operation is not valid due to the current state of the object.";
-case "Arg_CorruptedCustomCultureFile": return "The file of the custom culture {0} is corrupt. Try to unregister this culture.";
-case "Arg_InvokeMember": return "InvokeMember can be used only for COM objects.";
-case "Arg_InvalidNeutralResourcesLanguage_Asm_Culture": return "The NeutralResourcesLanguageAttribute on the assembly \"{0}\" specifies an invalid culture name: \"{1}\".";
-case "Arg_InvalidNeutralResourcesLanguage_FallbackLoc": return "The NeutralResourcesLanguageAttribute specifies an invalid or unrecognized ultimate resource fallback location: \"{0}\".";
-case "Arg_InvalidSatelliteContract_Asm_Ver": return "Satellite contract version attribute on the assembly '{0}' specifies an invalid version: {1}.";
-case "Arg_MethodAccessException": return "Attempt to access the method failed.";
-case "Arg_MethodAccessException_WithMethodName": return "Attempt to access the method \"{0}\" on type \"{1}\" failed.";
-case "Arg_MethodAccessException_WithCaller": return "Attempt by security transparent method '{0}' to access security critical method '{1}' failed.";
-case "Arg_MissingFieldException": return "Attempted to access a non-existing field.";
-case "Arg_MissingMemberException": return "Attempted to access a missing member.";
-case "Arg_MissingMethodException": return "Attempted to access a missing method.";
-case "Arg_MulticastNotSupportedException": return "Attempted to add multiple callbacks to a delegate that does not support multicast.";
-case "Arg_NotFiniteNumberException": return "Number encountered was not a finite quantity.";
-case "Arg_NotSupportedException": return "Specified method is not supported.";
-case "Arg_UnboundGenParam": return "Late bound operations cannot be performed on types or methods for which ContainsGenericParameters is true.";
-case "Arg_UnboundGenField": return "Late bound operations cannot be performed on fields with types for which Type.ContainsGenericParameters is true.";
-case "Arg_NotGenericParameter": return "Method may only be called on a Type for which Type.IsGenericParameter is true.";
-case "Arg_GenericParameter": return "Method must be called on a Type for which Type.IsGenericParameter is false.";
-case "Arg_NotGenericTypeDefinition": return "{0} is not a GenericTypeDefinition. MakeGenericType may only be called on a type for which Type.IsGenericTypeDefinition is true.";
-case "Arg_NotGenericMethodDefinition": return "{0} is not a GenericMethodDefinition. MakeGenericMethod may only be called on a method for which MethodBase.IsGenericMethodDefinition is true.";
-case "Arg_BadLiteralFormat": return "Encountered an invalid type for a default value.";
-case "Arg_MissingActivationArguments": return "The AppDomainSetup must specify the activation arguments for this call.";
-case "Argument_BadParameterTypeForCAB": return "Cannot emit a CustomAttribute with argument of type {0}.";
-case "Argument_InvalidMemberForNamedArgument": return "The member must be either a field or a property.";
-case "Argument_InvalidTypeName": return "The name of the type is invalid.";
-
-// ; Note - don't change the NullReferenceException default message. This was
-// ; negotiated carefully with the VB team to avoid saying "null" or "nothing".
-case "Arg_NullReferenceException": return "Object reference not set to an instance of an object.";
-
-case "Arg_AccessViolationException": return "Attempted to read or write protected memory. This is often an indication that other memory is corrupt.";
-case "Arg_OverflowException": return "Arithmetic operation resulted in an overflow.";
-case "Arg_PathGlobalRoot": return "Paths that begin with \\\\?\\GlobalRoot are internal to the kernel and should not be opened by managed applications.";
-case "Arg_PathIllegal": return "The path is not of a legal form.";
-case "Arg_PathIllegalUNC": return "The UNC path should be of the form \\\\server\\share.";
-case "Arg_RankException": return "Attempted to operate on an array with the incorrect number of dimensions.";
-case "Arg_RankMultiDimNotSupported": return "Only single dimensional arrays are supported for the requested action.";
-case "Arg_NonZeroLowerBound": return "The lower bound of target array must be zero.";
-case "Arg_RegSubKeyValueAbsent": return "No value exists with that name.";
-case "Arg_ResourceFileUnsupportedVersion": return "The ResourceReader class does not know how to read this version of .resources files. Expected version: {0}  This file: {1}";
-case "Arg_ResourceNameNotExist": return "The specified resource name \"{0}\" does not exist in the resource file.";
-case "Arg_SecurityException": return "Security error.";
-case "Arg_SerializationException": return "Serialization error.";
-case "Arg_StackOverflowException": return "Operation caused a stack overflow.";
-case "Arg_SurrogatesNotAllowedAsSingleChar": return "Unicode surrogate characters must be written out as pairs together in the same call, not individually. Consider passing in a character array instead.";
-case "Arg_SynchronizationLockException": return "Object synchronization method was called from an unsynchronized block of code.";
-case "Arg_RWLockRestoreException": return "ReaderWriterLock.RestoreLock was called without releasing all locks acquired since the call to ReleaseLock.";
-case "Arg_SystemException": return "System error.";
-case "Arg_TimeoutException": return "The operation has timed out.";
-case "Arg_UnauthorizedAccessException": return "Attempted to perform an unauthorized operation.";
-case "Arg_ArgumentException": return "Value does not fall within the expected range.";
-case "Arg_DirectoryNotFoundException": return "Attempted to access a path that is not on the disk.";
-case "Arg_DriveNotFoundException": return "Attempted to access a drive that is not available.";
-case "Arg_EndOfStreamException": return "Attempted to read past the end of the stream.";
-case "Arg_HexStyleNotSupported": return "The number style AllowHexSpecifier is not supported on floating point data types.";
-case "Arg_IOException": return "I/O error occurred.";
-case "Arg_InvalidHexStyle": return "With the AllowHexSpecifier bit set in the enum bit field, the only other valid bits that can be combined into the enum value must be a subset of those in HexNumber.";
-case "Arg_KeyNotFound": return "The given key was not present in the dictionary.";
-case "Argument_InvalidNumberStyles": return "An undefined NumberStyles value is being used.";
-case "Argument_InvalidDateTimeStyles": return "An undefined DateTimeStyles value is being used.";
-case "Argument_InvalidTimeSpanStyles": return "An undefined TimeSpanStyles value is being used.";
-case "Argument_DateTimeOffsetInvalidDateTimeStyles": return "The DateTimeStyles value 'NoCurrentDateDefault' is not allowed when parsing DateTimeOffset.";
-case "Argument_NativeResourceAlreadyDefined": return "Native resource has already been defined.";
-case "Argument_BadObjRef": return "Invalid ObjRef provided to '{0}'.";
-case "Argument_InvalidCultureName": return "Culture name '{0}' is not supported.";
-case "Argument_NameTooLong": return "The name '{0}' is too long to be a Culture or Region name, which is limited to {1} characters.";
-case "Argument_NameContainsInvalidCharacters": return "The name '{0}' contains characters that are not valid for a Culture or Region.";
-case "Argument_InvalidRegionName": return "Region name '{0}' is not supported.";
-case "Argument_CannotCreateTypedReference": return "Cannot use function evaluation to create a TypedReference object.";
-case "Arg_ArrayZeroError": return "Array must not be of length zero.";
-case "Arg_BogusIComparer": return "Unable to sort because the IComparer.Compare() method returns inconsistent results. Either a value does not compare equal to itself, or one value repeatedly compared to another value yields different results. IComparer: '{0}'.";
-case "Arg_CreatInstAccess": return "Cannot specify both CreateInstance and another access type.";
-case "Arg_CryptographyException": return "Error occurred during a cryptographic operation.";
-case "Arg_DateTimeRange": return "Combination of arguments to the DateTime constructor is out of the legal range.";
-case "Arg_DecBitCtor": return "Decimal byte array constructor requires an array of length four containing valid decimal bytes.";
-case "Arg_DlgtTargMeth": return "Cannot bind to the target method because its signature or security transparency is not compatible with that of the delegate type.";
-case "Arg_DlgtTypeMis": return "Delegates must be of the same type.";
-case "Arg_DlgtNullInst": return "Delegate to an instance method cannot have null 'this'.";
-case "Arg_DllInitFailure": return "One machine may not have remote administration enabled, or both machines may not be running the remote registry service.";
-case "Arg_EmptyArray": return "Array may not be empty.";
-case "Arg_EmptyOrNullArray": return "Array may not be empty or null.";
-case "Arg_EmptyCollection": return "Collection must not be empty.";
-case "Arg_EmptyOrNullString": return "String may not be empty or null.";
-case "Argument_ItemNotExist": return "The specified item does not exist in this KeyedCollection.";
-case "Argument_EncodingNotSupported": return "'{0}' is not a supported encoding name. For information on defining a custom encoding, see the documentation for the Encoding.RegisterProvider method.";
-case "Argument_FallbackBufferNotEmpty": return "Cannot change fallback when buffer is not empty. Previous Convert() call left data in the fallback buffer.";
-case "Argument_InvalidCodePageConversionIndex": return "Unable to translate Unicode character \\u{0:X4} at index {1} to specified code page.";
-case "Argument_InvalidCodePageBytesIndex": return "Unable to translate bytes {0} at index {1} from specified code page to Unicode.";
-case "Argument_RecursiveFallback": return "Recursive fallback not allowed for character \\u{0:X4}.";
-case "Argument_RecursiveFallbackBytes": return "Recursive fallback not allowed for bytes {0}.";
-case "Arg_EnumAndObjectMustBeSameType": return "Object must be the same type as the enum. The type passed in was '{0}'; the enum type was '{1}'.";
-case "Arg_EnumIllegalVal": return "Illegal enum value: {0}.";
-case "Arg_EnumNotSingleFlag": return "Must set exactly one flag.";
-case "Arg_EnumAtLeastOneFlag": return "Must set at least one flag.";
-case "Arg_EnumUnderlyingTypeAndObjectMustBeSameType": return "Enum underlying type and the object must be same type or object must be a String. Type passed in was '{0}'; the enum underlying type was '{1}'.";
-case "Arg_EnumFormatUnderlyingTypeAndObjectMustBeSameType": return "Enum underlying type and the object must be same type or object. Type passed in was '{0}'; the enum underlying type was '{1}'.";
-case "Arg_EnumMustHaveUnderlyingValueField": return "All enums must have an underlying value__ field.";
-case "Arg_COMAccess": return "Must specify property Set or Get or method call for a COM Object.";
-case "Arg_COMPropSetPut": return "Only one of the following binding flags can be set: BindingFlags.SetProperty, BindingFlags.PutDispProperty,  BindingFlags.PutRefDispProperty.";
-case "Arg_FldSetGet": return "Cannot specify both Get and Set on a field.";
-case "Arg_PropSetGet": return "Cannot specify both Get and Set on a property.";
-case "Arg_CannotBeNaN": return "TimeSpan does not accept floating point Not-a-Number values.";
-case "Arg_FldGetPropSet": return "Cannot specify both GetField and SetProperty.";
-case "Arg_FldSetPropGet": return "Cannot specify both SetField and GetProperty.";
-case "Arg_FldSetInvoke": return "Cannot specify Set on a Field and Invoke on a method.";
-case "Arg_FldGetArgErr": return "No arguments can be provided to Get a field value.";
-case "Arg_FldSetArgErr": return "Only the field value can be specified to set a field value.";
-case "Arg_GetMethNotFnd": return "Property Get method was not found.";
-case "Arg_GuidArrayCtor": return "Byte array for GUID must be exactly {0} bytes long.";
-case "Arg_HandleNotAsync": return "Handle does not support asynchronous operations. The parameters to the FileStream constructor may need to be changed to indicate that the handle was opened synchronously (that is, it was not opened for overlapped I/O).";
-case "Arg_HandleNotSync": return "Handle does not support synchronous operations. The parameters to the FileStream constructor may need to be changed to indicate that the handle was opened asynchronously (that is, it was opened explicitly for overlapped I/O).";
-case "Arg_HTCapacityOverflow": return "Hashtable's capacity overflowed and went negative. Check load factor, capacity and the current size of the table.";
-case "Arg_IndexMustBeInt": return "All indexes must be of type Int32.";
-case "Arg_InvalidConsoleColor": return "The ConsoleColor enum value was not defined on that enum. Please use a defined color from the enum.";
-case "Arg_InvalidFileAttrs": return "Invalid File or Directory attributes value.";
-case "Arg_InvalidHandle": return "Invalid handle.";
-case "Arg_InvalidTypeInSignature": return "The signature Type array contains some invalid type (i.e. null, void)";
-case "Arg_InvalidTypeInRetType": return "The return Type contains some invalid type (i.e. null, ByRef)";
-case "Arg_EHClauseNotFilter": return "This ExceptionHandlingClause is not a filter.";
-case "Arg_EHClauseNotClause": return "This ExceptionHandlingClause is not a clause.";
-case "Arg_ReflectionOnlyCA": return "It is illegal to reflect on the custom attributes of a Type loaded via ReflectionOnlyGetType (see Assembly.ReflectionOnly) -- use CustomAttributeData instead.";
-case "Arg_ReflectionOnlyInvoke": return "It is illegal to invoke a method on a Type loaded via ReflectionOnlyGetType.";
-case "Arg_ReflectionOnlyField": return "It is illegal to get or set the value on a field on a Type loaded via ReflectionOnlyGetType.";
-case "Arg_MemberInfoNullModule": return "The Module object containing the member cannot be null.";
-case "Arg_ParameterInfoNullMember": return "The MemberInfo object defining the parameter cannot be null.";
-case "Arg_ParameterInfoNullModule": return "The Module object containing the parameter cannot be null.";
-case "Arg_AssemblyNullModule": return "The manifest module of the assembly cannot be null.";
-case "Arg_LongerThanSrcArray": return "Source array was not long enough. Check srcIndex and length, and the array's lower bounds.";
-case "Arg_LongerThanDestArray": return "Destination array was not long enough. Check destIndex and length, and the array's lower bounds.";
-case "Arg_LowerBoundsMustMatch": return "The arrays' lower bounds must be identical.";
-case "Arg_MustBeBoolean": return "Object must be of type Boolean.";
-case "Arg_MustBeByte": return "Object must be of type Byte.";
-case "Arg_MustBeChar": return "Object must be of type Char.";
-case "Arg_MustBeDateTime": return "Object must be of type DateTime.";
-case "Arg_MustBeDateTimeOffset": return "Object must be of type DateTimeOffset.";
-case "Arg_MustBeDecimal": return "Object must be of type Decimal.";
-case "Arg_MustBeDelegate": return "Type must derive from Delegate.";
-case "Arg_MustBeDouble": return "Object must be of type Double.";
-case "Arg_MustBeDriveLetterOrRootDir": return "Object must be a root directory (\"C:\\\") or a drive letter (\"C\").";
-case "Arg_MustBeEnum": return "Type provided must be an Enum.";
-case "Arg_MustBeEnumBaseTypeOrEnum": return "The value passed in must be an enum base or an underlying type for an enum, such as an Int32.";
-case "Arg_MustBeGuid": return "Object must be of type GUID.";
-case "Arg_MustBeIdentityReferenceType": return "Type must be an IdentityReference, such as NTAccount or SecurityIdentifier.";
-case "Arg_MustBeInterface": return "Type passed must be an interface.";
-case "Arg_MustBeInt16": return "Object must be of type Int16.";
-case "Arg_MustBeInt32": return "Object must be of type Int32.";
-case "Arg_MustBeInt64": return "Object must be of type Int64.";
-case "Arg_MustBePrimArray": return "Object must be an array of primitives.";
-case "Arg_MustBePointer": return "Type must be a Pointer.";
-case "Arg_MustBeStatic": return "Method must be a static method.";
-case "Arg_MustBeString": return "Object must be of type String.";
-case "Arg_MustBeStringPtrNotAtom": return "The pointer passed in as a String must not be in the bottom 64K of the process's address space.";
-case "Arg_MustBeSByte": return "Object must be of type SByte.";
-case "Arg_MustBeSingle": return "Object must be of type Single.";
-case "Arg_MustBeTimeSpan": return "Object must be of type TimeSpan.";
-case "Arg_MustBeType": return "Type must be a type provided by the runtime.";
-case "Arg_MustBeUInt16": return "Object must be of type UInt16.";
-case "Arg_MustBeUInt32": return "Object must be of type UInt32.";
-case "Arg_MustBeUInt64": return "Object must be of type UInt64.";
-case "Arg_MustBeVersion": return "Object must be of type Version.";
-case "Arg_MustBeTrue": return "Argument must be true.";
-case "Arg_MustAllBeRuntimeType": return "At least one type argument is not a runtime type.";
-case "Arg_NamedParamNull": return "Named parameter value must not be null.";
-case "Arg_NamedParamTooBig": return "Named parameter array cannot be bigger than argument array.";
-case "Arg_Need1DArray": return "Array was not a one-dimensional array.";
-case "Arg_Need2DArray": return "Array was not a two-dimensional array.";
-case "Arg_Need3DArray": return "Array was not a three-dimensional array.";
-case "Arg_NeedAtLeast1Rank": return "Must provide at least one rank.";
-case "Arg_NoDefCTor": return "No parameterless constructor defined for this object.";
-case "Arg_BitArrayTypeUnsupported": return "Only supported array types for CopyTo on BitArrays are Boolean[], Int32[] and Byte[].";
-case "Arg_DivideByZero": return "Attempted to divide by zero.";
-case "Arg_NoAccessSpec": return "Must specify binding flags describing the invoke operation required (BindingFlags.InvokeMethod CreateInstance GetField SetField GetProperty SetProperty).";
-case "Arg_NoStaticVirtual": return "Method cannot be both static and virtual.";
-case "Arg_NotFoundIFace": return "Interface not found.";
-case "Arg_ObjObjEx": return "Object of type '{0}' cannot be converted to type '{1}'.";
-case "Arg_ObjObj": return "Object type cannot be converted to target type.";
-case "Arg_FieldDeclTarget": return "Field '{0}' defined on type '{1}' is not a field on the target object which is of type '{2}'.";
-case "Arg_OleAutDateInvalid": return "Not a legal OleAut date.";
-case "Arg_OleAutDateScale": return "OleAut date did not convert to a DateTime correctly.";
-case "Arg_PlatformNotSupported": return "Operation is not supported on this platform.";
-case "Arg_PlatformSecureString": return "SecureString is only supported on Windows 2000 SP3 and higher platforms.";
-case "Arg_ParmCnt": return "Parameter count mismatch.";
-case "Arg_ParmArraySize": return "Must specify one or more parameters.";
-case "Arg_Path2IsRooted": return "Second path fragment must not be a drive or UNC name.";
-case "Arg_PathIsVolume": return "Path must not be a drive.";
-case "Arg_PrimWiden": return "Cannot widen from source type to target type either because the source type is a not a primitive type or the conversion cannot be accomplished.";
-case "Arg_NullIndex": return "Arrays indexes must be set to an object instance.";
-case "Arg_VarMissNull": return "Missing parameter does not have a default value.";
-case "Arg_PropSetInvoke": return "Cannot specify Set on a property and Invoke on a method.";
-case "Arg_PropNotFound": return "Could not find the specified property.";
-case "Arg_RankIndices": return "Indices length does not match the array rank.";
-case "Arg_RanksAndBounds": return "Number of lengths and lowerBounds must match.";
-case "Arg_RegSubKeyAbsent": return "Cannot delete a subkey tree because the subkey does not exist.";
-case "Arg_RemoveArgNotFound": return "Cannot remove the specified item because it was not found in the specified Collection.";
-case "Arg_RegKeyDelHive": return "Cannot delete a registry hive's subtree.";
-case "Arg_RegKeyNoRemoteConnect": return "No remote connection to '{0}' while trying to read the registry.";
-case "Arg_RegKeyOutOfRange": return "Registry HKEY was out of the legal range.";
-case "Arg_RegKeyNotFound": return "The specified registry key does not exist.";
-case "Arg_RegKeyStrLenBug": return "Registry key names should not be greater than 255 characters.";
-case "Arg_RegValStrLenBug": return "Registry value names should not be greater than 16,383 characters.";
-case "Arg_RegBadKeyKind": return "The specified RegistryValueKind is an invalid value.";
-case "Arg_RegGetOverflowBug": return "RegistryKey.GetValue does not allow a String that has a length greater than Int32.MaxValue.";
-case "Arg_RegSetMismatchedKind": return "The type of the value object did not match the specified RegistryValueKind or the object could not be properly converted.";
-case "Arg_RegSetBadArrType": return "RegistryKey.SetValue does not support arrays of type '{0}'. Only Byte[] and String[] are supported.";
-case "Arg_RegSetStrArrNull": return "RegistryKey.SetValue does not allow a String[] that contains a null String reference.";
-case "Arg_RegInvalidKeyName": return "Registry key name must start with a valid base key name.";
-case "Arg_ResMgrNotResSet": return "Type parameter must refer to a subclass of ResourceSet.";
-case "Arg_SetMethNotFnd": return "Property set method not found.";
-case "Arg_TypeRefPrimitve": return "TypedReferences cannot be redefined as primitives.";
-case "Arg_UnknownTypeCode": return "Unknown TypeCode value.";
-case "Arg_VersionString": return "Version string portion was too short or too long.";
-case "Arg_NoITypeInfo": return "Specified TypeInfo was invalid because it did not support the ITypeInfo interface.";
-case "Arg_NoITypeLib": return "Specified TypeLib was invalid because it did not support the ITypeLib interface.";
-case "Arg_NoImporterCallback": return "Specified type library importer callback was invalid because it did not support the ITypeLibImporterNotifySink interface.";
-case "Arg_ImporterLoadFailure": return "The type library importer encountered an error during type verification. Try importing without class members.";
-case "Arg_InvalidBase": return "Invalid Base.";
-case "Arg_EnumValueNotFound": return "Requested value '{0}' was not found.";
-case "Arg_EnumLitValueNotFound": return "Literal value was not found.";
-case "Arg_MustContainEnumInfo": return "Must specify valid information for parsing in the string.";
-case "Arg_InvalidSearchPattern": return "Search pattern cannot contain \"..\" to move up directories and can be contained only internally in file/directory names, as in \"a..b\".";
-case "Arg_NegativeArgCount": return "Argument count must not be negative.";
-case "Arg_InvalidAccessEntry": return "Specified access entry is invalid because it is unrestricted. The global flags should be specified instead.";
-case "Arg_InvalidFileName": return "Specified file name was invalid.";
-case "Arg_InvalidFileExtension": return "Specified file extension was not a valid extension.";
-case "Arg_COMException": return "Error HRESULT E_FAIL has been returned from a call to a COM component.";
-case "Arg_ExternalException": return "External component has thrown an exception.";
-case "Arg_InvalidComObjectException": return "Attempt has been made to use a COM object that does not have a backing class factory.";
-case "Arg_InvalidOleVariantTypeException": return "Specified OLE variant was invalid.";
-case "Arg_MarshalDirectiveException": return "Marshaling directives are invalid.";
-case "Arg_MarshalAsAnyRestriction": return "AsAny cannot be used on return types, ByRef parameters, ArrayWithOffset, or parameters passed from unmanaged to managed.";
-case "Arg_NDirectBadObject": return "No PInvoke conversion exists for value passed to Object-typed parameter.";
-case "Arg_SafeArrayTypeMismatchException": return "Specified array was not of the expected type.";
-case "Arg_VTableCallsNotSupportedException": return "Attempted to make an early bound call on a COM dispatch-only interface.";
-case "Arg_SafeArrayRankMismatchException": return "Specified array was not of the expected rank.";
-case "Arg_AmbiguousMatchException": return "Ambiguous match found.";
-case "Arg_CustomAttributeFormatException": return "Binary format of the specified custom attribute was invalid.";
-case "Arg_InvalidFilterCriteriaException": return "Specified filter criteria was invalid.";
-case "Arg_TypeLoadNullStr": return "A null or zero length string does not represent a valid Type.";
-case "Arg_TargetInvocationException": return "Exception has been thrown by the target of an invocation.";
-case "Arg_TargetParameterCountException": return "Number of parameters specified does not match the expected number.";
-case "Arg_TypeAccessException": return "Attempt to access the type failed.";
-case "Arg_TypeLoadException": return "Failure has occurred while loading a type.";
-case "Arg_TypeUnloadedException": return "Type had been unloaded.";
-case "Arg_ThreadStateException": return "Thread was in an invalid state for the operation being executed.";
-case "Arg_ThreadStartException": return "Thread failed to start.";
-case "Arg_WrongAsyncResult": return "IAsyncResult object did not come from the corresponding async method on this type.";
-case "Arg_WrongType": return "The value \"{0}\" is not of type \"{1}\" and cannot be used in this generic collection.";
-case "Argument_InvalidArgumentForComparison": return "Type of argument is not compatible with the generic comparer.";
-case "Argument_ALSInvalidCapacity": return "Specified capacity must not be less than the current capacity.";
-case "Argument_ALSInvalidSlot": return "Specified slot number was invalid.";
-case "Argument_IdnIllegalName": return "Decoded string is not a valid IDN name.";
-case "Argument_IdnBadBidi": return "Left to right characters may not be mixed with right to left characters in IDN labels.";
-case "Argument_IdnBadLabelSize": return "IDN labels must be between 1 and 63 characters long.";
-case "Argument_IdnBadNameSize": return "IDN names must be between 1 and {0} characters long.";
-case "Argument_IdnBadPunycode": return "Invalid IDN encoded string.";
-case "Argument_IdnBadStd3": return "Label contains character '{0}' not allowed with UseStd3AsciiRules";
-case "Arg_InvalidANSIString": return "The ANSI string passed in could not be converted from the default ANSI code page to Unicode.";
-case "Arg_InvalidUTF8String": return "The UTF8 string passed in could not be converted to Unicode.";
-case "Argument_InvalidCharSequence": return "Invalid Unicode code point found at index {0}.";
-case "Argument_InvalidCharSequenceNoIndex": return "String contains invalid Unicode code points.";
-case "Argument_InvalidCalendar": return "Not a valid calendar for the given culture.";
-case "Argument_InvalidNormalizationForm": return "Invalid or unsupported normalization form.";
-case "Argument_InvalidPathChars": return "Illegal characters in path.";
-case "Argument_InvalidOffLen": return "Offset and length were out of bounds for the array or count is greater than the number of elements from index to the end of the source collection.";
-case "Argument_InvalidSeekOrigin": return "Invalid seek origin.";
-case "Argument_SeekOverflow": return "The specified seek offset '{0}' would result in a negative Stream position.";
-case "Argument_InvalidUnity": return "Invalid Unity type.";
-case "Argument_LongEnvVarName": return "Environment variable name cannot contain 1024 or more characters.";
-case "Argument_LongEnvVarValue": return "Environment variable name or value is too long.";
-case "Argument_StringFirstCharIsZero": return "The first char in the string is the null character.";
-case "Argument_OnlyMscorlib": return "Only mscorlib's assembly is valid.";
-case "Argument_PathEmpty": return "Path cannot be the empty string or all whitespace.";
-case "Argument_PathFormatNotSupported": return "The given path's format is not supported.";
-case "Argument_PathUriFormatNotSupported": return "URI formats are not supported.";
-case "Argument_TypeNameTooLong": return "Type name was too long. The fully qualified type name must be less than 1,024 characters.";
-case "Argument_StreamNotReadable": return "Stream was not readable.";
-case "Argument_StreamNotWritable": return "Stream was not writable.";
-case "Argument_InvalidNumberOfMembers": return "MemberData contains an invalid number of members.";
-case "Argument_InvalidValue": return "Value was invalid.";
-case "Argument_InvalidKey": return "Key was invalid.";
-case "Argument_MinMaxValue": return "'{0}' cannot be greater than {1}.";
-case "Argument_InvalidGroupSize": return "Every element in the value array should be between one and nine, except for the last element, which can be zero.";
-case "Argument_MustHaveAttributeBaseClass": return "Type passed in must be derived from System.Attribute or System.Attribute itself.";
-case "Argument_NoUninitializedStrings": return "Uninitialized Strings cannot be created.";
-case "Argument_UnequalMembers": return "Supplied MemberInfo does not match the expected type.";
-case "Argument_BadFormatSpecifier": return "Format specifier was invalid.";
-case "Argument_InvalidHighSurrogate": return "Found a high surrogate char without a following low surrogate at index: {0}. The input may not be in this encoding, or may not contain valid Unicode (UTF-16) characters.";
-case "Argument_InvalidLowSurrogate": return "Found a low surrogate char without a preceding high surrogate at index: {0}. The input may not be in this encoding, or may not contain valid Unicode (UTF-16) characters.";
-case "Argument_UnmatchingSymScope": return "Non-matching symbol scope.";
-case "Argument_NotInExceptionBlock": return "Not currently in an exception block.";
-case "Argument_BadExceptionCodeGen": return "Incorrect code generation for exception block.";
-case "Argument_NotExceptionType": return "Does not extend Exception.";
-case "Argument_DuplicateResourceName": return "Duplicate resource name within an assembly.";
-case "Argument_BadPersistableModuleInTransientAssembly": return "Cannot have a persistable module in a transient assembly.";
-case "Argument_InvalidPermissionState": return "Invalid permission state.";
-case "Argument_UnrestrictedIdentityPermission": return "Identity permissions cannot be unrestricted.";
-case "Argument_WrongType": return "Operation on type '{0}' attempted with target of incorrect type.";
-case "Argument_IllegalZone": return "Illegal security permission zone specified.";
-case "Argument_HasToBeArrayClass": return "Must be an array type.";
-case "Argument_InvalidDirectory": return "Invalid directory, '{0}'.";
-case "Argument_DataLengthDifferent": return "Parameters 'members' and 'data' must have the same length.";
-case "Argument_SigIsFinalized": return "Completed signature cannot be modified.";
-case "Argument_ArraysInvalid": return "Array or pointer types are not valid.";
-case "Argument_GenericsInvalid": return "Generic types are not valid.";
-case "Argument_LargeInteger": return "Integer or token was too large to be encoded.";
-case "Argument_BadSigFormat": return "Incorrect signature format.";
-case "Argument_UnmatchedMethodForLocal": return "Local passed in does not belong to this ILGenerator.";
-case "Argument_DuplicateName": return "Tried to add NamedPermissionSet with non-unique name.";
-case "Argument_InvalidXMLElement": return "Invalid XML. Missing required tag <{0}> for type '{1}'.";
-case "Argument_InvalidXMLMissingAttr": return "Invalid XML. Missing required attribute '{0}'.";
-case "Argument_CannotGetTypeTokenForByRef": return "Cannot get TypeToken for a ByRef type.";
-case "Argument_NotASimpleNativeType": return "The UnmanagedType passed to DefineUnmanagedMarshal is not a simple type. None of the following values may be used: UnmanagedType.ByValTStr, UnmanagedType.SafeArray, UnmanagedType.ByValArray, UnmanagedType.LPArray, UnmanagedType.CustomMarshaler.";
-case "Argument_NotACustomMarshaler": return "Not a custom marshal.";
-case "Argument_NoUnmanagedElementCount": return "Unmanaged marshal does not have ElementCount.";
-case "Argument_NoNestedMarshal": return "Only LPArray or SafeArray has nested unmanaged marshal.";
-case "Argument_InvalidXML": return "Invalid Xml.";
-case "Argument_NoUnderlyingCCW": return "The object has no underlying COM data associated with it.";
-case "Argument_BadFieldType": return "Bad field type in defining field.";
-case "Argument_InvalidXMLBadVersion": return "Invalid Xml - can only parse elements of version one.";
-case "Argument_NotAPermissionElement": return "'elem' was not a permission element.";
-case "Argument_NPMSInvalidName": return "Name can be neither null nor empty.";
-case "Argument_InvalidElementTag": return "Invalid element tag '{0}'.";
-case "Argument_InvalidElementText": return "Invalid element text '{0}'.";
-case "Argument_InvalidElementName": return "Invalid element name '{0}'.";
-case "Argument_InvalidElementValue": return "Invalid element value '{0}'.";
-case "Argument_AttributeNamesMustBeUnique": return "Attribute names must be unique.";
-#if FEATURE_CAS_POLICY
-case "Argument_UninitializedCertificate": return "Uninitialized certificate object.";
-case "Argument_MembershipConditionElement": return "Element must be a <IMembershipCondition> element.";
-case "Argument_ReservedNPMS": return "Cannot remove or modify reserved permissions set '{0}'.";
-case "Argument_NPMSInUse": return "Permission set '{0}' was in use and could not be deleted.";
-case "Argument_StrongNameGetPublicKey": return "Unable to obtain public key for StrongNameKeyPair.";
-case "Argument_SiteCannotBeNull": return "Site name must be specified.";
-case "Argument_BlobCannotBeNull": return "Public key must be specified.";
-case "Argument_ZoneCannotBeNull": return "Zone must be specified.";
-case "Argument_UrlCannotBeNull": return "URL must be specified.";
-case "Argument_NoNPMS": return "Unable to find a permission set with the provided name.";
-case "Argument_FailedCodeGroup": return "Failed to create a code group of type '{0}'.";
-case "Argument_CodeGroupChildrenMustBeCodeGroups": return "All objects in the input list must have a parent type of 'CodeGroup'.";
-#endif // FEATURE_CAS_POLICY
-#if FEATURE_IMPERSONATION
-case "Argument_InvalidPrivilegeName": return "Privilege '{0}' is not valid on this system.";
-case "Argument_TokenZero": return "Token cannot be zero.";
-case "Argument_InvalidImpersonationToken": return "Invalid token for impersonation - it cannot be duplicated.";
-case "Argument_ImpersonateUser": return "Unable to impersonate user.";
-#endif // FEATURE_IMPERSONATION
-case "Argument_InvalidHexFormat": return "Improperly formatted hex string.";
-case "Argument_InvalidSite": return "Invalid site.";
-case "Argument_InterfaceMap": return "'this' type cannot be an interface itself.";
-case "Argument_ArrayGetInterfaceMap": return "Interface maps for generic interfaces on arrays cannot be retrived.";
-case "Argument_InvalidName": return "Invalid name.";
-case "Argument_InvalidDirectoryOnUrl": return "Invalid directory on URL.";
-case "Argument_InvalidUrl": return "Invalid URL.";
-case "Argument_InvalidKindOfTypeForCA": return "This type cannot be represented as a custom attribute.";
-case "Argument_MustSupplyContainer": return "When supplying a FieldInfo for fixing up a nested type, a valid ID for that containing object must also be supplied.";
-case "Argument_MustSupplyParent": return "When supplying the ID of a containing object, the FieldInfo that identifies the current field within that object must also be supplied.";
-case "Argument_NoClass": return "Element does not specify a class.";
-case "Argument_WrongElementType": return "'{0}' element required.";
-case "Argument_UnableToGeneratePermissionSet": return "Unable to generate permission set; input XML may be malformed.";
-case "Argument_NoEra": return "No Era was supplied.";
-case "Argument_AssemblyAlreadyFullTrust": return "Assembly was already fully trusted.";
-case "Argument_AssemblyNotFullTrust": return "Assembly was not fully trusted.";
-case "Argument_AssemblyWinMD": return "Assembly must not be a Windows Runtime assembly.";
-case "Argument_MemberAndArray": return "Cannot supply both a MemberInfo and an Array to indicate the parent of a value type.";
-case "Argument_ObjNotComObject": return "The object's type must be __ComObject or derived from __ComObject.";
-case "Argument_ObjIsWinRTObject": return "The object's type must not be a Windows Runtime type.";
-case "Argument_TypeNotComObject": return "The type must be __ComObject or be derived from __ComObject.";
-case "Argument_TypeIsWinRTType": return "The type must not be a Windows Runtime type.";
-case "Argument_CantCallSecObjFunc": return "Cannot evaluate a security function.";
-case "Argument_StructMustNotBeValueClass": return "The structure must not be a value class.";
-case "Argument_NoSpecificCulture": return "Please select a specific culture, such as zh-CN, zh-HK, zh-TW, zh-MO, zh-SG.";
-case "Argument_InvalidResourceCultureName": return "The given culture name '{0}' cannot be used to locate a resource file. Resource filenames must consist of only letters, numbers, hyphens or underscores.";
-case "Argument_InvalidParamInfo": return "Invalid type for ParameterInfo member in Attribute class.";
-case "Argument_EmptyDecString": return "Decimal separator cannot be the empty string.";
-case "Argument_OffsetOfFieldNotFound": return "Field passed in is not a marshaled member of the type '{0}'.";
-case "Argument_EmptyStrongName": return "StrongName cannot have an empty string for the assembly name.";
-case "Argument_NotSerializable": return "Argument passed in is not serializable.";
-case "Argument_EmptyApplicationName": return "ApplicationId cannot have an empty string for the name.";
-case "Argument_NoDomainManager": return "The domain manager specified by the host could not be instantiated.";
-case "Argument_NoMain": return "Main entry point not defined.";
-case "Argument_InvalidDateTimeKind": return "Invalid DateTimeKind value.";
-case "Argument_ConflictingDateTimeStyles": return "The DateTimeStyles values AssumeLocal and AssumeUniversal cannot be used together.";
-case "Argument_ConflictingDateTimeRoundtripStyles": return "The DateTimeStyles value RoundtripKind cannot be used with the values AssumeLocal, AssumeUniversal or AdjustToUniversal.";
-case "Argument_InvalidDigitSubstitution": return "The DigitSubstitution property must be of a valid member of the DigitShapes enumeration. Valid entries include Context, NativeNational or None.";
-case "Argument_InvalidNativeDigitCount": return "The NativeDigits array must contain exactly ten members.";
-case "Argument_InvalidNativeDigitValue": return "Each member of the NativeDigits array must be a single text element (one or more UTF16 code points) with a Unicode Nd (Number, Decimal Digit) property indicating it is a digit.";
-case "ArgumentException_InvalidAceBinaryForm": return "The binary form of an ACE object is invalid.";
-case "ArgumentException_InvalidAclBinaryForm": return "The binary form of an ACL object is invalid.";
-case "ArgumentException_InvalidSDSddlForm": return "The SDDL form of a security descriptor object is invalid.";
-case "Argument_InvalidSafeHandle": return "The SafeHandle is invalid.";
-case "Argument_CannotPrepareAbstract": return "Abstract methods cannot be prepared.";
-case "Argument_ArrayTooLarge": return "The input array length must not exceed Int32.MaxValue / {0}. Otherwise BitArray.Length would exceed Int32.MaxValue.";
-case "Argument_RelativeUrlMembershipCondition": return "UrlMembershipCondition requires an absolute URL.";
-case "Argument_EmptyWaithandleArray": return "Waithandle array may not be empty.";
-case "Argument_InvalidSafeBufferOffLen": return "Offset and length were greater than the size of the SafeBuffer.";
-case "Argument_NotEnoughBytesToRead": return "There are not enough bytes remaining in the accessor to read at this position.";
-case "Argument_NotEnoughBytesToWrite": return "There are not enough bytes remaining in the accessor to write at this position.";
-case "Argument_OffsetAndLengthOutOfBounds": return "Offset and length were out of bounds for the array or count is greater than the number of elements from index to the end of the source collection.";
-case "Argument_OffsetAndCapacityOutOfBounds": return "Offset and capacity were greater than the size of the view.";
-case "Argument_UnmanagedMemAccessorWrapAround": return "The UnmanagedMemoryAccessor capacity and offset would wrap around the high end of the address space.";
-case "Argument_UnrecognizedLoaderOptimization": return "Unrecognized LOADER_OPTIMIZATION property value.  Supported values may include \"SingleDomain\", \"MultiDomain\", \"MultiDomainHost\", and \"NotSpecified\".";
-case "ArgumentException_NotAllCustomSortingFuncsDefined": return "Implementations of all the NLS functions must be provided.";
-case "ArgumentException_MinSortingVersion": return "The runtime does not support a version of \"{0}\" less than {1}.";
-
-// ;
-// ; =====================================================
-// ; Reflection Emit resource strings
-case "Arugment_EmitMixedContext1": return "Type '{0}' was loaded in the ReflectionOnly context but the AssemblyBuilder was not created as AssemblyBuilderAccess.ReflectionOnly.";
-case "Arugment_EmitMixedContext2": return "Type '{0}' was not loaded in the ReflectionOnly context but the AssemblyBuilder was created as AssemblyBuilderAccess.ReflectionOnly.";
-case "Argument_BadSizeForData": return "Data size must be > 0 and < 0x3f0000";
-case "Argument_InvalidLabel": return "Invalid Label.";
-case "Argument_RedefinedLabel": return "Label multiply defined.";
-case "Argument_UnclosedExceptionBlock": return "The IL Generator cannot be used while there are unclosed exceptions.";
-case "Argument_MissingDefaultConstructor": return "was missing default constructor.";
-case "Argument_TooManyFinallyClause": return "Exception blocks may have at most one finally clause.";
-case "Argument_NotInTheSameModuleBuilder": return "The argument passed in was not from the same ModuleBuilder.";
-case "Argument_BadCurrentLocalVariable": return "Bad current local variable for setting symbol information.";
-case "Argument_DuplicateModuleName": return "Duplicate dynamic module name within an assembly.";
-case "Argument_DuplicateTypeName": return "Duplicate type name within an assembly.";
-case "Argument_InvalidAssemblyName": return "Assembly names may not begin with whitespace or contain the characters '/', or '\\' or ':'.";
-case "Argument_InvalidGenericInstantiation": return "The given generic instantiation was invalid.";
-case "Argument_DuplicatedFileName": return "Duplicate file names.";
-case "Argument_GlobalFunctionHasToBeStatic": return "Global members must be static.";
-case "Argument_BadPInvokeOnInterface": return "PInvoke methods cannot exist on interfaces.";
-case "Argument_BadPInvokeMethod": return "PInvoke methods must be static and native and cannot be abstract.";
-case "Argument_MethodRedefined": return "Method has been already defined.";
-case "Argument_BadTypeAttrAbstractNFinal": return "Bad type attributes. A type cannot be both abstract and final.";
-case "Argument_BadTypeAttrNestedVisibilityOnNonNestedType": return "Bad type attributes. Nested visibility flag set on a non-nested type.";
-case "Argument_BadTypeAttrNonNestedVisibilityNestedType": return "Bad type attributes. Non-nested visibility flag set on a nested type.";
-case "Argument_BadTypeAttrInvalidLayout": return "Bad type attributes. Invalid layout attribute specified.";
-case "Argument_BadTypeAttrReservedBitsSet": return "Bad type attributes. Reserved bits set on the type.";
-case "Argument_BadFieldSig": return "Field signatures do not have return types.";
-case "Argument_ShouldOnlySetVisibilityFlags": return "Should only set visibility flags when creating EnumBuilder.";
-case "Argument_BadNestedTypeFlags": return "Visibility of interfaces must be one of the following: NestedAssembly, NestedFamANDAssem, NestedFamily, NestedFamORAssem, NestedPrivate or NestedPublic.";
-case "Argument_ShouldNotSpecifyExceptionType": return "Should not specify exception type for catch clause for filter block.";
-case "Argument_BadLabel": return "Bad label in ILGenerator.";
-case "Argument_BadLabelContent": return "Bad label content in ILGenerator.";
-case "Argument_EmitWriteLineType": return "EmitWriteLine does not support this field or local type.";
-case "Argument_ConstantNull": return "Null is not a valid constant value for this type.";
-case "Argument_ConstantDoesntMatch": return "Constant does not match the defined type.";
-case "Argument_ConstantNotSupported": return "{0} is not a supported constant type.";
-case "Argument_BadConstructor": return "Cannot have private or static constructor.";
-case "Argument_BadConstructorCallConv": return "Constructor must have standard calling convention.";
-case "Argument_BadPropertyForConstructorBuilder": return "Property must be on the same type of the given ConstructorInfo.";
-case "Argument_NotAWritableProperty": return "Not a writable property.";
-case "Argument_BadFieldForConstructorBuilder": return "Field must be on the same type of the given ConstructorInfo.";
-case "Argument_BadAttributeOnInterfaceMethod": return "Interface method must be abstract and virtual.";
-case "ArgumentException_BadMethodImplBody": return "MethodOverride's body must be from this type.";
-case "Argument_BadParameterCountsForConstructor": return "Parameter count does not match passed in argument value count.";
-case "Argument_BadParameterTypeForConstructor": return "Passed in argument value at index {0} does not match the parameter type.";
-case "Argument_BadTypeInCustomAttribute": return "An invalid type was used as a custom attribute constructor argument, field or property.";
-case "Argument_DateTimeBadBinaryData": return "The binary data must result in a DateTime with ticks between DateTime.MinValue.Ticks and DateTime.MaxValue.Ticks.";
-case "Argument_VerStringTooLong": return "The unmanaged Version information is too large to persist.";
-case "Argument_UnknownUnmanagedCallConv": return "Unknown unmanaged calling convention for function signature.";
-case "Argument_BadConstantValue": return "Bad default value.";
-case "Argument_IllegalName": return "Illegal name.";
-case "Argument_cvtres_NotFound": return "Cannot find cvtres.exe";
-case "Argument_BadCAForUnmngRSC": return "Bad '{0}' while generating unmanaged resource information.";
-case "Argument_MustBeInterfaceMethod": return "The MemberInfo must be an interface method.";
-case "Argument_CORDBBadVarArgCallConv": return "Cannot evaluate a VarArgs function.";
-case "Argument_CORDBBadMethod": return "Cannot find the method on the object instance.";
-case "Argument_InvalidOpCodeOnDynamicMethod": return "Ldtoken, Ldftn and Ldvirtftn OpCodes cannot target DynamicMethods.";
-case "Argument_InvalidTypeForDynamicMethod": return "Invalid type owner for DynamicMethod.";
-case "Argument_NeedGenericMethodDefinition": return "Method must represent a generic method definition on a generic type definition.";
-case "Argument_MethodNeedGenericDeclaringType": return "The specified method cannot be dynamic or global and must be declared on a generic type definition.";
-case "Argument_ConstructorNeedGenericDeclaringType": return "The specified constructor must be declared on a generic type definition.";
-case "Argument_FieldNeedGenericDeclaringType": return "The specified field must be declared on a generic type definition.";
-case "Argument_InvalidMethodDeclaringType": return "The specified method must be declared on the generic type definition of the specified type.";
-case "Argument_InvalidConstructorDeclaringType": return "The specified constructor must be declared on the generic type definition of the specified type.";
-case "Argument_InvalidFieldDeclaringType": return "The specified field must be declared on the generic type definition of the specified type.";
-case "Argument_NeedNonGenericType": return "The specified Type must not be a generic type definition.";
-case "Argument_MustBeTypeBuilder": return "'type' must contain a TypeBuilder as a generic argument.";
-case "Argument_CannotSetParentToInterface": return "Cannot set parent to an interface.";
-case "Argument_MismatchedArrays": return "Two arrays, {0} and {1}, must be of  the same size.";
-case "Argument_NeedNonGenericObject": return "The specified object must not be an instance of a generic type.";
-case "Argument_NeedStructWithNoRefs": return "The specified Type must be a struct containing no references.";
-case "Argument_NotMethodCallOpcode": return "The specified opcode cannot be passed to EmitCall.";
-
-// ; =====================================================
-// ;
-case "Argument_ModuleAlreadyLoaded": return "The specified module has already been loaded.";
-case "Argument_MustHaveLayoutOrBeBlittable": return "The specified structure must be blittable or have layout information.";
-case "Argument_NotSimpleFileName": return "The filename must not include a path specification.";
-case "Argument_TypeMustBeVisibleFromCom": return "The specified type must be visible from COM.";
-case "Argument_TypeMustBeComCreatable": return "The type must be creatable from COM.";
-case "Argument_TypeMustNotBeComImport": return "The type must not be imported from COM.";
-case "Argument_PolicyFileDoesNotExist": return "The requested policy file does not exist.";
-case "Argument_NonNullObjAndCtx": return "Either obj or ctx must be null.";
-case "Argument_NoModuleFileExtension": return "Module file name '{0}' must have file extension.";
-case "Argument_TypeDoesNotContainMethod": return "Type does not contain the given method.";
-case "Argument_StringZeroLength": return "String cannot be of zero length.";
-case "Argument_MustBeString": return "String is too long or has invalid contents.";
-case "Argument_AbsolutePathRequired": return "Absolute path information is required.";
-case "Argument_ManifestFileDoesNotExist": return "The specified manifest file does not exist.";
-case "Argument_MustBeRuntimeType": return "Type must be a runtime Type object.";
-case "Argument_TypeNotValid": return "The Type object is not valid.";
-case "Argument_MustBeRuntimeMethodInfo": return "MethodInfo must be a runtime MethodInfo object.";
-case "Argument_MustBeRuntimeFieldInfo": return "FieldInfo must be a runtime FieldInfo object.";
-case "Argument_InvalidFieldInfo": return "The FieldInfo object is not valid.";
-case "Argument_InvalidConstructorInfo": return "The ConstructorInfo object is not valid.";
-case "Argument_MustBeRuntimeAssembly": return "Assembly must be a runtime Assembly object.";
-case "Argument_MustBeRuntimeModule": return "Module must be a runtime Module object.";
-case "Argument_MustBeRuntimeParameterInfo": return "ParameterInfo must be a runtime ParameterInfo object.";
-case "Argument_InvalidParameterInfo": return "The ParameterInfo object is not valid.";
-case "Argument_MustBeRuntimeReflectionObject": return "The object must be a runtime Reflection object.";
-case "Argument_InvalidMarshalByRefObject": return "The MarshalByRefObject is not valid.";
-case "Argument_TypedReferenceInvalidField": return "Field in TypedReferences cannot be static or init only.";
-case "Argument_HandleLeak": return "Cannot pass a GCHandle across AppDomains.";
-case "Argument_ArgumentZero": return "Argument cannot be zero.";
-case "Argument_ImproperType": return "Improper types in collection.";
-case "Argument_NotAMembershipCondition": return "The type does not implement IMembershipCondition";
-case "Argument_NotAPermissionType": return "The type does not implement IPermission";
-case "Argument_NotACodeGroupType": return "The type does not inherit from CodeGroup";
-case "Argument_NotATP": return "Type must be a TransparentProxy";
-case "Argument_AlreadyACCW": return "The object already has a CCW associated with it.";
-case "Argument_OffsetLocalMismatch": return "The UTC Offset of the local dateTime parameter does not match the offset argument.";
-case "Argument_OffsetUtcMismatch": return "The UTC Offset for Utc DateTime instances must be 0.";
-case "Argument_UTCOutOfRange": return "The UTC time represented when the offset is applied must be between year 0 and 10,000.";
-case "Argument_OffsetOutOfRange": return "Offset must be within plus or minus 14 hours.";
-case "Argument_OffsetPrecision": return "Offset must be specified in whole minutes.";
-case "Argument_FlagNotSupported": return "One or more flags are not supported.";
-case "Argument_MustBeFalse": return "Argument must be initialized to false";
-case "Argument_ToExclusiveLessThanFromExclusive": return "fromInclusive must be less than or equal to toExclusive.";
-case "Argument_FrameworkNameTooShort": return "FrameworkName cannot have less than two components or more than three components.";
-case "Argument_FrameworkNameInvalid": return "FrameworkName is invalid.";
-case "Argument_FrameworkNameMissingVersion": return "FrameworkName version component is missing.";
-#if FEATURE_COMINTEROP
-case "Argument_TypeNotActivatableViaWindowsRuntime": return "Type '{0}' does not have an activation factory because it is not activatable by Windows Runtime.";
-case "Argument_WinRTSystemRuntimeType": return "Cannot marshal type '{0}' to Windows Runtime. Only 'System.RuntimeType' is supported.";
-case "Argument_Unexpected_TypeSource": return "Unexpected TypeKind when marshaling Windows.Foundation.TypeName. ";
-#endif // FEATURE_COMINTEROP
-
-// ; ArgumentNullException
-case "ArgumentNull_Array": return "Array cannot be null.";
-case "ArgumentNull_ArrayValue": return "Found a null value within an array.";
-case "ArgumentNull_ArrayElement": return "At least one element in the specified array was null.";
-case "ArgumentNull_Assembly": return "Assembly cannot be null.";
-case "ArgumentNull_AssemblyName": return "AssemblyName cannot be null.";
-case "ArgumentNull_AssemblyNameName": return "AssemblyName.Name cannot be null or an empty string.";
-case "ArgumentNull_Buffer": return "Buffer cannot be null.";
-case "ArgumentNull_Collection": return "Collection cannot be null.";
-case "ArgumentNull_CultureInfo": return "CultureInfo cannot be null.";
-case "ArgumentNull_Dictionary": return "Dictionary cannot be null.";
-case "ArgumentNull_FileName": return "File name cannot be null.";
-case "ArgumentNull_Key": return "Key cannot be null.";
-case "ArgumentNull_Graph": return "Object Graph cannot be null.";
-case "ArgumentNull_Path": return "Path cannot be null.";
-case "ArgumentNull_Stream": return "Stream cannot be null.";
-case "ArgumentNull_String": return "String reference not set to an instance of a String.";
-case "ArgumentNull_Type": return "Type cannot be null.";
-case "ArgumentNull_Obj": return "Object cannot be null.";
-case "ArgumentNull_GUID": return "GUID cannot be null.";
-case "ArgumentNull_NullMember": return "Member at position {0} was null.";
-case "ArgumentNull_Generic": return "Value cannot be null.";
-case "ArgumentNull_WithParamName": return "Parameter '{0}' cannot be null.";
-case "ArgumentNull_Child": return "Cannot have a null child.";
-case "ArgumentNull_SafeHandle": return "SafeHandle cannot be null.";
-case "ArgumentNull_CriticalHandle": return "CriticalHandle cannot be null.";
-case "ArgumentNull_TypedRefType": return "Type in TypedReference cannot be null.";
-case "ArgumentNull_ApplicationTrust": return "The application trust cannot be null.";
-case "ArgumentNull_TypeRequiredByResourceScope": return "The type parameter cannot be null when scoping the resource's visibility to Private or Assembly.";
-case "ArgumentNull_Waithandles": return "The waitHandles parameter cannot be null.";
-
-// ; ArgumentOutOfRangeException
-case "ArgumentOutOfRange_AddressSpace": return "The number of bytes cannot exceed the virtual address space on a 32 bit machine.";
-case "ArgumentOutOfRange_ArrayLB": return "Number was less than the array's lower bound in the first dimension.";
-case "ArgumentOutOfRange_ArrayLBAndLength": return "Higher indices will exceed Int32.MaxValue because of large lower bound and/or length.";
-case "ArgumentOutOfRange_ArrayLength": return "The length of the array must be between {0} and {1}, inclusive.";
-case "ArgumentOutOfRange_ArrayLengthMultiple": return "The length of the array must be a multiple of {0}.";
-case "ArgumentOutOfRange_ArrayListInsert": return "Insertion index was out of range. Must be non-negative and less than or equal to size.";
-case "ArgumentOutOfRange_ArrayTooSmall": return "Destination array is not long enough to copy all the required data. Check array length and offset.";
-case "ArgumentOutOfRange_BeepFrequency": return "Console.Beep's frequency must be between {0} and {1}.";
-case "ArgumentOutOfRange_BiggerThanCollection": return "Larger than collection size.";
-case "ArgumentOutOfRange_Bounds_Lower_Upper": return "Argument must be between {0} and {1}.";
-case "ArgumentOutOfRange_Count": return "Count must be positive and count must refer to a location within the string/array/collection.";
-case "ArgumentOutOfRange_CalendarRange": return "Specified time is not supported in this calendar. It should be between {0} (Gregorian date) and {1} (Gregorian date), inclusive.";
-case "ArgumentOutOfRange_ConsoleBufferBoundaries": return "The value must be greater than or equal to zero and less than the console's buffer size in that dimension.";
-case "ArgumentOutOfRange_ConsoleBufferLessThanWindowSize": return "The console buffer size must not be less than the current size and position of the console window, nor greater than or equal to Int16.MaxValue.";
-case "ArgumentOutOfRange_ConsoleWindowBufferSize": return "The new console window size would force the console buffer size to be too large.";
-case "ArgumentOutOfRange_ConsoleTitleTooLong": return "The console title is too long.";
-case "ArgumentOutOfRange_ConsoleWindowPos": return "The window position must be set such that the current window size fits within the console's buffer, and the numbers must not be negative.";
-case "ArgumentOutOfRange_ConsoleWindowSize_Size": return "The value must be less than the console's current maximum window size of {0} in that dimension. Note that this value depends on screen resolution and the console font.";
-case "ArgumentOutOfRange_ConsoleKey": return "Console key values must be between 0 and 255.";
-case "ArgumentOutOfRange_CursorSize": return "The cursor size is invalid. It must be a percentage between 1 and 100.";
-case "ArgumentOutOfRange_BadYearMonthDay": return "Year, Month, and Day parameters describe an un-representable DateTime.";
-case "ArgumentOutOfRange_BadHourMinuteSecond": return "Hour, Minute, and Second parameters describe an un-representable DateTime.";
-case "ArgumentOutOfRange_DateArithmetic": return "The added or subtracted value results in an un-representable DateTime.";
-case "ArgumentOutOfRange_DateTimeBadMonths": return "Months value must be between +/-120000.";
-case "ArgumentOutOfRange_DateTimeBadYears": return "Years value must be between +/-10000.";
-case "ArgumentOutOfRange_DateTimeBadTicks": return "Ticks must be between DateTime.MinValue.Ticks and DateTime.MaxValue.Ticks.";
-case "ArgumentOutOfRange_Day": return "Day must be between 1 and {0} for month {1}.";
-case "ArgumentOutOfRange_DecimalRound": return "Decimal can only round to between 0 and 28 digits of precision.";
-case "ArgumentOutOfRange_DecimalScale": return "Decimal's scale value must be between 0 and 28, inclusive.";
-case "ArgumentOutOfRange_Era": return "Time value was out of era range.";
-case "ArgumentOutOfRange_Enum": return "Enum value was out of legal range.";
-case "ArgumentOutOfRange_FileLengthTooBig": return "Specified file length was too large for the file system.";
-case "ArgumentOutOfRange_FileTimeInvalid": return "Not a valid Win32 FileTime.";
-case "ArgumentOutOfRange_GetByteCountOverflow": return "Too many characters. The resulting number of bytes is larger than what can be returned as an int.";
-case "ArgumentOutOfRange_GetCharCountOverflow": return "Too many bytes. The resulting number of chars is larger than what can be returned as an int.";
-case "ArgumentOutOfRange_HashtableLoadFactor": return "Load factor needs to be between 0.1 and 1.0.";
-case "ArgumentOutOfRange_HugeArrayNotSupported": return "Arrays larger than 2GB are not supported.";
-case "ArgumentOutOfRange_InvalidHighSurrogate": return "A valid high surrogate character is between 0xd800 and 0xdbff, inclusive.";
-case "ArgumentOutOfRange_InvalidLowSurrogate": return "A valid low surrogate character is between 0xdc00 and 0xdfff, inclusive.";
-case "ArgumentOutOfRange_InvalidEraValue": return "Era value was not valid.";
-case "ArgumentOutOfRange_InvalidUserDefinedAceType": return "User-defined ACEs must not have a well-known ACE type.";
-case "ArgumentOutOfRange_InvalidUTF32": return "A valid UTF32 value is between 0x000000 and 0x10ffff, inclusive, and should not include surrogate codepoint values (0x00d800 ~ 0x00dfff).";
-case "ArgumentOutOfRange_Index": return "Index was out of range. Must be non-negative and less than the size of the collection.";
-case "ArgumentOutOfRange_IndexString": return "Index was out of range. Must be non-negative and less than the length of the string.";
-case "ArgumentOutOfRange_StreamLength": return "Stream length must be non-negative and less than 2^31 - 1 - origin.";
-case "ArgumentOutOfRange_LessEqualToIntegerMaxVal": return "Argument must be less than or equal to 2^31 - 1 milliseconds.";
-case "ArgumentOutOfRange_Month": return "Month must be between one and twelve.";
-case "ArgumentOutOfRange_MustBeNonNegInt32": return "Value must be non-negative and less than or equal to Int32.MaxValue.";
-case "ArgumentOutOfRange_NeedNonNegNum": return "Non-negative number required.";
-case "ArgumentOutOfRange_NeedNonNegOrNegative1": return "Number must be either non-negative and less than or equal to Int32.MaxValue or -1.";
-case "ArgumentOutOfRange_NeedPosNum": return "Positive number required.";
-case "ArgumentOutOfRange_NegativeCapacity": return "Capacity must be positive.";
-case "ArgumentOutOfRange_NegativeCount": return "Count cannot be less than zero.";
-case "ArgumentOutOfRange_NegativeLength": return "Length cannot be less than zero.";
-case "ArgumentOutOfRange_NegFileSize": return "Length must be non-negative.";
-case "ArgumentOutOfRange_ObjectID": return "objectID cannot be less than or equal to zero.";
-case "ArgumentOutOfRange_SmallCapacity": return "capacity was less than the current size.";
-case "ArgumentOutOfRange_QueueGrowFactor": return "Queue grow factor must be between {0} and {1}.";
-case "ArgumentOutOfRange_RoundingDigits": return "Rounding digits must be between 0 and 15, inclusive.";
-case "ArgumentOutOfRange_StartIndex": return "StartIndex cannot be less than zero.";
-case "ArgumentOutOfRange_MustBePositive": return "'{0}' must be greater than zero.";
-case "ArgumentOutOfRange_MustBeNonNegNum": return "'{0}' must be non-negative.";
-case "ArgumentOutOfRange_LengthGreaterThanCapacity": return "The length cannot be greater than the capacity.";
-case "ArgumentOutOfRange_ListInsert": return "Index must be within the bounds of the List.";
-case "ArgumentOutOfRange_StartIndexLessThanLength": return "startIndex must be less than length of string.";
-case "ArgumentOutOfRange_StartIndexLargerThanLength": return "startIndex cannot be larger than length of string.";
-case "ArgumentOutOfRange_EndIndexStartIndex": return "endIndex cannot be greater than startIndex.";
-case "ArgumentOutOfRange_IndexCount": return "Index and count must refer to a location within the string.";
-case "ArgumentOutOfRange_IndexCountBuffer": return "Index and count must refer to a location within the buffer.";
-case "ArgumentOutOfRange_IndexLength": return "Index and length must refer to a location within the string.";
-case "ArgumentOutOfRange_InvalidThreshold": return "The specified threshold for creating dictionary is out of range.";
-case "ArgumentOutOfRange_Capacity": return "Capacity exceeds maximum capacity.";
-case "ArgumentOutOfRange_Length": return "The specified length exceeds maximum capacity of SecureString.";
-case "ArgumentOutOfRange_LengthTooLarge": return "The specified length exceeds the maximum value of {0}.";
-case "ArgumentOutOfRange_SmallMaxCapacity": return "MaxCapacity must be one or greater.";
-case "ArgumentOutOfRange_GenericPositive": return "Value must be positive.";
-case "ArgumentOutOfRange_Range": return "Valid values are between {0} and {1}, inclusive.";
-case "ArgumentOutOfRange_AddValue": return "Value to add was out of range.";
-case "ArgumentOutOfRange_OffsetLength": return "Offset and length must refer to a position in the string.";
-case "ArgumentOutOfRange_OffsetOut": return "Either offset did not refer to a position in the string, or there is an insufficient length of destination character array.";
-case "ArgumentOutOfRange_PartialWCHAR": return "Pointer startIndex and length do not refer to a valid string.";
-case "ArgumentOutOfRange_ParamSequence": return "The specified parameter index is not in range.";
-case "ArgumentOutOfRange_Version": return "Version's parameters must be greater than or equal to zero.";
-case "ArgumentOutOfRange_TimeoutTooLarge": return "Time-out interval must be less than 2^32-2.";
-case "ArgumentOutOfRange_UIntPtrMax-1": return "The length of the buffer must be less than the maximum UIntPtr value for your platform.";
-case "ArgumentOutOfRange_UnmanagedMemStreamLength": return "UnmanagedMemoryStream length must be non-negative and less than 2^63 - 1 - baseAddress.";
-case "ArgumentOutOfRange_UnmanagedMemStreamWrapAround": return "The UnmanagedMemoryStream capacity would wrap around the high end of the address space.";
-case "ArgumentOutOfRange_PeriodTooLarge": return "Period must be less than 2^32-2.";
-case "ArgumentOutOfRange_Year": return "Year must be between 1 and 9999.";
-case "ArgumentOutOfRange_BinaryReaderFillBuffer": return "The number of bytes requested does not fit into BinaryReader's internal buffer.";
-case "ArgumentOutOfRange_PositionLessThanCapacityRequired": return "The position may not be greater or equal to the capacity of the accessor.";
-
-// ; ArithmeticException
-case "Arithmetic_NaN": return "Function does not accept floating point Not-a-Number values.";
-
-// ; ArrayTypeMismatchException
-case "ArrayTypeMismatch_CantAssignType": return "Source array type cannot be assigned to destination array type.";
-case "ArrayTypeMismatch_ConstrainedCopy": return "Array.ConstrainedCopy will only work on array types that are provably compatible, without any form of boxing, unboxing, widening, or casting of each array element.  Change the array types (i.e., copy a Derived[] to a Base[]), or use a mitigation strategy in the CER for Array.Copy's less powerful reliability contract, such as cloning the array or throwing away the potentially corrupt destination array.";
-
-// ; BadImageFormatException
-case "BadImageFormat_ResType&SerBlobMismatch": return "The type serialized in the .resources file was not the same type that the .resources file said it contained. Expected '{0}' but read '{1}'.";
-case "BadImageFormat_ResourcesIndexTooLong": return "Corrupt .resources file. String for name index '{0}' extends past the end of the file.";
-case "BadImageFormat_ResourcesNameTooLong": return "Corrupt .resources file. Resource name extends past the end of the file.";
-case "BadImageFormat_ResourcesNameInvalidOffset": return "Corrupt .resources file. Invalid offset '{0}' into name section.";
-case "BadImageFormat_ResourcesHeaderCorrupted": return "Corrupt .resources file. Unable to read resources from this file because of invalid header information. Try regenerating the .resources file.";
-case "BadImageFormat_ResourceNameCorrupted": return "Corrupt .resources file. A resource name extends past the end of the stream.";
-case "BadImageFormat_ResourceNameCorrupted_NameIndex": return "Corrupt .resources file. The resource name for name index {0} extends past the end of the stream.";
-case "BadImageFormat_ResourceDataLengthInvalid": return "Corrupt .resources file.  The specified data length '{0}' is not a valid position in the stream.";
-case "BadImageFormat_TypeMismatch": return "Corrupt .resources file.  The specified type doesn't match the available data in the stream.";
-case "BadImageFormat_InvalidType": return "Corrupt .resources file.  The specified type doesn't exist.";
-case "BadImageFormat_ResourcesIndexInvalid": return "Corrupt .resources file. The resource index '{0}' is outside the valid range.";
-case "BadImageFormat_StreamPositionInvalid": return "Corrupt .resources file.  The specified position '{0}' is not a valid position in the stream.";
-case "BadImageFormat_ResourcesDataInvalidOffset": return "Corrupt .resources file. Invalid offset '{0}' into data section.";
-case "BadImageFormat_NegativeStringLength": return "Corrupt .resources file. String length must be non-negative.";
-case "BadImageFormat_ParameterSignatureMismatch": return "The parameters and the signature of the method don't match.";
-
-// ; Cryptography
-// ; These strings still appear in bcl.small but should go away eventually
-case "Cryptography_CSSM_Error": return "Error 0x{0} from the operating system security framework: '{1}'.";
-case "Cryptography_CSSM_Error_Unknown": return "Error 0x{0} from the operating system security framework.";
-case "Cryptography_InvalidDSASignatureSize": return "Length of the DSA signature was not 40 bytes.";
-case "Cryptography_InvalidHandle": return "{0} is an invalid handle.";
-case "Cryptography_InvalidOID": return "Object identifier (OID) is unknown.";
-case "Cryptography_OAEPDecoding": return "Error occurred while decoding OAEP padding.";
-case "Cryptography_PasswordDerivedBytes_InvalidIV": return "The Initialization vector should have the same length as the algorithm block size in bytes.";
-case "Cryptography_SSE_InvalidDataSize": return "Length of the data to encrypt is invalid.";
-case "Cryptography_X509_ExportFailed": return "The certificate export operation failed.";
-case "Cryptography_X509_InvalidContentType": return "Invalid content type.";
-case "Cryptography_CryptoStream_FlushFinalBlockTwice": return "FlushFinalBlock() method was called twice on a CryptoStream. It can only be called once.";
-case "Cryptography_HashKeySet": return "Hash key cannot be changed after the first write to the stream.";
-case "Cryptography_HashNotYetFinalized": return "Hash must be finalized before the hash value is retrieved.";
-case "Cryptography_InsufficientBuffer": return "Input buffer contains insufficient data.";
-case "Cryptography_InvalidBlockSize": return "Specified block size is not valid for this algorithm.";
-case "Cryptography_InvalidCipherMode": return "Specified cipher mode is not valid for this algorithm.";
-case "Cryptography_InvalidIVSize": return "Specified initialization vector (IV) does not match the block size for this algorithm.";
-case "Cryptography_InvalidKeySize": return "Specified key is not a valid size for this algorithm.";
-case "Cryptography_PasswordDerivedBytes_FewBytesSalt": return "Salt is not at least eight bytes.";
-case "Cryptography_PKCS7_InvalidPadding": return "Padding is invalid and cannot be removed.";
-case "Cryptography_UnknownHashAlgorithm": return "'{0}' is not a known hash algorithm.";
-case "Cryptography_LegacyNetCF_UnknownError": return "Unknown Error '{0}'.";
-case "Cryptography_LegacyNetCF_CSP_CouldNotAcquire": return "CryptoAPI cryptographic service provider (CSP) for this implementation could not be acquired.";
-
-#if FEATURE_CRYPTO
-case "Cryptography_Config_EncodedOIDError": return "Encoded OID length is too large (greater than 0x7f bytes).";
-case "Cryptography_CSP_AlgKeySizeNotAvailable": return "Algorithm implementation does not support a key size of {0}.";
-case "Cryptography_CSP_AlgorithmNotAvailable": return "Cryptographic service provider (CSP) could not be found for this algorithm.";
-case "Cryptography_CSP_CFBSizeNotSupported": return "Feedback size for the cipher feedback mode (CFB) must be 8 bits.";
-case "Cryptography_CSP_NotFound": return "The requested key container was not found.";
-case "Cryptography_CSP_NoPrivateKey": return "Object contains only the public half of a key pair. A private key must also be provided.";
-case "Cryptography_CSP_OFBNotSupported": return "Output feedback mode (OFB) is not supported by this implementation.";
-case "Cryptography_CSP_WrongKeySpec": return "The specified cryptographic service provider (CSP) does not support this key algorithm.";
-case "Cryptography_HashNameSet": return "Hash name cannot be changed after the first write to the stream.";
-case "Cryptography_InvalidHashSize": return "{0} algorithm hash size is {1} bytes.";
-case "Cryptography_InvalidKey_Weak": return "Specified key is a known weak key for '{0}' and cannot be used.";
-case "Cryptography_InvalidKey_SemiWeak": return "Specified key is a known semi-weak key for '{0}' and cannot be used.";
-case "Cryptography_InvalidKeyParameter": return "Parameter '{0}' is not a valid key parameter.";
-case "Cryptography_InvalidFeedbackSize": return "Specified feedback size is invalid.";
-case "Cryptography_InvalidOperation": return "This operation is not supported for this class.";
-case "Cryptography_InvalidPaddingMode": return "Specified padding mode is not valid for this algorithm.";
-case "Cryptography_InvalidFromXmlString": return "Input string does not contain a valid encoding of the '{0}' '{1}' parameter.";
-case "Cryptography_MissingKey": return "No asymmetric key object has been associated with this formatter object.";
-case "Cryptography_MissingOID": return "Required object identifier (OID) cannot be found.";
-case "Cryptography_NotInteractive": return "The current session is not interactive.";
-case "Cryptography_NonCompliantFIPSAlgorithm": return "This implementation is not part of the Windows Platform FIPS validated cryptographic algorithms.";
-case "Cryptography_Padding_Win2KEnhOnly": return "Direct Encryption and decryption using RSA are not available on this platform.";
-case "Cryptography_Padding_EncDataTooBig": return "The data to be encrypted exceeds the maximum for this modulus of {0} bytes.";
-case "Cryptography_Padding_DecDataTooBig": return "The data to be decrypted exceeds the maximum for this modulus of {0} bytes.";
-case "Cryptography_PasswordDerivedBytes_ValuesFixed": return "Value of '{0}' cannot be changed after the bytes have been retrieved.";
-case "Cryptography_PasswordDerivedBytes_TooManyBytes": return "Requested number of bytes exceeds the maximum.";
-case "Cryptography_PasswordDerivedBytes_InvalidAlgorithm": return "Algorithm is unavailable or is not supported for this operation.";
-case "Cryptography_PKCS1Decoding": return "Error occurred while decoding PKCS1 padding.";
-case "Cryptography_RC2_EKSKS": return "EffectiveKeySize value must be at least as large as the KeySize value.";
-case "Cryptography_RC2_EKSKS2": return "EffectiveKeySize must be the same as KeySize in this implementation.";
-case "Cryptography_RC2_EKS40": return "EffectiveKeySize value must be at least 40 bits.";
-case "Cryptography_SSD_InvalidDataSize": return "Length of the data to decrypt is invalid.";
-case "Cryptography_AddNullOrEmptyName": return "CryptoConfig cannot add a mapping for a null or empty name.";
-case "Cryptography_AlgorithmTypesMustBeVisible": return "Algorithms added to CryptoConfig must be accessable from outside their assembly.";
-#endif  // FEATURE_CRYPTO
-
-// ; EventSource
-case "EventSource_ToString": return "EventSource({0}, {1})";
-case "EventSource_EventSourceGuidInUse": return "An instance of EventSource with Guid {0} already exists.";
-case "EventSource_KeywordNeedPowerOfTwo": return "Value {0} for keyword {1} needs to be a power of 2.";
-case "EventSource_UndefinedKeyword": return "Use of undefined keyword value {0} for event {1}.";
-case "EventSource_UnsupportedEventTypeInManifest": return "Unsupported type {0} in event source.";
-case "EventSource_ListenerNotFound": return "Listener not found.";
-case "EventSource_ListenerCreatedInsideCallback": return "Creating an EventListener inside a EventListener callback.";
-case "EventSource_AttributeOnNonVoid": return "Event attribute placed on method {0} which does not return 'void'.";
-case "EventSource_NeedPositiveId": return "Event IDs must be positive integers.";
-case "EventSource_ReservedOpcode": return "Opcode values less than 11 are reserved for system use.";
-case "EventSource_ReservedKeywords": return "Keywords values larger than 0x0000100000000000 are reserved for system use";
-case "EventSource_PayloadTooBig": return "The payload for a single event is too large.";
-case "EventSource_NoFreeBuffers": return "No Free Buffers available from the operating system (e.g. event rate too fast).";
-case "EventSource_NullInput": return "Null passed as a event argument.";
-case "EventSource_TooManyArgs": return "Too many arguments.";
-case "EventSource_SessionIdError": return "Bit position in AllKeywords ({0}) must equal the command argument named \"EtwSessionKeyword\" ({1}).";
-case "EventSource_EnumKindMismatch": return "The type of {0} is not expected in {1}.";
-case "EventSource_MismatchIdToWriteEvent": return "Event {0} is givien event ID {1} but {2} was passed to WriteEvent.";
-case "EventSource_EventIdReused": return "Event {0} has ID {1} which is already in use.";
-case "EventSource_EventNameReused": return "Event name {0} used more than once.  If you wish to overload a method, the overloaded method should have a NonEvent attribute.";
-case "EventSource_UndefinedChannel": return "Use of undefined channel value {0} for event {1}.";
-case "EventSource_UndefinedOpcode": return "Use of undefined opcode value {0} for event {1}.";
-case "ArgumentOutOfRange_MaxArgExceeded": return "The total number of parameters must not exceed {0}.";
-case "ArgumentOutOfRange_MaxStringsExceeded": return "The number of String parameters must not exceed {0}.";
-case "ArgumentOutOfRange_NeedValidId": return "The ID parameter must be in the range {0} through {1}.";
-case "EventSource_NeedGuid": return "The Guid of an EventSource must be non zero.";
-case "EventSource_NeedName": return "The name of an EventSource must not be null.";
-case "EventSource_EtwAlreadyRegistered": return "The provider has already been registered with the operating system.";
-case "EventSource_ListenerWriteFailure": return "An error occurred when writing to a listener.";
-case "EventSource_TypeMustDeriveFromEventSource": return "Event source types must derive from EventSource.";
-case "EventSource_TypeMustBeSealedOrAbstract": return "Event source types must be sealed or abstract.";
-case "EventSource_TaskOpcodePairReused": return "Event {0} (with ID {1}) has the same task/opcode pair as event {2} (with ID {3}).";
-case "EventSource_EventMustHaveTaskIfNonDefaultOpcode": return "Event {0} (with ID {1}) has a non-default opcode but not a task.";
-case "EventSource_EventNameDoesNotEqualTaskPlusOpcode": return "Event {0} (with ID {1}) has a name that is not the concatenation of its task name and opcode.";
-case "EventSource_PeriodIllegalInProviderName": return "Period character ('.') is illegal in an ETW provider name ({0}).";
-case "EventSource_IllegalOpcodeValue": return "Opcode {0} has a value of {1} which is outside the legal range (11-238).";
-case "EventSource_OpcodeCollision": return "Opcodes {0} and {1} are defined with the same value ({2}).";
-case "EventSource_IllegalTaskValue": return "Task {0} has a value of {1} which is outside the legal range (1-65535).";
-case "EventSource_TaskCollision": return "Tasks {0} and {1} are defined with the same value ({2}).";
-case "EventSource_IllegalKeywordsValue": return "Keyword {0} has a value of {1} which is outside the legal range (0-0x0000080000000000).";
-case "EventSource_KeywordCollision": return "Keywords {0} and {1} are defined with the same value ({2}).";
-case "EventSource_EventChannelOutOfRange": return "Channel {0} has a value of [1} which is outside the legal range (16-254).";
-case "EventSource_ChannelTypeDoesNotMatchEventChannelValue": return "Channel {0} does not match event channel value {1}.";
-case "EventSource_MaxChannelExceeded": return "Attempt to define more than the maximum limit of 8 channels for a provider.";
-case "EventSource_DuplicateStringKey": return "Multiple definitions for string \"{0}\".";
-case "EventSource_EventWithAdminChannelMustHaveMessage": return "Event {0} specifies an Admin channel {1}. It must specify a Message property.";
-case "EventSource_UnsupportedMessageProperty": return "Event {0} specifies an illegal or unsupported formatting message (\"{1}\").";
-case "EventSource_AbstractMustNotDeclareKTOC": return "Abstract event source must not declare {0} nested type.";
-case "EventSource_AbstractMustNotDeclareEventMethods": return "Abstract event source must not declare event methods ({0} with ID {1}).";
-case "EventSource_EventMustNotBeExplicitImplementation": return "Event method {0} (with ID {1}) is an explicit interface method implementation. Re-write method as implicit implementation.";
-case "EventSource_EventParametersMismatch": return "Event {0} was called with {1} argument(s) , but it is defined with {2} paramenter(s).";
-case "EventSource_InvalidCommand": return "Invalid command value.";
-case "EventSource_InvalidEventFormat": return "Can't specify both etw event format flags.";
-case "EventSource_AddScalarOutOfRange": return "Getting out of bounds during scalar addition. ";
-case "EventSource_PinArrayOutOfRange": return " Pins are out of range.";
-case "EventSource_DataDescriptorsOutOfRange": return "Data descriptors are out of range.";
-case "EventSource_NotSupportedArrayOfNil": return "Arrays of Nil are not supported.";
-case "EventSource_NotSupportedArrayOfBinary": return "Arrays of Binary are not supported.";
-case "EventSource_NotSupportedArrayOfNullTerminatedString": return "Arrays of null-terminated string are not supported.";
-case "EventSource_TooManyFields": return "Too many fields in structure.";
-case "EventSource_RecursiveTypeDefinition": return "Recursive type definition is not supported.";
-case "EventSource_NotSupportedEnumType": return "Enum type {0} underlying type {1} is not supported for serialization.";
-case "EventSource_NonCompliantTypeError": return "The API supports only anonymous types or types decorated with the EventDataAttribute. Non-compliant type: {0} dataType.";
-case "EventSource_NotSupportedNestedArraysEnums": return "Nested arrays/enumerables are not supported.";
-case "EventSource_IncorrentlyAuthoredTypeInfo": return "Incorrectly-authored TypeInfo - a type should be serialized as one field or as one group";
-case "EventSource_NotSupportedCustomSerializedData": return "Enumerables of custom-serialized data are not supported";
-case "EventSource_StopsFollowStarts": return "An event with stop suffix must follow a corresponding event with a start suffix.";
-
-// ; ExecutionEngineException
-case "ExecutionEngine_InvalidAttribute": return "Attribute cannot have multiple definitions.";
-case "ExecutionEngine_MissingSecurityDescriptor": return "Unable to retrieve security descriptor for this frame.";
-
-// ;;ExecutionContext
-case "ExecutionContext_UndoFailed": return "Undo operation on a component context threw an exception";
-case "ExecutionContext_ExceptionInAsyncLocalNotification": return "An exception was not handled in an AsyncLocal<T> notification callback.";
-
-
-// ; FieldAccessException
-case "FieldAccess_InitOnly": return "InitOnly (aka ReadOnly) fields can only be initialized in the type/instance constructor.";
-
-// ; FormatException
-case "Format_AttributeUsage": return "Duplicate AttributeUsageAttribute found on attribute type {0}.";
-case "Format_Bad7BitInt32": return "Too many bytes in what should have been a 7 bit encoded Int32.";
-case "Format_BadBase": return "Invalid digits for the specified base.";
-case "Format_BadBase64Char": return "The input is not a valid Base-64 string as it contains a non-base 64 character, more than two padding characters, or an illegal character among the padding characters. ";
-case "Format_BadBase64CharArrayLength": return "Invalid length for a Base-64 char array or string.";
-case "Format_BadBoolean": return "String was not recognized as a valid Boolean.";
-case "Format_BadDateTime": return "String was not recognized as a valid DateTime.";
-case "Format_BadDateTimeCalendar": return "The DateTime represented by the string is not supported in calendar {0}.";
-case "Format_BadDayOfWeek": return "String was not recognized as a valid DateTime because the day of week was incorrect.";
-case "Format_DateOutOfRange": return "The DateTime represented by the string is out of range.";
-case "Format_BadDatePattern": return "Could not determine the order of year, month, and date from '{0}'.";
-case "Format_BadFormatSpecifier": return "Format specifier was invalid.";
-case "Format_BadTimeSpan": return "String was not recognized as a valid TimeSpan.";
-case "Format_BadQuote": return "Cannot find a matching quote character for the character '{0}'.";
-case "Format_EmptyInputString": return "Input string was either empty or contained only whitespace.";
-case "Format_ExtraJunkAtEnd": return "Additional non-parsable characters are at the end of the string.";
-case "Format_GuidBrace": return "Expected {0xdddddddd, etc}.";
-case "Format_GuidComma": return "Could not find a comma, or the length between the previous token and the comma was zero (i.e., '0x,'etc.).";
-case "Format_GuidBraceAfterLastNumber": return "Could not find a brace, or the length between the previous token and the brace was zero (i.e., '0x,'etc.).";
-case "Format_GuidDashes": return "Dashes are in the wrong position for GUID parsing.";
-case "Format_GuidEndBrace": return "Could not find the ending brace.";
-case "Format_GuidHexPrefix": return "Expected hex 0x in '{0}'.";
-case "Format_GuidInvLen": return "Guid should contain 32 digits with 4 dashes (xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx).";
-case "Format_GuidInvalidChar": return "Guid string should only contain hexadecimal characters.";
-case "Format_GuidUnrecognized": return "Unrecognized Guid format.";
-case "Format_InvalidEnumFormatSpecification": return "Format String can be only \"G\", \"g\", \"X\", \"x\", \"F\", \"f\", \"D\" or \"d\".";
-case "Format_InvalidGuidFormatSpecification": return "Format String can be only \"D\", \"d\", \"N\", \"n\", \"P\", \"p\", \"B\", \"b\", \"X\" or \"x\".";
-case "Format_InvalidString": return "Input string was not in a correct format.";
-case "Format_IndexOutOfRange": return "Index (zero based) must be greater than or equal to zero and less than the size of the argument list.";
-case "Format_UnknowDateTimeWord": return "The string was not recognized as a valid DateTime. There is an unknown word starting at index {0}.";
-case "Format_NeedSingleChar": return "String must be exactly one character long.";
-case "Format_NoParsibleDigits": return "Could not find any recognizable digits.";
-case "Format_RepeatDateTimePattern": return "DateTime pattern '{0}' appears more than once with different values.";
-case "Format_StringZeroLength": return "String cannot have zero length.";
-case "Format_TwoTimeZoneSpecifiers": return "The String being parsed cannot contain two TimeZone specifiers.";
-case "Format_UTCOutOfRange": return "The UTC representation of the date falls outside the year range 1-9999.";
-case "Format_OffsetOutOfRange": return "The time zone offset must be within plus or minus 14 hours.";
-case "Format_MissingIncompleteDate": return "There must be at least a partial date with a year present in the input.";
-
-// ; IndexOutOfRangeException
-case "IndexOutOfRange_ArrayRankIndex": return "Array does not have that many dimensions.";
-case "IndexOutOfRange_IORaceCondition": return "Probable I/O race condition detected while copying memory. The I/O package is not thread safe by default. In multithreaded applications, a stream must be accessed in a thread-safe way, such as a thread-safe wrapper returned by TextReader's or TextWriter's Synchronized methods. This also applies to classes like StreamWriter and StreamReader.";
-case "IndexOutOfRange_UMSPosition": return "Unmanaged memory stream position was beyond the capacity of the stream.";
-
-// ; InsufficientMemoryException
-case "InsufficientMemory_MemFailPoint": return "Insufficient available memory to meet the expected demands of an operation at this time.  Please try again later.";
-case "InsufficientMemory_MemFailPoint_TooBig": return "Insufficient memory to meet the expected demands of an operation, and this system is likely to never satisfy this request.  If this is a 32 bit system, consider booting in 3 GB mode.";
-case "InsufficientMemory_MemFailPoint_VAFrag": return "Insufficient available memory to meet the expected demands of an operation at this time, possibly due to virtual address space fragmentation.  Please try again later.";
-
-
-// ; InvalidCastException
-case "InvalidCast_DBNull": return "Object cannot be cast to DBNull.";
-case "InvalidCast_DownCastArrayElement": return "At least one element in the source array could not be cast down to the destination array type.";
-case "InvalidCast_Empty": return "Object cannot be cast to Empty.";
-case "InvalidCast_FromDBNull": return "Object cannot be cast from DBNull to other types.";
-case "InvalidCast_FromTo": return "Invalid cast from '{0}' to '{1}'.";
-case "InvalidCast_IConvertible": return "Object must implement IConvertible.";
-case "InvalidCast_OATypeMismatch": return "OleAut reported a type mismatch.";
-case "InvalidCast_StoreArrayElement": return "Object cannot be stored in an array of this type.";
-case "InvalidCast_CannotCoerceByRefVariant": return "Object cannot be coerced to the original type of the ByRef VARIANT it was obtained from.";
-case "InvalidCast_CannotCastNullToValueType": return "Null object cannot be converted to a value type.";
-#if FEATURE_COMINTEROP
-case "InvalidCast_WinRTIPropertyValueElement": return "Object in an IPropertyValue is of type '{0}', which cannot be converted to a '{1}'.";
-case "InvalidCast_WinRTIPropertyValueCoersion": return "Object in an IPropertyValue is of type '{0}' with value '{1}', which cannot be converted to a '{2}'.";
-case "InvalidCast_WinRTIPropertyValueArrayCoersion": return "Object in an IPropertyValue is of type '{0}' which cannot be convereted to a '{1}' due to array element '{2}': {3}.";
-#endif // FEATURE_COMINTEROP
-
-// ; InvalidOperationException
-case "InvalidOperation_ActivationArgsAppTrustMismatch": return "The activation arguments and application trust for the AppDomain must correspond to the same application identity.";
-case "InvalidOperation_AddContextFrozen": return "Attempted to add properties to a frozen context.";
-case "InvalidOperation_AppDomainSandboxAPINeedsExplicitAppBase": return "This API requires the ApplicationBase to be specified explicitly in the AppDomainSetup parameter.";
-case "InvalidOperation_CantCancelCtrlBreak": return "Applications may not prevent control-break from terminating their process.";
-case "InvalidOperation_CalledTwice": return "The method cannot be called twice on the same instance.";
-case "InvalidOperation_CollectionCorrupted": return "A prior operation on this collection was interrupted by an exception. Collection's state is no longer trusted.";
-case "InvalidOperation_CriticalTransparentAreMutuallyExclusive": return "SecurityTransparent and SecurityCritical attributes cannot be applied to the assembly scope at the same time.";
-case "InvalidOperation_SubclassedObject": return "Cannot set sub-classed {0} object to {1} object.";
-case "InvalidOperation_ExceptionStateCrossAppDomain": return "Thread.ExceptionState cannot access an ExceptionState from a different AppDomain.";
-case "InvalidOperation_DebuggerLaunchFailed": return "Debugger unable to launch.";
-case "InvalidOperation_ApartmentStateSwitchFailed": return "Failed to set the specified COM apartment state.";
-case "InvalidOperation_EmptyQueue": return "Queue empty.";
-case "InvalidOperation_EmptyStack": return "Stack empty.";
-case "InvalidOperation_CannotRemoveFromStackOrQueue": return "Removal is an invalid operation for Stack or Queue.";
-case "InvalidOperation_EnumEnded": return "Enumeration already finished.";
-case "InvalidOperation_EnumFailedVersion": return "Collection was modified; enumeration operation may not execute.";
-case "InvalidOperation_EnumNotStarted": return "Enumeration has not started. Call MoveNext.";
-case "InvalidOperation_EnumOpCantHappen": return "Enumeration has either not started or has already finished.";
-case "InvalidOperation_ModifyRONumFmtInfo": return "Unable to modify a read-only NumberFormatInfo object.";
-#if FEATURE_CAS_POLICY
-case "InvalidOperation_ModifyROPermSet": return "ReadOnlyPermissionSet objects may not be modified.";
-#endif // FEATURE_CAS_POLICY
-case "InvalidOperation_MustBeSameThread": return "This operation must take place on the same thread on which the object was created.";
-case "InvalidOperation_MustRevertPrivilege": return "Must revert the privilege prior to attempting this operation.";
-case "InvalidOperation_ReadOnly": return "Instance is read-only.";
-case "InvalidOperation_RegRemoveSubKey": return "Registry key has subkeys and recursive removes are not supported by this method.";
-case "InvalidOperation_IComparerFailed": return "Failed to compare two elements in the array.";
-case "InvalidOperation_InternalState": return "Invalid internal state.";
-case "InvalidOperation_DuplicatePropertyName": return "Another property by this name already exists.";
-case "InvalidOperation_NotCurrentDomain": return "You can only define a dynamic assembly on the current AppDomain.";
-case "InvalidOperation_ContextAlreadyFrozen": return "Context is already frozen.";
-case "InvalidOperation_WriteOnce": return "This property has already been set and cannot be modified.";
-case "InvalidOperation_MethodBaked": return "Type definition of the method is complete.";
-case "InvalidOperation_MethodHasBody": return "Method already has a body.";
-case "InvalidOperation_ModificationOfNonCanonicalAcl": return "This access control list is not in canonical form and therefore cannot be modified.";
-case "InvalidOperation_Method": return "This method is not supported by the current object.";
-case "InvalidOperation_NotADebugModule": return "Not a debug ModuleBuilder.";
-case "InvalidOperation_NoMultiModuleAssembly": return "You cannot have more than one dynamic module in each dynamic assembly in this version of the runtime.";
-case "InvalidOperation_OpenLocalVariableScope": return "Local variable scope was not properly closed.";
-case "InvalidOperation_SetVolumeLabelFailed": return "Volume labels can only be set for writable local volumes.";
-case "InvalidOperation_SetData": return "An additional permission should not be supplied for setting loader information.";
-case "InvalidOperation_SetData_OnlyOnce": return "SetData can only be used to set the value of a given name once.";
-case "InvalidOperation_SetData_OnlyLocationURI": return "SetData cannot be used to set the value for '{0}'.";
-case "InvalidOperation_TypeHasBeenCreated": return "Unable to change after type has been created.";
-case "InvalidOperation_TypeNotCreated": return "Type has not been created.";
-case "InvalidOperation_NoUnderlyingTypeOnEnum": return "Underlying type information on enumeration is not specified.";
-case "InvalidOperation_ResMgrBadResSet_Type": return "'{0}': ResourceSet derived classes must provide a constructor that takes a String file name and a constructor that takes a Stream.";
-case "InvalidOperation_AssemblyHasBeenSaved": return "Assembly '{0}' has been saved.";
-case "InvalidOperation_ModuleHasBeenSaved": return "Module '{0}' has been saved.";
-case "InvalidOperation_CannotAlterAssembly": return "Unable to alter assembly information.";
-case "InvalidOperation_BadTransientModuleReference": return "Unable to make a reference to a transient module from a non-transient module.";
-case "InvalidOperation_BadILGeneratorUsage": return "ILGenerator usage is invalid.";
-case "InvalidOperation_BadInstructionOrIndexOutOfBound": return "MSIL instruction is invalid or index is out of bounds.";
-case "InvalidOperation_ShouldNotHaveMethodBody": return "Method body should not exist.";
-case "InvalidOperation_EntryMethodNotDefinedInAssembly": return "Entry method is not defined in the same assembly.";
-case "InvalidOperation_CantSaveTransientAssembly": return "Cannot save a transient assembly.";
-case "InvalidOperation_BadResourceContainer": return "Unable to add resource to transient module or transient assembly.";
-case "InvalidOperation_CantInstantiateAbstractClass": return "Instances of abstract classes cannot be created.";
-case "InvalidOperation_CantInstantiateFunctionPointer": return "Instances of function pointers cannot be created.";
-case "InvalidOperation_BadTypeAttributesNotAbstract": return "Type must be declared abstract if any of its methods are abstract.";
-case "InvalidOperation_BadInterfaceNotAbstract": return "Interface must be declared abstract.";
-case "InvalidOperation_ConstructorNotAllowedOnInterface": return "Interface cannot have constructors.";
-case "InvalidOperation_BadMethodBody": return "Method '{0}' cannot have a method body.";
-case "InvalidOperation_MetaDataError": return "Metadata operation failed.";
-case "InvalidOperation_BadEmptyMethodBody": return "Method '{0}' does not have a method body.";
-case "InvalidOperation_EndInvokeCalledMultiple": return "EndInvoke can only be called once for each asynchronous operation.";
-case "InvalidOperation_EndReadCalledMultiple": return "EndRead can only be called once for each asynchronous operation.";
-case "InvalidOperation_EndWriteCalledMultiple": return "EndWrite can only be called once for each asynchronous operation.";
-case "InvalidOperation_AsmLoadedForReflectionOnly": return "Assembly has been loaded as ReflectionOnly. This API requires an assembly capable of execution.";
-case "InvalidOperation_NoAsmName": return "Assembly does not have an assembly name. In order to be registered for use by COM, an assembly must have a valid assembly name.";
-case "InvalidOperation_NoAsmCodeBase": return "Assembly does not have a code base.";
-case "InvalidOperation_HandleIsNotInitialized": return "Handle is not initialized.";
-case "InvalidOperation_HandleIsNotPinned": return "Handle is not pinned.";
-case "InvalidOperation_SlotHasBeenFreed": return "LocalDataStoreSlot storage has been freed.";
-case "InvalidOperation_GlobalsHaveBeenCreated": return "Type definition of the global function has been completed.";
-case "InvalidOperation_NotAVarArgCallingConvention": return "Calling convention must be VarArgs.";
-case "InvalidOperation_CannotImportGlobalFromDifferentModule": return "Unable to import a global method or field from a different module.";
-case "InvalidOperation_NonStaticComRegFunction": return "COM register function must be static.";
-case "InvalidOperation_NonStaticComUnRegFunction": return "COM unregister function must be static.";
-case "InvalidOperation_InvalidComRegFunctionSig": return "COM register function must have a System.Type parameter and a void return type.";
-case "InvalidOperation_InvalidComUnRegFunctionSig": return "COM unregister function must have a System.Type parameter and a void return type.";
-case "InvalidOperation_MultipleComRegFunctions": return "Type '{0}' has more than one COM registration function.";
-case "InvalidOperation_MultipleComUnRegFunctions": return "Type '{0}' has more than one COM unregistration function.";
-case "InvalidOperation_MustCallInitialize": return "You must call Initialize on this object instance before using it.";
-case "InvalidOperation_MustLockForReadOrWrite": return "Object must be locked for read or write.";
-case "InvalidOperation_MustLockForWrite": return "Object must be locked for read.";
-case "InvalidOperation_NoValue": return "Nullable object must have a value.";
-case "InvalidOperation_ResourceNotStream_Name": return "Resource '{0}' was not a Stream - call GetObject instead.";
-case "InvalidOperation_ResourceNotString_Name": return "Resource '{0}' was not a String - call GetObject instead.";
-case "InvalidOperation_ResourceNotString_Type": return "Resource was of type '{0}' instead of String - call GetObject instead.";
-case "InvalidOperation_ResourceWriterSaved": return "The resource writer has already been closed and cannot be edited.";
-case "InvalidOperation_UnderlyingArrayListChanged": return "This range in the underlying list is invalid. A possible cause is that elements were removed.";
-case "InvalidOperation_AnonymousCannotImpersonate": return "An anonymous identity cannot perform an impersonation.";
-case "InvalidOperation_DefaultConstructorILGen": return "Unable to access ILGenerator on a constructor created with DefineDefaultConstructor.";
-case "InvalidOperation_DefaultConstructorDefineBody": return "The method body of the default constructor cannot be changed.";
-case "InvalidOperation_ComputerName": return "Computer name could not be obtained.";
-case "InvalidOperation_MismatchedAsyncResult": return "The IAsyncResult object provided does not match this delegate.";
-case "InvalidOperation_PIAMustBeStrongNamed": return "Primary interop assemblies must be strongly named.";
-case "InvalidOperation_HashInsertFailed": return "Hashtable insert failed. Load factor too high. The most common cause is multiple threads writing to the Hashtable simultaneously.";
-case "InvalidOperation_UnknownEnumType": return "Unknown enum type.";
-case "InvalidOperation_GetVersion": return "OSVersion's call to GetVersionEx failed.";
-case "InvalidOperation_DateTimeParsing": return "Internal Error in DateTime and Calendar operations.";
-case "InvalidOperation_UserDomainName": return "UserDomainName native call failed.";
-case "InvalidOperation_WaitOnTransparentProxy": return "Cannot wait on a transparent proxy.";
-case "InvalidOperation_NoPublicAddMethod": return "Cannot add the event handler since no public add method exists for the event.";
-case "InvalidOperation_NoPublicRemoveMethod": return "Cannot remove the event handler since no public remove method exists for the event.";
-case "InvalidOperation_NotSupportedOnWinRTEvent": return "Adding or removing event handlers dynamically is not supported on WinRT events.";
-case "InvalidOperation_ConsoleKeyAvailableOnFile": return "Cannot see if a key has been pressed when either application does not have a console or when console input has been redirected from a file. Try Console.In.Peek.";
-case "InvalidOperation_ConsoleReadKeyOnFile": return "Cannot read keys when either application does not have a console or when console input has been redirected from a file. Try Console.Read.";
-case "InvalidOperation_ThreadWrongThreadStart": return "The thread was created with a ThreadStart delegate that does not accept a parameter.";
-case "InvalidOperation_ThreadAPIsNotSupported": return "Use CompressedStack.(Capture/Run) or ExecutionContext.(Capture/Run) APIs instead.";
-case "InvalidOperation_NotNewCaptureContext": return "Cannot apply a context that has been marshaled across AppDomains, that was not acquired through a Capture operation or that has already been the argument to a Set call.";
-case "InvalidOperation_NullContext": return "Cannot call Set on a null context";
-case "InvalidOperation_CannotCopyUsedContext": return "Only newly captured contexts can be copied";
-case "InvalidOperation_CannotUseSwitcherOtherThread": return "Undo operation must be performed on the thread where the corresponding context was Set.";
-case "InvalidOperation_SwitcherCtxMismatch": return "The Undo operation encountered a context that is different from what was applied in the corresponding Set operation. The possible cause is that a context was Set on the thread and not reverted(undone).";
-case "InvalidOperation_CannotOverrideSetWithoutRevert": return "Must override both HostExecutionContextManager.SetHostExecutionContext and HostExecutionContextManager.Revert.";
-case "InvalidOperation_CannotUseAFCOtherThread": return "AsyncFlowControl object must be used on the thread where it was created.";
-case "InvalidOperation_CannotRestoreUnsupressedFlow": return "Cannot restore context flow when it is not suppressed.";
-case "InvalidOperation_CannotSupressFlowMultipleTimes": return "Context flow is already suppressed.";
-case "InvalidOperation_CannotUseAFCMultiple": return "AsyncFlowControl object can be used only once to call Undo().";
-case "InvalidOperation_AsyncFlowCtrlCtxMismatch": return "AsyncFlowControl objects can be used to restore flow only on the Context that had its flow suppressed.";
-case "InvalidOperation_TimeoutsNotSupported": return "Timeouts are not supported on this stream.";
-case "InvalidOperation_Overlapped_Pack": return "Cannot pack a packed Overlapped again.";
-case "InvalidOperation_OnlyValidForDS": return "Adding ACEs with Object Flags and Object GUIDs is only valid for directory-object ACLs.";
-case "InvalidOperation_WrongAsyncResultOrEndReadCalledMultiple": return "Either the IAsyncResult object did not come from the corresponding async method on this type, or EndRead was called multiple times with the same IAsyncResult.";
-case "InvalidOperation_WrongAsyncResultOrEndWriteCalledMultiple": return "Either the IAsyncResult object did not come from the corresponding async method on this type, or EndWrite was called multiple times with the same IAsyncResult.";
-case "InvalidOperation_WrongAsyncResultOrEndCalledMultiple": return "Either the IAsyncResult object did not come from the corresponding async method on this type, or the End method was called multiple times with the same IAsyncResult.";
-case "InvalidOperation_NoSecurityDescriptor": return "The object does not contain a security descriptor.";
-case "InvalidOperation_NotAllowedInReflectionOnly": return "The requested operation is invalid in the ReflectionOnly context.";
-case "InvalidOperation_NotAllowedInDynamicMethod": return "The requested operation is invalid for DynamicMethod.";
-case "InvalidOperation_PropertyInfoNotAvailable": return "This API does not support PropertyInfo tokens.";
-case "InvalidOperation_EventInfoNotAvailable": return "This API does not support EventInfo tokens.";
-case "InvalidOperation_UnexpectedWin32Error": return "Unexpected error when calling an operating system function.  The returned error code is 0x{0:x}.";
-case "InvalidOperation_AssertTransparentCode": return "Cannot perform CAS Asserts in Security Transparent methods";
-case "InvalidOperation_NullModuleHandle": return "The requested operation is invalid when called on a null ModuleHandle.";
-case "InvalidOperation_NotWithConcurrentGC": return "This API is not available when the concurrent GC is enabled.";
-case "InvalidOperation_WithoutARM": return "This API is not available when AppDomain Resource Monitoring is not turned on.";
-case "InvalidOperation_NotGenericType": return "This operation is only valid on generic types.";
-case "InvalidOperation_TypeCannotBeBoxed": return "The given type cannot be boxed.";
-case "InvalidOperation_HostModifiedSecurityState": return "The security state of an AppDomain was modified by an AppDomainManager configured with the NoSecurityChanges flag.";
-case "InvalidOperation_StrongNameKeyPairRequired": return "A strong name key pair is required to emit a strong-named dynamic assembly.";
-#if FEATURE_COMINTEROP
-case "InvalidOperation_EventTokenTableRequiresDelegate": return "Type '{0}' is not a delegate type.  EventTokenTable may only be used with delegate types.";
-#endif // FEATURE_COMINTEROP
-case "InvalidOperation_NullArray": return "The underlying array is null.";
-// ;system.security.claims
-case "InvalidOperation_ClaimCannotBeRemoved": return "The Claim '{0}' was not able to be removed.  It is either not part of this Identity or it is a claim that is owned by the Principal that contains this Identity. For example, the Principal will own the claim when creating a GenericPrincipal with roles. The roles will be exposed through the Identity that is passed in the constructor, but not actually owned by the Identity.  Similar logic exists for a RolePrincipal.";
-case "InvalidOperationException_ActorGraphCircular": return "Actor cannot be set so that circular directed graph will exist chaining the subjects together.";
-case "InvalidOperation_AsyncIOInProgress": return "The stream is currently in use by a previous operation on the stream.";
-case "InvalidOperation_APIInvalidForCurrentContext": return "The API '{0}' cannot be used on the current platform.";
-
-// ; InvalidProgramException
-case "InvalidProgram_Default": return "Common Language Runtime detected an invalid program.";
-
-// ; Isolated Storage
-#if FEATURE_ISOSTORE
-case "IsolatedStorage_AssemblyMissingIdentity": return "Unable to determine assembly of the caller.";
-case "IsolatedStorage_ApplicationMissingIdentity": return "Unable to determine application identity of the caller.";
-case "IsolatedStorage_DomainMissingIdentity": return "Unable to determine domain of the caller.";
-case "IsolatedStorage_AssemblyGrantSet": return "Unable to determine granted permission for assembly.";
-case "IsolatedStorage_DomainGrantSet": return "Unable to determine granted permission for domain.";
-case "IsolatedStorage_ApplicationGrantSet": return "Unable to determine granted permission for application.";
-case "IsolatedStorage_Init": return "Initialization failed.";
-case "IsolatedStorage_ApplicationNoEvidence": return "Unable to determine identity of application.";
-case "IsolatedStorage_AssemblyNoEvidence": return "Unable to determine identity of assembly.";
-case "IsolatedStorage_DomainNoEvidence": return "Unable to determine the identity of domain.";
-case "IsolatedStorage_DeleteDirectories": return "Unable to delete; directory or files in the directory could be in use.";
-case "IsolatedStorage_DeleteFile": return "Unable to delete file.";
-case "IsolatedStorage_CreateDirectory": return "Unable to create directory.";
-case "IsolatedStorage_DeleteDirectory": return "Unable to delete, directory not empty or does not exist.";
-case "IsolatedStorage_Operation_ISFS": return "Operation not permitted on IsolatedStorageFileStream.";
-case "IsolatedStorage_Operation": return "Operation not permitted.";
-case "IsolatedStorage_Path": return "Path must be a valid file name.";
-case "IsolatedStorage_FileOpenMode": return "Invalid mode, see System.IO.FileMode.";
-case "IsolatedStorage_SeekOrigin": return "Invalid origin, see System.IO.SeekOrigin.";
-case "IsolatedStorage_Scope_U_R_M": return "Invalid scope, expected User, User|Roaming or Machine.";
-case "IsolatedStorage_Scope_Invalid": return "Invalid scope.";
-case "IsolatedStorage_Exception": return "An error occurred while accessing IsolatedStorage.";
-case "IsolatedStorage_QuotaIsUndefined": return "{0} is not defined for this store. An operation was performed that requires access to {0}. Stores obtained using enumeration APIs do not have a well-defined {0}, since partial evidence is used to open the store.";
-case "IsolatedStorage_CurrentSizeUndefined": return "Current size cannot be determined for this store.";
-case "IsolatedStorage_DomainUndefined": return "Domain cannot be determined on an Assembly or Application store.";
-case "IsolatedStorage_ApplicationUndefined": return "Application cannot be determined on an Assembly or Domain store.";
-case "IsolatedStorage_AssemblyUndefined": return "Assembly cannot be determined for an Application store.";
-case "IsolatedStorage_StoreNotOpen": return "Store must be open for this operation.";
-case "IsolatedStorage_OldQuotaLarger": return "The new quota must be larger than the old quota.";
-case "IsolatedStorage_UsageWillExceedQuota": return "There is not enough free space to perform the operation.";
-case "IsolatedStorage_NotValidOnDesktop": return "The Site scope is currently not supported.";
-case "IsolatedStorage_OnlyIncreaseUserApplicationStore": return "Increasing the quota of this scope is not supported.  Only the user application scope�s quota can be increased.";
-#endif  // FEATURE_ISOSTORE
-
-// ; Verification Exception
-case "Verification_Exception": return "Operation could destabilize the runtime.";
-
-// ; IL stub marshaler exceptions
-case "Marshaler_StringTooLong": return "Marshaler restriction: Excessively long string.";
-
-// ; Missing (General)
-case "MissingConstructor_Name": return "Constructor on type '{0}' not found.";
-case "MissingField": return "Field not found.";
-case "MissingField_Name": return "Field '{0}' not found.";
-case "MissingMember": return "Member not found.";
-case "MissingMember_Name": return "Member '{0}' not found.";
-case "MissingMethod_Name": return "Method '{0}' not found.";
-case "MissingModule": return "Module '{0}' not found.";
-case "MissingType": return "Type '{0}' not found.";
-
-// ; MissingManifestResourceException
-case "Arg_MissingManifestResourceException": return "Unable to find manifest resource.";
-case "MissingManifestResource_LooselyLinked": return "Could not find a manifest resource entry called \"{0}\" in assembly \"{1}\". Please check spelling, capitalization, and build rules to ensure \"{0}\" is being linked into the assembly.";
-case "MissingManifestResource_NoNeutralAsm": return "Could not find any resources appropriate for the specified culture or the neutral culture.  Make sure \"{0}\" was correctly embedded or linked into assembly \"{1}\" at compile time, or that all the satellite assemblies required are loadable and fully signed.";
-case "MissingManifestResource_NoNeutralDisk": return "Could not find any resources appropriate for the specified culture (or the neutral culture) on disk.";
-case "MissingManifestResource_MultipleBlobs": return "A case-insensitive lookup for resource file \"{0}\" in assembly \"{1}\" found multiple entries. Remove the duplicates or specify the exact case.";
-#if !FEATURE_CORECLR
-case "MissingManifestResource_ResWFileNotLoaded": return "Unable to load resources for resource file \"{0}\" in package \"{1}\".";
-case "MissingManifestResource_NoPRIresources": return "Unable to open Package Resource Index.";
-#endif
-
-// ; MissingMember
-case "MissingMemberTypeRef": return "FieldInfo does not match the target Type.";
-case "MissingMemberNestErr": return "TypedReference can only be made on nested value Types.";
-
-// ; MissingSatelliteAssemblyException
-case "MissingSatelliteAssembly_Default": return "Resource lookup fell back to the ultimate fallback resources in a satellite assembly, but that satellite either was not found or could not be loaded. Please consider reinstalling or repairing the application.";
-case "MissingSatelliteAssembly_Culture_Name": return "The satellite assembly named \"{1}\" for fallback culture \"{0}\" either could not be found or could not be loaded. This is generally a setup problem. Please consider reinstalling or repairing the application.";
-
-// ; MulticastNotSupportedException
-case "Multicast_Combine": return "Delegates that are not of type MulticastDelegate may not be combined.";
-
-// ; NotImplementedException
-case "Arg_NotImplementedException": return "The method or operation is not implemented.";
-case "NotImplemented_ResourcesLongerThan2^63": return "Resource files longer than 2^63 bytes are not currently implemented.";
-
-// ; NotSupportedException
-case "NotSupported_NYI": return "This feature is not currently implemented.";
-case "NotSupported_AbstractNonCLS": return "This non-CLS method is not implemented.";
-case "NotSupported_ChangeType": return "ChangeType operation is not supported.";
-case "NotSupported_ContainsStackPtr": return "Cannot create boxed TypedReference, ArgIterator, or RuntimeArgumentHandle Objects.";
-case "NotSupported_ContainsStackPtr[]": return "Cannot create arrays of TypedReference, ArgIterator, ByRef, or RuntimeArgumentHandle Objects.";
-case "NotSupported_OpenType": return "Cannot create arrays of open type. ";
-case "NotSupported_DBNullSerial": return "Only one DBNull instance may exist, and calls to DBNull deserialization methods are not allowed.";
-case "NotSupported_DelegateSerHolderSerial": return "DelegateSerializationHolder objects are designed to represent a delegate during serialization and are not serializable themselves.";
-case "NotSupported_DelegateCreationFromPT": return "Application code cannot use Activator.CreateInstance to create types that derive from System.Delegate. Delegate.CreateDelegate can be used instead.";
-case "NotSupported_EncryptionNeedsNTFS": return "File encryption support only works on NTFS partitions.";
-case "NotSupported_FileStreamOnNonFiles": return "FileStream was asked to open a device that was not a file. For support for devices like 'com1:' or 'lpt1:', call CreateFile, then use the FileStream constructors that take an OS handle as an IntPtr.";
-case "NotSupported_FixedSizeCollection": return "Collection was of a fixed size.";
-case "NotSupported_KeyCollectionSet": return "Mutating a key collection derived from a dictionary is not allowed.";
-case "NotSupported_ValueCollectionSet": return "Mutating a value collection derived from a dictionary is not allowed.";
-case "NotSupported_MemStreamNotExpandable": return "Memory stream is not expandable.";
-case "NotSupported_ObsoleteResourcesFile": return "Found an obsolete .resources file in assembly '{0}'. Rebuild that .resources file then rebuild that assembly.";
-case "NotSupported_OleAutBadVarType": return "The given Variant type is not supported by this OleAut function.";
-case "NotSupported_PopulateData": return "This Surrogate does not support PopulateData().";
-case "NotSupported_ReadOnlyCollection": return "Collection is read-only.";
-case "NotSupported_RangeCollection": return "The specified operation is not supported on Ranges.";
-case "NotSupported_SortedListNestedWrite": return "This operation is not supported on SortedList nested types because they require modifying the original SortedList.";
-case "NotSupported_SubclassOverride": return "Derived classes must provide an implementation.";
-case "NotSupported_TypeCannotDeserialized": return "Direct deserialization of type '{0}' is not supported.";
-case "NotSupported_UnreadableStream": return "Stream does not support reading.";
-case "NotSupported_UnseekableStream": return "Stream does not support seeking.";
-case "NotSupported_UnwritableStream": return "Stream does not support writing.";
-case "NotSupported_CannotWriteToBufferedStreamIfReadBufferCannotBeFlushed": return "Cannot write to a BufferedStream while the read buffer is not empty if the underlying stream is not seekable. Ensure that the stream underlying this BufferedStream can seek or avoid interleaving read and write operations on this BufferedStream.";
-case "NotSupported_Method": return "Method is not supported.";
-case "NotSupported_Constructor": return "Object cannot be created through this constructor.";
-case "NotSupported_DynamicModule": return "The invoked member is not supported in a dynamic module.";
-case "NotSupported_TypeNotYetCreated": return "The invoked member is not supported before the type is created.";
-case "NotSupported_SymbolMethod": return "Not supported in an array method of a type definition that is not complete.";
-case "NotSupported_NotDynamicModule": return "The MethodRental.SwapMethodBody method can only be called to swap the method body of a method in a dynamic module.";
-case "NotSupported_DynamicAssembly": return "The invoked member is not supported in a dynamic assembly.";
-case "NotSupported_NotAllTypesAreBaked": return "Type '{0}' was not completed.";
-case "NotSupported_CannotSaveModuleIndividually": return "Unable to save a ModuleBuilder if it was created underneath an AssemblyBuilder. Call Save on the AssemblyBuilder instead.";
-case "NotSupported_MaxWaitHandles": return "The number of WaitHandles must be less than or equal to 64.";
-case "NotSupported_IllegalOneByteBranch": return "Illegal one-byte branch at position: {0}. Requested branch was: {1}.";
-case "NotSupported_OutputStreamUsingTypeBuilder": return "Output streams do not support TypeBuilders.";
-case "NotSupported_ValueClassCM": return "Custom marshalers for value types are not currently supported.";
-case "NotSupported_Void[]": return "Arrays of System.Void are not supported.";
-case "NotSupported_NoParentDefaultConstructor": return "Parent does not have a default constructor. The default constructor must be explicitly defined.";
-case "NotSupported_NonReflectedType": return "Not supported in a non-reflected type.";
-case "NotSupported_GlobalFunctionNotBaked": return "The type definition of the global function is not completed.";
-case "NotSupported_SecurityPermissionUnion": return "Union is not implemented.";
-case "NotSupported_UnitySerHolder": return "The UnitySerializationHolder object is designed to transmit information about other types and is not serializable itself.";
-case "NotSupported_UnknownTypeCode": return "TypeCode '{0}' was not valid.";
-case "NotSupported_WaitAllSTAThread": return "WaitAll for multiple handles on a STA thread is not supported.";
-case "NotSupported_SignalAndWaitSTAThread": return "SignalAndWait on a STA thread is not supported.";
-case "NotSupported_CreateInstanceWithTypeBuilder": return "CreateInstance cannot be used with an object of type TypeBuilder.";
-case "NotSupported_NonUrlAttrOnMBR": return "UrlAttribute is the only attribute supported for MarshalByRefObject.";
-case "NotSupported_ActivAttrOnNonMBR": return "Activation Attributes are not supported for types not deriving from MarshalByRefObject.";
-case "NotSupported_ActivForCom": return "Activation Attributes not supported for COM Objects.";
-case "NotSupported_NoCodepageData": return "No data is available for encoding {0}. For information on defining a custom encoding, see the documentation for the Encoding.RegisterProvider method.";
-case "NotSupported_CodePage50229": return "The ISO-2022-CN Encoding (Code page 50229) is not supported.";
-case "NotSupported_DynamicAssemblyNoRunAccess": return "Cannot execute code on a dynamic assembly without run access.";
-case "NotSupported_IDispInvokeDefaultMemberWithNamedArgs": return "Invoking default method with named arguments is not supported.";
-case "NotSupported_Type": return "Type is not supported.";
-case "NotSupported_GetMethod": return "The 'get' method is not supported on this property.";
-case "NotSupported_SetMethod": return "The 'set' method is not supported on this property.";
-case "NotSupported_DeclarativeUnion": return "Declarative unionizing of these permissions is not supported.";
-case "NotSupported_StringComparison": return "The string comparison type passed in is currently not supported.";
-case "NotSupported_WrongResourceReader_Type": return "This .resources file should not be read with this reader. The resource reader type is \"{0}\".";
-case "NotSupported_MustBeModuleBuilder": return "Module argument must be a ModuleBuilder.";
-case "NotSupported_CallToVarArg": return "Vararg calling convention not supported.";
-case "NotSupported_TooManyArgs": return "Stack size too deep. Possibly too many arguments.";
-case "NotSupported_DeclSecVarArg": return "Assert, Deny, and PermitOnly are not supported on methods with a Vararg calling convention.";
-case "NotSupported_AmbiguousIdentity": return "The operation is ambiguous because the permission represents multiple identities.";
-case "NotSupported_DynamicMethodFlags": return "Wrong MethodAttributes or CallingConventions for DynamicMethod. Only public, static, standard supported";
-case "NotSupported_GlobalMethodSerialization": return "Serialization of global methods (including implicit serialization via the use of asynchronous delegates) is not supported.";
-case "NotSupported_InComparableType": return "A type must implement IComparable<T> or IComparable to support comparison.";
-case "NotSupported_ManagedActivation": return "Cannot create uninitialized instances of types requiring managed activation.";
-case "NotSupported_ByRefReturn": return "ByRef return value not supported in reflection invocation.";
-case "NotSupported_DelegateMarshalToWrongDomain": return "Delegates cannot be marshaled from native code into a domain other than their home domain.";
-case "NotSupported_ResourceObjectSerialization": return "Cannot read resources that depend on serialization.";
-case "NotSupported_One": return "The arithmetic type '{0}' cannot represent the number one.";
-case "NotSupported_Zero": return "The arithmetic type '{0}' cannot represent the number zero.";
-case "NotSupported_MaxValue": return "The arithmetic type '{0}' does not have a maximum value.";
-case "NotSupported_MinValue": return "The arithmetic type '{0}' does not have a minimum value.";
-case "NotSupported_PositiveInfinity": return "The arithmetic type '{0}' cannot represent positive infinity.";
-case "NotSupported_NegativeInfinity": return "The arithmetic type '{0}' cannot represent negative infinity.";
-case "NotSupported_UmsSafeBuffer": return "This operation is not supported for an UnmanagedMemoryStream created from a SafeBuffer.";
-case "NotSupported_Reading": return "Accessor does not support reading.";
-case "NotSupported_Writing": return "Accessor does not support writing.";
-case "NotSupported_UnsafePointer": return "This accessor was created with a SafeBuffer; use the SafeBuffer to gain access to the pointer.";
-case "NotSupported_CollectibleCOM": return "COM Interop is not supported for collectible types.";
-case "NotSupported_CollectibleAssemblyResolve": return "Resolving to a collectible assembly is not supported.";
-case "NotSupported_CollectibleBoundNonCollectible": return "A non-collectible assembly may not reference a collectible assembly.";
-case "NotSupported_CollectibleDelegateMarshal": return "Delegate marshaling for types within collectible assemblies is not supported.";
-#if FEATURE_WINDOWSPHONE
-case "NotSupported_UserDllImport": return "DllImport cannot be used on user-defined methods.";
-case "NotSupported_UserCOM": return "COM Interop is not supported for user-defined types.";
-#endif //FEATURE_WINDOWSPHONE
-#if FEATURE_CAS_POLICY
-case "NotSupported_RequiresCasPolicyExplicit": return "This method explicitly uses CAS policy, which has been obsoleted by the .NET Framework. In order to enable CAS policy for compatibility reasons, please use the NetFx40_LegacySecurityPolicy configuration switch. Please see http://go.microsoft.com/fwlink/?LinkID": return "155570 for more information.";
-case "NotSupported_RequiresCasPolicyImplicit": return "This method implicitly uses CAS policy, which has been obsoleted by the .NET Framework. In order to enable CAS policy for compatibility reasons, please use the NetFx40_LegacySecurityPolicy configuration switch. Please see http://go.microsoft.com/fwlink/?LinkID": return "155570 for more information.";
-case "NotSupported_CasDeny": return "The Deny stack modifier has been obsoleted by the .NET Framework.  Please see http://go.microsoft.com/fwlink/?LinkId": return "155571 for more information.";
-case "NotSupported_SecurityContextSourceAppDomainInHeterogenous": return "SecurityContextSource.CurrentAppDomain is not supported in heterogenous AppDomains.";
-#endif // FEATURE_CAS_POLICY
-#if FEATURE_APPX
-case "NotSupported_AppX": return "{0} is not supported in AppX.";
-case "LoadOfFxAssemblyNotSupported_AppX": return "{0} of .NET Framework assemblies is not supported in AppX.";
-#endif
-#if FEATURE_COMINTEROP
-case "NotSupported_WinRT_PartialTrust": return "Windows Runtime is not supported in partial trust.";
-#endif // FEATURE_COMINTEROP
-// ; ReflectionTypeLoadException
-case "ReflectionTypeLoad_LoadFailed": return "Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information.";
-#if !FEATURE_CORECLR
-case "NotSupported_NoTypeInfo": return "Cannot resolve {0} to a TypeInfo object.";
-#endif
-#if FEATURE_COMINTEROP
-case "NotSupported_PIAInAppxProcess": return "A Primary Interop Assembly is not supported in AppX.";
-#endif
-#if FEATURE_WINDOWSPHONE
-case "NotSupported_WindowsPhone": return "{0} is not supported on Windows Phone.";
-case "NotSupported_AssemblyLoadCodeBase": return "Assembly.Load with a Codebase is not supported on Windows Phone.";
-#endif
-
-// ; TypeLoadException
-case "TypeLoad_ResolveType": return "Could not resolve type '{0}'.";
-case "TypeLoad_ResolveTypeFromAssembly": return "Could not resolve type '{0}' in assembly '{1}'.";
-case "TypeLoad_ResolveNestedType": return "Could not resolve nested type '{0}' in type \"{1}'.";
-case "FileNotFound_ResolveAssembly": return "Could not resolve assembly '{0}'.";
-
-// ; NullReferenceException
-case "NullReference_This": return "The pointer for this method was null.";
-
-// ; ObjectDisposedException
-case "ObjectDisposed_Generic": return "Cannot access a disposed object.";
-case "ObjectDisposed_FileClosed": return "Cannot access a closed file.";
-case "ObjectDisposed_ObjectName_Name": return "Object name: '{0}'.";
-case "ObjectDisposed_ReaderClosed": return "Cannot read from a closed TextReader.";
-case "ObjectDisposed_ResourceSet": return "Cannot access a closed resource set.";
-case "ObjectDisposed_RegKeyClosed": return "Cannot access a closed registry key.";
-case "ObjectDisposed_StreamClosed": return "Cannot access a closed Stream.";
-case "ObjectDisposed_WriterClosed": return "Cannot write to a closed TextWriter.";
-case "ObjectDisposed_ViewAccessorClosed": return "Cannot access a closed accessor.";
-
-// ; OperationCanceledException
-case "OperationCanceled": return "The operation was canceled.";
-
-// ; OutOfMemoryException
-case "OutOfMemory_GCHandleMDA": return "The GCHandle MDA has run out of available cookies.";
-
-// ; OverflowException
-case "Overflow_Byte": return "Value was either too large or too small for an unsigned byte.";
-case "Overflow_Char": return "Value was either too large or too small for a character.";
-case "Overflow_Currency": return "Value was either too large or too small for a Currency.";
-case "Overflow_Decimal": return "Value was either too large or too small for a Decimal.";
-case "Overflow_Int16": return "Value was either too large or too small for an Int16.";
-case "Overflow_Int32": return "Value was either too large or too small for an Int32.";
-case "Overflow_Int64": return "Value was either too large or too small for an Int64.";
-case "Overflow_NegateTwosCompNum": return "Negating the minimum value of a twos complement number is invalid.";
-case "Overflow_NegativeUnsigned": return "The string was being parsed as an unsigned number and could not have a negative sign.";
-case "Overflow_SByte": return "Value was either too large or too small for a signed byte.";
-case "Overflow_Single": return "Value was either too large or too small for a Single.";
-case "Overflow_Double": return "Value was either too large or too small for a Double.";
-case "Overflow_TimeSpanTooLong": return "TimeSpan overflowed because the duration is too long.";
-case "Overflow_TimeSpanElementTooLarge": return "The TimeSpan could not be parsed because at least one of the numeric components is out of range or contains too many digits.";
-case "Overflow_Duration": return "The duration cannot be returned for TimeSpan.MinValue because the absolute value of TimeSpan.MinValue exceeds the value of TimeSpan.MaxValue.";
-case "Overflow_UInt16": return "Value was either too large or too small for a UInt16.";
-case "Overflow_UInt32": return "Value was either too large or too small for a UInt32.";
-case "Overflow_UInt64": return "Value was either too large or too small for a UInt64.";
-
-// ; PlatformNotsupportedException
-case "PlatformNotSupported_RequiresLonghorn": return "This operation is only supported on Windows Vista and above.";
-case "PlatformNotSupported_RequiresNT": return "This operation is only supported on Windows 2000, Windows XP, and higher.";
-case "PlatformNotSupported_RequiresW2kSP3": return "This operation is only supported on Windows 2000 SP3 or later operating systems.";
-#if FEATURE_COMINTEROP
-case "PlatformNotSupported_WinRT": return "Windows Runtime is not supported on this operating system.";
-#endif // FEATURE_COMINTEROP
-
-// ; PolicyException
-// ; This still appears in bcl.small but should go away eventually
-case "Policy_Default": return "Error occurred while performing a policy operation.";
-case "Policy_CannotLoadSemiTrustAssembliesDuringInit": return "All assemblies loaded as part of AppDomain initialization must be fully trusted.";
-#if FEATURE_IMPERSONATION
-case "Policy_PrincipalTwice": return "Default principal object cannot be set twice.";
-#endif // FEATURE_IMPERSONATION
-#if FEATURE_CAS_POLICY
-case "Policy_PolicyAlreadySet": return "Policy for this domain cannot be set twice.";
-case "Policy_NoExecutionPermission": return "Execution permission cannot be acquired.";
-case "Policy_NoRequiredPermission": return "Required permissions cannot be acquired.";
-case "Policy_MultipleExclusive": return "More than one exclusive group is not allowed.";
-case "Policy_RecoverNotFileBased": return "PolicyLevel object not based on a file cannot be recovered.";
-case "Policy_RecoverNoConfigFile": return "No old configuration file exists to recover.";
-case "Policy_UnableToSave": return "Policy level '{0}' could not be saved: {1}.";
-case "Policy_BadXml": return "Policy configuration XML is invalid. The required tag '{0}' is missing.";
-case "Policy_NonFullTrustAssembly": return "Policy references an assembly not in the full trust assemblies list.";
-case "Policy_MissingActivationContextInAppEvidence": return "The application evidence does not contain a Fusion activation context.";
-case "Policy_NoTrustManager": return "A trust manager could not be loaded for this application.";
-case "Policy_GrantSetDoesNotMatchDomain": return "An assembly was provided an invalid grant set by runtime host '{0}'. In a homogenous AppDomain, the only valid grant sets are FullTrust and the AppDomain's sandbox grant set.";
-#endif  // FEATURE_CAS_POLICY
-case "Policy_SaveNotFileBased": return "PolicyLevel object not based on a file cannot be saved.";
-case "Policy_AppTrustMustGrantAppRequest": return "ApplicationTrust grant set does not contain ActivationContext's minimum request set.";
-
-case "Error_SecurityPolicyFileParse": return "Error occurred while parsing the '{0}' policy level. The default policy level was used instead.";
-case "Error_SecurityPolicyFileParseEx": return "Error '{1}' occurred while parsing the '{0}' policy level. The default policy level was used instead.";
-
-#if FEATURE_CAS_POLICY
-case "Policy_EvidenceMustBeSerializable": return "Objects used as evidence must be serializable.";
-case "Policy_DuplicateEvidence": return "The evidence collection already contains evidence of type '{0}'. Multiple pieces of the same type of evidence are not allowed.";
-case "Policy_IncorrectHostEvidence": return "Runtime host '{0}' returned evidence of type '{1}' from a request for evidence of type '{2}'.";
-case "Policy_NullHostEvidence": return "Runtime host '{0}' returned null when asked for assembly evidence for assembly '{1}'.";
-case "Policy_NullHostGrantSet": return "Runtime host '{0}' returned a null grant set from ResolvePolicy.";
-#endif // FEATURE_CAS_POLICY
-
-// ; Policy codegroup and permission set names and descriptions
-#if FEATURE_CAS_POLICY
-case "Policy_AllCode_Name": return "All_Code";
-case "Policy_AllCode_DescriptionFullTrust": return "Code group grants all code full trust and forms the root of the code group tree.";
-case "Policy_AllCode_DescriptionNothing": return "Code group grants no permissions and forms the root of the code group tree.";
-case "Policy_MyComputer_Name": return "My_Computer_Zone";
-case "Policy_MyComputer_Description": return "Code group grants full trust to all code originating on the local computer";
-case "Policy_Intranet_Name": return "LocalIntranet_Zone";
-case "Policy_Intranet_Description": return "Code group grants the intranet permission set to code from the intranet zone. This permission set grants intranet code the right to use isolated storage, full UI access, some capability to do reflection, and limited access to environment variables.";
-case "Policy_IntranetNet_Name": return "Intranet_Same_Site_Access";
-case "Policy_IntranetNet_Description": return "All intranet code gets the right to connect back to the site of its origin.";
-case "Policy_IntranetFile_Name": return "Intranet_Same_Directory_Access";
-case "Policy_IntranetFile_Description": return "All intranet code gets the right to read from its install directory.";
-case "Policy_Internet_Name": return "Internet_Zone";
-case "Policy_Internet_Description": return "Code group grants code from the Internet zone the Internet permission set. This permission set grants Internet code the right to use isolated storage and limited UI access.";
-case "Policy_InternetNet_Name": return "Internet_Same_Site_Access";
-case "Policy_InternetNet_Description": return "All Internet code gets the right to connect back to the site of its origin.";
-case "Policy_Trusted_Name": return "Trusted_Zone";
-case "Policy_Trusted_Description": return "Code from a trusted zone is granted the Internet permission set. This permission set grants the right to use isolated storage and limited UI access.";
-case "Policy_TrustedNet_Name": return "Trusted_Same_Site_Access";
-case "Policy_TrustedNet_Description": return "All Trusted Code gets the right to connect back to the site of its origin.";
-case "Policy_Untrusted_Name": return "Restricted_Zone";
-case "Policy_Untrusted_Description": return "Code coming from a restricted zone does not receive any permissions.";
-case "Policy_Microsoft_Name": return "Microsoft_Strong_Name";
-case "Policy_Microsoft_Description": return "Code group grants full trust to code signed with the Microsoft strong name.";
-case "Policy_Ecma_Name": return "ECMA_Strong_Name";
-case "Policy_Ecma_Description": return "Code group grants full trust to code signed with the ECMA strong name.";
-
-// ; Policy permission set descriptions
-case "Policy_PS_FullTrust": return "Allows full access to all resources";
-case "Policy_PS_Everything": return "Allows unrestricted access to all resources covered by built-in permissions";
-case "Policy_PS_Nothing": return "Denies all resources, including the right to execute";
-case "Policy_PS_Execution": return "Permits execution";
-case "Policy_PS_SkipVerification": return "Grants right to bypass the verification";
-case "Policy_PS_Internet": return "Default rights given to Internet applications";
-case "Policy_PS_LocalIntranet": return "Default rights given to applications on the local intranet";
-
-// ; default Policy level names
-case "Policy_PL_Enterprise": return "Enterprise";
-case "Policy_PL_Machine": return "Machine";
-case "Policy_PL_User": return "User";
-case "Policy_PL_AppDomain": return "AppDomain";
-#endif  // FEATURE_CAS_POLICY
-
-// ; RankException
-case "Rank_MultiDimNotSupported": return "Only single dimension arrays are supported here.";
-case "Rank_MustMatch": return "The specified arrays must have the same number of dimensions.";
-
-// ; TypeInitializationException
-case "TypeInitialization_Default": return "Type constructor threw an exception.";
-case "TypeInitialization_Type": return "The type initializer for '{0}' threw an exception.";
-
-// ; TypeLoadException
-
-
-// ;
-// ; Reflection exceptions
-// ;
-case "RtType.InvalidCaller": return "Caller is not a friend.";
-
-// ;CustomAttributeFormatException
-case "RFLCT.InvalidPropFail": return "'{0}' property specified was not found.";
-case "RFLCT.InvalidFieldFail": return "'{0}' field specified was not found.";
-
-// ;InvalidFilterCriteriaException
-case "RFLCT.FltCritString": return "A String must be provided for the filter criteria.";
-case "RFLCT.FltCritInt": return "An Int32 must be provided for the filter criteria.";
-
-// ; TargetException
-case "RFLCT.Targ_ITargMismatch": return "Object does not match target type.";
-case "RFLCT.Targ_StatMethReqTarg": return "Non-static method requires a target.";
-case "RFLCT.Targ_StatFldReqTarg": return "Non-static field requires a target.";
-
-// ;AmbiguousMatchException
-case "RFLCT.Ambiguous": return "Ambiguous match found.";
-case "RFLCT.AmbigCust": return "Multiple custom attributes of the same type found.";
-
-// ;
-// ; Remoting exceptions
-// ;
-case "Remoting_AppDomainUnloaded_ThreadUnwound": return "The application domain in which the thread was running has been unloaded.";
-case "Remoting_AppDomainUnloaded": return "The target application domain has been unloaded.";
-case "Remoting_CantRemotePointerType": return "Pointer types cannot be passed in a remote call.";
-case "Remoting_TypeCantBeRemoted": return "The given type cannot be passed in a remote call.";
-case "Remoting_Delegate_TooManyTargets": return "The delegate must have only one target.";
-case "Remoting_InvalidContext": return "The context is not valid.";
-case "Remoting_InvalidValueTypeFieldAccess": return "An attempt was made to calculate the address of a value type field on a remote object. This was likely caused by an attempt to directly get or set the value of a field within this embedded value type. Avoid this and instead provide and use access methods for each field in the object that will be accessed remotely.";
-case "Remoting_Message_BadRetValOrOutArg": return "Bad return value or out-argument inside the return message.";
-case "Remoting_NonPublicOrStaticCantBeCalledRemotely": return "Permission denied: cannot call non-public or static methods remotely.";
-case "Remoting_Proxy_ProxyTypeIsNotMBR": return "classToProxy argument must derive from MarshalByRef type.";
-case "Remoting_TP_NonNull": return "The transparent proxy field of a real proxy must be null.";
-#if FEATURE_REMOTING
-case "Remoting_Activation_BadAttribute": return "Activation attribute does not implement the IContextAttribute interface.";
-case "Remoting_Activation_BadObject": return "Proxy Attribute returned an incompatible object when constructing an instance of type {0}.";
-case "Remoting_Activation_MBR_ProxyAttribute": return "Proxy Attributes are supported on ContextBound types only.";
-case "Remoting_Activation_ConnectFailed": return "An attempt to connect to the remote activator failed with exception '{0}'.";
-case "Remoting_Activation_Failed": return "Activation failed due to an unknown reason.";
-case "Remoting_Activation_InconsistentState": return "Inconsistent state during activation; there may be two proxies for the same object.";
-case "Remoting_Activation_MissingRemoteAppEntry": return "Cannot find an entry for remote application '{0}'.";
-case "Remoting_Activation_NullReturnValue": return "Return value of construction call was null.";
-case "Remoting_Activation_NullFromInternalUnmarshal": return "InternalUnmarshal of returned ObjRef from activation call returned null.";
-case "Remoting_Activation_WellKnownCTOR": return "Cannot run a non-default constructor when connecting to well-known objects.";
-case "Remoting_Activation_PermissionDenied": return "Type '{0}' is not registered for activation.";
-case "Remoting_Activation_PropertyUnhappy": return "A context property did not approve the candidate context for activating the object.";
-case "Remoting_Activation_AsyncUnsupported": return "Async Activation not supported.";
-case "Remoting_AmbiguousCTOR": return "Cannot resolve the invocation to the correct constructor.";
-case "Remoting_AmbiguousMethod": return "Cannot resolve the invocation to the correct method.";
-case "Remoting_AppDomains_NYI": return "This feature is not yet supported for cross-application domain.";
-case "Remoting_AppDomainsCantBeCalledRemotely": return "Permission denied: cannot call methods on the AppDomain class remotely.";
-case "Remoting_AssemblyLoadFailed": return "Cannot load assembly '{0}'.";
-case "Remoting_Attribute_UseAttributeNotsettable": return "UseAttribute not allowed in SoapTypeAttribute.";
-case "Remoting_BadType": return "Cannot load type '{0}'.";
-case "Remoting_BadField": return "Remoting cannot find field '{0}' on type '{1}'.";
-case "Remoting_BadInternalState_ActivationFailure": return "Invalid internal state: Activation service failed to initialize.";
-case "Remoting_BadInternalState_ProxySameAppDomain": return "Invalid internal state: A marshal by ref object should not have a proxy in its own AppDomain.";
-case "Remoting_BadInternalState_FailEnvoySink": return "Invalid internal state: Failed to create an envoy sink for the object.";
-case "Remoting_CantDisconnectClientProxy": return "Cannot call disconnect on a proxy.";
-case "Remoting_CantInvokeIRemoteDispatch": return "Cannot invoke methods on IRemoteDispatch.";
-case "Remoting_ChannelNameAlreadyRegistered": return "The channel '{0}' is already registered.";
-case "Remoting_ChannelNotRegistered": return "The channel '{0}' is not registered with remoting services.";
-case "Remoting_Channel_PopOnEmptySinkStack": return "Tried to pop data from an empty channel sink stack.";
-case "Remoting_Channel_PopFromSinkStackWithoutPush": return "A channel sink tried to pop data from the stack without first pushing data onto the stack.";
-case "Remoting_Channel_StoreOnEmptySinkStack": return "A channel sink called the Store method when the sink stack was empty.";
-case "Remoting_Channel_StoreOnSinkStackWithoutPush": return "A channel sink called the Store method on the sink stack without first pushing data onto the stack.";
-case "Remoting_Channel_CantCallAPRWhenStackEmpty": return "Cannot call the AsyncProcessResponse method on the previous channel sink because the stack is empty.";
-case "Remoting_Channel_CantCallFRSWhenStackEmtpy": return "Called FlipRememberedStack() when stack was not null.";
-case "Remoting_Channel_CantCallGetResponseStreamWhenStackEmpty": return "Cannot call the GetResponseStream method on the previous channel sink because the stack is empty.";
-case "Remoting_Channel_DispatchSinkMessageMissing": return "No message was deserialized prior to calling the DispatchChannelSink.";
-case "Remoting_Channel_DispatchSinkWantsNullRequestStream": return "The request stream should be null when the DispatchChannelSink is called. ";
-case "Remoting_Channel_CannotBeSecured": return "Channel {0} cannot be secured. Please consider using a channel that implements ISecurableChannel";
-case "Remoting_Config_ChannelMissingCtor": return "To be used from a .config file, the channel type '{0}' must have a constructor of the form '{1}'";
-case "Remoting_Config_SinkProviderMissingCtor": return "To be used from a .config file, the sink provider type '{0}' must have a constructor of the form '{1}'";
-case "Remoting_Config_SinkProviderNotFormatter": return "A sink provider of type '{0}' is incorrectly labeled as a 'formatter'.";
-case "Remoting_Config_ConfigurationFailure": return "Remoting configuration failed with the exception '{0}'.";
-case "Remoting_Config_InvalidTimeFormat": return "Invalid time format '{0}'. Examples of valid time formats include 7D, 10H, 5M, 30S, or 20MS.";
-case "Remoting_Config_AppNameSet": return "The remoting application name, '{0}', had already been set.";
-case "Remoting_Config_ErrorsModeSet": return "The remoting custom errors mode had already been set.";
-case "Remoting_Config_CantRedirectActivationOfWellKnownService": return "Attempt to redirect activation for type '{0}, {1}'. This is not allowed since either a well-known service type has already been registered with that type or that type has been registered has a activated service type.";
-case "Remoting_Config_CantUseRedirectedTypeForWellKnownService": return "Attempt to register a well-known or activated service type of type '{0}, {1}'. This is not allowed since the type has already been redirected to activate elsewhere.";
-case "Remoting_Config_InvalidChannelType": return "'{0}' does not implement IChannelReceiver or IChannelSender. All channels must implement one of these interfaces.";
-case "Remoting_Config_InvalidSinkProviderType": return "Unable to use '{0}' as a channel sink provider. It does not implement '{1}'.";
-case "Remoting_Config_MissingWellKnownModeAttribute": return "Well-known service entries must contain a 'mode' attribute with a value of 'Singleton' or 'SingleCall'.";
-case "Remoting_Config_MissingTypeAttribute": return "'{0}' entries must contain a '{1}' attribute of the form 'typeName, assemblyName'.";
-case "Remoting_Config_MissingXmlTypeAttribute": return "'{0}' entries must contain a '{1}' attribute of the form 'xmlTypeName, xmlTypeNamespace'.";
-case "Remoting_Config_NoAppName": return "Improper remoting configuration: missing ApplicationName property.";
-case "Remoting_Config_NonTemplateIdAttribute": return "Only '{0}' templates can have an 'id' attribute.";
-case "Remoting_Config_PreloadRequiresTypeOrAssembly": return "Preload entries require a type or assembly attribute.";
-case "Remoting_Config_ProviderNeedsElementName": return "Sink providers must have an element name of 'formatter' or 'provider'.";
-case "Remoting_Config_RequiredXmlAttribute": return "'{0}' entries require a '{1}' attribute.";
-case "Remoting_Config_ReadFailure": return ".Config file '{0}' cannot be read successfully due to exception '{1}'.";
-case "Remoting_Config_NodeMustBeUnique": return "There can be only one '{0}' node in the '{1}' section of a config file.";
-case "Remoting_Config_TemplateCannotReferenceTemplate": return "A '{0}' template cannot reference another '{0}' template.";
-case "Remoting_Config_TypeAlreadyRedirected": return "Attempt to redirect activation of type '{0}, {1}' which is already redirected.";
-case "Remoting_Config_UnknownValue": return "Unknown value {1} was found on the {0} node.";
-case "Remoting_Config_UnableToResolveTemplate": return "Cannot resolve '{0}' template reference: '{1}'.";
-case "Remoting_Config_VersionPresent": return "Version information is present in the assembly name '{0}' which is not allowed for '{1}' entries.";
-case "Remoting_Contexts_BadProperty": return "A property that contributed a bad sink to the chain was found.";
-case "Remoting_Contexts_NoProperty": return "A property with the name '{0}' was not found.";
-case "Remoting_Contexts_ContextNotFrozenForCallBack": return "Context should be frozen before calling the DoCallBack method.";
-case "Remoting_Default": return "Unknown remoting error.";
-case "Remoting_HandlerNotRegistered": return "The tracking handler of type '{0}' is not registered with Remoting Services.";
-case "Remoting_InvalidMsg": return "Invalid Message Object.";
-case "Remoting_InvalidCallingType": return "Attempted to call a method declared on type '{0}' on an object which exposes '{1}'.";
-case "Remoting_InvalidRequestedType": return "The server object type cannot be cast to the requested type '{0}'.";
-case "Remoting_InternalError": return "Server encountered an internal error. For more information, turn off customErrors in the server's .config file.";
-case "Remoting_Lifetime_ILeaseReturn": return "Expected a return object of type ILease, but received '{0}'.";
-case "Remoting_Lifetime_InitialStateInitialLeaseTime": return "InitialLeaseTime property can only be set when the lease is in initial state. The state is '{0}'.";
-case "Remoting_Lifetime_InitialStateRenewOnCall": return "RenewOnCallTime property can only be set when the lease is in initial state. The state is '{0}'.";
-case "Remoting_Lifetime_InitialStateSponsorshipTimeout": return "SponsorshipTimeout property can only be set when the lease is in initial state. State is '{0}'.";
-case "Remoting_Lifetime_SetOnce": return "'{0}' can only be set once within an AppDomain.";
-case "Remoting_Message_ArgMismatch": return "{2} arguments were passed to '{0}::{1}'. {3} arguments were expected by this method.";
-case "Remoting_Message_BadAsyncResult": return "The async result object is null or of an unexpected type.";
-case "Remoting_Message_BadType": return "The method was called with a Message of an unexpected type.";
-case "Remoting_Message_CoercionFailed": return "The argument type '{0}' cannot be converted into parameter type '{1}'.";
-case "Remoting_Message_MissingArgValue": return "Expecting an instance of type '{0}' at pos {1} in the args array.";
-case "Remoting_Message_BadSerialization": return "Invalid or malformed serialization information for the message object.";
-case "Remoting_NoIdentityEntry": return "No remoting information was found for this object.";
-case "Remoting_NotRemotableByReference": return "Trying to create a proxy to an unbound type.";
-case "Remoting_NullMessage": return "The method was called with a null message.";
-case "Remoting_Proxy_BadType": return "The proxy is of an unsupported type.";
-case "Remoting_ResetURI": return "Attempt to reset the URI for an object from '{0}' to '{1}'.";
-case "Remoting_ServerObjectNotFound": return "The server object for URI '{0}' is not registered with the remoting infrastructure (it may have been disconnected).";
-case "Remoting_SetObjectUriForMarshal__ObjectNeedsToBeLocal": return "SetObjectUriForMarshal method should only be called for MarshalByRefObjects that exist in the current AppDomain.";
-case "Remoting_SetObjectUriForMarshal__UriExists": return "SetObjectUriForMarshal method has already been called on this object or the object has already been marshaled.";
-case "Remoting_Proxy_BadReturnType": return "Return argument has an invalid type.";
-case "Remoting_Proxy_ReturnValueTypeCannotBeNull": return "ByRef value type parameter cannot be null.";
-case "Remoting_Proxy_BadReturnTypeForActivation": return "Bad return type for activation call via Invoke: must be of type IConstructionReturnMessage.";
-case "Remoting_Proxy_BadTypeForActivation": return "Type mismatch between proxy type '{0}' and activation type '{1}'.";
-case "Remoting_Proxy_ExpectedOriginalMessage": return "The message passed to Invoke should be passed to PropagateOutParameters.";
-case "Remoting_Proxy_InvalidCall": return "Trying to call proxy while constructor call is in progress.";
-case "Remoting_Proxy_InvalidState": return "Channel sink does not exist. Failed to dispatch async call.";
-case "Remoting_Proxy_NoChannelSink": return "This remoting proxy has no channel sink which means either the server has no registered server channels that are listening, or this application has no suitable client channel to talk to the server.";
-case "Remoting_Proxy_InvalidCallType": return "Only the synchronous call type is supported for messages that are not of type Message.";
-case "Remoting_Proxy_WrongContext": return " ExecuteMessage can be called only from the native context of the object.";
-case "Remoting_SOAPInteropxsdInvalid": return "Soap Parse error, xsd:type '{0}' invalid {1}";
-case "Remoting_SOAPQNameNamespace": return "SoapQName missing a Namespace value '{0}'.";
-case "Remoting_ThreadAffinity_InvalidFlag": return "The specified flag '{0}' does not have one of the valid values.";
-case "Remoting_TrackingHandlerAlreadyRegistered": return "The handler has already been registered with TrackingServices.";
-case "Remoting_URIClash": return "Found two different objects associated with the same URI, '{0}'.";
-case "Remoting_URIExists": return "The remoted object already has an associated URI.";
-case "Remoting_URIToProxy": return "Trying to associate the URI with a proxy.";
-case "Remoting_WellKnown_MustBeMBR": return "Attempted to create well-known object of type '{0}'. Well-known objects must derive from the MarshalByRefObject class.";
-case "Remoting_WellKnown_CtorCantMarshal": return "'{0}': A well-known object cannot marshal itself in its constructor, or perform any action that would cause it to be marshaled (such as passing the 'this' pointer as a parameter to a remote method).";
-case "Remoting_WellKnown_CantDirectlyConnect": return "Attempt to connect to a server using its object URI: '{0}'. A valid, complete URL must be used.";
-case "Remoting_Connect_CantCreateChannelSink": return "Cannot create channel sink to connect to URL '{0}'. An appropriate channel has probably not been registered.";
-case "Remoting_UnexpectedNullTP": return "Failed to create a transparent proxy. If a custom RealProxy is being used ensure it sets the proxy type.";
-// ; The following remoting exception messages appear in native resources too (mscorrc.rc)
-case "Remoting_Disconnected": return "Object '{0}' has been disconnected or does not exist at the server.";
-case "Remoting_Message_MethodMissing": return "The method '{0}' was not found on the interface/type '{1}'.";
-#endif  // FEATURE_REMOTING
-
-// ; Resources exceptions
-// ;
-case "Resources_StreamNotValid": return "Stream is not a valid resource file.";
-case "ResourceReaderIsClosed": return "ResourceReader is closed.";
-
-// ; RuntimeWrappedException
-case "RuntimeWrappedException": return "An object that does not derive from System.Exception has been wrapped in a RuntimeWrappedException.";
-
-// ; UnauthorizedAccessException
-case "UnauthorizedAccess_MemStreamBuffer": return "MemoryStream's internal buffer cannot be accessed.";
-case "UnauthorizedAccess_IODenied_Path": return "Access to the path '{0}' is denied.";
-case "UnauthorizedAccess_IODenied_NoPathName": return "Access to the path is denied.";
-case "UnauthorizedAccess_RegistryKeyGeneric_Key": return "Access to the registry key '{0}' is denied.";
-case "UnauthorizedAccess_RegistryNoWrite": return "Cannot write to the registry key.";
-case "UnauthorizedAccess_SystemDomain": return "Cannot execute an assembly in the system domain.";
-
-// ;
-// ; Security exceptions
-// ;
-
-// ;SecurityException
-// ; These still appear in bcl.small but should go away eventually
-case "Security_Generic": return "Request for the permission of type '{0}' failed.";
-case "Security_GenericNoType": return "Request failed.";
-case "Security_NoAPTCA": return "That assembly does not allow partially trusted callers.";
-case "Security_RegistryPermission": return "Requested registry access is not allowed.";
-case "Security_MustRevertOverride": return "Stack walk modifier must be reverted before another modification of the same type can be performed.";
-#if FEATURE_CAS_POLICY
-case "Security_CannotGenerateHash": return "Hash for the assembly cannot be generated.";
-case "Security_CannotGetRawData": return "Assembly bytes could not be retrieved.";
-case "Security_PrincipalPermission": return "Request for principal permission failed.";
-case "Security_Action": return "The action that failed was:";
-case "Security_TypeFirstPermThatFailed": return "The type of the first permission that failed was:";
-case "Security_FirstPermThatFailed": return "The first permission that failed was:";
-case "Security_Demanded": return "The demand was for:";
-case "Security_GrantedSet": return "The granted set of the failing assembly was:";
-case "Security_RefusedSet": return "The refused set of the failing assembly was:";
-case "Security_Denied": return "The denied permissions were:";
-case "Security_PermitOnly": return "The only permitted permissions were:";
-case "Security_Assembly": return "The assembly or AppDomain that failed was:";
-case "Security_Method": return "The method that caused the failure was:";
-case "Security_Zone": return "The Zone of the assembly that failed was:";
-case "Security_Url": return "The Url of the assembly that failed was:";
-case "Security_AnonymouslyHostedDynamicMethodCheckFailed": return "The demand failed due to the code access security information captured during the creation of an anonymously hosted dynamic method. In order for this operation to succeed, ensure that the demand would have succeeded at the time the method was created. See http://go.microsoft.com/fwlink/?LinkId": return "288746 for more information.";
-#endif  // FEATURE_CAS_POLICY
-
-// ;
-// ; HostProtection exceptions
-// ;
-
-case "HostProtection_HostProtection": return "Attempted to perform an operation that was forbidden by the CLR host.";
-case "HostProtection_ProtectedResources": return "The protected resources (only available with full trust) were:";
-case "HostProtection_DemandedResources": return "The demanded resources were:";
-
-// ;
-// ; IO exceptions
-// ;
-
-// ; EOFException
-case "IO.EOF_ReadBeyondEOF": return "Unable to read beyond the end of the stream.";
-
-// ; FileNotFoundException
-case "IO.FileNotFound": return "Unable to find the specified file.";
-case "IO.FileNotFound_FileName": return "Could not find file '{0}'.";
-case "IO.FileName_Name": return "File name: '{0}'";
-case "IO.FileLoad": return "Could not load the specified file.";
-
-// ; IOException
-case "IO.IO_AlreadyExists_Name": return "Cannot create \"{0}\" because a file or directory with the same name already exists.";
-case "IO.IO_BindHandleFailed": return "BindHandle for ThreadPool failed on this handle.";
-case "IO.IO_FileExists_Name": return "The file '{0}' already exists.";
-case "IO.IO_FileStreamHandlePosition": return "The OS handle's position is not what FileStream expected. Do not use a handle simultaneously in one FileStream and in Win32 code or another FileStream. This may cause data loss.";
-case "IO.IO_FileTooLong2GB": return "The file is too long. This operation is currently limited to supporting files less than 2 gigabytes in size.";
-case "IO.IO_FileTooLongOrHandleNotSync": return "IO operation will not work. Most likely the file will become too long or the handle was not opened to support synchronous IO operations.";
-case "IO.IO_FixedCapacity": return "Unable to expand length of this stream beyond its capacity.";
-case "IO.IO_InvalidStringLen_Len": return "BinaryReader encountered an invalid string length of {0} characters.";
-case "IO.IO_NoConsole": return "There is no console.";
-case "IO.IO_NoPermissionToDirectoryName": return "<Path discovery permission to the specified directory was denied.>";
-case "IO.IO_SeekBeforeBegin": return "An attempt was made to move the position before the beginning of the stream.";
-case "IO.IO_SeekAppendOverwrite": return "Unable seek backward to overwrite data that previously existed in a file opened in Append mode.";
-case "IO.IO_SetLengthAppendTruncate": return "Unable to truncate data that previously existed in a file opened in Append mode.";
-case "IO.IO_SharingViolation_File": return "The process cannot access the file '{0}' because it is being used by another process.";
-case "IO.IO_SharingViolation_NoFileName": return "The process cannot access the file because it is being used by another process.";
-case "IO.IO_StreamTooLong": return "Stream was too long.";
-case "IO.IO_CannotCreateDirectory": return "The specified directory '{0}' cannot be created.";
-case "IO.IO_SourceDestMustBeDifferent": return "Source and destination path must be different.";
-case "IO.IO_SourceDestMustHaveSameRoot": return "Source and destination path must have identical roots. Move will not work across volumes.";
-
-// ; DirectoryNotFoundException
-case "IO.DriveNotFound_Drive": return "Could not find the drive '{0}'. The drive might not be ready or might not be mapped.";
-case "IO.PathNotFound_Path": return "Could not find a part of the path '{0}'.";
-case "IO.PathNotFound_NoPathName": return "Could not find a part of the path.";
-
-// ; PathTooLongException
-case "IO.PathTooLong": return "The specified path, file name, or both are too long. The fully qualified file name must be less than 260 characters, and the directory name must be less than 248 characters.";
-
-#if FEATURE_CORECLR
-// ; SecurityException
-case "FileSecurityState_OperationNotPermitted": return "File operation not permitted. Access to path '{0}' is denied.";
-#endif
-
-// ; PrivilegeNotHeldException
-case "PrivilegeNotHeld_Default": return "The process does not possess some privilege required for this operation.";
-case "PrivilegeNotHeld_Named": return "The process does not possess the '{0}' privilege which is required for this operation.";
-
-// ; General strings used in the IO package
-case "IO_UnknownFileName": return "[Unknown]";
-case "IO_StreamWriterBufferedDataLost": return "A StreamWriter was not closed and all buffered data within that StreamWriter was not flushed to the underlying stream.  (This was detected when the StreamWriter was finalized with data in its buffer.)  A portion of the data was lost.  Consider one of calling Close(), Flush(), setting the StreamWriter's AutoFlush property to true, or allocating the StreamWriter with a \"using\" statement.  Stream type: {0}\r\nFile name: {1}\r\nAllocated from:\r\n {2}";
-case "IO_StreamWriterBufferedDataLostCaptureAllocatedFromCallstackNotEnabled": return "callstack information is not captured by default for performance reasons. Please enable captureAllocatedCallStack config switch for streamWriterBufferedDataLost MDA (refer to MSDN MDA documentation for how to do this).  ";
-
-// ;
-// ; Serialization Exceptions
-// ;
-#if FEATURE_SERIALIZATION
-// ; SerializationException
-case "Serialization_NoID": return "Object has never been assigned an objectID.";
-case "Serialization_UnknownMemberInfo": return "Only FieldInfo, PropertyInfo, and SerializationMemberInfo are recognized.";
-case "Serialization_UnableToFixup": return "Cannot perform fixup.";
-case "Serialization_NoType": return "Object does not specify a type.";
-case "Serialization_ValueTypeFixup": return "ValueType fixup on Arrays is not implemented.";
-case "Serialization_PartialValueTypeFixup": return "Fixing up a partially available ValueType chain is not implemented.";
-case "Serialization_InvalidData": return "An error occurred while deserializing the object.  The serialized data is corrupt.";
-case "Serialization_InvalidID": return "Object specifies an invalid ID.";
-case "Serialization_InvalidPtrValue": return "An IntPtr or UIntPtr with an eight byte value cannot be deserialized on a machine with a four byte word size.";
-case "Serialization_DuplicateSelector": return "Selector is already on the list of checked selectors.";
-case "Serialization_MemberTypeNotRecognized": return "Unknown member type.";
-case "Serialization_NoBaseType": return "Object does not specify a base type.";
-case "Serialization_ArrayNoLength": return "Array does not specify a length.";
-case "Serialization_CannotGetType": return "Cannot get the type '{0}'.";
-case "Serialization_AssemblyNotFound": return "Unable to find assembly '{0}'.";
-case "Serialization_ArrayInvalidLength": return "Array specifies an invalid length.";
-case "Serialization_MalformedArray": return "The array information in the stream is invalid.";
-case "Serialization_InsufficientState": return "Insufficient state to return the real object.";
-case "Serialization_InvalidFieldState": return "Object fields may not be properly initialized.";
-case "Serialization_MissField": return "Field {0} is missing.";
-case "Serialization_MultipleMembers": return "Cannot resolve multiple members with the same name.";
-case "Serialization_NullSignature": return "The method signature cannot be null.";
-case "Serialization_ObjectUsedBeforeDeserCallback": return "An object was used before its deserialization callback ran, which may break higher-level consistency guarantees in the application.";
-case "Serialization_UnknownMember": return "Cannot get the member '{0}'.";
-case "Serialization_RegisterTwice": return "An object cannot be registered twice.";
-case "Serialization_IdTooSmall": return "Object IDs must be greater than zero.";
-case "Serialization_NotFound": return "Member '{0}' was not found.";
-case "Serialization_InsufficientDeserializationState": return "Insufficient state to deserialize the object. Missing field '{0}'. More information is needed.";
-case "Serialization_UnableToFindModule": return "The given module {0} cannot be found within the assembly {1}.";
-case "Serialization_TooManyReferences": return "The implementation of the IObjectReference interface returns too many nested references to other objects that implement IObjectReference.";
-case "Serialization_NotISer": return "The given object does not implement the ISerializable interface.";
-case "Serialization_InvalidOnDeser": return "OnDeserialization method was called while the object was not being deserialized.";
-case "Serialization_MissingKeys": return "The Keys for this Hashtable are missing.";
-case "Serialization_MissingKeyValuePairs": return "The KeyValuePairs for this Dictionary are missing.";
-case "Serialization_MissingValues": return "The values for this dictionary are missing.";
-case "Serialization_NullKey": return "One of the serialized keys is null.";
-case "Serialization_KeyValueDifferentSizes": return "The keys and values arrays have different sizes.";
-case "Serialization_SurrogateCycleInArgument": return "Selector contained a cycle.";
-case "Serialization_SurrogateCycle": return "Adding selector will introduce a cycle.";
-case "Serialization_NeverSeen": return "A fixup is registered to the object with ID {0}, but the object does not appear in the graph.";
-case "Serialization_IORIncomplete": return "The object with ID {0} implements the IObjectReference interface for which all dependencies cannot be resolved. The likely cause is two instances of IObjectReference that have a mutual dependency on each other.";
-case "Serialization_NotCyclicallyReferenceableSurrogate": return "{0}.SetObjectData returns a value that is neither null nor equal to the first parameter. Such Surrogates cannot be part of cyclical reference.";
-case "Serialization_ObjectNotSupplied": return "The object with ID {0} was referenced in a fixup but does not exist.";
-case "Serialization_TooManyElements": return "The internal array cannot expand to greater than Int32.MaxValue elements.";
-case "Serialization_SameNameTwice": return "Cannot add the same member twice to a SerializationInfo object.";
-case "Serialization_InvalidType": return "Only system-provided types can be passed to the GetUninitializedObject method. '{0}' is not a valid instance of a type.";
-case "Serialization_MissingObject": return "The object with ID {0} was referenced in a fixup but has not been registered.";
-case "Serialization_InvalidFixupType": return "A member fixup was registered for an object which implements ISerializable or has a surrogate. In this situation, a delayed fixup must be used.";
-case "Serialization_InvalidFixupDiscovered": return "A fixup on an object implementing ISerializable or having a surrogate was discovered for an object which does not have a SerializationInfo available.";
-case "Serialization_InvalidFormat": return "The input stream is not a valid binary format. The starting contents (in bytes) are: {0} ...";
-case "Serialization_ParentChildIdentical": return "The ID of the containing object cannot be the same as the object ID.";
-case "Serialization_IncorrectNumberOfFixups": return "The ObjectManager found an invalid number of fixups. This usually indicates a problem in the Formatter.";
-case "Serialization_BadParameterInfo": return "Non existent ParameterInfo. Position bigger than member's parameters length.";
-case "Serialization_NoParameterInfo": return "Serialized member does not have a ParameterInfo.";
-case "Serialization_StringBuilderMaxCapacity": return "The serialized MaxCapacity property of StringBuilder must be positive and greater than or equal to the String length.";
-case "Serialization_StringBuilderCapacity": return "The serialized Capacity property of StringBuilder must be positive, less than or equal to MaxCapacity and greater than or equal to the String length.";
-case "Serialization_InvalidDelegateType": return "Cannot serialize delegates over unmanaged function pointers, dynamic methods or methods outside the delegate creator's assembly.";
-case "Serialization_OptionalFieldVersionValue": return "Version value must be positive.";
-case "Serialization_MissingDateTimeData": return "Invalid serialized DateTime data. Unable to find 'ticks' or 'dateData'.";
-case "Serialization_DateTimeTicksOutOfRange": return "Invalid serialized DateTime data. Ticks must be between DateTime.MinValue.Ticks and DateTime.MaxValue.Ticks. ";
-// ; The following serialization exception messages appear in native resources too (mscorrc.rc)
-case "Serialization_NonSerType": return "Type '{0}' in Assembly '{1}' is not marked as serializable.";
-case "Serialization_ConstructorNotFound": return "The constructor to deserialize an object of type '{0}' was not found.";
-
-// ; SerializationException used by Formatters
-case "Serialization_ArrayType": return "Invalid array type '{0}'.";
-case "Serialization_ArrayTypeObject": return "Array element type is Object, 'dt' attribute is null.";
-case "Serialization_Assembly": return "No assembly information is available for object on the wire, '{0}'.";
-case "Serialization_AssemblyId": return "No assembly ID for object type '{0}'.";
-case "Serialization_BinaryHeader": return "Binary stream '{0}' does not contain a valid BinaryHeader. Possible causes are invalid stream or object version change between serialization and deserialization.";
-case "Serialization_CrossAppDomainError": return "Cross-AppDomain BinaryFormatter error; expected '{0}' but received '{1}'.";
-case "Serialization_CorruptedStream": return "Invalid BinaryFormatter stream.";
-case "Serialization_HeaderReflection": return "Header reflection error: number of value members: {0}.";
-case "Serialization_ISerializableTypes": return "Types not available for ISerializable object '{0}'.";
-case "Serialization_ISerializableMemberInfo": return "MemberInfo requested for ISerializable type.";
-case "Serialization_MBRAsMBV": return "Type {0} must be marshaled by reference in this context.";
-case "Serialization_Map": return "No map for object '{0}'.";
-case "Serialization_MemberInfo": return "MemberInfo cannot be obtained for ISerialized Object '{0}'.";
-case "Serialization_Method": return "Invalid MethodCall or MethodReturn stream format.";
-case "Serialization_MissingMember": return "Member '{0}' in class '{1}' is not present in the serialized stream and is not marked with {2}.";
-case "Serialization_NoMemberInfo": return "No MemberInfo for Object {0}.";
-case "Serialization_ObjNoID": return "Object {0} has never been assigned an objectID.";
-case "Serialization_ObjectTypeEnum": return "Invalid ObjectTypeEnum {0}.";
-case "Serialization_ParseError": return "Parse error. Current element is not compatible with the next element, {0}.";
-case "Serialization_SerMemberInfo": return "MemberInfo type {0} cannot be serialized.";
-case "Serialization_Stream": return "Attempting to deserialize an empty stream.";
-case "Serialization_StreamEnd": return "End of Stream encountered before parsing was completed.";
-case "Serialization_TopObject": return "No top object.";
-case "Serialization_TopObjectInstantiate": return "Top object cannot be instantiated for element '{0}'.";
-case "Serialization_TypeCode": return "Invalid type code in stream '{0}'.";
-case "Serialization_TypeExpected": return "Invalid expected type.";
-case "Serialization_TypeMissing": return "Type is missing for member of type Object '{0}'.";
-case "Serialization_TypeRead": return "Invalid read type request '{0}'.";
-case "Serialization_TypeSecurity": return "Type {0} and the types derived from it (such as {1}) are not permitted to be deserialized at this security level.";
-case "Serialization_TypeWrite": return "Invalid write type request '{0}'.";
-case "Serialization_XMLElement": return "Invalid element '{0}'.";
-case "Serialization_Security": return "Because of security restrictions, the type {0} cannot be accessed.";
-case "Serialization_TypeLoadFailure": return "Unable to load type {0} required for deserialization.";
-case "Serialization_RequireFullTrust": return "A type '{0}' that is defined in a partially trusted assembly cannot be type forwarded from an assembly with a different Public Key Token or without a public key token. To fix this, please either turn on unsafeTypeForwarding flag in the configuration file or remove the TypeForwardedFrom attribute.";
-// ; The following serialization exception messages appear in native resources too (mscorrc.rc)
-case "Serialization_TypeResolved": return "Type is not resolved for member '{0}'.";
-case "Serialization_MemberOutOfRange": return "The deserialized value of the member \"{0}\" in the class \"{1}\" is out of range.";
-#endif  // FEATURE_SERIALIZATION
-
-// ;
-// ; StringBuilder Exceptions
-// ;
-case "Arg_LongerThanSrcString": return "Source string was not long enough. Check sourceIndex and count.";
-
-
-// ;
-// ; System.Threading
-// ;
-
-// ;
-// ; Thread Exceptions
-// ;
-case "ThreadState_NoAbortRequested": return "Unable to reset abort because no abort was requested.";
-case "Threading.WaitHandleTooManyPosts": return "The WaitHandle cannot be signaled because it would exceed its maximum count.";
-// ;
-// ; WaitHandleCannotBeOpenedException
-// ;
-case "Threading.WaitHandleCannotBeOpenedException": return "No handle of the given name exists.";
-case "Threading.WaitHandleCannotBeOpenedException_InvalidHandle": return "A WaitHandle with system-wide name '{0}' cannot be created. A WaitHandle of a different type might have the same name.";
-
-// ;
-// ; AbandonedMutexException
-// ;
-case "Threading.AbandonedMutexException": return "The wait completed due to an abandoned mutex.";
-
-// ; AggregateException
-case "AggregateException_ctor_DefaultMessage": return "One or more errors occurred.";
-case "AggregateException_ctor_InnerExceptionNull": return "An element of innerExceptions was null.";
-case "AggregateException_DeserializationFailure": return "The serialization stream contains no inner exceptions.";
-case "AggregateException_ToString": return "{0}{1}---> (Inner Exception #{2}) {3}{4}{5}";
-
-// ; Cancellation
-case "CancellationToken_CreateLinkedToken_TokensIsEmpty": return "No tokens were supplied.";
-case "CancellationTokenSource_Disposed": return "The CancellationTokenSource has been disposed.";
-case "CancellationToken_SourceDisposed": return "The CancellationTokenSource associated with this CancellationToken has been disposed.";
-
-// ; Exceptions shared by all concurrent collection
-case "ConcurrentCollection_SyncRoot_NotSupported": return "The SyncRoot property may not be used for the synchronization of concurrent collections.";
-
-// ; Exceptions shared by ConcurrentStack and ConcurrentQueue
-case "ConcurrentStackQueue_OnDeserialization_NoData": return "The serialization stream contains no elements.";
-
-// ; ConcurrentStack<T>
-case "ConcurrentStack_PushPopRange_StartOutOfRange": return "The startIndex argument must be greater than or equal to zero.";
-case "ConcurrentStack_PushPopRange_CountOutOfRange": return "The count argument must be greater than or equal to zero.";
-case "ConcurrentStack_PushPopRange_InvalidCount": return "The sum of the startIndex and count arguments must be less than or equal to the collection's Count.";
-
-// ; ConcurrentDictionary<TKey, TValue>
-case "ConcurrentDictionary_ItemKeyIsNull": return "TKey is a reference type and item.Key is null.";
-case "ConcurrentDictionary_SourceContainsDuplicateKeys": return "The source argument contains duplicate keys.";
-case "ConcurrentDictionary_IndexIsNegative": return "The index argument is less than zero.";
-case "ConcurrentDictionary_ConcurrencyLevelMustBePositive": return "The concurrencyLevel argument must be positive.";
-case "ConcurrentDictionary_CapacityMustNotBeNegative": return "The capacity argument must be greater than or equal to zero.";
-case "ConcurrentDictionary_ArrayNotLargeEnough": return "The index is equal to or greater than the length of the array, or the number of elements in the dictionary is greater than the available space from index to the end of the destination array.";
-case "ConcurrentDictionary_ArrayIncorrectType": return "The array is multidimensional, or the type parameter for the set cannot be cast automatically to the type of the destination array.";
-case "ConcurrentDictionary_KeyAlreadyExisted": return "The key already existed in the dictionary.";
-case "ConcurrentDictionary_TypeOfKeyIncorrect": return "The key was of an incorrect type for this dictionary.";
-case "ConcurrentDictionary_TypeOfValueIncorrect": return "The value was of an incorrect type for this dictionary.";
-
-// ; Partitioner
-case "Partitioner_DynamicPartitionsNotSupported": return "Dynamic partitions are not supported by this partitioner.";
-
-// ; OrderablePartitioner
-case "OrderablePartitioner_GetPartitions_WrongNumberOfPartitions": return "GetPartitions returned an incorrect number of partitions.";
-
-// ; PartitionerStatic
-case "PartitionerStatic_CurrentCalledBeforeMoveNext": return "MoveNext must be called at least once before calling Current.";
-case "PartitionerStatic_CanNotCallGetEnumeratorAfterSourceHasBeenDisposed": return "Can not call GetEnumerator on partitions after the source enumerable is disposed";
-
-// ; CDSCollectionETWBCLProvider events
-case "event_ConcurrentStack_FastPushFailed": return "Push to ConcurrentStack spun {0} time(s).";
-case "event_ConcurrentStack_FastPopFailed": return "Pop from ConcurrentStack spun {0} time(s).";
-case "event_ConcurrentDictionary_AcquiringAllLocks": return "ConcurrentDictionary acquiring all locks on {0} bucket(s).";
-case "event_ConcurrentBag_TryTakeSteals": return "ConcurrentBag stealing in TryTake.";
-case "event_ConcurrentBag_TryPeekSteals": return "ConcurrentBag stealing in TryPeek.";
-
-// ; CountdownEvent
-case "CountdownEvent_Decrement_BelowZero": return "Invalid attempt made to decrement the event's count below zero.";
-case "CountdownEvent_Increment_AlreadyZero": return "The event is already signaled and cannot be incremented.";
-case "CountdownEvent_Increment_AlreadyMax": return "The increment operation would cause the CurrentCount to overflow.";
-
-// ; Parallel
-case "Parallel_Invoke_ActionNull": return "One of the actions was null.";
-case "Parallel_ForEach_OrderedPartitionerKeysNotNormalized": return "This method requires the use of an OrderedPartitioner with the KeysNormalized property set to true.";
-case "Parallel_ForEach_PartitionerNotDynamic": return "The Partitioner used here must support dynamic partitioning.";
-case "Parallel_ForEach_PartitionerReturnedNull": return "The Partitioner used here returned a null partitioner source.";
-case "Parallel_ForEach_NullEnumerator": return "The Partitioner source returned a null enumerator.";
-
-// ; SemaphyoreFullException
-case "Threading_SemaphoreFullException": return "Adding the specified count to the semaphore would cause it to exceed its maximum count.";
-
-// ; Lazy
-case "Lazy_ctor_ValueSelectorNull": return "The valueSelector argument is null.";
-case "Lazy_ctor_InfoNull": return "The info argument is null.";
-case "Lazy_ctor_deserialization_ValueInvalid": return "The Value cannot be null.";
-case "Lazy_ctor_ModeInvalid": return "The mode argument specifies an invalid value.";
-case "Lazy_CreateValue_NoParameterlessCtorForT": return "The lazily-initialized type does not have a public, parameterless constructor.";
-case "Lazy_StaticInit_InvalidOperation": return "ValueFactory returned null.";
-case "Lazy_Value_RecursiveCallsToValue": return "ValueFactory attempted to access the Value property of this instance.";
-case "Lazy_ToString_ValueNotCreated": return "Value is not created.";
-
-
-// ;ThreadLocal
-case "ThreadLocal_Value_RecursiveCallsToValue": return "ValueFactory attempted to access the Value property of this instance.";
-case "ThreadLocal_Disposed": return "The ThreadLocal object has been disposed.";
-case "ThreadLocal_ValuesNotAvailable": return "The ThreadLocal object is not tracking values. To use the Values property, use a ThreadLocal constructor that accepts the trackAllValues parameter and set the parameter to true.";
-
-// ; SemaphoreSlim
-case "SemaphoreSlim_ctor_InitialCountWrong": return "The initialCount argument must be non-negative and less than or equal to the maximumCount.";
-case "SemaphoreSlim_ctor_MaxCountWrong": return "The maximumCount argument must be a positive number. If a maximum is not required, use the constructor without a maxCount parameter.";
-case "SemaphoreSlim_Wait_TimeoutWrong": return "The timeout must represent a value between -1 and Int32.MaxValue, inclusive.";
-case "SemaphoreSlim_Release_CountWrong": return "The releaseCount argument must be greater than zero.";
-case "SemaphoreSlim_Disposed": return "The semaphore has been disposed.";
-
-// ; ManualResetEventSlim
-case "ManualResetEventSlim_ctor_SpinCountOutOfRange": return "The spinCount argument must be in the range 0 to {0}, inclusive.";
-case "ManualResetEventSlim_ctor_TooManyWaiters": return "There are too many threads currently waiting on the event. A maximum of {0} waiting threads are supported.";
-case "ManualResetEventSlim_Disposed": return "The event has been disposed.";
-
-// ; SpinLock
-case "SpinLock_TryEnter_ArgumentOutOfRange": return "The timeout must be a value between -1 and Int32.MaxValue, inclusive.";
-case "SpinLock_TryEnter_LockRecursionException": return "The calling thread already holds the lock.";
-case "SpinLock_TryReliableEnter_ArgumentException": return "The tookLock argument must be set to false before calling this method.";
-case "SpinLock_Exit_SynchronizationLockException": return "The calling thread does not hold the lock.";
-case "SpinLock_IsHeldByCurrentThread": return "Thread tracking is disabled.";
-
-// ; SpinWait
-case "SpinWait_SpinUntil_TimeoutWrong": return "The timeout must represent a value between -1 and Int32.MaxValue, inclusive.";
-case "SpinWait_SpinUntil_ArgumentNull": return "The condition argument is null.";
-
-// ; CdsSyncEtwBCLProvider events
-case "event_SpinLock_FastPathFailed": return "SpinLock beginning to spin.";
-case "event_SpinWait_NextSpinWillYield": return "Next spin will yield.";
-case "event_Barrier_PhaseFinished": return "Barrier finishing phase {1}.";
-
-// ;
-// ; System.Threading.Tasks
-// ;
-
-// ; AsyncMethodBuilder
-case "AsyncMethodBuilder_InstanceNotInitialized": return "The builder was not properly initialized.";
-
-// ; TaskAwaiter and YieldAwaitable
-case "AwaitableAwaiter_InstanceNotInitialized": return "The awaitable or awaiter was not properly initialized.";
-case "TaskAwaiter_TaskNotCompleted": return "The awaited task has not yet completed.";
-
-// ; Task<T>
-case "TaskT_SetException_HasAnInitializer": return "A task's Exception may only be set directly if the task was created without a function.";
-case "TaskT_TransitionToFinal_AlreadyCompleted": return "An attempt was made to transition a task to a final state when it had already completed.";
-case "TaskT_ctor_SelfReplicating": return "It is invalid to specify TaskCreationOptions.SelfReplicating for a Task<TResult>.";
-case "TaskT_DebuggerNoResult": return "{Not yet computed}";
-
-// ; Task
-case "Task_ctor_LRandSR": return "(Internal)An attempt was made to create a LongRunning SelfReplicating task.";
-case "Task_ThrowIfDisposed": return "The task has been disposed.";
-case "Task_Dispose_NotCompleted": return "A task may only be disposed if it is in a completion state (RanToCompletion, Faulted or Canceled).";
-case "Task_Start_Promise": return "Start may not be called on a promise-style task.";
-case "Task_Start_AlreadyStarted": return "Start may not be called on a task that was already started.";
-case "Task_Start_TaskCompleted": return "Start may not be called on a task that has completed.";
-case "Task_Start_ContinuationTask": return "Start may not be called on a continuation task.";
-case "Task_RunSynchronously_AlreadyStarted": return "RunSynchronously may not be called on a task that was already started.";
-case "Task_RunSynchronously_TaskCompleted": return "RunSynchronously may not be called on a task that has already completed.";
-case "Task_RunSynchronously_Promise": return "RunSynchronously may not be called on a task not bound to a delegate, such as the task returned from an asynchronous method.";
-case "Task_RunSynchronously_Continuation": return "RunSynchronously may not be called on a continuation task.";
-case "Task_ContinueWith_NotOnAnything": return "The specified TaskContinuationOptions excluded all continuation kinds.";
-case "Task_ContinueWith_ESandLR": return "The specified TaskContinuationOptions combined LongRunning and ExecuteSynchronously.  Synchronous continuations should not be long running.";
-case "Task_MultiTaskContinuation_NullTask": return "The tasks argument included a null value.";
-case "Task_MultiTaskContinuation_FireOptions": return "It is invalid to exclude specific continuation kinds for continuations off of multiple tasks.";
-case "Task_MultiTaskContinuation_EmptyTaskList": return "The tasks argument contains no tasks.";
-case "Task_FromAsync_TaskManagerShutDown": return "FromAsync was called with a TaskManager that had already shut down.";
-case "Task_FromAsync_SelfReplicating": return "It is invalid to specify TaskCreationOptions.SelfReplicating in calls to FromAsync.";
-case "Task_FromAsync_LongRunning": return "It is invalid to specify TaskCreationOptions.LongRunning in calls to FromAsync.";
-case "Task_FromAsync_PreferFairness": return "It is invalid to specify TaskCreationOptions.PreferFairness in calls to FromAsync.";
-case "Task_WaitMulti_NullTask": return "The tasks array included at least one null element.";
-case "Task_Delay_InvalidMillisecondsDelay": return "The value needs to be either -1 (signifying an infinite timeout), 0 or a positive integer.";
-case "Task_Delay_InvalidDelay": return "The value needs to translate in milliseconds to -1 (signifying an infinite timeout), 0 or a positive integer less than or equal to Int32.MaxValue.";
-
-// ; TaskCanceledException
-case "TaskCanceledException_ctor_DefaultMessage": return "A task was canceled.";
-
-// ;TaskCompletionSource<T>
-case "TaskCompletionSourceT_TrySetException_NullException": return "The exceptions collection included at least one null element.";
-case "TaskCompletionSourceT_TrySetException_NoExceptions": return "The exceptions collection was empty.";
-
-// ;TaskExceptionHolder
-case "TaskExceptionHolder_UnknownExceptionType": return "(Internal)Expected an Exception or an IEnumerable<Exception>";
-case "TaskExceptionHolder_UnhandledException": return "A Task's exception(s) were not observed either by Waiting on the Task or accessing its Exception property. As a result, the unobserved exception was rethrown by the finalizer thread.";
-
-// ; TaskScheduler
-case "TaskScheduler_ExecuteTask_TaskAlreadyExecuted": return "ExecuteTask may not be called for a task which was already executed.";
-case "TaskScheduler_ExecuteTask_WrongTaskScheduler": return "ExecuteTask may not be called for a task which was previously queued to a different TaskScheduler.";
-case "TaskScheduler_InconsistentStateAfterTryExecuteTaskInline": return "The TryExecuteTaskInline call to the underlying scheduler succeeded, but the task body was not invoked.";
-case "TaskScheduler_FromCurrentSynchronizationContext_NoCurrent": return "The current SynchronizationContext may not be used as a TaskScheduler.";
-
-// ; TaskSchedulerException
-case "TaskSchedulerException_ctor_DefaultMessage": return "An exception was thrown by a TaskScheduler.";
-
-// ;
-// ; ParallelState ( used in Parallel.For(), Parallel.ForEach() )
-case "ParallelState_Break_InvalidOperationException_BreakAfterStop": return "Break was called after Stop was called.";
-case "ParallelState_Stop_InvalidOperationException_StopAfterBreak": return "Stop was called after Break was called.";
-case "ParallelState_NotSupportedException_UnsupportedMethod": return "This method is not supported.";
-
-// ;
-// ; TPLETWProvider events
-case "event_ParallelLoopBegin": return "Beginning {3} loop {2} from Task {1}.";
-case "event_ParallelLoopEnd": return "Ending loop {2} after {3} iterations.";
-case "event_ParallelInvokeBegin": return "Beginning ParallelInvoke {2} from Task {1} for {4} actions.";
-case "event_ParallelInvokeEnd": return "Ending ParallelInvoke {2}.";
-case "event_ParallelFork": return "Task {1} entering fork/join {2}.";
-case "event_ParallelJoin": return "Task {1} leaving fork/join {2}.";
-case "event_TaskScheduled": return "Task {2} scheduled to TaskScheduler {0}.";
-case "event_TaskStarted": return "Task {2} executing.";
-case "event_TaskCompleted": return "Task {2} completed.";
-case "event_TaskWaitBegin": return "Beginning wait ({3}) on Task {2}.";
-case "event_TaskWaitEnd": return "Ending wait on Task {2}.";
-
-
-// ;
-// ; Weak Reference Exception
-// ;
-case "WeakReference_NoLongerValid": return "The weak reference is no longer valid.";
-
-
-// ;
-// ; Interop Exceptions
-// ;
-case "Interop.COM_TypeMismatch": return "Type mismatch between source and destination types.";
-case "Interop_Marshal_Unmappable_Char": return "Cannot marshal: Encountered unmappable character.";
-
-#if FEATURE_COMINTEROP_WINRT_DESKTOP_HOST
-case "WinRTHostDomainName": return "Windows Runtime Object Host Domain for '{0}'";
-#endif
-
-// ;
-// ; Loader Exceptions
-// ;
-case "Loader_InvalidPath": return "Relative path must be a string that contains the substring, \"..\", or does not contain a root directory.";
-case "Loader_Name": return "Name:";
-case "Loader_NoContextPolicies": return "There are no context policies.";
-case "Loader_ContextPolicies": return "Context Policies:";
-
-// ;
-// ; AppDomain Exceptions
-case "AppDomain_RequireApplicationName": return "ApplicationName must be set before the DynamicBase can be set.";
-case "AppDomain_AppBaseNotSet": return "The ApplicationBase must be set before retrieving this property.";
-
-#if FEATURE_HOST_ASSEMBLY_RESOLVER
-case "AppDomain_BindingModelIsLocked": return "Binding model is already locked for the AppDomain and cannot be reset.";
-case "Argument_CustomAssemblyLoadContextRequestedNameMismatch": return "Resolved assembly's simple name should be the same as of the requested assembly.";
-#endif // FEATURE_HOST_ASSEMBLY_RESOLVER
-// ;
-// ; XMLSyntaxExceptions
-case "XMLSyntax_UnexpectedEndOfFile": return "Unexpected end of file.";
-case "XMLSyntax_ExpectedCloseBracket": return "Expected > character.";
-case "XMLSyntax_ExpectedSlashOrString": return "Expected / character or string.";
-case "XMLSyntax_UnexpectedCloseBracket": return "Unexpected > character.";
-case "XMLSyntax_SyntaxError": return "Invalid syntax on line {0}.";
-case "XMLSyntax_SyntaxErrorEx": return "Invalid syntax on line {0} - '{1}'.";
-case "XMLSyntax_InvalidSyntax": return "Invalid syntax.";
-case "XML_Syntax_InvalidSyntaxInFile": return "Invalid XML in file '{0}' near element '{1}'.";
-case "XMLSyntax_InvalidSyntaxSatAssemTag": return "Invalid XML in file \"{0}\" near element \"{1}\". The <satelliteassemblies> section only supports <assembly> tags.";
-case "XMLSyntax_InvalidSyntaxSatAssemTagBadAttr": return "Invalid XML in file \"{0}\" near \"{1}\" and \"{2}\". In the <satelliteassemblies> section, the <assembly> tag must have exactly 1 attribute called 'name', whose value is a fully-qualified assembly name.";
-case "XMLSyntax_InvalidSyntaxSatAssemTagNoAttr": return "Invalid XML in file \"{0}\". In the <satelliteassemblies> section, the <assembly> tag must have exactly 1 attribute called 'name', whose value is a fully-qualified assembly name.";
-
-// ; CodeGroup
-#if FEATURE_CAS_POLICY
-case "NetCodeGroup_PermissionSet": return "Same site Web";
-case "MergeLogic_Union": return "Union";
-case "MergeLogic_FirstMatch": return "First Match";
-case "FileCodeGroup_PermissionSet": return "Same directory FileIO - '{0}'";
-#endif // FEATURE_CAS_POLICY
-
-// ; MembershipConditions
-case "StrongName_ToString": return "StrongName - {0}{1}{2}";
-case "StrongName_Name": return "name = {0}";
-case "StrongName_Version": return "version = {0}";
-case "Site_ToString": return "Site";
-case "Publisher_ToString": return "Publisher";
-case "Hash_ToString": return "Hash - {0} = {1}";
-case "ApplicationDirectory_ToString": return "ApplicationDirectory";
-case "Zone_ToString": return "Zone - {0}";
-case "All_ToString": return "All code";
-case "Url_ToString": return "Url";
-case "GAC_ToString": return "GAC";
-#if FEATURE_CAS_POLICY
-case "Site_ToStringArg": return "Site - {0}";
-case "Publisher_ToStringArg": return "Publisher - {0}";
-case "Url_ToStringArg": return "Url - {0}";
-#endif // FEATURE_CAS_POLICY
-
-
-// ; Interop non exception strings.
-case "TypeLibConverter_ImportedTypeLibProductName": return "Assembly imported from type library '{0}'.";
-
-// ;
-// ; begin System.TimeZoneInfo ArgumentException's
-// ;
-case "Argument_AdjustmentRulesNoNulls": return "The AdjustmentRule array cannot contain null elements.";
-case "Argument_AdjustmentRulesOutOfOrder": return "The elements of the AdjustmentRule array must be in chronological order and must not overlap.";
-case "Argument_AdjustmentRulesAmbiguousOverlap": return "The elements of the AdjustmentRule array must not contain ambiguous time periods that extend beyond the DateStart or DateEnd properties of the element.";
-case "Argument_AdjustmentRulesrDaylightSavingTimeOverlap": return "The elements of the AdjustmentRule array must not contain Daylight Saving Time periods that overlap adjacent elements in such a way as to cause invalid or ambiguous time periods.";
-case "Argument_AdjustmentRulesrDaylightSavingTimeOverlapNonRuleRange": return "The elements of the AdjustmentRule array must not contain Daylight Saving Time periods that overlap the DateStart or DateEnd properties in such a way as to cause invalid or ambiguous time periods.";
-case "Argument_AdjustmentRulesInvalidOverlap": return "The elements of the AdjustmentRule array must not contain invalid time periods that extend beyond the DateStart or DateEnd properties of the element. ";
-case "Argument_ConvertMismatch": return "The conversion could not be completed because the supplied DateTime did not have the Kind property set correctly.  For example, when the Kind property is DateTimeKind.Local, the source time zone must be TimeZoneInfo.Local.";
-case "Argument_DateTimeHasTimeOfDay": return "The supplied DateTime includes a TimeOfDay setting.   This is not supported.";
-case "Argument_DateTimeIsInvalid": return "The supplied DateTime represents an invalid time.  For example, when the clock is adjusted forward, any time in the period that is skipped is invalid.";
-case "Argument_DateTimeIsNotAmbiguous": return "The supplied DateTime is not in an ambiguous time range.";
-case "Argument_DateTimeOffsetIsNotAmbiguous": return "The supplied DateTimeOffset is not in an ambiguous time range.";
-case "Argument_DateTimeKindMustBeUnspecified": return "The supplied DateTime must have the Kind property set to DateTimeKind.Unspecified.";
-case "Argument_DateTimeHasTicks": return "The supplied DateTime must have the Year, Month, and Day properties set to 1.  The time cannot be specified more precisely than whole milliseconds.";
-case "Argument_InvalidId": return "The specified ID parameter '{0}' is not supported.";
-case "Argument_InvalidSerializedString": return "The specified serialized string '{0}' is not supported.";
-case "Argument_InvalidREG_TZI_FORMAT": return "The REG_TZI_FORMAT structure is corrupt.";
-case "Argument_OutOfOrderDateTimes": return "The DateStart property must come before the DateEnd property.";
-case "Argument_TimeSpanHasSeconds": return "The TimeSpan parameter cannot be specified more precisely than whole minutes.";
-case "Argument_TimeZoneInfoBadTZif": return "The tzfile does not begin with the magic characters 'TZif'.  Please verify that the file is not corrupt.";
-case "Argument_TimeZoneInfoInvalidTZif": return "The TZif data structure is corrupt.";
-case "Argument_TransitionTimesAreIdentical": return "The DaylightTransitionStart property must not equal the DaylightTransitionEnd property.";
-// ;
-// ; begin System.TimeZoneInfo ArgumentOutOfRangeException's
-// ;
-case "ArgumentOutOfRange_DayParam": return "The Day parameter must be in the range 1 through 31.";
-case "ArgumentOutOfRange_DayOfWeek": return "The DayOfWeek enumeration must be in the range 0 through 6.";
-case "ArgumentOutOfRange_MonthParam": return "The Month parameter must be in the range 1 through 12.";
-case "ArgumentOutOfRange_UtcOffset": return "The TimeSpan parameter must be within plus or minus 14.0 hours.";
-case "ArgumentOutOfRange_UtcOffsetAndDaylightDelta": return "The sum of the BaseUtcOffset and DaylightDelta properties must within plus or minus 14.0 hours.";
-case "ArgumentOutOfRange_Week": return "The Week parameter must be in the range 1 through 5.";
-// ;
-// ; begin System.TimeZoneInfo InvalidTimeZoneException's
-// ;
-case "InvalidTimeZone_InvalidRegistryData": return "The time zone ID '{0}' was found on the local computer, but the registry information was corrupt.";
-case "InvalidTimeZone_InvalidWin32APIData": return "The Local time zone was found on the local computer, but the data was corrupt.";
-// ;
-// ; begin System.TimeZoneInfo SecurityException's
-// ;
-case "Security_CannotReadRegistryData": return "The time zone ID '{0}' was found on the local computer, but the application does not have permission to read the registry information.";
-// ;
-// ; begin System.TimeZoneInfo SerializationException's
-// ;
-case "Serialization_CorruptField": return "The value of the field '{0}' is invalid.  The serialized data is corrupt.  ";
-case "Serialization_InvalidEscapeSequence": return "The serialized data contained an invalid escape sequence '\\{0}'.";
-// ;
-// ; begin System.TimeZoneInfo TimeZoneNotFoundException's
-// ;
-case "TimeZoneNotFound_MissingRegistryData": return "The time zone ID '{0}' was not found on the local computer.";
-// ;
-// ; end System.TimeZoneInfo
-// ;
-
-
-// ; Tuple
-case "ArgumentException_TupleIncorrectType": return "Argument must be of type {0}.";
-case "ArgumentException_TupleNonIComparableElement": return "The tuple contains an element of type {0} which does not implement the IComparable interface.";
-case "ArgumentException_TupleLastArgumentNotATuple": return "The last element of an eight element tuple must be a Tuple.";
-case "ArgumentException_OtherNotArrayOfCorrectLength": return "Object is not a array with the same number of elements as the array to compare it to.";
-
-// ; WinRT collection adapters
-case "Argument_IndexOutOfArrayBounds": return "The specified index is out of bounds of the specified array.";
-case "Argument_InsufficientSpaceToCopyCollection": return "The specified space is not sufficient to copy the elements from this Collection.";
-case "ArgumentOutOfRange_IndexLargerThanMaxValue": return "This collection cannot work with indices larger than Int32.MaxValue - 1 (0x7FFFFFFF - 1).";
-case "ArgumentOutOfRange_IndexOutOfRange": return "The specified index is outside the current index range of this collection.";
-case "InvalidOperation_CollectionBackingListTooLarge": return "The collection backing this List contains too many elements.";
-case "InvalidOperation_CollectionBackingDictionaryTooLarge": return "The collection backing this Dictionary contains too many elements.";
-case "InvalidOperation_CannotRemoveLastFromEmptyCollection": return "Cannot remove the last element from an empty collection.";
-
-// ; Globalization resources
-// ;------------------
-
-#if !FEATURE_CORECLR
-case "Globalization.LegacyModifier": return " Legacy";
-
-// ;
-// ;Total items: 809
-// ;
-case "Globalization.ci_": return "Invariant Language (Invariant Country)";
-case "Globalization.ci_aa": return "Afar";
-case "Globalization.ci_aa-DJ": return "Afar (Djibouti)";
-case "Globalization.ci_aa-ER": return "Afar (Eritrea)";
-case "Globalization.ci_aa-ET": return "Afar (Ethiopia)";
-case "Globalization.ci_af": return "Afrikaans";
-case "Globalization.ci_af-NA": return "Afrikaans (Namibia)";
-case "Globalization.ci_af-ZA": return "Afrikaans (South Africa)";
-case "Globalization.ci_agq": return "Aghem";
-case "Globalization.ci_agq-CM": return "Aghem (Cameroon)";
-case "Globalization.ci_ak": return "Akan";
-case "Globalization.ci_ak-GH": return "Akan (Ghana)";
-case "Globalization.ci_am": return "Amharic";
-case "Globalization.ci_am-ET": return "Amharic (Ethiopia)";
-case "Globalization.ci_ar": return "Arabic";
-case "Globalization.ci_ar-001": return "Arabic (World)";
-case "Globalization.ci_ar-AE": return "Arabic (U.A.E.)";
-case "Globalization.ci_ar-BH": return "Arabic (Bahrain)";
-case "Globalization.ci_ar-DJ": return "Arabic (Djibouti)";
-case "Globalization.ci_ar-DZ": return "Arabic (Algeria)";
-case "Globalization.ci_ar-EG": return "Arabic (Egypt)";
-case "Globalization.ci_ar-ER": return "Arabic (Eritrea)";
-case "Globalization.ci_ar-IL": return "Arabic (Israel)";
-case "Globalization.ci_ar-IQ": return "Arabic (Iraq)";
-case "Globalization.ci_ar-JO": return "Arabic (Jordan)";
-case "Globalization.ci_ar-KM": return "Arabic (Comoros)";
-case "Globalization.ci_ar-KW": return "Arabic (Kuwait)";
-case "Globalization.ci_ar-LB": return "Arabic (Lebanon)";
-case "Globalization.ci_ar-LY": return "Arabic (Libya)";
-case "Globalization.ci_ar-MA": return "Arabic (Morocco)";
-case "Globalization.ci_ar-MR": return "Arabic (Mauritania)";
-case "Globalization.ci_ar-OM": return "Arabic (Oman)";
-case "Globalization.ci_ar-PS": return "Arabic (Palestinian Authority)";
-case "Globalization.ci_ar-QA": return "Arabic (Qatar)";
-case "Globalization.ci_ar-SA": return "Arabic (Saudi Arabia)";
-case "Globalization.ci_ar-SD": return "Arabic (Sudan)";
-case "Globalization.ci_ar-SO": return "Arabic (Somalia)";
-case "Globalization.ci_ar-SS": return "Arabic (South Sudan)";
-case "Globalization.ci_ar-SY": return "Arabic (Syria)";
-case "Globalization.ci_ar-TD": return "Arabic (Chad)";
-case "Globalization.ci_ar-TN": return "Arabic (Tunisia)";
-case "Globalization.ci_ar-YE": return "Arabic (Yemen)";
-case "Globalization.ci_arn": return "Mapudungun";
-case "Globalization.ci_arn-CL": return "Mapudungun (Chile)";
-case "Globalization.ci_as": return "Assamese";
-case "Globalization.ci_as-IN": return "Assamese (India)";
-case "Globalization.ci_asa": return "Asu";
-case "Globalization.ci_asa-TZ": return "Asu (Tanzania)";
-case "Globalization.ci_ast": return "Asturian";
-case "Globalization.ci_ast-ES": return "Asturian (Spain)";
-case "Globalization.ci_az": return "Azerbaijani";
-case "Globalization.ci_az-Cyrl": return "Azerbaijani (Cyrillic)";
-case "Globalization.ci_az-Cyrl-AZ": return "Azerbaijani (Cyrillic, Azerbaijan)";
-case "Globalization.ci_az-Latn": return "Azerbaijani (Latin)";
-case "Globalization.ci_az-Latn-AZ": return "Azerbaijani (Latin, Azerbaijan)";
-case "Globalization.ci_ba": return "Bashkir";
-case "Globalization.ci_ba-RU": return "Bashkir (Russia)";
-case "Globalization.ci_bas": return "Basaa";
-case "Globalization.ci_bas-CM": return "Basaa (Cameroon)";
-case "Globalization.ci_be": return "Belarusian";
-case "Globalization.ci_be-BY": return "Belarusian (Belarus)";
-case "Globalization.ci_bem": return "Bemba";
-case "Globalization.ci_bem-ZM": return "Bemba (Zambia)";
-case "Globalization.ci_bez": return "Bena";
-case "Globalization.ci_bez-TZ": return "Bena (Tanzania)";
-case "Globalization.ci_bg": return "Bulgarian";
-case "Globalization.ci_bg-BG": return "Bulgarian (Bulgaria)";
-case "Globalization.ci_bm": return "Bambara";
-case "Globalization.ci_bm-Latn": return "Bambara (Latin)";
-case "Globalization.ci_bm-Latn-ML": return "Bambara (Latin, Mali)";
-case "Globalization.ci_bm-ML": return "Bamanankan (Latin, Mali)";
-case "Globalization.ci_bn": return "Bangla";
-case "Globalization.ci_bn-BD": return "Bangla (Bangladesh)";
-case "Globalization.ci_bn-IN": return "Bangla (India)";
-case "Globalization.ci_bo": return "Tibetan";
-case "Globalization.ci_bo-CN": return "Tibetan (PRC)";
-case "Globalization.ci_bo-IN": return "Tibetan (India)";
-case "Globalization.ci_br": return "Breton";
-case "Globalization.ci_br-FR": return "Breton (France)";
-case "Globalization.ci_brx": return "Bodo";
-case "Globalization.ci_brx-IN": return "Bodo (India)";
-case "Globalization.ci_bs": return "Bosnian";
-case "Globalization.ci_bs-Cyrl": return "Bosnian (Cyrillic)";
-case "Globalization.ci_bs-Cyrl-BA": return "Bosnian (Cyrillic, Bosnia and Herzegovina)";
-case "Globalization.ci_bs-Latn": return "Bosnian (Latin)";
-case "Globalization.ci_bs-Latn-BA": return "Bosnian (Latin, Bosnia and Herzegovina)";
-case "Globalization.ci_byn": return "Blin";
-case "Globalization.ci_byn-ER": return "Blin (Eritrea)";
-case "Globalization.ci_ca": return "Catalan";
-case "Globalization.ci_ca-AD": return "Catalan (Andorra)";
-case "Globalization.ci_ca-ES": return "Catalan (Catalan)";
-case "Globalization.ci_ca-ES-valencia": return "Valencian (Spain)";
-case "Globalization.ci_ca-FR": return "Catalan (France)";
-case "Globalization.ci_ca-IT": return "Catalan (Italy)";
-case "Globalization.ci_cgg": return "Chiga";
-case "Globalization.ci_cgg-UG": return "Chiga (Uganda)";
-case "Globalization.ci_chr": return "Cherokee";
-case "Globalization.ci_chr-Cher": return "Cherokee (Cherokee)";
-case "Globalization.ci_chr-Cher-US": return "Cherokee (Cherokee)";
-case "Globalization.ci_co": return "Corsican";
-case "Globalization.ci_co-FR": return "Corsican (France)";
-case "Globalization.ci_cs": return "Czech";
-case "Globalization.ci_cs-CZ": return "Czech (Czech Republic)";
-case "Globalization.ci_cy": return "Welsh";
-case "Globalization.ci_cy-GB": return "Welsh (United Kingdom)";
-case "Globalization.ci_da": return "Danish";
-case "Globalization.ci_da-DK": return "Danish (Denmark)";
-case "Globalization.ci_da-GL": return "Danish (Greenland)";
-case "Globalization.ci_dav": return "Taita";
-case "Globalization.ci_dav-KE": return "Taita (Kenya)";
-case "Globalization.ci_de": return "German";
-case "Globalization.ci_de-AT": return "German (Austria)";
-case "Globalization.ci_de-BE": return "German (Belgium)";
-case "Globalization.ci_de-CH": return "German (Switzerland)";
-case "Globalization.ci_de-DE": return "German (Germany)";
-case "Globalization.ci_de-DE_phoneb": return "German (Germany)";
-case "Globalization.ci_de-LI": return "German (Liechtenstein)";
-case "Globalization.ci_de-LU": return "German (Luxembourg)";
-case "Globalization.ci_dje": return "Zarma";
-case "Globalization.ci_dje-NE": return "Zarma (Niger)";
-case "Globalization.ci_dsb": return "Lower Sorbian";
-case "Globalization.ci_dsb-DE": return "Lower Sorbian (Germany)";
-case "Globalization.ci_dua": return "Duala";
-case "Globalization.ci_dua-CM": return "Duala (Cameroon)";
-case "Globalization.ci_dv": return "Divehi";
-case "Globalization.ci_dv-MV": return "Divehi (Maldives)";
-case "Globalization.ci_dyo": return "Jola-Fonyi";
-case "Globalization.ci_dyo-SN": return "Jola-Fonyi (Senegal)";
-case "Globalization.ci_dz": return "Dzongkha";
-case "Globalization.ci_dz-BT": return "Dzongkha (Bhutan)";
-case "Globalization.ci_ebu": return "Embu";
-case "Globalization.ci_ebu-KE": return "Embu (Kenya)";
-case "Globalization.ci_ee": return "Ewe";
-case "Globalization.ci_ee-GH": return "Ewe (Ghana)";
-case "Globalization.ci_ee-TG": return "Ewe (Togo)";
-case "Globalization.ci_el": return "Greek";
-case "Globalization.ci_el-CY": return "Greek (Cyprus)";
-case "Globalization.ci_el-GR": return "Greek (Greece)";
-case "Globalization.ci_en": return "English";
-case "Globalization.ci_en-001": return "English (World)";
-case "Globalization.ci_en-029": return "English (Caribbean)";
-case "Globalization.ci_en-150": return "English (Europe)";
-case "Globalization.ci_en-AG": return "English (Antigua and Barbuda)";
-case "Globalization.ci_en-AI": return "English (Anguilla)";
-case "Globalization.ci_en-AS": return "English (American Samoa)";
-case "Globalization.ci_en-AU": return "English (Australia)";
-case "Globalization.ci_en-BB": return "English (Barbados)";
-case "Globalization.ci_en-BE": return "English (Belgium)";
-case "Globalization.ci_en-BM": return "English (Bermuda)";
-case "Globalization.ci_en-BS": return "English (Bahamas)";
-case "Globalization.ci_en-BW": return "English (Botswana)";
-case "Globalization.ci_en-BZ": return "English (Belize)";
-case "Globalization.ci_en-CA": return "English (Canada)";
-case "Globalization.ci_en-CC": return "English (Cocos [Keeling] Islands)";
-case "Globalization.ci_en-CK": return "English (Cook Islands)";
-case "Globalization.ci_en-CM": return "English (Cameroon)";
-case "Globalization.ci_en-CX": return "English (Christmas Island)";
-case "Globalization.ci_en-DM": return "English (Dominica)";
-case "Globalization.ci_en-ER": return "English (Eritrea)";
-case "Globalization.ci_en-FJ": return "English (Fiji)";
-case "Globalization.ci_en-FK": return "English (Falkland Islands)";
-case "Globalization.ci_en-FM": return "English (Micronesia)";
-case "Globalization.ci_en-GB": return "English (United Kingdom)";
-case "Globalization.ci_en-GD": return "English (Grenada)";
-case "Globalization.ci_en-GG": return "English (Guernsey)";
-case "Globalization.ci_en-GH": return "English (Ghana)";
-case "Globalization.ci_en-GI": return "English (Gibraltar)";
-case "Globalization.ci_en-GM": return "English (Gambia)";
-case "Globalization.ci_en-GU": return "English (Guam)";
-case "Globalization.ci_en-GY": return "English (Guyana)";
-case "Globalization.ci_en-HK": return "English (Hong Kong SAR)";
-case "Globalization.ci_en-IE": return "English (Ireland)";
-case "Globalization.ci_en-IM": return "English (Isle of Man)";
-case "Globalization.ci_en-IN": return "English (India)";
-case "Globalization.ci_en-IO": return "English (British Indian Ocean Territory)";
-case "Globalization.ci_en-JE": return "English (Jersey)";
-case "Globalization.ci_en-JM": return "English (Jamaica)";
-case "Globalization.ci_en-KE": return "English (Kenya)";
-case "Globalization.ci_en-KI": return "English (Kiribati)";
-case "Globalization.ci_en-KN": return "English (Saint Kitts and Nevis)";
-case "Globalization.ci_en-KY": return "English (Cayman Islands)";
-case "Globalization.ci_en-LC": return "English (Saint Lucia)";
-case "Globalization.ci_en-LR": return "English (Liberia)";
-case "Globalization.ci_en-LS": return "English (Lesotho)";
-case "Globalization.ci_en-MG": return "English (Madagascar)";
-case "Globalization.ci_en-MH": return "English (Marshall Islands)";
-case "Globalization.ci_en-MO": return "English (Macao SAR)";
-case "Globalization.ci_en-MP": return "English (Northern Mariana Islands)";
-case "Globalization.ci_en-MS": return "English (Montserrat)";
-case "Globalization.ci_en-MT": return "English (Malta)";
-case "Globalization.ci_en-MU": return "English (Mauritius)";
-case "Globalization.ci_en-MW": return "English (Malawi)";
-case "Globalization.ci_en-MY": return "English (Malaysia)";
-case "Globalization.ci_en-NA": return "English (Namibia)";
-case "Globalization.ci_en-NF": return "English (Norfolk Island)";
-case "Globalization.ci_en-NG": return "English (Nigeria)";
-case "Globalization.ci_en-NR": return "English (Nauru)";
-case "Globalization.ci_en-NU": return "English (Niue)";
-case "Globalization.ci_en-NZ": return "English (New Zealand)";
-case "Globalization.ci_en-PG": return "English (Papua New Guinea)";
-case "Globalization.ci_en-PH": return "English (Republic of the Philippines)";
-case "Globalization.ci_en-PK": return "English (Pakistan)";
-case "Globalization.ci_en-PN": return "English (Pitcairn Islands)";
-case "Globalization.ci_en-PR": return "English (Puerto Rico)";
-case "Globalization.ci_en-PW": return "English (Palau)";
-case "Globalization.ci_en-RW": return "English (Rwanda)";
-case "Globalization.ci_en-SB": return "English (Solomon Islands)";
-case "Globalization.ci_en-SC": return "English (Seychelles)";
-case "Globalization.ci_en-SD": return "English (Sudan)";
-case "Globalization.ci_en-SG": return "English (Singapore)";
-case "Globalization.ci_en-SH": return "English (St Helena, Ascension, Tristan da Cunha)";
-case "Globalization.ci_en-SL": return "English (Sierra Leone)";
-case "Globalization.ci_en-SS": return "English (South Sudan)";
-case "Globalization.ci_en-SX": return "English (Sint Maarten)";
-case "Globalization.ci_en-SZ": return "English (Swaziland)";
-case "Globalization.ci_en-TC": return "English (Turks and Caicos Islands)";
-case "Globalization.ci_en-TK": return "English (Tokelau)";
-case "Globalization.ci_en-TO": return "English (Tonga)";
-case "Globalization.ci_en-TT": return "English (Trinidad and Tobago)";
-case "Globalization.ci_en-TV": return "English (Tuvalu)";
-case "Globalization.ci_en-TZ": return "English (Tanzania)";
-case "Globalization.ci_en-UG": return "English (Uganda)";
-case "Globalization.ci_en-UM": return "English (US Minor Outlying Islands)";
-case "Globalization.ci_en-US": return "English (United States)";
-case "Globalization.ci_en-VC": return "English (Saint Vincent and the Grenadines)";
-case "Globalization.ci_en-VG": return "English (British Virgin Islands)";
-case "Globalization.ci_en-VI": return "English (US Virgin Islands)";
-case "Globalization.ci_en-VU": return "English (Vanuatu)";
-case "Globalization.ci_en-WS": return "English (Samoa)";
-case "Globalization.ci_en-ZA": return "English (South Africa)";
-case "Globalization.ci_en-ZM": return "English (Zambia)";
-case "Globalization.ci_en-ZW": return "English (Zimbabwe)";
-case "Globalization.ci_eo": return "Esperanto";
-case "Globalization.ci_eo-001": return "Esperanto (World)";
-case "Globalization.ci_es": return "Spanish";
-case "Globalization.ci_es-419": return "Spanish (Latin America)";
-case "Globalization.ci_es-AR": return "Spanish (Argentina)";
-case "Globalization.ci_es-BO": return "Spanish (Bolivia)";
-case "Globalization.ci_es-CL": return "Spanish (Chile)";
-case "Globalization.ci_es-CO": return "Spanish (Colombia)";
-case "Globalization.ci_es-CR": return "Spanish (Costa Rica)";
-case "Globalization.ci_es-CU": return "Spanish (Cuba)";
-case "Globalization.ci_es-DO": return "Spanish (Dominican Republic)";
-case "Globalization.ci_es-EC": return "Spanish (Ecuador)";
-case "Globalization.ci_es-ES": return "Spanish (Spain)";
-case "Globalization.ci_es-ES_tradnl": return "Spanish (Spain)";
-case "Globalization.ci_es-GQ": return "Spanish (Equatorial Guinea)";
-case "Globalization.ci_es-GT": return "Spanish (Guatemala)";
-case "Globalization.ci_es-HN": return "Spanish (Honduras)";
-case "Globalization.ci_es-MX": return "Spanish (Mexico)";
-case "Globalization.ci_es-NI": return "Spanish (Nicaragua)";
-case "Globalization.ci_es-PA": return "Spanish (Panama)";
-case "Globalization.ci_es-PE": return "Spanish (Peru)";
-case "Globalization.ci_es-PH": return "Spanish (Philippines)";
-case "Globalization.ci_es-PR": return "Spanish (Puerto Rico)";
-case "Globalization.ci_es-PY": return "Spanish (Paraguay)";
-case "Globalization.ci_es-SV": return "Spanish (El Salvador)";
-case "Globalization.ci_es-US": return "Spanish (United States)";
-case "Globalization.ci_es-UY": return "Spanish (Uruguay)";
-case "Globalization.ci_es-VE": return "Spanish (Bolivarian Republic of Venezuela)";
-case "Globalization.ci_et": return "Estonian";
-case "Globalization.ci_et-EE": return "Estonian (Estonia)";
-case "Globalization.ci_eu": return "Basque";
-case "Globalization.ci_eu-ES": return "Basque (Basque)";
-case "Globalization.ci_ewo": return "Ewondo";
-case "Globalization.ci_ewo-CM": return "Ewondo (Cameroon)";
-case "Globalization.ci_fa": return "Persian";
-case "Globalization.ci_fa-AF": return "Persian (Afghanistan)";
-case "Globalization.ci_fa-IR": return "Persian";
-case "Globalization.ci_ff": return "Fulah";
-case "Globalization.ci_ff-CM": return "Fulah (Cameroon)";
-case "Globalization.ci_ff-GN": return "Fulah (Guinea)";
-case "Globalization.ci_ff-Latn": return "Fulah (Latin)";
-case "Globalization.ci_ff-Latn-SN": return "Fulah (Latin, Senegal)";
-case "Globalization.ci_ff-MR": return "Fulah (Mauritania)";
-case "Globalization.ci_fi": return "Finnish";
-case "Globalization.ci_fi-FI": return "Finnish (Finland)";
-case "Globalization.ci_fil": return "Filipino";
-case "Globalization.ci_fil-PH": return "Filipino (Philippines)";
-case "Globalization.ci_fo": return "Faroese";
-case "Globalization.ci_fo-FO": return "Faroese (Faroe Islands)";
-case "Globalization.ci_fr": return "French";
-case "Globalization.ci_fr-BE": return "French (Belgium)";
-case "Globalization.ci_fr-BF": return "French (Burkina Faso)";
-case "Globalization.ci_fr-BI": return "French (Burundi)";
-case "Globalization.ci_fr-BJ": return "French (Benin)";
-case "Globalization.ci_fr-BL": return "French (Saint Barth�lemy)";
-case "Globalization.ci_fr-CA": return "French (Canada)";
-case "Globalization.ci_fr-CD": return "French (Congo DRC)";
-case "Globalization.ci_fr-CF": return "French (Central African Republic)";
-case "Globalization.ci_fr-CG": return "French (Congo)";
-case "Globalization.ci_fr-CH": return "French (Switzerland)";
-case "Globalization.ci_fr-CI": return "French (C�te d�Ivoire)";
-case "Globalization.ci_fr-CM": return "French (Cameroon)";
-case "Globalization.ci_fr-DJ": return "French (Djibouti)";
-case "Globalization.ci_fr-DZ": return "French (Algeria)";
-case "Globalization.ci_fr-FR": return "French (France)";
-case "Globalization.ci_fr-GA": return "French (Gabon)";
-case "Globalization.ci_fr-GF": return "French (French Guiana)";
-case "Globalization.ci_fr-GN": return "French (Guinea)";
-case "Globalization.ci_fr-GP": return "French (Guadeloupe)";
-case "Globalization.ci_fr-GQ": return "French (Equatorial Guinea)";
-case "Globalization.ci_fr-HT": return "French (Haiti)";
-case "Globalization.ci_fr-KM": return "French (Comoros)";
-case "Globalization.ci_fr-LU": return "French (Luxembourg)";
-case "Globalization.ci_fr-MA": return "French (Morocco)";
-case "Globalization.ci_fr-MC": return "French (Monaco)";
-case "Globalization.ci_fr-MF": return "French (Saint Martin)";
-case "Globalization.ci_fr-MG": return "French (Madagascar)";
-case "Globalization.ci_fr-ML": return "French (Mali)";
-case "Globalization.ci_fr-MQ": return "French (Martinique)";
-case "Globalization.ci_fr-MR": return "French (Mauritania)";
-case "Globalization.ci_fr-MU": return "French (Mauritius)";
-case "Globalization.ci_fr-NC": return "French (New Caledonia)";
-case "Globalization.ci_fr-NE": return "French (Niger)";
-case "Globalization.ci_fr-PF": return "French (French Polynesia)";
-case "Globalization.ci_fr-PM": return "French (Saint Pierre and Miquelon)";
-case "Globalization.ci_fr-RE": return "French (Reunion)";
-case "Globalization.ci_fr-RW": return "French (Rwanda)";
-case "Globalization.ci_fr-SC": return "French (Seychelles)";
-case "Globalization.ci_fr-SN": return "French (Senegal)";
-case "Globalization.ci_fr-SY": return "French (Syria)";
-case "Globalization.ci_fr-TD": return "French (Chad)";
-case "Globalization.ci_fr-TG": return "French (Togo)";
-case "Globalization.ci_fr-TN": return "French (Tunisia)";
-case "Globalization.ci_fr-VU": return "French (Vanuatu)";
-case "Globalization.ci_fr-WF": return "French (Wallis and Futuna)";
-case "Globalization.ci_fr-YT": return "French (Mayotte)";
-case "Globalization.ci_fur": return "Friulian";
-case "Globalization.ci_fur-IT": return "Friulian (Italy)";
-case "Globalization.ci_fy": return "Frisian";
-case "Globalization.ci_fy-NL": return "Frisian (Netherlands)";
-case "Globalization.ci_ga": return "Irish";
-case "Globalization.ci_ga-IE": return "Irish (Ireland)";
-case "Globalization.ci_gd": return "Scottish Gaelic";
-case "Globalization.ci_gd-GB": return "Scottish Gaelic (United Kingdom)";
-case "Globalization.ci_gl": return "Galician";
-case "Globalization.ci_gl-ES": return "Galician (Galician)";
-case "Globalization.ci_gn": return "Guarani";
-case "Globalization.ci_gn-PY": return "Guarani (Paraguay)";
-case "Globalization.ci_gsw": return "Alsatian";
-case "Globalization.ci_gsw-CH": return "Alsatian (Switzerland)";
-case "Globalization.ci_gsw-FR": return "Alsatian (France)";
-case "Globalization.ci_gsw-LI": return "Alsatian (Liechtenstein)";
-case "Globalization.ci_gu": return "Gujarati";
-case "Globalization.ci_gu-IN": return "Gujarati (India)";
-case "Globalization.ci_guz": return "Gusii";
-case "Globalization.ci_guz-KE": return "Gusii (Kenya)";
-case "Globalization.ci_gv": return "Manx";
-case "Globalization.ci_gv-IM": return "Manx (Isle of Man)";
-case "Globalization.ci_ha": return "Hausa";
-case "Globalization.ci_ha-Latn": return "Hausa (Latin)";
-case "Globalization.ci_ha-Latn-GH": return "Hausa (Latin, Ghana)";
-case "Globalization.ci_ha-Latn-NE": return "Hausa (Latin, Niger)";
-case "Globalization.ci_ha-Latn-NG": return "Hausa (Latin, Nigeria)";
-case "Globalization.ci_haw": return "Hawaiian";
-case "Globalization.ci_haw-US": return "Hawaiian (United States)";
-case "Globalization.ci_he": return "Hebrew";
-case "Globalization.ci_he-IL": return "Hebrew (Israel)";
-case "Globalization.ci_hi": return "Hindi";
-case "Globalization.ci_hi-IN": return "Hindi (India)";
-case "Globalization.ci_hr": return "Croatian";
-case "Globalization.ci_hr-BA": return "Croatian (Latin, Bosnia and Herzegovina)";
-case "Globalization.ci_hr-HR": return "Croatian (Croatia)";
-case "Globalization.ci_hsb": return "Upper Sorbian";
-case "Globalization.ci_hsb-DE": return "Upper Sorbian (Germany)";
-case "Globalization.ci_hu": return "Hungarian";
-case "Globalization.ci_hu-HU": return "Hungarian (Hungary)";
-case "Globalization.ci_hu-HU_technl": return "Hungarian (Hungary)";
-case "Globalization.ci_hy": return "Armenian";
-case "Globalization.ci_hy-AM": return "Armenian (Armenia)";
-case "Globalization.ci_ia": return "Interlingua";
-case "Globalization.ci_ia-001": return "Interlingua (World)";
-case "Globalization.ci_ia-FR": return "Interlingua (France)";
-case "Globalization.ci_id": return "Indonesian";
-case "Globalization.ci_id-ID": return "Indonesian (Indonesia)";
-case "Globalization.ci_ig": return "Igbo";
-case "Globalization.ci_ig-NG": return "Igbo (Nigeria)";
-case "Globalization.ci_ii": return "Yi";
-case "Globalization.ci_ii-CN": return "Yi (PRC)";
-case "Globalization.ci_is": return "Icelandic";
-case "Globalization.ci_is-IS": return "Icelandic (Iceland)";
-case "Globalization.ci_it": return "Italian";
-case "Globalization.ci_it-CH": return "Italian (Switzerland)";
-case "Globalization.ci_it-IT": return "Italian (Italy)";
-case "Globalization.ci_it-SM": return "Italian (San Marino)";
-case "Globalization.ci_iu": return "Inuktitut";
-case "Globalization.ci_iu-Cans": return "Inuktitut (Syllabics)";
-case "Globalization.ci_iu-Cans-CA": return "Inuktitut (Syllabics, Canada)";
-case "Globalization.ci_iu-Latn": return "Inuktitut (Latin)";
-case "Globalization.ci_iu-Latn-CA": return "Inuktitut (Latin, Canada)";
-case "Globalization.ci_ja": return "Japanese";
-case "Globalization.ci_ja-JP": return "Japanese (Japan)";
-case "Globalization.ci_ja-JP_radstr": return "Japanese (Japan)";
-case "Globalization.ci_jgo": return "Ngomba";
-case "Globalization.ci_jgo-CM": return "Ngomba (Cameroon)";
-case "Globalization.ci_jmc": return "Machame";
-case "Globalization.ci_jmc-TZ": return "Machame (Tanzania)";
-case "Globalization.ci_jv": return "Javanese";
-case "Globalization.ci_jv-Latn": return "Javanese";
-case "Globalization.ci_jv-Latn-ID": return "Javanese (Indonesia)";
-case "Globalization.ci_ka": return "Georgian";
-case "Globalization.ci_ka-GE": return "Georgian (Georgia)";
-case "Globalization.ci_ka-GE_modern": return "Georgian (Georgia)";
-case "Globalization.ci_kab": return "Kabyle";
-case "Globalization.ci_kab-DZ": return "Kabyle (Algeria)";
-case "Globalization.ci_kam": return "Kamba";
-case "Globalization.ci_kam-KE": return "Kamba (Kenya)";
-case "Globalization.ci_kde": return "Makonde";
-case "Globalization.ci_kde-TZ": return "Makonde (Tanzania)";
-case "Globalization.ci_kea": return "Kabuverdianu";
-case "Globalization.ci_kea-CV": return "Kabuverdianu (Cabo Verde)";
-case "Globalization.ci_khq": return "Koyra Chiini";
-case "Globalization.ci_khq-ML": return "Koyra Chiini (Mali)";
-case "Globalization.ci_ki": return "Kikuyu";
-case "Globalization.ci_ki-KE": return "Kikuyu (Kenya)";
-case "Globalization.ci_kk": return "Kazakh";
-case "Globalization.ci_kk-KZ": return "Kazakh (Kazakhstan)";
-case "Globalization.ci_kkj": return "Kako";
-case "Globalization.ci_kkj-CM": return "Kako (Cameroon)";
-case "Globalization.ci_kl": return "Greenlandic";
-case "Globalization.ci_kl-GL": return "Greenlandic (Greenland)";
-case "Globalization.ci_kln": return "Kalenjin";
-case "Globalization.ci_kln-KE": return "Kalenjin (Kenya)";
-case "Globalization.ci_km": return "Khmer";
-case "Globalization.ci_km-KH": return "Khmer (Cambodia)";
-case "Globalization.ci_kn": return "Kannada";
-case "Globalization.ci_kn-IN": return "Kannada (India)";
-case "Globalization.ci_ko": return "Korean";
-case "Globalization.ci_ko-KR": return "Korean (Korea)";
-case "Globalization.ci_kok": return "Konkani";
-case "Globalization.ci_kok-IN": return "Konkani (India)";
-case "Globalization.ci_ks": return "Kashmiri";
-case "Globalization.ci_ks-Arab": return "Kashmiri (Perso-Arabic)";
-case "Globalization.ci_ks-Arab-IN": return "Kashmiri (Perso-Arabic)";
-case "Globalization.ci_ksb": return "Shambala";
-case "Globalization.ci_ksb-TZ": return "Shambala (Tanzania)";
-case "Globalization.ci_ksf": return "Bafia";
-case "Globalization.ci_ksf-CM": return "Bafia (Cameroon)";
-case "Globalization.ci_ksh": return "Colognian";
-case "Globalization.ci_ksh-DE": return "Ripuarian (Germany)";
-case "Globalization.ci_ku": return "Central Kurdish";
-case "Globalization.ci_ku-Arab": return "Central Kurdish (Arabic)";
-case "Globalization.ci_ku-Arab-IQ": return "Central Kurdish (Iraq)";
-case "Globalization.ci_kw": return "Cornish";
-case "Globalization.ci_kw-GB": return "Cornish (United Kingdom)";
-case "Globalization.ci_ky": return "Kyrgyz";
-case "Globalization.ci_ky-KG": return "Kyrgyz (Kyrgyzstan)";
-case "Globalization.ci_lag": return "Langi";
-case "Globalization.ci_lag-TZ": return "Langi (Tanzania)";
-case "Globalization.ci_lb": return "Luxembourgish";
-case "Globalization.ci_lb-LU": return "Luxembourgish (Luxembourg)";
-case "Globalization.ci_lg": return "Ganda";
-case "Globalization.ci_lg-UG": return "Ganda (Uganda)";
-case "Globalization.ci_lkt": return "Lakota";
-case "Globalization.ci_lkt-US": return "Lakota (United States)";
-case "Globalization.ci_ln": return "Lingala";
-case "Globalization.ci_ln-AO": return "Lingala (Angola)";
-case "Globalization.ci_ln-CD": return "Lingala (Congo DRC)";
-case "Globalization.ci_ln-CF": return "Lingala (Central African Republic)";
-case "Globalization.ci_ln-CG": return "Lingala (Congo)";
-case "Globalization.ci_lo": return "Lao";
-case "Globalization.ci_lo-LA": return "Lao (Lao P.D.R.)";
-case "Globalization.ci_lt": return "Lithuanian";
-case "Globalization.ci_lt-LT": return "Lithuanian (Lithuania)";
-case "Globalization.ci_lu": return "Luba-Katanga";
-case "Globalization.ci_lu-CD": return "Luba-Katanga (Congo DRC)";
-case "Globalization.ci_luo": return "Luo";
-case "Globalization.ci_luo-KE": return "Luo (Kenya)";
-case "Globalization.ci_luy": return "Luyia";
-case "Globalization.ci_luy-KE": return "Luyia (Kenya)";
-case "Globalization.ci_lv": return "Latvian";
-case "Globalization.ci_lv-LV": return "Latvian (Latvia)";
-case "Globalization.ci_mas": return "Masai";
-case "Globalization.ci_mas-KE": return "Masai (Kenya)";
-case "Globalization.ci_mas-TZ": return "Masai (Tanzania)";
-case "Globalization.ci_mer": return "Meru";
-case "Globalization.ci_mer-KE": return "Meru (Kenya)";
-case "Globalization.ci_mfe": return "Morisyen";
-case "Globalization.ci_mfe-MU": return "Morisyen (Mauritius)";
-case "Globalization.ci_mg": return "Malagasy";
-case "Globalization.ci_mg-MG": return "Malagasy (Madagascar)";
-case "Globalization.ci_mgh": return "Makhuwa-Meetto";
-case "Globalization.ci_mgh-MZ": return "Makhuwa-Meetto (Mozambique)";
-case "Globalization.ci_mgo": return "Meta'";
-case "Globalization.ci_mgo-CM": return "Meta' (Cameroon)";
-case "Globalization.ci_mi": return "Maori";
-case "Globalization.ci_mi-NZ": return "Maori (New Zealand)";
-case "Globalization.ci_mk": return "Macedonian (FYROM)";
-case "Globalization.ci_mk-MK": return "Macedonian (Former Yugoslav Republic of Macedonia)";
-case "Globalization.ci_ml": return "Malayalam";
-case "Globalization.ci_ml-IN": return "Malayalam (India)";
-case "Globalization.ci_mn": return "Mongolian";
-case "Globalization.ci_mn-Cyrl": return "Mongolian (Cyrillic)";
-case "Globalization.ci_mn-MN": return "Mongolian (Cyrillic, Mongolia)";
-case "Globalization.ci_mn-Mong": return "Mongolian (Traditional Mongolian)";
-case "Globalization.ci_mn-Mong-CN": return "Mongolian (Traditional Mongolian, PRC)";
-case "Globalization.ci_mn-Mong-MN": return "Mongolian (Traditional Mongolian, Mongolia)";
-case "Globalization.ci_moh": return "Mohawk";
-case "Globalization.ci_moh-CA": return "Mohawk (Mohawk)";
-case "Globalization.ci_mr": return "Marathi";
-case "Globalization.ci_mr-IN": return "Marathi (India)";
-case "Globalization.ci_ms": return "Malay";
-case "Globalization.ci_ms-BN": return "Malay (Brunei Darussalam)";
-case "Globalization.ci_ms-MY": return "Malay (Malaysia)";
-case "Globalization.ci_ms-SG": return "Malay (Latin, Singapore)";
-case "Globalization.ci_mt": return "Maltese";
-case "Globalization.ci_mt-MT": return "Maltese (Malta)";
-case "Globalization.ci_mua": return "Mundang";
-case "Globalization.ci_mua-CM": return "Mundang (Cameroon)";
-case "Globalization.ci_my": return "Burmese";
-case "Globalization.ci_my-MM": return "Burmese (Myanmar)";
-case "Globalization.ci_naq": return "Nama";
-case "Globalization.ci_naq-NA": return "Nama (Namibia)";
-case "Globalization.ci_nb": return "Norwegian (Bokm�l)";
-case "Globalization.ci_nb-NO": return "Norwegian, Bokm�l (Norway)";
-case "Globalization.ci_nb-SJ": return "Norwegian, Bokm�l (Svalbard and Jan Mayen)";
-case "Globalization.ci_nd": return "North Ndebele";
-case "Globalization.ci_nd-ZW": return "North Ndebele (Zimbabwe)";
-case "Globalization.ci_ne": return "Nepali";
-case "Globalization.ci_ne-IN": return "Nepali (India)";
-case "Globalization.ci_ne-NP": return "Nepali (Nepal)";
-case "Globalization.ci_nl": return "Dutch";
-case "Globalization.ci_nl-AW": return "Dutch (Aruba)";
-case "Globalization.ci_nl-BE": return "Dutch (Belgium)";
-case "Globalization.ci_nl-BQ": return "Dutch (Bonaire, Sint Eustatius and Saba)";
-case "Globalization.ci_nl-CW": return "Dutch (Cura�ao)";
-case "Globalization.ci_nl-NL": return "Dutch (Netherlands)";
-case "Globalization.ci_nl-SR": return "Dutch (Suriname)";
-case "Globalization.ci_nl-SX": return "Dutch (Sint Maarten)";
-case "Globalization.ci_nmg": return "Kwasio";
-case "Globalization.ci_nmg-CM": return "Kwasio (Cameroon)";
-case "Globalization.ci_nn": return "Norwegian (Nynorsk)";
-case "Globalization.ci_nn-NO": return "Norwegian, Nynorsk (Norway)";
-case "Globalization.ci_nnh": return "Ngiemboon";
-case "Globalization.ci_nnh-CM": return "Ngiemboon (Cameroon)";
-case "Globalization.ci_no": return "Norwegian";
-case "Globalization.ci_nqo": return "N'ko";
-case "Globalization.ci_nqo-GN": return "N'ko (Guinea)";
-case "Globalization.ci_nr": return "South Ndebele";
-case "Globalization.ci_nr-ZA": return "South Ndebele (South Africa)";
-case "Globalization.ci_nso": return "Sesotho sa Leboa";
-case "Globalization.ci_nso-ZA": return "Sesotho sa Leboa (South Africa)";
-case "Globalization.ci_nus": return "Nuer";
-case "Globalization.ci_nus-SD": return "Nuer (Sudan)";
-case "Globalization.ci_nyn": return "Nyankole";
-case "Globalization.ci_nyn-UG": return "Nyankole (Uganda)";
-case "Globalization.ci_oc": return "Occitan";
-case "Globalization.ci_oc-FR": return "Occitan (France)";
-case "Globalization.ci_om": return "Oromo";
-case "Globalization.ci_om-ET": return "Oromo (Ethiopia)";
-case "Globalization.ci_om-KE": return "Oromo (Kenya)";
-case "Globalization.ci_or": return "Odia";
-case "Globalization.ci_or-IN": return "Odia (India)";
-case "Globalization.ci_os": return "Ossetic";
-case "Globalization.ci_os-GE": return "Ossetian (Cyrillic, Georgia)";
-case "Globalization.ci_os-RU": return "Ossetian (Cyrillic, Russia)";
-case "Globalization.ci_pa": return "Punjabi";
-case "Globalization.ci_pa-Arab": return "Punjabi (Arabic)";
-case "Globalization.ci_pa-Arab-PK": return "Punjabi (Islamic Republic of Pakistan)";
-case "Globalization.ci_pa-IN": return "Punjabi (India)";
-case "Globalization.ci_pl": return "Polish";
-case "Globalization.ci_pl-PL": return "Polish (Poland)";
-case "Globalization.ci_prs": return "Dari";
-case "Globalization.ci_prs-AF": return "Dari (Afghanistan)";
-case "Globalization.ci_ps": return "Pashto";
-case "Globalization.ci_ps-AF": return "Pashto (Afghanistan)";
-case "Globalization.ci_pt": return "Portuguese";
-case "Globalization.ci_pt-AO": return "Portuguese (Angola)";
-case "Globalization.ci_pt-BR": return "Portuguese (Brazil)";
-case "Globalization.ci_pt-CV": return "Portuguese (Cabo Verde)";
-case "Globalization.ci_pt-GW": return "Portuguese (Guinea-Bissau)";
-case "Globalization.ci_pt-MO": return "Portuguese (Macao SAR)";
-case "Globalization.ci_pt-MZ": return "Portuguese (Mozambique)";
-case "Globalization.ci_pt-PT": return "Portuguese (Portugal)";
-case "Globalization.ci_pt-ST": return "Portuguese (S�o Tom� and Pr�ncipe)";
-case "Globalization.ci_pt-TL": return "Portuguese (Timor-Leste)";
-case "Globalization.ci_qps-ploc": return "Pseudo Language (Pseudo)";
-case "Globalization.ci_qps-ploca": return "Pseudo Language (Pseudo Asia)";
-case "Globalization.ci_qps-plocm": return "Pseudo Language (Pseudo Mirrored)";
-case "Globalization.ci_qu": return "Quechua";
-case "Globalization.ci_qu-BO": return "Quechua (Bolivia)";
-case "Globalization.ci_qu-EC": return "Quechua (Ecuador)";
-case "Globalization.ci_qu-PE": return "Quechua (Peru)";
-case "Globalization.ci_quc": return "K'iche'";
-case "Globalization.ci_quc-Latn": return "K'iche'";
-case "Globalization.ci_quc-Latn-GT": return "K'iche' (Guatemala)";
-case "Globalization.ci_qut": return "K'iche";
-case "Globalization.ci_qut-GT": return "K'iche (Guatemala)";
-case "Globalization.ci_quz": return "Quechua";
-case "Globalization.ci_quz-BO": return "Quechua (Bolivia)";
-case "Globalization.ci_quz-EC": return "Quechua (Ecuador)";
-case "Globalization.ci_quz-PE": return "Quechua (Peru)";
-case "Globalization.ci_rm": return "Romansh";
-case "Globalization.ci_rm-CH": return "Romansh (Switzerland)";
-case "Globalization.ci_rn": return "Rundi";
-case "Globalization.ci_rn-BI": return "Rundi (Burundi)";
-case "Globalization.ci_ro": return "Romanian";
-case "Globalization.ci_ro-MD": return "Romanian (Moldova)";
-case "Globalization.ci_ro-RO": return "Romanian (Romania)";
-case "Globalization.ci_rof": return "Rombo";
-case "Globalization.ci_rof-TZ": return "Rombo (Tanzania)";
-case "Globalization.ci_ru": return "Russian";
-case "Globalization.ci_ru-BY": return "Russian (Belarus)";
-case "Globalization.ci_ru-KG": return "Russian (Kyrgyzstan)";
-case "Globalization.ci_ru-KZ": return "Russian (Kazakhstan)";
-case "Globalization.ci_ru-MD": return "Russian (Moldova)";
-case "Globalization.ci_ru-RU": return "Russian (Russia)";
-case "Globalization.ci_ru-UA": return "Russian (Ukraine)";
-case "Globalization.ci_rw": return "Kinyarwanda";
-case "Globalization.ci_rw-RW": return "Kinyarwanda (Rwanda)";
-case "Globalization.ci_rwk": return "Rwa";
-case "Globalization.ci_rwk-TZ": return "Rwa (Tanzania)";
-case "Globalization.ci_sa": return "Sanskrit";
-case "Globalization.ci_sa-IN": return "Sanskrit (India)";
-case "Globalization.ci_sah": return "Sakha";
-case "Globalization.ci_sah-RU": return "Sakha (Russia)";
-case "Globalization.ci_saq": return "Samburu";
-case "Globalization.ci_saq-KE": return "Samburu (Kenya)";
-case "Globalization.ci_sbp": return "Sangu";
-case "Globalization.ci_sbp-TZ": return "Sangu (Tanzania)";
-case "Globalization.ci_sd": return "Sindhi";
-case "Globalization.ci_sd-Arab": return "Sindhi (Arabic)";
-case "Globalization.ci_sd-Arab-PK": return "Sindhi (Islamic Republic of Pakistan)";
-case "Globalization.ci_se": return "Sami (Northern)";
-case "Globalization.ci_se-FI": return "Sami, Northern (Finland)";
-case "Globalization.ci_se-NO": return "Sami, Northern (Norway)";
-case "Globalization.ci_se-SE": return "Sami, Northern (Sweden)";
-case "Globalization.ci_seh": return "Sena";
-case "Globalization.ci_seh-MZ": return "Sena (Mozambique)";
-case "Globalization.ci_ses": return "Koyraboro Senni";
-case "Globalization.ci_ses-ML": return "Koyraboro Senni (Mali)";
-case "Globalization.ci_sg": return "Sango";
-case "Globalization.ci_sg-CF": return "Sango (Central African Republic)";
-case "Globalization.ci_shi": return "Tachelhit";
-case "Globalization.ci_shi-Latn": return "Tachelhit (Latin)";
-case "Globalization.ci_shi-Latn-MA": return "Tachelhit (Latin, Morocco)";
-case "Globalization.ci_shi-Tfng": return "Tachelhit (Tifinagh)";
-case "Globalization.ci_shi-Tfng-MA": return "Tachelhit (Tifinagh, Morocco)";
-case "Globalization.ci_si": return "Sinhala";
-case "Globalization.ci_si-LK": return "Sinhala (Sri Lanka)";
-case "Globalization.ci_sk": return "Slovak";
-case "Globalization.ci_sk-SK": return "Slovak (Slovakia)";
-case "Globalization.ci_sl": return "Slovenian";
-case "Globalization.ci_sl-SI": return "Slovenian (Slovenia)";
-case "Globalization.ci_sma": return "Sami (Southern)";
-case "Globalization.ci_sma-NO": return "Sami, Southern (Norway)";
-case "Globalization.ci_sma-SE": return "Sami, Southern (Sweden)";
-case "Globalization.ci_smj": return "Sami (Lule)";
-case "Globalization.ci_smj-NO": return "Sami, Lule (Norway)";
-case "Globalization.ci_smj-SE": return "Sami, Lule (Sweden)";
-case "Globalization.ci_smn": return "Sami (Inari)";
-case "Globalization.ci_smn-FI": return "Sami, Inari (Finland)";
-case "Globalization.ci_sms": return "Sami (Skolt)";
-case "Globalization.ci_sms-FI": return "Sami, Skolt (Finland)";
-case "Globalization.ci_sn": return "Shona";
-case "Globalization.ci_sn-Latn": return "Shona (Latin)";
-case "Globalization.ci_sn-Latn-ZW": return "Shona (Latin, Zimbabwe)";
-case "Globalization.ci_so": return "Somali";
-case "Globalization.ci_so-DJ": return "Somali (Djibouti)";
-case "Globalization.ci_so-ET": return "Somali (Ethiopia)";
-case "Globalization.ci_so-KE": return "Somali (Kenya)";
-case "Globalization.ci_so-SO": return "Somali (Somalia)";
-case "Globalization.ci_sq": return "Albanian";
-case "Globalization.ci_sq-AL": return "Albanian (Albania)";
-case "Globalization.ci_sq-MK": return "Albanian (Macedonia, FYRO)";
-case "Globalization.ci_sr": return "Serbian";
-case "Globalization.ci_sr-Cyrl": return "Serbian (Cyrillic)";
-case "Globalization.ci_sr-Cyrl-BA": return "Serbian (Cyrillic, Bosnia and Herzegovina)";
-case "Globalization.ci_sr-Cyrl-CS": return "Serbian (Cyrillic, Serbia and Montenegro (Former))";
-case "Globalization.ci_sr-Cyrl-ME": return "Serbian (Cyrillic, Montenegro)";
-case "Globalization.ci_sr-Cyrl-RS": return "Serbian (Cyrillic, Serbia)";
-case "Globalization.ci_sr-Latn": return "Serbian (Latin)";
-case "Globalization.ci_sr-Latn-BA": return "Serbian (Latin, Bosnia and Herzegovina)";
-case "Globalization.ci_sr-Latn-CS": return "Serbian (Latin, Serbia and Montenegro (Former))";
-case "Globalization.ci_sr-Latn-ME": return "Serbian (Latin, Montenegro)";
-case "Globalization.ci_sr-Latn-RS": return "Serbian (Latin, Serbia)";
-case "Globalization.ci_ss": return "Swati";
-case "Globalization.ci_ss-SZ": return "Swati (Swaziland)";
-case "Globalization.ci_ss-ZA": return "Swati (South Africa)";
-case "Globalization.ci_ssy": return "Saho";
-case "Globalization.ci_ssy-ER": return "Saho (Eritrea)";
-case "Globalization.ci_st": return "Southern Sotho";
-case "Globalization.ci_st-LS": return "Sesotho (Lesotho)";
-case "Globalization.ci_st-ZA": return "Southern Sotho (South Africa)";
-case "Globalization.ci_sv": return "Swedish";
-case "Globalization.ci_sv-AX": return "Swedish (�land Islands)";
-case "Globalization.ci_sv-FI": return "Swedish (Finland)";
-case "Globalization.ci_sv-SE": return "Swedish (Sweden)";
-case "Globalization.ci_sw": return "Kiswahili";
-case "Globalization.ci_sw-KE": return "Kiswahili (Kenya)";
-case "Globalization.ci_sw-TZ": return "Kiswahili (Tanzania)";
-case "Globalization.ci_sw-UG": return "Kiswahili (Uganda)";
-case "Globalization.ci_swc": return "Congo Swahili";
-case "Globalization.ci_swc-CD": return "Congo Swahili (Congo DRC)";
-case "Globalization.ci_syr": return "Syriac";
-case "Globalization.ci_syr-SY": return "Syriac (Syria)";
-case "Globalization.ci_ta": return "Tamil";
-case "Globalization.ci_ta-IN": return "Tamil (India)";
-case "Globalization.ci_ta-LK": return "Tamil (Sri Lanka)";
-case "Globalization.ci_ta-MY": return "Tamil (Malaysia)";
-case "Globalization.ci_ta-SG": return "Tamil (Singapore)";
-case "Globalization.ci_te": return "Telugu";
-case "Globalization.ci_te-IN": return "Telugu (India)";
-case "Globalization.ci_teo": return "Teso";
-case "Globalization.ci_teo-KE": return "Teso (Kenya)";
-case "Globalization.ci_teo-UG": return "Teso (Uganda)";
-case "Globalization.ci_tg": return "Tajik";
-case "Globalization.ci_tg-Cyrl": return "Tajik (Cyrillic)";
-case "Globalization.ci_tg-Cyrl-TJ": return "Tajik (Cyrillic, Tajikistan)";
-case "Globalization.ci_th": return "Thai";
-case "Globalization.ci_th-TH": return "Thai (Thailand)";
-case "Globalization.ci_ti": return "Tigrinya";
-case "Globalization.ci_ti-ER": return "Tigrinya (Eritrea)";
-case "Globalization.ci_ti-ET": return "Tigrinya (Ethiopia)";
-case "Globalization.ci_tig": return "Tigre";
-case "Globalization.ci_tig-ER": return "Tigre (Eritrea)";
-case "Globalization.ci_tk": return "Turkmen";
-case "Globalization.ci_tk-TM": return "Turkmen (Turkmenistan)";
-case "Globalization.ci_tn": return "Setswana";
-case "Globalization.ci_tn-BW": return "Setswana (Botswana)";
-case "Globalization.ci_tn-ZA": return "Setswana (South Africa)";
-case "Globalization.ci_to": return "Tongan";
-case "Globalization.ci_to-TO": return "Tongan (Tonga)";
-case "Globalization.ci_tr": return "Turkish";
-case "Globalization.ci_tr-CY": return "Turkish (Cyprus)";
-case "Globalization.ci_tr-TR": return "Turkish (Turkey)";
-case "Globalization.ci_ts": return "Tsonga";
-case "Globalization.ci_ts-ZA": return "Tsonga (South Africa)";
-case "Globalization.ci_tt": return "Tatar";
-case "Globalization.ci_tt-RU": return "Tatar (Russia)";
-case "Globalization.ci_twq": return "Tasawaq";
-case "Globalization.ci_twq-NE": return "Tasawaq (Niger)";
-case "Globalization.ci_tzm": return "Tamazight";
-case "Globalization.ci_tzm-Latn": return "Tamazight (Latin)";
-case "Globalization.ci_tzm-Latn-DZ": return "Tamazight (Latin, Algeria)";
-case "Globalization.ci_tzm-Latn-MA": return "Central Atlas Tamazight (Latin, Morocco)";
-case "Globalization.ci_tzm-Tfng": return "Tamazight (Tifinagh)";
-case "Globalization.ci_tzm-Tfng-MA": return "Central Atlas Tamazight (Tifinagh, Morocco)";
-case "Globalization.ci_ug": return "Uyghur";
-case "Globalization.ci_ug-CN": return "Uyghur (PRC)";
-case "Globalization.ci_uk": return "Ukrainian";
-case "Globalization.ci_uk-UA": return "Ukrainian (Ukraine)";
-case "Globalization.ci_ur": return "Urdu";
-case "Globalization.ci_ur-IN": return "Urdu (India)";
-case "Globalization.ci_ur-PK": return "Urdu (Islamic Republic of Pakistan)";
-case "Globalization.ci_uz": return "Uzbek";
-case "Globalization.ci_uz-Arab": return "Uzbek (Perso-Arabic)";
-case "Globalization.ci_uz-Arab-AF": return "Uzbek (Perso-Arabic, Afghanistan)";
-case "Globalization.ci_uz-Cyrl": return "Uzbek (Cyrillic)";
-case "Globalization.ci_uz-Cyrl-UZ": return "Uzbek (Cyrillic, Uzbekistan)";
-case "Globalization.ci_uz-Latn": return "Uzbek (Latin)";
-case "Globalization.ci_uz-Latn-UZ": return "Uzbek (Latin, Uzbekistan)";
-case "Globalization.ci_vai": return "Vai";
-case "Globalization.ci_vai-Latn": return "Vai (Latin)";
-case "Globalization.ci_vai-Latn-LR": return "Vai (Latin, Liberia)";
-case "Globalization.ci_vai-Vaii": return "Vai (Vai)";
-case "Globalization.ci_vai-Vaii-LR": return "Vai (Vai, Liberia)";
-case "Globalization.ci_ve": return "Venda";
-case "Globalization.ci_ve-ZA": return "Venda (South Africa)";
-case "Globalization.ci_vi": return "Vietnamese";
-case "Globalization.ci_vi-VN": return "Vietnamese (Vietnam)";
-case "Globalization.ci_vo": return "Volap�k";
-case "Globalization.ci_vo-001": return "Volap�k (World)";
-case "Globalization.ci_vun": return "Vunjo";
-case "Globalization.ci_vun-TZ": return "Vunjo (Tanzania)";
-case "Globalization.ci_wae": return "Walser";
-case "Globalization.ci_wae-CH": return "Walser (Switzerland)";
-case "Globalization.ci_wal": return "Wolaytta";
-case "Globalization.ci_wal-ET": return "Wolaytta (Ethiopia)";
-case "Globalization.ci_wo": return "Wolof";
-case "Globalization.ci_wo-SN": return "Wolof (Senegal)";
-case "Globalization.ci_x-IV": return "Invariant Language (Invariant Country)";
-case "Globalization.ci_x-IV_mathan": return "Invariant Language (Invariant Country)";
-case "Globalization.ci_xh": return "isiXhosa";
-case "Globalization.ci_xh-ZA": return "isiXhosa (South Africa)";
-case "Globalization.ci_xog": return "Soga";
-case "Globalization.ci_xog-UG": return "Soga (Uganda)";
-case "Globalization.ci_yav": return "Yangben";
-case "Globalization.ci_yav-CM": return "Yangben (Cameroon)";
-case "Globalization.ci_yi": return "Yiddish";
-case "Globalization.ci_yi-001": return "Yiddish (World)";
-case "Globalization.ci_yo": return "Yoruba";
-case "Globalization.ci_yo-BJ": return "Yoruba (Benin)";
-case "Globalization.ci_yo-NG": return "Yoruba (Nigeria)";
-case "Globalization.ci_zgh": return "Standard Moroccan Tamazight";
-case "Globalization.ci_zgh-Tfng": return "Standard Moroccan Tamazight (Tifinagh)";
-case "Globalization.ci_zgh-Tfng-MA": return "Standard Moroccan Tamazight (Tifinagh, Morocco)";
-case "Globalization.ci_zh": return "Chinese";
-case "Globalization.ci_zh-CHS": return "Chinese (Simplified) Legacy";
-case "Globalization.ci_zh-CHT": return "Chinese (Traditional) Legacy";
-case "Globalization.ci_zh-CN": return "Chinese (Simplified, PRC)";
-case "Globalization.ci_zh-CN_stroke": return "Chinese (Simplified, PRC)";
-case "Globalization.ci_zh-Hans": return "Chinese (Simplified)";
-case "Globalization.ci_zh-Hant": return "Chinese (Traditional)";
-case "Globalization.ci_zh-HK": return "Chinese (Traditional, Hong Kong S.A.R.)";
-case "Globalization.ci_zh-HK_radstr": return "Chinese (Traditional, Hong Kong S.A.R.)";
-case "Globalization.ci_zh-MO": return "Chinese (Traditional, Macao S.A.R.)";
-case "Globalization.ci_zh-MO_radstr": return "Chinese (Traditional, Macao S.A.R.)";
-case "Globalization.ci_zh-MO_stroke": return "Chinese (Traditional, Macao S.A.R.)";
-case "Globalization.ci_zh-SG": return "Chinese (Simplified, Singapore)";
-case "Globalization.ci_zh-SG_stroke": return "Chinese (Simplified, Singapore)";
-case "Globalization.ci_zh-TW": return "Chinese (Traditional, Taiwan)";
-case "Globalization.ci_zh-TW_pronun": return "Chinese (Traditional, Taiwan)";
-case "Globalization.ci_zh-TW_radstr": return "Chinese (Traditional, Taiwan)";
-case "Globalization.ci_zu": return "isiZulu";
-case "Globalization.ci_zu-ZA": return "isiZulu (South Africa)";
-// ;------------------
-// ;
-// ;Total items: 129
-// ;
-case "Globalization.ri_029": return "Caribbean";
-case "Globalization.ri_AE": return "U.A.E.";
-case "Globalization.ri_AF": return "Afghanistan";
-case "Globalization.ri_AL": return "Albania";
-case "Globalization.ri_AM": return "Armenia";
-case "Globalization.ri_AR": return "Argentina";
-case "Globalization.ri_AT": return "Austria";
-case "Globalization.ri_AU": return "Australia";
-case "Globalization.ri_AZ": return "Azerbaijan";
-case "Globalization.ri_BA": return "Bosnia and Herzegovina";
-case "Globalization.ri_BD": return "Bangladesh";
-case "Globalization.ri_BE": return "Belgium";
-case "Globalization.ri_BG": return "Bulgaria";
-case "Globalization.ri_BH": return "Bahrain";
-case "Globalization.ri_BN": return "Brunei Darussalam";
-case "Globalization.ri_BO": return "Bolivia";
-case "Globalization.ri_BR": return "Brazil";
-case "Globalization.ri_BY": return "Belarus";
-case "Globalization.ri_BZ": return "Belize";
-case "Globalization.ri_CA": return "Canada";
-case "Globalization.ri_CH": return "Switzerland";
-case "Globalization.ri_CL": return "Chile";
-case "Globalization.ri_CN": return "People's Republic of China";
-case "Globalization.ri_CO": return "Colombia";
-case "Globalization.ri_CR": return "Costa Rica";
-case "Globalization.ri_CS": return "Serbia and Montenegro (Former)";
-case "Globalization.ri_CZ": return "Czech Republic";
-case "Globalization.ri_DE": return "Germany";
-case "Globalization.ri_DK": return "Denmark";
-case "Globalization.ri_DO": return "Dominican Republic";
-case "Globalization.ri_DZ": return "Algeria";
-case "Globalization.ri_EC": return "Ecuador";
-case "Globalization.ri_EE": return "Estonia";
-case "Globalization.ri_EG": return "Egypt";
-case "Globalization.ri_ER": return "Eritrea";
-case "Globalization.ri_ES": return "Spain";
-case "Globalization.ri_ET": return "Ethiopia";
-case "Globalization.ri_FI": return "Finland";
-case "Globalization.ri_FO": return "Faroe Islands";
-case "Globalization.ri_FR": return "France";
-case "Globalization.ri_GB": return "United Kingdom";
-case "Globalization.ri_GE": return "Georgia";
-case "Globalization.ri_GL": return "Greenland";
-case "Globalization.ri_GR": return "Greece";
-case "Globalization.ri_GT": return "Guatemala";
-case "Globalization.ri_HK": return "Hong Kong S.A.R.";
-case "Globalization.ri_HN": return "Honduras";
-case "Globalization.ri_HR": return "Croatia";
-case "Globalization.ri_HU": return "Hungary";
-case "Globalization.ri_ID": return "Indonesia";
-case "Globalization.ri_IE": return "Ireland";
-case "Globalization.ri_IL": return "Israel";
-case "Globalization.ri_IN": return "India";
-case "Globalization.ri_IQ": return "Iraq";
-case "Globalization.ri_IR": return "Iran";
-case "Globalization.ri_IS": return "Iceland";
-case "Globalization.ri_IT": return "Italy";
-case "Globalization.ri_IV": return "Invariant Country";
-case "Globalization.ri_JM": return "Jamaica";
-case "Globalization.ri_JO": return "Jordan";
-case "Globalization.ri_JP": return "Japan";
-case "Globalization.ri_KE": return "Kenya";
-case "Globalization.ri_KG": return "Kyrgyzstan";
-case "Globalization.ri_KH": return "Cambodia";
-case "Globalization.ri_KR": return "Korea";
-case "Globalization.ri_KW": return "Kuwait";
-case "Globalization.ri_KZ": return "Kazakhstan";
-case "Globalization.ri_LA": return "Lao P.D.R.";
-case "Globalization.ri_LB": return "Lebanon";
-case "Globalization.ri_LI": return "Liechtenstein";
-case "Globalization.ri_LK": return "Sri Lanka";
-case "Globalization.ri_LT": return "Lithuania";
-case "Globalization.ri_LU": return "Luxembourg";
-case "Globalization.ri_LV": return "Latvia";
-case "Globalization.ri_LY": return "Libya";
-case "Globalization.ri_MA": return "Morocco";
-case "Globalization.ri_MC": return "Principality of Monaco";
-case "Globalization.ri_ME": return "Montenegro";
-case "Globalization.ri_MK": return "Macedonia (FYROM)";
-case "Globalization.ri_MN": return "Mongolia";
-case "Globalization.ri_MO": return "Macao S.A.R.";
-case "Globalization.ri_MT": return "Malta";
-case "Globalization.ri_MV": return "Maldives";
-case "Globalization.ri_MX": return "Mexico";
-case "Globalization.ri_MY": return "Malaysia";
-case "Globalization.ri_NG": return "Nigeria";
-case "Globalization.ri_NI": return "Nicaragua";
-case "Globalization.ri_NL": return "Netherlands";
-case "Globalization.ri_NO": return "Norway";
-case "Globalization.ri_NP": return "Nepal";
-case "Globalization.ri_NZ": return "New Zealand";
-case "Globalization.ri_OM": return "Oman";
-case "Globalization.ri_PA": return "Panama";
-case "Globalization.ri_PE": return "Peru";
-case "Globalization.ri_PH": return "Philippines";
-case "Globalization.ri_PK": return "Islamic Republic of Pakistan";
-case "Globalization.ri_PL": return "Poland";
-case "Globalization.ri_PR": return "Puerto Rico";
-case "Globalization.ri_PT": return "Portugal";
-case "Globalization.ri_PY": return "Paraguay";
-case "Globalization.ri_QA": return "Qatar";
-case "Globalization.ri_RO": return "Romania";
-case "Globalization.ri_RS": return "Serbia";
-case "Globalization.ri_RU": return "Russia";
-case "Globalization.ri_RW": return "Rwanda";
-case "Globalization.ri_SA": return "Saudi Arabia";
-case "Globalization.ri_SE": return "Sweden";
-case "Globalization.ri_SG": return "Singapore";
-case "Globalization.ri_SI": return "Slovenia";
-case "Globalization.ri_SK": return "Slovakia";
-case "Globalization.ri_SN": return "Senegal";
-case "Globalization.ri_SV": return "El Salvador";
-case "Globalization.ri_SY": return "Syria";
-case "Globalization.ri_TH": return "Thailand";
-case "Globalization.ri_TJ": return "Tajikistan";
-case "Globalization.ri_TM": return "Turkmenistan";
-case "Globalization.ri_TN": return "Tunisia";
-case "Globalization.ri_TR": return "Turkey";
-case "Globalization.ri_TT": return "Trinidad and Tobago";
-case "Globalization.ri_TW": return "Taiwan";
-case "Globalization.ri_UA": return "Ukraine";
-case "Globalization.ri_US": return "United States";
-case "Globalization.ri_UY": return "Uruguay";
-case "Globalization.ri_UZ": return "Uzbekistan";
-case "Globalization.ri_VE": return "Bolivarian Republic of Venezuela";
-case "Globalization.ri_VN": return "Vietnam";
-case "Globalization.ri_YE": return "Yemen";
-case "Globalization.ri_ZA": return "South Africa";
-case "Globalization.ri_ZW": return "Zimbabwe";
-#endif //!FEATURE_CORECLR
-
-// ;------------------
-// ; Encoding names:
-// ;
-// ;Total items: 147
-// ;
-case "Globalization.cp_1200": return "Unicode";
-case "Globalization.cp_1201": return "Unicode (Big-Endian)";
-case "Globalization.cp_65001": return "Unicode (UTF-8)";
-case "Globalization.cp_65000": return "Unicode (UTF-7)";
-case "Globalization.cp_12000": return "Unicode (UTF-32)";
-case "Globalization.cp_12001": return "Unicode (UTF-32 Big-Endian)";
-case "Globalization.cp_20127": return "US-ASCII";
-case "Globalization.cp_28591": return "Western European (ISO)";
-
-#if FEATURE_NON_UNICODE_CODE_PAGES
-case "Globalization.cp_37": return "IBM EBCDIC (US-Canada)";
-case "Globalization.cp_437": return "OEM United States";
-case "Globalization.cp_500": return "IBM EBCDIC (International)";
-case "Globalization.cp_708": return "Arabic (ASMO 708)";
-case "Globalization.cp_720": return "Arabic (DOS)";
-case "Globalization.cp_737": return "Greek (DOS)";
-case "Globalization.cp_775": return "Baltic (DOS)";
-case "Globalization.cp_850": return "Western European (DOS)";
-case "Globalization.cp_852": return "Central European (DOS)";
-case "Globalization.cp_855": return "OEM Cyrillic";
-case "Globalization.cp_857": return "Turkish (DOS)";
-case "Globalization.cp_858": return "OEM Multilingual Latin I";
-case "Globalization.cp_860": return "Portuguese (DOS)";
-case "Globalization.cp_861": return "Icelandic (DOS)";
-case "Globalization.cp_862": return "Hebrew (DOS)";
-case "Globalization.cp_863": return "French Canadian (DOS)";
-case "Globalization.cp_864": return "Arabic (864)";
-case "Globalization.cp_865": return "Nordic (DOS)";
-case "Globalization.cp_866": return "Cyrillic (DOS)";
-case "Globalization.cp_869": return "Greek, Modern (DOS)";
-case "Globalization.cp_870": return "IBM EBCDIC (Multilingual Latin-2)";
-case "Globalization.cp_874": return "Thai (Windows)";
-case "Globalization.cp_875": return "IBM EBCDIC (Greek Modern)";
-case "Globalization.cp_932": return "Japanese (Shift-JIS)";
-case "Globalization.cp_936": return "Chinese Simplified (GB2312)";
-case "Globalization.cp_949": return "Korean";
-case "Globalization.cp_950": return "Chinese Traditional (Big5)";
-case "Globalization.cp_1026": return "IBM EBCDIC (Turkish Latin-5)";
-case "Globalization.cp_1047": return "IBM Latin-1";
-case "Globalization.cp_1140": return "IBM EBCDIC (US-Canada-Euro)";
-case "Globalization.cp_1141": return "IBM EBCDIC (Germany-Euro)";
-case "Globalization.cp_1142": return "IBM EBCDIC (Denmark-Norway-Euro)";
-case "Globalization.cp_1143": return "IBM EBCDIC (Finland-Sweden-Euro)";
-case "Globalization.cp_1144": return "IBM EBCDIC (Italy-Euro)";
-case "Globalization.cp_1145": return "IBM EBCDIC (Spain-Euro)";
-case "Globalization.cp_1146": return "IBM EBCDIC (UK-Euro)";
-case "Globalization.cp_1147": return "IBM EBCDIC (France-Euro)";
-case "Globalization.cp_1148": return "IBM EBCDIC (International-Euro)";
-case "Globalization.cp_1149": return "IBM EBCDIC (Icelandic-Euro)";
-case "Globalization.cp_1250": return "Central European (Windows)";
-case "Globalization.cp_1251": return "Cyrillic (Windows)";
-case "Globalization.cp_1252": return "Western European (Windows)";
-case "Globalization.cp_1253": return "Greek (Windows)";
-case "Globalization.cp_1254": return "Turkish (Windows)";
-case "Globalization.cp_1255": return "Hebrew (Windows)";
-case "Globalization.cp_1256": return "Arabic (Windows)";
-case "Globalization.cp_1257": return "Baltic (Windows)";
-case "Globalization.cp_1258": return "Vietnamese (Windows)";
-case "Globalization.cp_1361": return "Korean (Johab)";
-case "Globalization.cp_10000": return "Western European (Mac)";
-case "Globalization.cp_10001": return "Japanese (Mac)";
-case "Globalization.cp_10002": return "Chinese Traditional (Mac)";
-case "Globalization.cp_10003": return "Korean (Mac)";
-case "Globalization.cp_10004": return "Arabic (Mac)";
-case "Globalization.cp_10005": return "Hebrew (Mac)";
-case "Globalization.cp_10006": return "Greek (Mac)";
-case "Globalization.cp_10007": return "Cyrillic (Mac)";
-case "Globalization.cp_10008": return "Chinese Simplified (Mac)";
-case "Globalization.cp_10010": return "Romanian (Mac)";
-case "Globalization.cp_10017": return "Ukrainian (Mac)";
-case "Globalization.cp_10021": return "Thai (Mac)";
-case "Globalization.cp_10029": return "Central European (Mac)";
-case "Globalization.cp_10079": return "Icelandic (Mac)";
-case "Globalization.cp_10081": return "Turkish (Mac)";
-case "Globalization.cp_10082": return "Croatian (Mac)";
-case "Globalization.cp_20000": return "Chinese Traditional (CNS)";
-case "Globalization.cp_20001": return "TCA Taiwan";
-case "Globalization.cp_20002": return "Chinese Traditional (Eten)";
-case "Globalization.cp_20003": return "IBM5550 Taiwan";
-case "Globalization.cp_20004": return "TeleText Taiwan";
-case "Globalization.cp_20005": return "Wang Taiwan";
-case "Globalization.cp_20105": return "Western European (IA5)";
-case "Globalization.cp_20106": return "German (IA5)";
-case "Globalization.cp_20107": return "Swedish (IA5)";
-case "Globalization.cp_20108": return "Norwegian (IA5)";
-case "Globalization.cp_20261": return "T.61";
-case "Globalization.cp_20269": return "ISO-6937";
-case "Globalization.cp_20273": return "IBM EBCDIC (Germany)";
-case "Globalization.cp_20277": return "IBM EBCDIC (Denmark-Norway)";
-case "Globalization.cp_20278": return "IBM EBCDIC (Finland-Sweden)";
-case "Globalization.cp_20280": return "IBM EBCDIC (Italy)";
-case "Globalization.cp_20284": return "IBM EBCDIC (Spain)";
-case "Globalization.cp_20285": return "IBM EBCDIC (UK)";
-case "Globalization.cp_20290": return "IBM EBCDIC (Japanese katakana)";
-case "Globalization.cp_20297": return "IBM EBCDIC (France)";
-case "Globalization.cp_20420": return "IBM EBCDIC (Arabic)";
-case "Globalization.cp_20423": return "IBM EBCDIC (Greek)";
-case "Globalization.cp_20424": return "IBM EBCDIC (Hebrew)";
-case "Globalization.cp_20833": return "IBM EBCDIC (Korean Extended)";
-case "Globalization.cp_20838": return "IBM EBCDIC (Thai)";
-case "Globalization.cp_20866": return "Cyrillic (KOI8-R)";
-case "Globalization.cp_20871": return "IBM EBCDIC (Icelandic)";
-case "Globalization.cp_20880": return "IBM EBCDIC (Cyrillic Russian)";
-case "Globalization.cp_20905": return "IBM EBCDIC (Turkish)";
-case "Globalization.cp_20924": return "IBM Latin-1";
-case "Globalization.cp_20932": return "Japanese (JIS 0208-1990 and 0212-1990)";
-case "Globalization.cp_20936": return "Chinese Simplified (GB2312-80)";
-case "Globalization.cp_20949": return "Korean Wansung";
-case "Globalization.cp_21025": return "IBM EBCDIC (Cyrillic Serbian-Bulgarian)";
-case "Globalization.cp_21027": return "Ext Alpha Lowercase";
-case "Globalization.cp_21866": return "Cyrillic (KOI8-U)";
-case "Globalization.cp_28592": return "Central European (ISO)";
-case "Globalization.cp_28593": return "Latin 3 (ISO)";
-case "Globalization.cp_28594": return "Baltic (ISO)";
-case "Globalization.cp_28595": return "Cyrillic (ISO)";
-case "Globalization.cp_28596": return "Arabic (ISO)";
-case "Globalization.cp_28597": return "Greek (ISO)";
-case "Globalization.cp_28598": return "Hebrew (ISO-Visual)";
-case "Globalization.cp_28599": return "Turkish (ISO)";
-case "Globalization.cp_28603": return "Estonian (ISO)";
-case "Globalization.cp_28605": return "Latin 9 (ISO)";
-case "Globalization.cp_29001": return "Europa";
-case "Globalization.cp_38598": return "Hebrew (ISO-Logical)";
-case "Globalization.cp_50000": return "User Defined";
-case "Globalization.cp_50220": return "Japanese (JIS)";
-case "Globalization.cp_50221": return "Japanese (JIS-Allow 1 byte Kana)";
-case "Globalization.cp_50222": return "Japanese (JIS-Allow 1 byte Kana - SO/SI)";
-case "Globalization.cp_50225": return "Korean (ISO)";
-case "Globalization.cp_50227": return "Chinese Simplified (ISO-2022)";
-case "Globalization.cp_50229": return "Chinese Traditional (ISO-2022)";
-case "Globalization.cp_50930": return "IBM EBCDIC (Japanese and Japanese Katakana)";
-case "Globalization.cp_50931": return "IBM EBCDIC (Japanese and US-Canada)";
-case "Globalization.cp_50933": return "IBM EBCDIC (Korean and Korean Extended)";
-case "Globalization.cp_50935": return "IBM EBCDIC (Simplified Chinese)";
-case "Globalization.cp_50937": return "IBM EBCDIC (Traditional Chinese)";
-case "Globalization.cp_50939": return "IBM EBCDIC (Japanese and Japanese-Latin)";
-case "Globalization.cp_51932": return "Japanese (EUC)";
-case "Globalization.cp_51936": return "Chinese Simplified (EUC)";
-case "Globalization.cp_51949": return "Korean (EUC)";
-case "Globalization.cp_52936": return "Chinese Simplified (HZ)";
-case "Globalization.cp_54936": return "Chinese Simplified (GB18030)";
-case "Globalization.cp_57002": return "ISCII Devanagari";
-case "Globalization.cp_57003": return "ISCII Bengali";
-case "Globalization.cp_57004": return "ISCII Tamil";
-case "Globalization.cp_57005": return "ISCII Telugu";
-case "Globalization.cp_57006": return "ISCII Assamese";
-case "Globalization.cp_57007": return "ISCII Oriya";
-case "Globalization.cp_57008": return "ISCII Kannada";
-case "Globalization.cp_57009": return "ISCII Malayalam";
-case "Globalization.cp_57010": return "ISCII Gujarati";
-case "Globalization.cp_57011": return "ISCII Punjabi";
-#endif // FEATURE_NON_UNICODE_CODE_PAGES
-#endif // INCLUDE_DEBUG
-
-// ;------------------
-
-}
-
-return id;
-
-} }
index 0ee3a5c94c4621dacb0bc354d9c04c66ed96a0fc..73235c9c23d14f10337b09296ca8ca8d80a01623 100644 (file)
@@ -58,7 +58,7 @@ namespace System.IO {
                private bool m_disposed;
                
                public BinaryReader(Stream input) 
-                       : this(input, Encoding.UTF8UnmarkedUnsafe)
+                       : this(input, EncodingHelper.UTF8UnmarkedUnsafe)
                {
                }
                
index 292573c45ac7429bdc673b0779d8971d6408332e..e433115ea629b4fed017caed31c896cc5bc25184 100644 (file)
@@ -51,11 +51,11 @@ namespace System.IO {
                int maxCharsPerRound;
                bool disposed;
 
-               protected BinaryWriter() : this (Stream.Null, Encoding.UTF8UnmarkedUnsafe)
+               protected BinaryWriter() : this (Stream.Null, EncodingHelper.UTF8UnmarkedUnsafe)
                {
                }
 
-               public BinaryWriter(Stream output) : this(output, Encoding.UTF8UnmarkedUnsafe)
+               public BinaryWriter(Stream output) : this(output, EncodingHelper.UTF8UnmarkedUnsafe)
                {
                }
                
diff --git a/mcs/class/corlib/System.IO/BufferedStream.cs b/mcs/class/corlib/System.IO/BufferedStream.cs
deleted file mode 100644 (file)
index e5b68c4..0000000
+++ /dev/null
@@ -1,323 +0,0 @@
-//
-// System.IO.BufferedStream
-//
-// Author:
-//   Matt Kimball (matt@kimball.net)
-//   Ville Palo <vi64pa@kolumbus.fi>
-//
-// Copyright (C) 2004 Novell (http://www.novell.com)
-//
-
-//
-// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-// 
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-// 
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using System.Globalization;
-using System.Runtime.InteropServices;
-
-namespace System.IO {
-       [ComVisible (true)]
-       public sealed class BufferedStream : Stream {
-               Stream m_stream;
-               byte[] m_buffer;
-               int m_buffer_pos;
-               int m_buffer_read_ahead;
-               bool m_buffer_reading;
-               private bool disposed = false;
-
-               public BufferedStream (Stream stream) : this (stream, 4096) 
-               {
-               }
-
-               public BufferedStream (Stream stream, int bufferSize) 
-               {
-                       if (stream == null)
-                               throw new ArgumentNullException ("stream");
-                       // LAMESPEC: documented as < 0
-                       if (bufferSize <= 0)
-                               throw new ArgumentOutOfRangeException ("bufferSize", "<= 0");
-                       if (!stream.CanRead && !stream.CanWrite) {
-                               throw new ObjectDisposedException (
-                                       Locale.GetText ("Cannot access a closed Stream."));
-                       }
-
-                       m_stream = stream;
-                       m_buffer = new byte [bufferSize];
-               }
-
-               public override bool CanRead {
-                       get {
-                               return m_stream.CanRead;
-                       }
-               }
-
-               public override bool CanWrite {
-                       get {
-                               return m_stream.CanWrite;
-                       }
-               }
-
-               public override bool CanSeek {
-                       get {
-                               return m_stream.CanSeek;
-                       }
-               }
-
-               public override long Length {
-                       get {                           
-                               Flush ();
-                               return m_stream.Length;
-                       }
-               }
-               
-               public override long Position {
-                       get {
-                               CheckObjectDisposedException ();
-                               return m_stream.Position - m_buffer_read_ahead + m_buffer_pos;
-                       }
-
-                       set {
-                               if (value < Position && (Position - value <= m_buffer_pos) && m_buffer_reading) {
-                                       m_buffer_pos -= (int) (Position - value);
-                               }
-                               else if (value > Position && (value - Position < m_buffer_read_ahead - m_buffer_pos) && m_buffer_reading) {
-                                       m_buffer_pos += (int) (value - Position);
-                               }
-                               else {
-                                       Flush();
-                                       m_stream.Position = value;
-                               }
-                       }
-               }
-
-               protected override void Dispose (bool disposing)
-               {
-                       if (disposed)
-                               return;
-                       if (m_buffer != null)
-                               Flush();
-
-                       m_stream.Close();
-                       m_buffer = null;
-                       disposed = true;
-               }
-
-               public override void Flush ()
-               {
-                       CheckObjectDisposedException ();
-
-                       if (m_buffer_reading) {
-                               if (CanSeek)
-                                       m_stream.Position = Position;
-                       } else if (m_buffer_pos > 0) {
-                               m_stream.Write(m_buffer, 0, m_buffer_pos);
-                       }
-
-                       m_buffer_read_ahead = 0;
-                       m_buffer_pos = 0;
-               }
-
-               public override long Seek (long offset, SeekOrigin origin)
-               {
-                       CheckObjectDisposedException ();
-                       if (!CanSeek) {
-                               throw new NotSupportedException (
-                                       Locale.GetText ("Non seekable stream."));
-                       }
-                       Flush ();
-                       return m_stream.Seek (offset, origin);
-               }
-
-               public override void SetLength (long value)
-               {
-                       CheckObjectDisposedException ();
-
-                       if (value < 0)
-                               throw new ArgumentOutOfRangeException ("value must be positive");
-
-                       if (!m_stream.CanWrite && !m_stream.CanSeek)
-                               throw new NotSupportedException ("the stream cannot seek nor write.");
-
-                       if ((m_stream == null) || (!m_stream.CanRead && !m_stream.CanWrite))
-                               throw new IOException ("the stream is not open");
-                       
-                       m_stream.SetLength(value);
-                       if (Position > value)
-                               Position = value;
-               }
-
-               public override int ReadByte ()
-               {
-                       CheckObjectDisposedException ();
-                       
-                       if (!m_stream.CanRead) {
-                               throw new NotSupportedException (
-                                       Locale.GetText ("Cannot read from stream"));
-                       }
-
-                       if (!m_buffer_reading) {
-                               Flush ();
-                               m_buffer_reading = true;
-                       }
-
-                       if (1 <= m_buffer_read_ahead - m_buffer_pos) {
-                               return m_buffer [m_buffer_pos++];
-                       }
-                       else
-                       {
-                               if (m_buffer_pos >= m_buffer_read_ahead) {
-                                       m_buffer_pos = 0;
-                                       m_buffer_read_ahead = 0;
-                               }
-
-                               m_buffer_read_ahead = m_stream.Read (m_buffer, 0, m_buffer.Length);
-                               if (1 <= m_buffer_read_ahead) {
-                                       return m_buffer [m_buffer_pos++];
-                               } else {
-                                       return -1;
-                               }
-                       }
-               }
-
-               public override void WriteByte (byte value) 
-               {
-                       CheckObjectDisposedException ();
-                       if (!m_stream.CanWrite) {
-                               throw new NotSupportedException (
-                                       Locale.GetText ("Cannot write to stream"));
-                       }
-
-                       if (m_buffer_reading) {
-                               Flush ();
-                               m_buffer_reading = false;
-                       } 
-                       else
-                       // reordered to avoid possible integer overflow
-                       if (m_buffer_pos >= m_buffer.Length - 1) {
-                               Flush ();
-                       } 
-
-                       m_buffer [m_buffer_pos++] = value;
-               }
-
-               public override int Read ([In,Out] byte[] array, int offset, int count) 
-               {
-                       if (array == null)
-                               throw new ArgumentNullException ("array");
-                       CheckObjectDisposedException ();
-                       if (!m_stream.CanRead) {
-                               throw new NotSupportedException (
-                                       Locale.GetText ("Cannot read from stream"));
-                       }
-                       if (offset < 0)
-                               throw new ArgumentOutOfRangeException ("offset", "< 0");
-                       if (count < 0)
-                               throw new ArgumentOutOfRangeException ("count", "< 0");
-                       // re-ordered to avoid possible integer overflow
-                       if (array.Length - offset < count)
-                               throw new ArgumentException ("array.Length - offset < count");
-
-                       if (!m_buffer_reading) {
-                               Flush();
-                               m_buffer_reading = true;
-                       }
-
-                       if (count <= m_buffer_read_ahead - m_buffer_pos) {
-                               Buffer.BlockCopyInternal (m_buffer, m_buffer_pos, array, offset, count);
-
-                               m_buffer_pos += count;
-                               if (m_buffer_pos == m_buffer_read_ahead) {
-                                       m_buffer_pos = 0;
-                                       m_buffer_read_ahead = 0;
-                               }
-
-                               return count;
-                       }
-
-                       int ret = m_buffer_read_ahead - m_buffer_pos;
-                       Buffer.BlockCopyInternal (m_buffer, m_buffer_pos, array, offset, ret);
-                       m_buffer_pos = 0;
-                       m_buffer_read_ahead = 0;
-                       offset += ret;
-                       count -= ret;
-
-                       if (count >= m_buffer.Length) {
-                               ret += m_stream.Read (array, offset, count);
-                       } else {
-                               m_buffer_read_ahead = m_stream.Read (m_buffer, 0, m_buffer.Length);
-                               
-                               if (count < m_buffer_read_ahead) {
-                                       Buffer.BlockCopyInternal (m_buffer, 0, array, offset, count);
-                                       m_buffer_pos = count;
-                                       ret += count;
-                               } else {
-                                       Buffer.BlockCopyInternal (m_buffer, 0, array, offset, m_buffer_read_ahead);
-                                       ret += m_buffer_read_ahead;
-                                       m_buffer_read_ahead = 0;
-                               }
-                       }
-
-                       return ret;
-               }
-
-               public override void Write (byte[] array, int offset, int count)
-               {
-                       if (array == null)
-                               throw new ArgumentNullException ("array");
-                       CheckObjectDisposedException ();
-                       if (!m_stream.CanWrite) {
-                               throw new NotSupportedException (
-                                       Locale.GetText ("Cannot write to stream"));
-                       }
-                       if (offset < 0)
-                               throw new ArgumentOutOfRangeException ("offset", "< 0");
-                       if (count < 0)
-                               throw new ArgumentOutOfRangeException ("count", "< 0");
-                       // avoid possible integer overflow
-                       if (array.Length - offset < count)
-                               throw new ArgumentException ("array.Length - offset < count");
-
-                       if (m_buffer_reading) {
-                               Flush();
-                               m_buffer_reading = false;
-                       }
-
-                       // reordered to avoid possible integer overflow
-                       if (m_buffer_pos >= m_buffer.Length - count) {
-                               Flush ();
-                               m_stream.Write (array, offset, count);
-                       } 
-                       else {
-                               Buffer.BlockCopyInternal  (array, offset, m_buffer, m_buffer_pos, count);
-                               m_buffer_pos += count;
-                       }
-               }
-
-               private void CheckObjectDisposedException () 
-               {
-                       if (disposed) {
-                               throw new ObjectDisposedException ("BufferedStream", 
-                                       Locale.GetText ("Stream is closed"));
-                       }
-               }
-       }
-}
index de1758611c936cd78e37e8310a5ae226f906e8c9..8f4b57290c822e271064aadd68ae09223bed966d 100644 (file)
@@ -575,7 +575,7 @@ namespace System.IO
 
                public static void WriteAllText (string path, string contents)
                {
-                       WriteAllText (path, contents, Encoding.UTF8Unmarked);
+                       WriteAllText (path, contents, EncodingHelper.UTF8Unmarked);
                }
 
                public static void WriteAllText (string path, string contents, Encoding encoding)
index 1ca519f5d64b3948945b1522afba491c174f4029..dbc3cca0a86957e55695a783179427968fb4bc40 100644 (file)
@@ -148,6 +148,11 @@ namespace System.IO
                }
 #endif
 
+               internal FileStream (string path, FileMode mode, FileAccess access, FileShare share, int bufferSize, FileOptions options, string msgPath, bool bFromProxy, bool useLongPath, bool checkHost)
+                       : this (path, mode, access, share, bufferSize, false, options)
+               {
+               }
+
                internal FileStream (string path, FileMode mode, FileAccess access, FileShare share, int bufferSize, bool isAsync, bool anonymous)
                        : this (path, mode, access, share, bufferSize, anonymous, isAsync ? FileOptions.Asynchronous : FileOptions.None)
                {
@@ -692,7 +697,7 @@ namespace System.IO
                        result.BytesRead = -1;
                        result.Count = numBytes;
                        result.OriginalCount = numBytes;
-
+/*
                        if (buf_dirty) {
                                MemoryStream ms = new MemoryStream ();
                                FlushBuffer (ms);
@@ -703,7 +708,7 @@ namespace System.IO
                                array = ms.ToArray ();
                                numBytes = array.Length;
                        }
-
+*/
                        WriteDelegate w = WriteInternal;
                        return w.BeginInvoke (array, offset, numBytes, userCallback, stateObject);      
                }
@@ -1012,20 +1017,21 @@ namespace System.IO
                        return(count);
                }
 
-               void FlushBuffer (Stream st)
+               void FlushBuffer ()
                {
                        if (buf_dirty) {
-                               MonoIOError error;
+//                             if (st == null) {
+                                       MonoIOError error;
 
-                               if (CanSeek == true && !isExposed) {
-                                       MonoIO.Seek (safeHandle, buf_start, SeekOrigin.Begin, out error);
+                                       if (CanSeek == true && !isExposed) {
+                                               MonoIO.Seek (safeHandle, buf_start, SeekOrigin.Begin, out error);
 
-                                       if (error != MonoIOError.ERROR_SUCCESS) {
-                                               // don't leak the path information for isolated storage
-                                               throw MonoIO.GetException (GetSecureFileName (name), error);
+                                               if (error != MonoIOError.ERROR_SUCCESS) {
+                                                       // don't leak the path information for isolated storage
+                                                       throw MonoIO.GetException (GetSecureFileName (name), error);
+                                               }
                                        }
-                               }
-                               if (st == null) {
+
                                        int wcount = buf_length;
                                        int offset = 0;
                                        while (wcount > 0){
@@ -1037,9 +1043,9 @@ namespace System.IO
                                                wcount -= n;
                                                offset += n;
                                        }
-                               } else {
-                                       st.Write (buf, 0, buf_length);
-                               }
+//                             } else {
+//                                     st.Write (buf, 0, buf_length);
+//                             }
                        }
 
                        buf_start += buf_offset;
@@ -1047,15 +1053,10 @@ namespace System.IO
                        buf_dirty = false;
                }
 
-               private void FlushBuffer ()
-               {
-                       FlushBuffer (null);
-               }
-
                private void FlushBufferIfDirty ()
                {
                        if (buf_dirty)
-                               FlushBuffer (null);
+                               FlushBuffer ();
                }
 
                private void RefillBuffer ()
diff --git a/mcs/class/corlib/System.IO/MemoryStream.cs b/mcs/class/corlib/System.IO/MemoryStream.cs
deleted file mode 100644 (file)
index 77dd6d6..0000000
+++ /dev/null
@@ -1,494 +0,0 @@
-//
-// System.IO.MemoryStream.cs
-//
-// Authors:    Marcin Szczepanski (marcins@zipworld.com.au)
-//             Patrik Torstensson
-//             Gonzalo Paniagua Javier (gonzalo@ximian.com)
-//             Marek Safar (marek.safar@gmail.com)
-//
-// (c) 2001,2002 Marcin Szczepanski, Patrik Torstensson
-// (c) 2003 Ximian, Inc. (http://www.ximian.com)
-// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
-// Copyright 2011 Xamarin, Inc (http://www.xamarin.com)
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-// 
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-// 
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using System.Globalization;
-using System.Runtime.InteropServices;
-using System.Threading;
-using System.Threading.Tasks;
-
-namespace System.IO
-{
-       [Serializable]
-       [ComVisible (true)]
-       [MonoLimitation ("Serialization format not compatible with .NET")]
-       public class MemoryStream : Stream
-       {
-               bool canWrite;
-               bool allowGetBuffer;
-               int capacity;
-               int length;
-               byte [] internalBuffer;
-               int initialIndex;
-               bool expandable;
-               bool streamClosed;
-               int position;
-               int dirty_bytes;
-               [NonSerialized]
-               Task<int> read_task;
-
-               public MemoryStream () : this (0)
-               {
-               }
-
-               public MemoryStream (int capacity)
-               {
-                       if (capacity < 0)
-                               throw new ArgumentOutOfRangeException ("capacity");
-
-                       canWrite = true;
-
-                       this.capacity = capacity;
-                       internalBuffer = new byte [capacity];
-
-                       expandable = true;
-                       allowGetBuffer = true;
-               }
-
-               public MemoryStream (byte [] buffer)
-               {
-                       if (buffer == null)
-                               throw new ArgumentNullException ("buffer");
-                       
-                       InternalConstructor (buffer, 0, buffer.Length, true, false);                        
-               }
-
-               public MemoryStream (byte [] buffer, bool writable)
-               {
-                       if (buffer == null)
-                               throw new ArgumentNullException ("buffer");
-                       
-                       InternalConstructor (buffer, 0, buffer.Length, writable, false);
-               }
-
-               public MemoryStream (byte [] buffer, int index, int count)
-               {
-                       InternalConstructor (buffer, index, count, true, false);
-               }
-
-               public MemoryStream (byte [] buffer, int index, int count, bool writable)
-               {
-                       InternalConstructor (buffer, index, count, writable, false);
-               }
-
-               public MemoryStream (byte [] buffer, int index, int count, bool writable, bool publiclyVisible)
-               {
-                       InternalConstructor (buffer, index, count, writable, publiclyVisible);
-               }
-
-               void InternalConstructor (byte [] buffer, int index, int count, bool writable, bool publicallyVisible)
-               {
-                       if (buffer == null)
-                               throw new ArgumentNullException ("buffer");
-
-                       if (index < 0 || count < 0)
-                               throw new ArgumentOutOfRangeException ("index or count is less than 0.");
-
-                       if (buffer.Length - index < count)
-                               throw new ArgumentException ("index+count", 
-                                                            "The size of the buffer is less than index + count.");
-
-                       canWrite = writable;
-
-                       internalBuffer = buffer;
-                       capacity = count + index;
-                       length = capacity;
-                       position = index;
-                       initialIndex = index;
-
-                       allowGetBuffer = publicallyVisible;
-                       expandable = false;                
-               }
-
-               void CheckIfClosedThrowDisposed ()
-               {
-                       if (streamClosed)
-                               throw new ObjectDisposedException ("MemoryStream");
-               }
-               
-               public override bool CanRead {
-                       get { return !streamClosed; }
-               }
-
-               public override bool CanSeek {
-                       get { return !streamClosed; }
-               }
-
-               public override bool CanWrite {
-                       get { return (!streamClosed && canWrite); }
-               }
-
-               public virtual int Capacity {
-                       get {
-                               CheckIfClosedThrowDisposed ();
-                               return capacity - initialIndex;
-                       }
-
-                       set {
-                               CheckIfClosedThrowDisposed ();
-
-                               if (!expandable)
-                                       throw new NotSupportedException ("Cannot expand this MemoryStream");
-
-                               if (value < 0 || value < length)
-                                       throw new ArgumentOutOfRangeException ("value",
-                                       "New capacity cannot be negative or less than the current capacity " + value + " " + capacity);
-
-                               if (internalBuffer != null && value == internalBuffer.Length)
-                                       return;
-
-                               byte [] newBuffer = null;
-                               if (value != 0) {
-                                       newBuffer = new byte [value];
-                                       if (internalBuffer != null)
-                                               Buffer.BlockCopy (internalBuffer, 0, newBuffer, 0, length);
-                               }
-
-                               dirty_bytes = 0; // discard any dirty area beyond previous length
-                               internalBuffer = newBuffer; // It's null when capacity is set to 0
-                               capacity = value;
-                       }
-               }
-
-               public override long Length {
-                       get {
-                               // LAMESPEC: The spec says to throw an IOException if the
-                               // stream is closed and an ObjectDisposedException if
-                               // "methods were called after the stream was closed".  What
-                               // is the difference?
-
-                               CheckIfClosedThrowDisposed ();
-
-                               // This is ok for MemoryStreamTest.ConstructorFive
-                               return length - initialIndex;
-                       }
-               }
-
-               public override long Position {
-                       get {
-                               CheckIfClosedThrowDisposed ();
-                               return position - initialIndex;
-                       }
-
-                       set {
-                               CheckIfClosedThrowDisposed ();
-                               if (value < 0)
-                                       throw new ArgumentOutOfRangeException ("value",
-                                                               "Position cannot be negative" );
-
-                               if (value > Int32.MaxValue)
-                                       throw new ArgumentOutOfRangeException ("value",
-                                       "Position must be non-negative and less than 2^31 - 1 - origin");
-
-                               position = initialIndex + (int) value;
-                       }
-               }
-
-               protected override void Dispose (bool disposing)
-               {
-                       streamClosed = true;
-                       expandable = false;
-               }
-
-               public override void Flush ()
-               {
-                       // Do nothing
-               }
-
-               public virtual byte [] GetBuffer ()
-               {
-                       if (!allowGetBuffer)
-                               throw new UnauthorizedAccessException ();
-
-                       return internalBuffer;
-               }
-
-               public override int Read ([In,Out] byte [] buffer, int offset, int count)
-               {
-                       if (buffer == null)
-                               throw new ArgumentNullException ("buffer");
-
-                       if (offset < 0 || count < 0)
-                               throw new ArgumentOutOfRangeException ("offset or count less than zero.");
-
-                       if (buffer.Length - offset < count )
-                               throw new ArgumentException ("offset+count",
-                                                             "The size of the buffer is less than offset + count.");
-
-                       CheckIfClosedThrowDisposed ();
-
-                       if (position >= length || count == 0)
-                               return 0;
-
-                       if (position > length - count)
-                               count = length - position;
-
-                       Buffer.BlockCopy (internalBuffer, position, buffer, offset, count);
-                       position += count;
-                       return count;
-               }
-
-               public override int ReadByte ()
-               {
-                       CheckIfClosedThrowDisposed ();
-                       if (position >= length)
-                               return -1;
-
-                       return internalBuffer [position++];
-               }
-
-               public override long Seek (long offset, SeekOrigin loc)
-               {
-                       CheckIfClosedThrowDisposed ();
-
-                       // It's funny that they don't throw this exception for < Int32.MinValue
-                       if (offset > (long) Int32.MaxValue)
-                               throw new ArgumentOutOfRangeException ("Offset out of range. " + offset);
-
-                       int refPoint;
-                       switch (loc) {
-                       case SeekOrigin.Begin:
-                               if (offset < 0)
-                                       throw new IOException ("Attempted to seek before start of MemoryStream.");
-                               refPoint = initialIndex;
-                               break;
-                       case SeekOrigin.Current:
-                               refPoint = position;
-                               break;
-                       case SeekOrigin.End:
-                               refPoint = length;
-                               break;
-                       default:
-                               throw new ArgumentException ("loc", "Invalid SeekOrigin");
-                       }
-
-                       // LAMESPEC: My goodness, how may LAMESPECs are there in this
-                       // class! :)  In the spec for the Position property it's stated
-                       // "The position must not be more than one byte beyond the end of the stream."
-                       // In the spec for seek it says "Seeking to any location beyond the length of the 
-                       // stream is supported."  That's a contradiction i'd say.
-                       // I guess seek can go anywhere but if you use position it may get moved back.
-
-                       refPoint += (int) offset;
-                       if (refPoint < initialIndex)
-                               throw new IOException ("Attempted to seek before start of MemoryStream.");
-
-                       position = refPoint;
-                       return position;
-               }
-
-               int CalculateNewCapacity (int minimum)
-               {
-                       if (minimum < 256)
-                               minimum = 256; // See GetBufferTwo test
-
-                       if (minimum < capacity * 2)
-                               minimum = capacity * 2;
-
-                       return minimum;
-               }
-
-               void Expand (int newSize)
-               {
-                       // We don't need to take into account the dirty bytes when incrementing the
-                       // Capacity, as changing it will only preserve the valid clear region.
-                       if (newSize > capacity)
-                               Capacity = CalculateNewCapacity (newSize);
-                       else if (dirty_bytes > 0) {
-                               Array.Clear (internalBuffer, length, dirty_bytes);
-                               dirty_bytes = 0;
-                       }
-               }
-
-               public override void SetLength (long value)
-               {
-                       if (!expandable && value > capacity)
-                               throw new NotSupportedException ("Expanding this MemoryStream is not supported");
-
-                       CheckIfClosedThrowDisposed ();
-
-                       if (!canWrite) {
-                               throw new NotSupportedException (Locale.GetText 
-                                       ("Cannot write to this MemoryStream"));
-                       }
-
-                       // LAMESPEC: AGAIN! It says to throw this exception if value is
-                       // greater than "the maximum length of the MemoryStream".  I haven't
-                       // seen anywhere mention what the maximum length of a MemoryStream is and
-                       // since we're this far this memory stream is expandable.
-                       if (value < 0 || (value + initialIndex) > (long) Int32.MaxValue)
-                               throw new ArgumentOutOfRangeException ();
-
-                       int newSize = (int) value + initialIndex;
-
-                       if (newSize > length)
-                               Expand (newSize);
-                       else if (newSize < length) // Postpone the call to Array.Clear till expand time
-                               dirty_bytes += length - newSize;
-
-                       length = newSize;
-                       if (position > length)
-                               position = length;
-               }
-
-               public virtual byte [] ToArray ()
-               {
-                       int l = length - initialIndex;
-                       byte[] outBuffer = new byte [l];
-
-                       if (internalBuffer != null)
-                               Buffer.BlockCopy (internalBuffer, initialIndex, outBuffer, 0, l);
-                       return outBuffer; 
-               }
-
-               public override void Write (byte [] buffer, int offset, int count)
-               {
-                       if (buffer == null)
-                               throw new ArgumentNullException ("buffer");
-                       
-                       if (offset < 0 || count < 0)
-                               throw new ArgumentOutOfRangeException ();
-
-                       if (buffer.Length - offset < count)
-                               throw new ArgumentException ("offset+count",
-                                                            "The size of the buffer is less than offset + count.");
-
-                       CheckIfClosedThrowDisposed ();
-
-                       if (!CanWrite)
-                               throw new NotSupportedException ("Cannot write to this stream.");
-
-                       // reordered to avoid possible integer overflow
-                       if (position > length - count)
-                               Expand (position + count);
-
-                       Buffer.BlockCopy (buffer, offset, internalBuffer, position, count);
-                       position += count;
-                       if (position >= length)
-                               length = position;
-               }
-
-               public override void WriteByte (byte value)
-               {
-                       CheckIfClosedThrowDisposed ();
-                       if (!canWrite)
-                               throw new NotSupportedException ("Cannot write to this stream.");
-
-                       if (position >= length) {
-                               Expand (position + 1);
-                               length = position + 1;
-                       }
-
-                       internalBuffer [position++] = value;
-               }
-
-               public virtual void WriteTo (Stream stream)
-               {
-                       CheckIfClosedThrowDisposed ();
-
-                       if (stream == null)
-                               throw new ArgumentNullException ("stream");
-
-                       stream.Write (internalBuffer, initialIndex, length - initialIndex);
-               }
-
-
-               public override Task CopyToAsync (Stream destination, int bufferSize, CancellationToken cancellationToken)
-               {
-                       // TODO: Specialization but what for?
-                       return base.CopyToAsync (destination, bufferSize, cancellationToken);
-               }
-
-               public override Task FlushAsync (CancellationToken cancellationToken)
-               {
-                       if (cancellationToken.IsCancellationRequested)
-                               return TaskConstants.Canceled;
-
-                       try {
-                               Flush ();
-                               return TaskConstants.Finished;
-                       } catch (Exception ex) {
-                               return Task.FromException<object> (ex);
-                       }
-               }
-
-               public override Task<int> ReadAsync (byte[] buffer, int offset, int count, CancellationToken cancellationToken)
-               {
-                       if (buffer == null)
-                               throw new ArgumentNullException ("buffer");
-
-                       if (offset < 0 || count < 0)
-                               throw new ArgumentOutOfRangeException ("offset or count less than zero.");
-
-                       if (buffer.Length - offset < count )
-                               throw new ArgumentException ("offset+count",
-                                                            "The size of the buffer is less than offset + count.");
-                       if (cancellationToken.IsCancellationRequested)
-                               return TaskConstants<int>.Canceled;
-
-                       try {
-                               count = Read (buffer, offset, count);
-
-                               // Try not to allocate a new task for every buffer read
-                               if (read_task == null || read_task.Result != count)
-                                       read_task = Task<int>.FromResult (count);
-
-                               return read_task;
-                       } catch (Exception ex) {
-                               return Task.FromException<int> (ex);
-                       }
-               }
-
-               public override Task WriteAsync (byte[] buffer, int offset, int count, CancellationToken cancellationToken)
-               {
-                       if (buffer == null)
-                               throw new ArgumentNullException ("buffer");
-                       
-                       if (offset < 0 || count < 0)
-                               throw new ArgumentOutOfRangeException ();
-
-                       if (buffer.Length - offset < count)
-                               throw new ArgumentException ("offset+count",
-                                                            "The size of the buffer is less than offset + count.");
-
-                       if (cancellationToken.IsCancellationRequested)
-                               return TaskConstants.Canceled;
-
-                       try {
-                               Write (buffer, offset, count);
-                               return TaskConstants.Finished;
-                       } catch (Exception ex) {
-                               return Task.FromException<object> (ex);
-                       }
-               }
-       }               
-}
index 660c08f27318946915ae6eba9056f5e4e5c51aae..2394a9affd81c8e70d61bfe6cf1b94fae978e406 100644 (file)
@@ -362,8 +362,8 @@ namespace System.IO {
 
                        var canonicalize = true;
                        if (path.Length >= 2 &&
-                               IsDsc (path [0]) &&
-                               IsDsc (path [1])) {
+                               IsDirectorySeparator (path [0]) &&
+                               IsDirectorySeparator (path [1])) {
                                if (path.Length == 2 || path.IndexOf (path [0], 2) < 0)
                                        throw new ArgumentException ("UNC paths should be of the form \\\\server\\share.");
 
@@ -390,8 +390,8 @@ namespace System.IO {
                                                path = cwd + DirectorySeparatorChar + path;                                     
                                } else if (DirectorySeparatorChar == '\\' &&
                                        path.Length >= 2 &&
-                                       IsDsc (path [0]) &&
-                                       !IsDsc (path [1])) { // like `\abc\def'
+                                       IsDirectorySeparator (path [0]) &&
+                                       !IsDirectorySeparator (path [1])) { // like `\abc\def'
                                        string current = Directory.InsecureGetCurrentDirectory();
                                        if (current [1] == VolumeSeparatorChar)
                                                path = current.Substring (0, 2) + path;
@@ -404,16 +404,16 @@ namespace System.IO {
                            path = CanonicalizePath (path);
 
                        // if the original ended with a [Alt]DirectorySeparatorChar then ensure the full path also ends with one
-                       if (IsDsc (end) && (path [path.Length - 1] != DirectorySeparatorChar))
+                       if (IsDirectorySeparator (end) && (path [path.Length - 1] != DirectorySeparatorChar))
                                path += DirectorySeparatorChar;
 
                        return path;
                }
 
-               static bool IsDsc (char c) {
+               internal static bool IsDirectorySeparator (char c) {
                        return c == DirectorySeparatorChar || c == AltDirectorySeparatorChar;
                }
-               
+
                public static string GetPathRoot (string path)
                {
                        if (path == null)
@@ -427,36 +427,36 @@ namespace System.IO {
                        
                        if (DirectorySeparatorChar == '/') {
                                // UNIX
-                               return IsDsc (path [0]) ? DirectorySeparatorStr : String.Empty;
+                               return IsDirectorySeparator (path [0]) ? DirectorySeparatorStr : String.Empty;
                        } else {
                                // Windows
                                int len = 2;
 
-                               if (path.Length == 1 && IsDsc (path [0]))
+                               if (path.Length == 1 && IsDirectorySeparator (path [0]))
                                        return DirectorySeparatorStr;
                                else if (path.Length < 2)
                                        return String.Empty;
 
-                               if (IsDsc (path [0]) && IsDsc (path[1])) {
+                               if (IsDirectorySeparator (path [0]) && IsDirectorySeparator (path[1])) {
                                        // UNC: \\server or \\server\share
                                        // Get server
-                                       while (len < path.Length && !IsDsc (path [len])) len++;
+                                       while (len < path.Length && !IsDirectorySeparator (path [len])) len++;
 
                                        // Get share
                                        if (len < path.Length) {
                                                len++;
-                                               while (len < path.Length && !IsDsc (path [len])) len++;
+                                               while (len < path.Length && !IsDirectorySeparator (path [len])) len++;
                                        }
 
                                        return DirectorySeparatorStr +
                                                DirectorySeparatorStr +
                                                path.Substring (2, len - 2).Replace (AltDirectorySeparatorChar, DirectorySeparatorChar);
-                               } else if (IsDsc (path [0])) {
+                               } else if (IsDirectorySeparator (path [0])) {
                                        // path starts with '\' or '/'
                                        return DirectorySeparatorStr;
                                } else if (path[1] == VolumeSeparatorChar) {
                                        // C:\folder
-                                       if (path.Length >= 3 && (IsDsc (path [2]))) len++;
+                                       if (path.Length >= 3 && (IsDirectorySeparator (path [2]))) len++;
                                } else
                                        return Directory.GetCurrentDirectory ().Substring (0, 2);// + path.Substring (0, len);
                                return path.Substring (0, len);
@@ -628,11 +628,11 @@ namespace System.IO {
                static string GetServerAndShare (string path)
                {
                        int len = 2;
-                       while (len < path.Length && !IsDsc (path [len])) len++;
+                       while (len < path.Length && !IsDirectorySeparator (path [len])) len++;
 
                        if (len < path.Length) {
                                len++;
-                               while (len < path.Length && !IsDsc (path [len])) len++;
+                               while (len < path.Length && !IsDirectorySeparator (path [len])) len++;
                        }
 
                        return path.Substring (2, len - 2).Replace (AltDirectorySeparatorChar, DirectorySeparatorChar);
@@ -646,8 +646,8 @@ namespace System.IO {
                                return false;
 
                        // UNC handling
-                       if (IsDsc (root[0]) && IsDsc (root[1])) {
-                               if (!(IsDsc (path[0]) && IsDsc (path[1])))
+                       if (IsDirectorySeparator (root[0]) && IsDirectorySeparator (root[1])) {
+                               if (!(IsDirectorySeparator (path[0]) && IsDirectorySeparator (path[1])))
                                        return false;
 
                                string rootShare = GetServerAndShare (root);
@@ -664,7 +664,7 @@ namespace System.IO {
                                return false;
                        if ((root.Length > 2) && (path.Length > 2)) {
                                // but don't directory compare the directory separator
-                               return (IsDsc (root[2]) && IsDsc (path[2]));
+                               return (IsDirectorySeparator (root[2]) && IsDirectorySeparator (path[2]));
                        }
                        return true;
                }
@@ -692,7 +692,7 @@ namespace System.IO {
                        int target = 0;
 
                        bool isUnc = Environment.IsRunningOnWindows &&
-                               root.Length > 2 && IsDsc (root[0]) && IsDsc (root[1]);
+                               root.Length > 2 && IsDirectorySeparator (root[0]) && IsDirectorySeparator (root[1]);
 
                        // Set an overwrite limit for UNC paths since '\' + server + share
                        // must not be eliminated by the '..' elimination algorithm.
@@ -728,7 +728,7 @@ namespace System.IO {
 
                                        if (isUnc) {
                                                return ret;
-                                       } else if (!IsDsc (path[0]) && SameRoot (root, path)) {
+                                       } else if (!IsDirectorySeparator (path[0]) && SameRoot (root, path)) {
                                                if (ret.Length <= 2 && !ret.EndsWith (DirectorySeparatorStr)) // '\' after "c:"
                                                        ret += Path.DirectorySeparatorChar;
                                                return ret;
@@ -736,10 +736,10 @@ namespace System.IO {
                                                string current = Directory.GetCurrentDirectory ();
                                                if (current.Length > 1 && current[1] == Path.VolumeSeparatorChar) {
                                                        // DOS local file path
-                                                       if (ret.Length == 0 || IsDsc (ret[0]))
+                                                       if (ret.Length == 0 || IsDirectorySeparator (ret[0]))
                                                                ret += '\\';
                                                        return current.Substring (0, 2) + ret;
-                                               } else if (IsDsc (current[current.Length - 1]) && IsDsc (ret[0]))
+                                               } else if (IsDirectorySeparator (current[current.Length - 1]) && IsDirectorySeparator (ret[0]))
                                                        return current + ret.Substring (1);
                                                else
                                                        return current + ret;
diff --git a/mcs/class/corlib/System.IO/Stream.cs b/mcs/class/corlib/System.IO/Stream.cs
deleted file mode 100644 (file)
index 8307d0a..0000000
+++ /dev/null
@@ -1,513 +0,0 @@
-//
-// System.IO.Stream.cs
-//
-// Authors:
-//   Dietmar Maurer (dietmar@ximian.com)
-//   Miguel de Icaza (miguel@ximian.com)
-//   Gonzalo Paniagua Javier (gonzalo@ximian.com)
-//   Marek Safar (marek.safar@gmail.com)
-//
-// (C) 2001, 2002 Ximian, Inc.  http://www.ximian.com
-// (c) 2004 Novell, Inc. (http://www.novell.com)
-// Copyright 2011 Xamarin, Inc (http://www.xamarin.com)
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-// 
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-// 
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using System.Threading;
-using System.Runtime.Remoting.Messaging;
-using System.Runtime.InteropServices;
-using System.Threading.Tasks;
-
-namespace System.IO
-{
-       [Serializable]
-       [ComVisible (true)]
-#if NET_2_1
-       public abstract class Stream : IDisposable
-#else
-       public abstract class Stream : MarshalByRefObject, IDisposable
-#endif
-       {
-               public static readonly Stream Null = new NullStream ();
-
-               [NonSerialized]
-               Func<byte[], int, int, int> async_read;
-               [NonSerialized]
-               Action<byte[], int, int> async_write;
-               [NonSerialized]
-               AutoResetEvent async_event;
-
-               protected Stream ()
-               {
-               }
-
-               public abstract bool CanRead
-               {
-                       get;
-               }
-
-               public abstract bool CanSeek
-               {
-                       get;
-               }
-
-               public abstract bool CanWrite
-               {
-                       get;
-               }
-
-               [ComVisible (false)]
-               public virtual bool CanTimeout {
-                       get {
-                               return false;
-                       }
-               }
-
-               public abstract long Length
-               {
-                       get;
-               }
-
-               public abstract long Position
-               {
-                       get;
-                       set;
-               }
-
-
-               public void Dispose ()
-               {
-                       Close ();
-               }
-
-               protected virtual void Dispose (bool disposing)
-               {
-                       if (async_event != null && disposing) {
-                               async_event.Close ();
-                               async_event = null;
-                       }
-               }
-
-               public virtual void Close ()
-               {
-                       Dispose (true);
-                       GC.SuppressFinalize (this);
-               }
-
-               [ComVisible (false)]
-               public virtual int ReadTimeout {
-                       get {
-                               throw new InvalidOperationException ("Timeouts are not supported on this stream.");
-                       }
-                       set {
-                               throw new InvalidOperationException ("Timeouts are not supported on this stream.");
-                       }
-               }
-
-               [ComVisible (false)]
-               public virtual int WriteTimeout {
-                       get {
-                               throw new InvalidOperationException ("Timeouts are not supported on this stream.");
-                       }
-                       set {
-                               throw new InvalidOperationException ("Timeouts are not supported on this stream.");
-                       }
-               }
-
-               public static Stream Synchronized (Stream stream)
-               {
-                       return new SynchronizedStream (stream);
-               }
-
-               [Obsolete ("CreateWaitHandle is due for removal.  Use \"new ManualResetEvent(false)\" instead.")]
-               protected virtual WaitHandle CreateWaitHandle()
-               {
-                       return new ManualResetEvent (false);
-               }
-               
-               public abstract void Flush ();
-
-               public abstract int Read ([In,Out] byte[] buffer, int offset, int count);
-
-               public virtual int ReadByte ()
-               {
-                       byte[] buffer = new byte [1];
-
-                       if (Read (buffer, 0, 1) > 0)
-                               return buffer [0];
-                       
-                       return -1;
-               }
-
-               public abstract long Seek (long offset, SeekOrigin origin);
-
-               public abstract void SetLength (long value);
-
-               public abstract void Write (byte[] buffer, int offset, int count);
-
-               public virtual void WriteByte (byte value)
-               {
-                       byte[] buffer = new byte [1];
-
-                       buffer [0] = value;
-
-                       Write (buffer, 0, 1);
-               }
-
-               public virtual IAsyncResult BeginRead (byte[] buffer, int offset, int count, AsyncCallback callback, object state)
-               {
-                       if (!CanRead)
-                               throw new NotSupportedException ("This stream does not support reading");
-
-                       if (async_event == null) {
-                               lock (this) {
-                                       if (async_event == null)
-                                               async_event = new AutoResetEvent (true);
-                               }
-                       }
-
-                       async_event.WaitOne ();
-                       async_read = Read;
-                       return async_read.BeginInvoke (buffer, offset, count, callback, state);
-               }
-
-               public virtual IAsyncResult BeginWrite (byte[] buffer, int offset, int count, AsyncCallback callback, object state)
-               {
-                       if (!CanWrite)
-                               throw new NotSupportedException ("This stream does not support writing");
-
-                       if (async_event == null) {
-                               lock (this) {
-                                       if (async_event == null)
-                                               async_event = new AutoResetEvent (true);
-                               }
-                       }
-
-                       async_event.WaitOne ();
-                       async_write = Write;
-                       return async_write.BeginInvoke (buffer, offset, count, callback, state);
-               }
-               
-               public virtual int EndRead (IAsyncResult asyncResult)
-               {
-                       if (asyncResult == null)
-                               throw new ArgumentNullException ("asyncResult");
-
-                       if (async_read == null)
-                               throw new ArgumentException ("EndRead cannot be called multiple times");
-
-                       try {
-                               return async_read.EndInvoke (asyncResult);
-                       } finally {
-                               async_read = null;
-                               async_event.Set ();
-                       }
-               }
-
-               public virtual void EndWrite (IAsyncResult asyncResult)
-               {
-                       if (asyncResult == null)
-                               throw new ArgumentNullException ("asyncResult");
-
-                       if (async_write == null)
-                               throw new ArgumentException ("EndWrite cannot be called multiple times");
-
-                       try {
-                               async_write.EndInvoke (asyncResult);
-                       } finally {
-                               async_write = null;
-                               async_event.Set ();
-                       }
-               }
-
-               public void CopyTo (Stream destination)
-               {
-                       CopyTo (destination, 16*1024);
-               }
-
-               public void CopyTo (Stream destination, int bufferSize)
-               {
-                       if (destination == null)
-                               throw new ArgumentNullException ("destination");
-                       if (!CanRead)
-                               throw new NotSupportedException ("This stream does not support reading");
-                       if (!destination.CanWrite)
-                               throw new NotSupportedException ("This destination stream does not support writing");
-                       if (bufferSize <= 0)
-                               throw new ArgumentOutOfRangeException ("bufferSize");
-
-                       var buffer = new byte [bufferSize];
-                       int nread;
-                       while ((nread = Read (buffer, 0, bufferSize)) != 0)
-                               destination.Write (buffer, 0, nread);
-               }
-
-               [ObsoleteAttribute("Do not call or override this method")]
-               protected virtual void ObjectInvariant ()
-               {
-               }
-               
-
-               public Task CopyToAsync (Stream destination)
-               {
-                       return CopyToAsync (destination, 16 * 1024, CancellationToken.None);
-               }
-
-               public Task CopyToAsync (Stream destination, int bufferSize)
-               {
-                       return CopyToAsync (destination, bufferSize, CancellationToken.None);
-               }
-
-               public virtual Task CopyToAsync (Stream destination, int bufferSize, CancellationToken cancellationToken)
-               {
-                       if (destination == null)
-                               throw new ArgumentNullException ("destination");
-                       if (!CanRead)
-                               throw new NotSupportedException ("This stream does not support reading");
-                       if (!destination.CanWrite)
-                               throw new NotSupportedException ("This destination stream does not support writing");
-                       if (bufferSize <= 0)
-                               throw new ArgumentOutOfRangeException ("bufferSize");
-
-                       if (cancellationToken.IsCancellationRequested)
-                               return TaskConstants.Canceled;
-
-                       return CopyToAsync (destination, new byte[bufferSize], cancellationToken);
-               }
-
-               async Task CopyToAsync (Stream destination, byte[] buffer, CancellationToken cancellationToken)
-               {
-                       int nread;
-                       while ((nread = await ReadAsync (buffer, 0, buffer.Length, cancellationToken).ConfigureAwait (false)) != 0)
-                               await destination.WriteAsync (buffer, 0, nread, cancellationToken).ConfigureAwait (false);
-               }
-
-               public Task FlushAsync ()
-               {
-                       return FlushAsync (CancellationToken.None);
-               }
-
-               public virtual Task FlushAsync (CancellationToken cancellationToken)
-               {
-                       if (cancellationToken.IsCancellationRequested)
-                               return TaskConstants.Canceled;
-
-                       return Task.Factory.StartNew (l => ((Stream) l).Flush (), this, cancellationToken);
-               }
-
-               public Task<int> ReadAsync (byte[] buffer, int offset, int count)
-               {
-                       return ReadAsync (buffer, offset, count, CancellationToken.None);
-               }
-
-               public virtual Task<int> ReadAsync (byte[] buffer, int offset, int count, CancellationToken cancellationToken)
-               {
-                       if (cancellationToken.IsCancellationRequested)
-                               return TaskConstants<int>.Canceled;
-
-                       return Task<int>.Factory.FromAsync (BeginRead, EndRead, buffer, offset, count, null);
-               }
-
-               public Task WriteAsync (byte[] buffer, int offset, int count)
-               {
-                       return WriteAsync (buffer, offset, count, CancellationToken.None);
-               }
-
-               public virtual Task WriteAsync (byte[] buffer, int offset, int count, CancellationToken cancellationToken)
-               {
-                       return Task.Factory.FromAsync (BeginWrite, EndWrite, buffer, offset, count, null);
-               }
-       }
-
-       class NullStream : Stream
-       {
-               public override bool CanRead
-               {
-                       get {
-                               return true;
-                       }
-               }
-
-               public override bool CanSeek
-               {
-                        get {
-                                return true;
-                        }
-                }
-
-                public override bool CanWrite
-               {
-                        get {
-                                return true;
-                        }
-                }
-
-               public override long Length
-               {
-                       get {
-                               return 0;
-                       }
-               }
-
-               public override long Position
-               {
-                       get {
-                               return 0;
-                       }
-                       set {
-                       }
-               }
-
-               public override void Flush ()
-               {
-               }
-
-               public override int Read (byte[] buffer, int offset, int count)
-               {
-                       return 0;
-               }
-
-               public override int ReadByte ()
-               {
-                       return -1;
-               }
-
-               public override long Seek (long offset, SeekOrigin origin)
-               {
-                       return 0;
-               }
-
-               public override void SetLength (long value)
-               {
-               }
-
-               public override void Write (byte[] buffer, int offset, int count)
-               {
-               }
-
-               public override void WriteByte (byte value)
-               {
-               }
-       }
-
-       class SynchronizedStream : Stream {
-               Stream source;
-               object slock;
-                       
-               internal SynchronizedStream (Stream source)
-               {
-                       this.source = source;
-                       slock = new object ();
-               }
-               
-               public override bool CanRead
-               {
-                       get {
-                               lock (slock)
-                                       return source.CanRead;
-                       }
-               }
-
-               public override bool CanSeek
-               {
-                        get {
-                               lock (slock)
-                                       return source.CanSeek;
-                        }
-                }
-
-                public override bool CanWrite
-               {
-                        get {
-                               lock (slock)
-                                       return source.CanWrite;
-                        }
-                }
-
-               public override long Length
-               {
-                       get {
-                               lock (slock)
-                                       return source.Length;
-                       }
-               }
-
-               public override long Position
-               {
-                       get {
-                               lock (slock)
-                                       return source.Position;
-                       }
-                       set {
-                               lock (slock)
-                                       source.Position = value;
-                       }
-               }
-
-               public override void Close ()
-               {
-                       lock (slock)
-                               source.Close ();
-               }
-
-               public override void Flush ()
-               {
-                       lock (slock)
-                               source.Flush ();
-               }
-
-               public override int Read (byte[] buffer, int offset, int count)
-               {
-                       lock (slock)
-                               return source.Read (buffer, offset, count);
-               }
-
-               public override int ReadByte ()
-               {
-                       lock (slock)
-                               return source.ReadByte ();
-               }
-
-               public override long Seek (long offset, SeekOrigin origin)
-               {
-                       lock (slock)
-                               return source.Seek (offset, origin);
-               }
-
-               public override void SetLength (long value)
-               {
-                       lock (slock)
-                               source.SetLength (value);
-               }
-
-               public override void Write (byte[] buffer, int offset, int count)
-               {
-                       lock (slock)
-                               source.Write (buffer, offset, count);
-               }
-
-               public override void WriteByte (byte value)
-               {
-                       lock (slock)
-                               source.WriteByte (value);
-               }
-       }
-}
diff --git a/mcs/class/corlib/System.IO/StreamReader.cs b/mcs/class/corlib/System.IO/StreamReader.cs
deleted file mode 100644 (file)
index 1adf8ab..0000000
+++ /dev/null
@@ -1,755 +0,0 @@
-//
-// System.IO.StreamReader.cs
-//
-// Authors:
-//   Dietmar Maurer (dietmar@ximian.com)
-//   Miguel de Icaza (miguel@ximian.com) 
-//   Marek Safar (marek.safar@gmail.com)
-//
-// (C) Ximian, Inc.  http://www.ximian.com
-// Copyright (C) 2004 Novell (http://www.novell.com)
-// Copyright 2011, 2013 Xamarin Inc.
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-// 
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-// 
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using System;
-using System.Text;
-using System.Runtime.InteropServices;
-using System.Threading.Tasks;
-
-namespace System.IO {
-       [Serializable]
-       [ComVisible (true)]
-       public class StreamReader : TextReader
-       {
-               sealed class NullStreamReader : StreamReader
-               {
-                       internal NullStreamReader ()
-                       {
-                               base_stream = Stream.Null;
-                       }
-
-                       public override int Peek ()
-                       {
-                               return -1;
-                       }
-
-                       public override int Read ()
-                       {
-                               return -1;
-                       }
-
-                       public override int Read ([In, Out] char[] buffer, int index, int count)
-                       {
-                               return 0;
-                       }
-
-                       public override string ReadLine ()
-                       {
-                               return null;
-                       }
-
-                       public override string ReadToEnd ()
-                       {
-                               return String.Empty;
-                       }
-
-                       public override Stream BaseStream {
-                               get { return Stream.Null; }
-                       }
-
-                       public override Encoding CurrentEncoding {
-                               get { return Encoding.Unicode; }
-                       }
-               }
-
-               const int DefaultBufferSize = 1024;
-               const int DefaultFileBufferSize = 4096;
-               const int MinimumBufferSize = 128;
-
-               //
-               // The input buffer
-               //
-               byte [] input_buffer;
-               
-               // Input buffer ready for recycling
-               static byte [] input_buffer_recycle;
-               static object input_buffer_recycle_lock = new object ();
-
-               //
-               // The decoded buffer from the above input buffer
-               //
-               char [] decoded_buffer;
-               static char[] decoded_buffer_recycle;
-
-               Encoding encoding;
-               Decoder decoder;
-               StringBuilder line_builder;
-               Stream base_stream;
-
-               //
-               // Decoded bytes in decoded_buffer.
-               //
-               int decoded_count;
-
-               //
-               // Current position in the decoded_buffer
-               //
-               int pos;
-
-               //
-               // The buffer size that we are using
-               //
-               int buffer_size;
-
-               int do_checks;
-               
-               bool mayBlock;
-
-               IDecoupledTask async_task;
-               readonly bool leave_open;
-
-               public new static readonly StreamReader Null =  new NullStreamReader ();
-               
-               private StreamReader() {}
-
-               public StreamReader(Stream stream)
-                       : this (stream, Encoding.UTF8, true, DefaultBufferSize) { }
-
-               public StreamReader(Stream stream, bool detectEncodingFromByteOrderMarks)
-                       : this (stream, Encoding.UTF8, detectEncodingFromByteOrderMarks, DefaultBufferSize) { }
-
-               public StreamReader(Stream stream, Encoding encoding)
-                       : this (stream, encoding, true, DefaultBufferSize) { }
-
-               public StreamReader(Stream stream, Encoding encoding, bool detectEncodingFromByteOrderMarks)
-                       : this (stream, encoding, detectEncodingFromByteOrderMarks, DefaultBufferSize) { }
-
-               public StreamReader(Stream stream, Encoding encoding, bool detectEncodingFromByteOrderMarks, int bufferSize)
-                       : this (stream, encoding, detectEncodingFromByteOrderMarks, bufferSize, false)
-               {
-               }
-
-               public StreamReader(Stream stream, Encoding encoding, bool detectEncodingFromByteOrderMarks, int bufferSize, bool leaveOpen)
-               {
-                       leave_open = leaveOpen;
-                       Initialize (stream, encoding, detectEncodingFromByteOrderMarks, bufferSize);
-               }
-
-               public StreamReader(string path)
-                       : this (path, Encoding.UTF8, true, DefaultFileBufferSize) { }
-
-               public StreamReader(string path, bool detectEncodingFromByteOrderMarks)
-                       : this (path, Encoding.UTF8, detectEncodingFromByteOrderMarks, DefaultFileBufferSize) { }
-
-               public StreamReader(string path, Encoding encoding)
-                       : this (path, encoding, true, DefaultFileBufferSize) { }
-
-               public StreamReader(string path, Encoding encoding, bool detectEncodingFromByteOrderMarks)
-                       : this (path, encoding, detectEncodingFromByteOrderMarks, DefaultFileBufferSize) { }
-               
-               public StreamReader(string path, Encoding encoding, bool detectEncodingFromByteOrderMarks, int bufferSize)
-               {
-                       if (null == path)
-                               throw new ArgumentNullException("path");
-                       if (String.Empty == path)
-                               throw new ArgumentException("Empty path not allowed");
-                       if (path.IndexOfAny (Path.InvalidPathChars) != -1)
-                               throw new ArgumentException("path contains invalid characters");
-                       if (null == encoding)
-                               throw new ArgumentNullException ("encoding");
-                       if (bufferSize <= 0)
-                               throw new ArgumentOutOfRangeException ("bufferSize", "The minimum size of the buffer must be positive");
-
-                       Stream stream = (Stream) File.OpenRead (path);
-                       Initialize (stream, encoding, detectEncodingFromByteOrderMarks, bufferSize);
-               }
-
-               internal void Initialize (Stream stream, Encoding encoding, bool detectEncodingFromByteOrderMarks, int bufferSize)
-               {
-                       if (null == stream)
-                               throw new ArgumentNullException ("stream");
-                       if (null == encoding)
-                               throw new ArgumentNullException ("encoding");
-                       if (!stream.CanRead)
-                               throw new ArgumentException ("Cannot read stream");
-                       if (bufferSize <= 0)
-                               throw new ArgumentOutOfRangeException ("bufferSize", "The minimum size of the buffer must be positive");
-
-                       if (bufferSize < MinimumBufferSize)
-                               bufferSize = MinimumBufferSize;
-                       
-                       // since GetChars() might add flushed character, it 
-                       // should have additional char buffer for extra 1 
-                       // (probably 1 is ok, but might be insufficient. I'm not sure)
-                       var decoded_buffer_size = encoding.GetMaxCharCount (bufferSize) + 1;
-
-                       //
-                       // Instead of allocating a new default buffer use the
-                       // last one if there is any available
-                       //
-                       if (bufferSize <= DefaultBufferSize && input_buffer_recycle != null) {
-                               lock (input_buffer_recycle_lock) {
-                                       if (input_buffer_recycle != null) {
-                                               input_buffer = input_buffer_recycle;
-                                               input_buffer_recycle = null;
-                                       }
-                                       
-                                       if (decoded_buffer_recycle != null && decoded_buffer_size <= decoded_buffer_recycle.Length) {
-                                               decoded_buffer = decoded_buffer_recycle;
-                                               decoded_buffer_recycle = null;
-                                       }
-                               }
-                       }
-                       
-                       if (input_buffer == null)
-                               input_buffer = new byte [bufferSize];
-                       else
-                               Array.Clear (input_buffer, 0, bufferSize);
-                       
-                       if (decoded_buffer == null)
-                               decoded_buffer = new char [decoded_buffer_size];
-                       else
-                               Array.Clear (decoded_buffer, 0, decoded_buffer_size);
-
-                       base_stream = stream;           
-                       this.buffer_size = bufferSize;
-                       this.encoding = encoding;
-                       decoder = encoding.GetDecoder ();
-
-                       byte [] preamble = encoding.GetPreamble ();
-                       do_checks = detectEncodingFromByteOrderMarks ? 1 : 0;
-                       do_checks += (preamble.Length == 0) ? 0 : 2;
-                       
-                       decoded_count = 0;
-                       pos = 0;
-               }
-
-               public virtual Stream BaseStream {
-                       get {
-                               return base_stream;
-                       }
-               }
-
-               public virtual Encoding CurrentEncoding {
-                       get {
-                               return encoding;
-                       }
-               }
-
-               public bool EndOfStream {
-                       get { return Peek () < 0; }
-               }
-
-               public override void Close ()
-               {
-                       Dispose (true);
-               }
-
-               protected override void Dispose (bool disposing)
-               {
-                       if (disposing && base_stream != null && !leave_open)
-                               base_stream.Close ();
-                       
-                       if (input_buffer != null && input_buffer.Length == DefaultBufferSize && input_buffer_recycle == null) {
-                               lock (input_buffer_recycle_lock) {
-                                       if (input_buffer_recycle == null) {
-                                               input_buffer_recycle = input_buffer;
-                                       }
-                                       
-                                       if (decoded_buffer_recycle == null) {
-                                               decoded_buffer_recycle = decoded_buffer;
-                                       }
-                               }
-                       }
-                       
-                       input_buffer = null;
-                       decoded_buffer = null;
-                       encoding = null;
-                       decoder = null;
-                       base_stream = null;
-                       base.Dispose (disposing);
-               }
-
-               //
-               // Provides auto-detection of the encoding, as well as skipping over
-               // byte marks at the beginning of a stream.
-               //
-               int DoChecks (int count)
-               {
-                       if ((do_checks & 2) == 2){
-                               byte [] preamble = encoding.GetPreamble ();
-                               int c = preamble.Length;
-                               if (count >= c){
-                                       int i;
-                                       
-                                       for (i = 0; i < c; i++)
-                                               if (input_buffer [i] != preamble [i])
-                                                       break;
-
-                                       if (i == c)
-                                               return i;
-                               }
-                       }
-
-                       if ((do_checks & 1) == 1){
-                               if (count < 2)
-                                       return 0;
-
-                               if (input_buffer [0] == 0xfe && input_buffer [1] == 0xff){
-                                       this.encoding = Encoding.BigEndianUnicode;
-                                       return 2;
-                               }
-                               if (input_buffer [0] == 0xff && input_buffer [1] == 0xfe && count < 4) {
-                                       // If we don't have enough bytes we can't check for UTF32, so use Unicode
-                                       this.encoding = Encoding.Unicode;
-                                       return 2;
-                               }
-
-                               if (count < 3)
-                                       return 0;
-
-                               if (input_buffer [0] == 0xef && input_buffer [1] == 0xbb && input_buffer [2] == 0xbf){
-                                       this.encoding = Encoding.UTF8Unmarked;
-                                       return 3;
-                               }
-
-                               if (count < 4) {
-                                       if (input_buffer [0] == 0xff && input_buffer [1] == 0xfe && input_buffer [2] != 0) {
-                                               this.encoding = Encoding.Unicode;
-                                               return 2;
-                                       }
-                                       return 0;
-                               }
-
-                               if (input_buffer [0] == 0 && input_buffer [1] == 0
-                                       && input_buffer [2] == 0xfe && input_buffer [3] == 0xff)
-                               {
-                                       this.encoding = Encoding.BigEndianUTF32;
-                                       return 4;
-                               }
-
-                               if (input_buffer [0] == 0xff && input_buffer [1] == 0xfe) {
-                                       if (input_buffer [2] == 0 && input_buffer[3] == 0) {
-                                               this.encoding = Encoding.UTF32;
-                                               return 4;
-                                       }
-
-                                       this.encoding = Encoding.Unicode;
-                                       return 2;
-                               }
-                       }
-
-                       return 0;
-               }
-
-               public void DiscardBufferedData ()
-               {
-                       CheckState ();
-
-                       pos = decoded_count = 0;
-                       mayBlock = false;
-                       // Discard internal state of the decoder too.
-                       decoder = encoding.GetDecoder ();
-               }
-               
-               // the buffer is empty, fill it again
-               // Keep in sync with ReadBufferAsync
-               int ReadBuffer ()
-               {
-                       pos = 0;
-
-                       // keep looping until the decoder gives us some chars
-                       decoded_count = 0;
-                       do {
-                               var cbEncoded = base_stream.Read (input_buffer, 0, buffer_size);
-                               if (cbEncoded <= 0)
-                                       return 0;
-
-                               decoded_count = ReadBufferCore (cbEncoded);
-                       } while (decoded_count == 0);
-
-                       return decoded_count;
-               }
-
-               int ReadBufferCore (int cbEncoded)
-               {
-                       int parse_start;
-
-                       mayBlock = cbEncoded < buffer_size;
-                       if (do_checks > 0){
-                               Encoding old = encoding;
-                               parse_start = DoChecks (cbEncoded);
-                               if (old != encoding){
-                                       int old_decoded_size = old.GetMaxCharCount (buffer_size) + 1;
-                                       int new_decoded_size = encoding.GetMaxCharCount (buffer_size) + 1;
-                                       if (old_decoded_size != new_decoded_size)
-                                               decoded_buffer = new char [new_decoded_size];
-                                       decoder = encoding.GetDecoder ();
-                               }
-                               do_checks = 0;
-                               cbEncoded -= parse_start;
-                       } else {
-                               parse_start = 0;
-                       }
-                               
-                       return decoder.GetChars (input_buffer, parse_start, cbEncoded, decoded_buffer, 0);
-               }
-
-               //
-               // Peek can block:
-               // http://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=96484
-               //
-               public override int Peek ()
-               {
-                       CheckState ();
-
-                       if (pos >= decoded_count && ReadBuffer () == 0)
-                               return -1;
-
-                       return decoded_buffer [pos];
-               }
-
-               //
-               // Used internally by our console, as it previously depended on Peek() being a
-               // routine that would not block.
-               //
-               internal bool DataAvailable ()
-               {
-                       return pos < decoded_count;
-               }
-               
-               public override int Read ()
-               {
-                       CheckState ();
-
-                       if (pos >= decoded_count && ReadBuffer () == 0)
-                               return -1;
-
-                       return decoded_buffer [pos++];
-               }
-
-               // Keep in sync with ReadAsync
-               public override int Read ([In, Out] char[] buffer, int index, int count)
-               {
-                       if (buffer == null)
-                               throw new ArgumentNullException ("buffer");
-                       if (index < 0)
-                               throw new ArgumentOutOfRangeException ("index", "< 0");
-                       if (count < 0)
-                               throw new ArgumentOutOfRangeException ("count", "< 0");
-                       // re-ordered to avoid possible integer overflow
-                       if (index > buffer.Length - count)
-                               throw new ArgumentException ("index + count > buffer.Length");
-
-                       CheckState ();
-
-                       int chars_read = 0;
-                       while (count > 0) {
-                               if (pos >= decoded_count && ReadBuffer () == 0)
-                                       return chars_read > 0 ? chars_read : 0;
-
-                               int cch = Math.Min (decoded_count - pos, count);
-                               Array.Copy (decoded_buffer, pos, buffer, index, cch);
-                               pos += cch;
-                               index += cch;
-                               count -= cch;
-                               chars_read += cch;
-                               if (mayBlock)
-                                       break;
-                       }
-                       return chars_read;
-               }
-
-               bool foundCR;
-               int FindNextEOL ()
-               {
-                       char c = '\0';
-                       for (; pos < decoded_count; pos++) {
-                               c = decoded_buffer [pos];
-                               if (c == '\n') {
-                                       pos++;
-                                       int res = (foundCR) ? (pos - 2) : (pos - 1);
-                                       if (res < 0)
-                                               res = 0; // if a new buffer starts with a \n and there was a \r at
-                                                       // the end of the previous one, we get here.
-                                       foundCR = false;
-                                       return res;
-                               } else if (foundCR) {
-                                       foundCR = false;
-                                       if (pos == 0)
-                                               return -2; // Need to flush the current buffered line.
-                                                          // This is a \r at the end of the previous decoded buffer that
-                                                          // is not followed by a \n in the current decoded buffer.
-                                       return pos - 1;
-                               }
-
-                               foundCR = (c == '\r');
-                       }
-
-                       return -1;
-               }
-
-               // Keep in sync with ReadLineAsync
-               public override string ReadLine()
-               {
-                       CheckState ();
-
-                       if (pos >= decoded_count && ReadBuffer () == 0)
-                               return null;
-
-                       int begin = pos;
-                       int end = FindNextEOL ();
-                       if (end < decoded_count && end >= begin)
-                               return new string (decoded_buffer, begin, end - begin);
-                       if (end == -2)
-                               return line_builder.ToString (0, line_builder.Length);
-
-                       if (line_builder == null)
-                               line_builder = new StringBuilder ();
-                       else
-                               line_builder.Length = 0;
-
-                       while (true) {
-                               if (foundCR) // don't include the trailing CR if present
-                                       decoded_count--;
-
-                               line_builder.Append (decoded_buffer, begin, decoded_count - begin);
-                               if (ReadBuffer () == 0) {
-                                       if (line_builder.Capacity > 32768) {
-                                               StringBuilder sb = line_builder;
-                                               line_builder = null;
-                                               return sb.ToString (0, sb.Length);
-                                       }
-                                       return line_builder.ToString (0, line_builder.Length);
-                               }
-
-                               begin = pos;
-                               end = FindNextEOL ();
-                               if (end < decoded_count && end >= begin) {
-                                       line_builder.Append (decoded_buffer, begin, end - begin);
-                                       if (line_builder.Capacity > 32768) {
-                                               StringBuilder sb = line_builder;
-                                               line_builder = null;
-                                               return sb.ToString (0, sb.Length);
-                                       }
-                                       return line_builder.ToString (0, line_builder.Length);
-                               }
-
-                               if (end == -2)
-                                       return line_builder.ToString (0, line_builder.Length);
-                       }
-               }
-
-               // Keep in sync with ReadToEndAsync
-               public override string ReadToEnd()
-               {
-                       CheckState ();
-
-                       StringBuilder text = new StringBuilder ();
-
-                       do {
-                               text.Append (decoded_buffer, pos, decoded_count - pos);
-                       } while (ReadBuffer () != 0);
-
-                       return text.ToString ();
-               }
-
-               void CheckState ()
-               {
-                       if (base_stream == null)
-                               throw new ObjectDisposedException ("StreamReader", "Cannot read from a closed StreamReader");
-
-                       if (async_task != null && !async_task.IsCompleted)
-                               throw new InvalidOperationException ();
-               }
-
-               public override int ReadBlock ([In, Out] char[] buffer, int index, int count)
-               {
-                       if (buffer == null)
-                               throw new ArgumentNullException ("buffer");
-                       if (index < 0)
-                               throw new ArgumentOutOfRangeException ("index", "< 0");
-                       if (count < 0)
-                               throw new ArgumentOutOfRangeException ("count", "< 0");
-                       // re-ordered to avoid possible integer overflow
-                       if (index > buffer.Length - count)
-                               throw new ArgumentException ("index + count > buffer.Length");
-
-                       CheckState ();
-
-                       return base.ReadBlock (buffer, index, count);
-               }
-
-               public override Task<int> ReadAsync (char[] buffer, int index, int count)
-               {
-                       if (buffer == null)
-                               throw new ArgumentNullException ("buffer");
-                       if (index < 0)
-                               throw new ArgumentOutOfRangeException ("index", "< 0");
-                       if (count < 0)
-                               throw new ArgumentOutOfRangeException ("count", "< 0");
-                       // re-ordered to avoid possible integer overflow
-                       if (index > buffer.Length - count)
-                               throw new ArgumentException ("index + count > buffer.Length");
-
-                       CheckState ();
-
-                       DecoupledTask<int> res;
-                       async_task = res = new DecoupledTask<int> (ReadAsyncCore (buffer, index, count));
-                       return res.Task;
-               }
-
-               async Task<int> ReadAsyncCore (char[] buffer, int index, int count)
-               {
-                       int chars_read = 0;
-
-                       while (count > 0) {
-                               if (pos >= decoded_count && await ReadBufferAsync ().ConfigureAwait (false) == 0)
-                                       return chars_read > 0 ? chars_read : 0;
-
-                               int cch = Math.Min (decoded_count - pos, count);
-                               Array.Copy (decoded_buffer, pos, buffer, index, cch);
-                               pos += cch;
-                               index += cch;
-                               count -= cch;
-                               chars_read += cch;
-                               if (mayBlock)
-                                       break;
-                       }
-
-                       return chars_read;
-               }
-
-               public override Task<int> ReadBlockAsync (char[] buffer, int index, int count)
-               {
-                       if (buffer == null)
-                               throw new ArgumentNullException ("buffer");
-                       if (index < 0)
-                               throw new ArgumentOutOfRangeException ("index", "< 0");
-                       if (count < 0)
-                               throw new ArgumentOutOfRangeException ("count", "< 0");
-                       // re-ordered to avoid possible integer overflow
-                       if (index > buffer.Length - count)
-                               throw new ArgumentException ("index + count > buffer.Length");
-
-                       CheckState ();
-
-                       DecoupledTask<int> res;
-                       async_task = res = new DecoupledTask<int> (ReadAsyncCore (buffer, index, count));
-                       return res.Task;
-               }
-
-               public override Task<string> ReadLineAsync ()
-               {
-                       CheckState ();
-
-                       DecoupledTask<string> res;
-                       async_task = res = new DecoupledTask<string> (ReadLineAsyncCore ());
-                       return res.Task;
-               }
-
-               async Task<string> ReadLineAsyncCore ()
-               {
-                       if (pos >= decoded_count && await ReadBufferAsync ().ConfigureAwait (false) == 0)
-                               return null;
-
-                       int begin = pos;
-                       int end = FindNextEOL ();
-                       if (end < decoded_count && end >= begin)
-                               return new string (decoded_buffer, begin, end - begin);
-                       if (end == -2)
-                               return line_builder.ToString (0, line_builder.Length);
-
-                       if (line_builder == null)
-                               line_builder = new StringBuilder ();
-                       else
-                               line_builder.Length = 0;
-
-                       while (true) {
-                               if (foundCR) // don't include the trailing CR if present
-                                       decoded_count--;
-
-                               line_builder.Append (decoded_buffer, begin, decoded_count - begin);
-                               if (await ReadBufferAsync ().ConfigureAwait (false) == 0) {
-                                       if (line_builder.Capacity > 32768) {
-                                               StringBuilder sb = line_builder;
-                                               line_builder = null;
-                                               return sb.ToString (0, sb.Length);
-                                       }
-                                       return line_builder.ToString (0, line_builder.Length);
-                               }
-
-                               begin = pos;
-                               end = FindNextEOL ();
-                               if (end < decoded_count && end >= begin) {
-                                       line_builder.Append (decoded_buffer, begin, end - begin);
-                                       if (line_builder.Capacity > 32768) {
-                                               StringBuilder sb = line_builder;
-                                               line_builder = null;
-                                               return sb.ToString (0, sb.Length);
-                                       }
-                                       return line_builder.ToString (0, line_builder.Length);
-                               }
-
-                               if (end == -2)
-                                       return line_builder.ToString (0, line_builder.Length);
-                       }
-               }
-
-               public override Task<string> ReadToEndAsync ()
-               {
-                       CheckState ();
-
-                       DecoupledTask<string> res;
-                       async_task = res = new DecoupledTask<string> (ReadToEndAsyncCore ());
-                       return res.Task;
-               }
-
-               async Task<string> ReadToEndAsyncCore ()
-               {
-                       StringBuilder text = new StringBuilder ();
-
-                       do {
-                               text.Append (decoded_buffer, pos, decoded_count - pos);
-                       } while (await ReadBufferAsync () != 0);
-
-                       return text.ToString ();
-               }
-
-               async Task<int> ReadBufferAsync ()
-               {
-                       pos = 0;
-
-                       // keep looping until the decoder gives us some chars
-                       decoded_count = 0;
-                       do {
-                               var cbEncoded = await base_stream.ReadAsync (input_buffer, 0, buffer_size).ConfigureAwait (false);
-                               if (cbEncoded <= 0)
-                                       return 0;
-
-                               decoded_count = ReadBufferCore (cbEncoded);
-                       } while (decoded_count == 0);
-
-                       return decoded_count;
-               }
-       }
-}
diff --git a/mcs/class/corlib/System.IO/StreamWriter.cs b/mcs/class/corlib/System.IO/StreamWriter.cs
deleted file mode 100644 (file)
index ef4e866..0000000
+++ /dev/null
@@ -1,546 +0,0 @@
-//\r
-// System.IO.StreamWriter.cs\r
-//\r
-// Authors:\r
-//   Dietmar Maurer (dietmar@ximian.com)\r
-//   Paolo Molaro (lupus@ximian.com)\r
-//   Marek Safar (marek.safar@gmail.com)\r
-//\r
-// (C) Ximian, Inc.  http://www.ximian.com\r
-// Copyright (C) 2004 Novell, Inc (http://www.novell.com)\r
-// Copyright 2011, 2013 Xamarin Inc.\r
-//\r
-// Permission is hereby granted, free of charge, to any person obtaining\r
-// a copy of this software and associated documentation files (the\r
-// "Software"), to deal in the Software without restriction, including\r
-// without limitation the rights to use, copy, modify, merge, publish,\r
-// distribute, sublicense, and/or sell copies of the Software, and to\r
-// permit persons to whom the Software is furnished to do so, subject to\r
-// the following conditions:\r
-// \r
-// The above copyright notice and this permission notice shall be\r
-// included in all copies or substantial portions of the Software.\r
-// \r
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE\r
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\r
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION\r
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r
-//\r
-\r
-using System.Text;\r
-using System.Runtime.InteropServices;\r
-using System.Threading.Tasks;\r
-\r
-namespace System.IO {\r
-       \r
-       [Serializable]\r
-       [ComVisible (true)]\r
-       public class StreamWriter : TextWriter {\r
-\r
-               private Encoding internalEncoding;\r
-\r
-               private Stream internalStream;\r
-\r
-               private const int DefaultBufferSize = 1024;\r
-               private const int DefaultFileBufferSize = 4096;\r
-               private const int MinimumBufferSize = 256;\r
-\r
-               private byte[] byte_buf;\r
-               private char[] decode_buf;\r
-               private int byte_pos;\r
-               private int decode_pos;\r
-\r
-               private bool iflush;\r
-               private bool preamble_done;\r
-\r
-               readonly bool leave_open;\r
-               IDecoupledTask async_task;\r
-\r
-               public new static readonly StreamWriter Null = new StreamWriter (Stream.Null, Encoding.UTF8Unmarked, 1);\r
-\r
-               public StreamWriter (Stream stream)\r
-                       : this (stream, Encoding.UTF8Unmarked, DefaultBufferSize) {}\r
-\r
-               public StreamWriter (Stream stream, Encoding encoding)\r
-                       : this (stream, encoding, DefaultBufferSize) {}\r
-\r
-               internal void Initialize(Encoding encoding, int bufferSize) {\r
-                       internalEncoding = encoding;\r
-                       decode_pos = byte_pos = 0;\r
-                       int BufferSize = Math.Max(bufferSize, MinimumBufferSize);\r
-                       decode_buf = new char [BufferSize];\r
-                       byte_buf = new byte [encoding.GetMaxByteCount (BufferSize)];\r
-\r
-                       // Fixes bug http://bugzilla.ximian.com/show_bug.cgi?id=74513\r
-                       if (internalStream.CanSeek && internalStream.Position > 0)\r
-                               preamble_done = true;\r
-               }\r
-\r
-               public StreamWriter (Stream stream, Encoding encoding, int bufferSize)\r
-                       : this (stream, encoding, bufferSize, false)\r
-               {\r
-               }\r
-               \r
-               public StreamWriter (Stream stream, Encoding encoding, int bufferSize, bool leaveOpen)\r
-               {\r
-                       if (null == stream)\r
-                               throw new ArgumentNullException("stream");\r
-                       if (null == encoding)\r
-                               throw new ArgumentNullException("encoding");\r
-                       if (bufferSize <= 0)\r
-                               throw new ArgumentOutOfRangeException("bufferSize");\r
-                       if (!stream.CanWrite)\r
-                               throw new ArgumentException ("Can not write to stream");\r
-\r
-                       leave_open = leaveOpen;\r
-                       internalStream = stream;\r
-\r
-                       Initialize(encoding, bufferSize);\r
-               }\r
-\r
-               public StreamWriter (string path)\r
-                       : this (path, false, Encoding.UTF8Unmarked, DefaultFileBufferSize) {}\r
-\r
-               public StreamWriter (string path, bool append)\r
-                       : this (path, append, Encoding.UTF8Unmarked, DefaultFileBufferSize) {}\r
-\r
-               public StreamWriter (string path, bool append, Encoding encoding)\r
-                       : this (path, append, encoding, DefaultFileBufferSize) {}\r
-\r
-               public StreamWriter (string path, bool append, Encoding encoding, int bufferSize)\r
-               {\r
-                       if (null == encoding)\r
-                               throw new ArgumentNullException("encoding");\r
-                       if (bufferSize <= 0)\r
-                               throw new ArgumentOutOfRangeException("bufferSize");\r
-\r
-                       FileMode mode;\r
-\r
-                       if (append)\r
-                               mode = FileMode.Append;\r
-                       else\r
-                               mode = FileMode.Create;\r
-                       \r
-                       internalStream = new FileStream (path, mode, FileAccess.Write, FileShare.Read);\r
-\r
-                       if (append)\r
-                               internalStream.Position = internalStream.Length;\r
-                       else\r
-                               internalStream.SetLength (0);\r
-\r
-                       Initialize(encoding, bufferSize);\r
-               }\r
-\r
-               public virtual bool AutoFlush {\r
-                       get {\r
-                               return iflush;\r
-                       }\r
-                       set {\r
-                               iflush = value;\r
-                               if (iflush)\r
-                                       Flush ();\r
-                       }\r
-               }\r
-\r
-               public virtual Stream BaseStream {\r
-                       get {\r
-                               return internalStream;\r
-                       }\r
-               }\r
-\r
-               public override Encoding Encoding {\r
-                       get {\r
-                               return internalEncoding;\r
-                       }\r
-               }\r
-\r
-               protected override void Dispose (bool disposing) \r
-               {\r
-                       if (byte_buf == null || !disposing)\r
-                               return;\r
-\r
-                       try {\r
-                               Flush ();\r
-                       } finally {\r
-                               byte_buf = null;\r
-                               internalEncoding = null;\r
-                               decode_buf = null;\r
-\r
-                               if (!leave_open) {\r
-                                       internalStream.Close ();\r
-                               }\r
-\r
-                               internalStream = null;\r
-                       }\r
-               }\r
-\r
-               public override void Flush ()\r
-               {\r
-                       CheckState ();\r
-                       FlushCore ();\r
-               }\r
-\r
-               // Keep in sync with FlushCoreAsync\r
-               void FlushCore ()\r
-               {\r
-                       Decode ();\r
-                       if (byte_pos > 0) {\r
-                               FlushBytes ();\r
-                               internalStream.Flush ();\r
-                       }\r
-               }\r
-\r
-               // how the speedup works:\r
-               // the Write () methods simply copy the characters in a buffer of chars (decode_buf)\r
-               // Decode () is called when the buffer is full or we need to flash.\r
-               // Decode () will use the encoding to get the bytes and but them inside\r
-               // byte_buf. From byte_buf the data is finally outputted to the stream.\r
-               void FlushBytes () \r
-               {\r
-                       // write the encoding preamble only at the start of the stream\r
-                       if (!preamble_done && byte_pos > 0) {\r
-                               byte[] preamble = internalEncoding.GetPreamble ();\r
-                               if (preamble.Length > 0)\r
-                                       internalStream.Write (preamble, 0, preamble.Length);\r
-                               preamble_done = true;\r
-                       }\r
-                       internalStream.Write (byte_buf, 0, byte_pos);\r
-                       byte_pos = 0;\r
-               }\r
-\r
-               void Decode () \r
-               {\r
-                       if (byte_pos > 0)\r
-                               FlushBytes ();\r
-                       if (decode_pos > 0) {\r
-                               int len = internalEncoding.GetBytes (decode_buf, 0, decode_pos, byte_buf, byte_pos);\r
-                               byte_pos += len;\r
-                               decode_pos = 0;\r
-                       }\r
-               }\r
-\r
-               void LowLevelWrite (char[] buffer, int index, int count)\r
-               {\r
-                       while (count > 0) {\r
-                               int todo = decode_buf.Length - decode_pos;\r
-                               if (todo == 0) {\r
-                                       Decode ();\r
-                                       todo = decode_buf.Length;\r
-                               }\r
-                               if (todo > count)\r
-                                       todo = count;\r
-                               Buffer.BlockCopy (buffer, index * 2, decode_buf, decode_pos * 2, todo * 2);\r
-                               count -= todo;\r
-                               index += todo;\r
-                               decode_pos += todo;\r
-                       }\r
-               }\r
-               \r
-               void LowLevelWrite (string s)\r
-               {\r
-                       int count = s.Length;\r
-                       int index = 0;\r
-                       while (count > 0) {\r
-                               int todo = decode_buf.Length - decode_pos;\r
-                               if (todo == 0) {\r
-                                       Decode ();\r
-                                       todo = decode_buf.Length;\r
-                               }\r
-                               if (todo > count)\r
-                                       todo = count;\r
-                               \r
-                               for (int i = 0; i < todo; i ++)\r
-                                       decode_buf [i + decode_pos] = s [i + index];\r
-                               \r
-                               count -= todo;\r
-                               index += todo;\r
-                               decode_pos += todo;\r
-                       }\r
-               }               \r
-\r
-               async Task FlushCoreAsync ()\r
-               {\r
-                       await DecodeAsync ().ConfigureAwait (false);\r
-                       if (byte_pos > 0) {\r
-                               await FlushBytesAsync ().ConfigureAwait (false);\r
-                               await internalStream.FlushAsync ().ConfigureAwait (false);\r
-                       }\r
-               }\r
-\r
-               async Task FlushBytesAsync ()\r
-               {\r
-                       // write the encoding preamble only at the start of the stream\r
-                       if (!preamble_done && byte_pos > 0) {\r
-                               byte[] preamble = internalEncoding.GetPreamble ();\r
-                               if (preamble.Length > 0)\r
-                                       await internalStream.WriteAsync (preamble, 0, preamble.Length).ConfigureAwait (false);\r
-                               preamble_done = true;\r
-                       }\r
-\r
-                       await internalStream.WriteAsync (byte_buf, 0, byte_pos).ConfigureAwait (false);\r
-                       byte_pos = 0;\r
-               }\r
-\r
-               async Task DecodeAsync () \r
-               {\r
-                       if (byte_pos > 0)\r
-                               await FlushBytesAsync ().ConfigureAwait (false);\r
-                       if (decode_pos > 0) {\r
-                               int len = internalEncoding.GetBytes (decode_buf, 0, decode_pos, byte_buf, byte_pos);\r
-                               byte_pos += len;\r
-                               decode_pos = 0;\r
-                       }\r
-               }               \r
-\r
-               async Task LowLevelWriteAsync (char[] buffer, int index, int count)\r
-               {\r
-                       while (count > 0) {\r
-                               int todo = decode_buf.Length - decode_pos;\r
-                               if (todo == 0) {\r
-                                       await DecodeAsync ().ConfigureAwait (false);\r
-                                       todo = decode_buf.Length;\r
-                               }\r
-                               if (todo > count)\r
-                                       todo = count;\r
-                               Buffer.BlockCopy (buffer, index * 2, decode_buf, decode_pos * 2, todo * 2);\r
-                               count -= todo;\r
-                               index += todo;\r
-                               decode_pos += todo;\r
-                       }\r
-               }\r
-               \r
-               async Task LowLevelWriteAsync (string s)\r
-               {\r
-                       int count = s.Length;\r
-                       int index = 0;\r
-                       while (count > 0) {\r
-                               int todo = decode_buf.Length - decode_pos;\r
-                               if (todo == 0) {\r
-                                       await DecodeAsync ().ConfigureAwait (false);\r
-                                       todo = decode_buf.Length;\r
-                               }\r
-                               if (todo > count)\r
-                                       todo = count;\r
-                               \r
-                               for (int i = 0; i < todo; i ++)\r
-                                       decode_buf [i + decode_pos] = s [i + index];\r
-                               \r
-                               count -= todo;\r
-                               index += todo;\r
-                               decode_pos += todo;\r
-                       }\r
-               }       \r
-\r
-               public override void Write (char[] buffer, int index, int count) \r
-               {\r
-                       if (buffer == null)\r
-                               throw new ArgumentNullException ("buffer");\r
-                       if (index < 0)\r
-                               throw new ArgumentOutOfRangeException ("index", "< 0");\r
-                       if (count < 0)\r
-                               throw new ArgumentOutOfRangeException ("count", "< 0");\r
-                       // re-ordered to avoid possible integer overflow\r
-                       if (index > buffer.Length - count)\r
-                               throw new ArgumentException ("index + count > buffer.Length");\r
-\r
-                       CheckState ();\r
-\r
-                       LowLevelWrite (buffer, index, count);\r
-                       if (iflush)\r
-                               FlushCore ();\r
-               }\r
-               \r
-               public override void Write (char value)\r
-               {\r
-                       CheckState ();\r
-\r
-                       // the size of decode_buf is always > 0 and\r
-                       // we check for overflow right away\r
-                       if (decode_pos >= decode_buf.Length)\r
-                               Decode ();\r
-                       decode_buf [decode_pos++] = value;\r
-                       if (iflush)\r
-                               FlushCore ();\r
-               }\r
-\r
-               public override void Write (char[] buffer)\r
-               {\r
-                       CheckState ();\r
-\r
-                       if (buffer != null)\r
-                               LowLevelWrite (buffer, 0, buffer.Length);\r
-                       if (iflush)\r
-                               FlushCore ();\r
-               }\r
-\r
-               public override void Write (string value) \r
-               {\r
-                       CheckState ();\r
-\r
-                       if (value == null)\r
-                               return;\r
-                       \r
-                       LowLevelWrite (value);\r
-                       \r
-                       if (iflush)\r
-                               FlushCore ();\r
-               }\r
-\r
-               public override void Close()\r
-               {\r
-                       Dispose (true);\r
-               }\r
-\r
-               void CheckState ()\r
-               {\r
-                       if (byte_buf == null)\r
-                               throw new ObjectDisposedException ("StreamWriter");\r
-\r
-                       if (async_task != null && !async_task.IsCompleted)\r
-                               throw new InvalidOperationException ();\r
-               }\r
-\r
-               public override Task FlushAsync ()\r
-               {\r
-                       CheckState ();\r
-                       DecoupledTask res;\r
-                       async_task = res = new DecoupledTask (FlushCoreAsync ());\r
-                       return res.Task;\r
-               }\r
-\r
-               public override Task WriteAsync (char value)\r
-               {\r
-                       CheckState ();\r
-\r
-                       DecoupledTask res;\r
-                       async_task = res = new DecoupledTask (WriteAsyncCore (value));\r
-                       return res.Task;\r
-               }\r
-\r
-               async Task WriteAsyncCore (char value)\r
-               {\r
-                       // the size of decode_buf is always > 0 and\r
-                       // we check for overflow right away\r
-                       if (decode_pos >= decode_buf.Length)\r
-                               await DecodeAsync ().ConfigureAwait (false);\r
-                       decode_buf [decode_pos++] = value;\r
-\r
-                       if (iflush)\r
-                               await FlushCoreAsync ().ConfigureAwait (false);\r
-               }\r
-\r
-               public override Task WriteAsync (char[] buffer, int index, int count)\r
-               {\r
-                       CheckState ();\r
-                       if (buffer == null)\r
-                               return TaskConstants.Finished;\r
-\r
-                       DecoupledTask res;\r
-                       async_task = res = new DecoupledTask (WriteAsyncCore (buffer, index, count));\r
-                       return res.Task;\r
-               }\r
-\r
-               async Task WriteAsyncCore (char[] buffer, int index, int count)\r
-               {\r
-                       // Debug.Assert (buffer == null);\r
-\r
-                       await LowLevelWriteAsync (buffer, index, count).ConfigureAwait (false);\r
-\r
-                       if (iflush)\r
-                               await FlushCoreAsync ().ConfigureAwait (false);\r
-               }\r
-\r
-               public override Task WriteAsync (string value)\r
-               {\r
-                       CheckState ();\r
-\r
-                       if (value == null)\r
-                               return TaskConstants.Finished;\r
-\r
-                       DecoupledTask res;                      \r
-                       async_task = res = new DecoupledTask (WriteAsyncCore (value, false));\r
-                       return res.Task;\r
-               }\r
-\r
-               async Task WriteAsyncCore (string value, bool appendNewLine)\r
-               {\r
-                       // Debug.Assert (value == null);\r
-\r
-                       await LowLevelWriteAsync (value).ConfigureAwait (false);\r
-                       if (appendNewLine)\r
-                               await LowLevelWriteAsync (CoreNewLine, 0, CoreNewLine.Length).ConfigureAwait (false);\r
-                       \r
-                       if (iflush)\r
-                               await FlushCoreAsync ().ConfigureAwait (false);\r
-               }               \r
-\r
-               public override Task WriteLineAsync ()\r
-               {\r
-                       CheckState ();\r
-\r
-                       DecoupledTask res;\r
-                       async_task = res = new DecoupledTask (WriteAsyncCore (CoreNewLine, 0, CoreNewLine.Length));\r
-                       return res.Task;\r
-               }\r
-\r
-               public override Task WriteLineAsync (char value)\r
-               {\r
-                       CheckState ();\r
-                       DecoupledTask res;\r
-                       async_task = res = new DecoupledTask (WriteLineAsyncCore (value));\r
-                       return res.Task;\r
-               }\r
-\r
-               async Task WriteLineAsyncCore (char value)\r
-               {\r
-                       await WriteAsyncCore (value).ConfigureAwait (false);\r
-                       await LowLevelWriteAsync (CoreNewLine, 0, CoreNewLine.Length).ConfigureAwait (false);\r
-                       \r
-                       if (iflush)\r
-                               await FlushCoreAsync ().ConfigureAwait (false);\r
-               }               \r
-\r
-               public override Task WriteLineAsync (char[] buffer, int index, int count)\r
-               {\r
-                       if (buffer == null)\r
-                               throw new ArgumentNullException ("buffer");\r
-                       if (index < 0)\r
-                               throw new ArgumentOutOfRangeException ("index", "< 0");\r
-                       if (count < 0)\r
-                               throw new ArgumentOutOfRangeException ("count", "< 0");\r
-                       // re-ordered to avoid possible integer overflow\r
-                       if (index > buffer.Length - count)\r
-                               throw new ArgumentException ("index + count > buffer.Length");\r
-\r
-                       CheckState ();\r
-                       DecoupledTask res;\r
-                       async_task = res = new DecoupledTask (WriteLineAsyncCore (buffer, index, count));\r
-                       return res.Task;\r
-               }\r
-\r
-               async Task WriteLineAsyncCore (char[] buffer, int index, int count)\r
-               {\r
-                       // Debug.Assert (buffer == null);\r
-\r
-                       await LowLevelWriteAsync (buffer, index, count).ConfigureAwait (false);\r
-                       await LowLevelWriteAsync (CoreNewLine, 0, CoreNewLine.Length).ConfigureAwait (false);\r
-                       \r
-                       if (iflush)\r
-                               await FlushCoreAsync ().ConfigureAwait (false);\r
-               }               \r
-\r
-               public override Task WriteLineAsync (string value)\r
-               {\r
-                       if (value == null)\r
-                               return WriteLineAsync ();\r
-\r
-                       CheckState ();\r
-                       DecoupledTask res;                      \r
-                       async_task = res = new DecoupledTask (WriteAsyncCore (value, true));\r
-                       return res.Task;\r
-               }\r
-       }\r
-}\r
diff --git a/mcs/class/corlib/System.IO/StringReader.cs b/mcs/class/corlib/System.IO/StringReader.cs
deleted file mode 100644 (file)
index bd8bd82..0000000
+++ /dev/null
@@ -1,186 +0,0 @@
-//
-// System.IO.StringReader
-//
-// Authors:
-//   Marcin Szczepanski (marcins@zipworld.com.au)
-//   Marek Safar (marek.safar@gmail.com)
-//
-// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
-// Copyright 2011 Xamarin Inc.
-//
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-// 
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-// 
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using System;
-using System.Globalization;
-using System.Runtime.InteropServices;
-using System.Threading.Tasks;
-
-namespace System.IO {
-       [Serializable]
-       [ComVisible (true)]
-       public class StringReader : TextReader {
-
-               string source;
-               int nextChar;
-               int sourceLength;
-               static char[] cr_lf;
-
-               public StringReader (string s)
-               {
-                       if (s == null) 
-                               throw new ArgumentNullException ("s");
-
-                       this.source = s;
-                       nextChar = 0;
-                       sourceLength = s.Length;
-               }
-
-               public override void Close ()
-               {
-                       Dispose (true);
-               }
-
-               protected override void Dispose (bool disposing)
-               {
-                       source = null;
-                       base.Dispose (disposing);
-               }
-
-               public override int Peek ()
-               {
-                       if (source == null)
-                               ObjectDisposedException ();
-
-                       if (nextChar >= sourceLength) 
-                               return -1;
-                       return (int)source [nextChar];
-               }
-
-               public override int Read ()
-               {
-                       if (source == null)
-                               ObjectDisposedException ();
-
-                       if (nextChar >= sourceLength)
-                               return -1;
-                       return (int)source [nextChar++];
-               }
-
-               // The method will read up to count characters from the StringReader
-               // into the buffer character array starting at position index. Returns
-               // the actual number of characters read, or zero if the end of the string
-               // has been reached and no characters are read.
-
-               public override int Read ([In, Out] char[] buffer, int index, int count)
-               {
-                       if (source == null)
-                               ObjectDisposedException ();
-
-                       if (buffer == null)
-                               throw new ArgumentNullException ("buffer");
-                       if (buffer.Length - index < count)
-                               throw new ArgumentException ();
-                       if (index < 0 || count < 0)
-                               throw new ArgumentOutOfRangeException ();
-
-                       int charsToRead;
-
-                       // reordered to avoir possible integer overflow
-                       if (nextChar > sourceLength - count)
-                               charsToRead = sourceLength - nextChar;
-                       else
-                               charsToRead = count;
-                       
-                       source.CopyTo (nextChar, buffer, index, charsToRead);
-
-                       nextChar += charsToRead;
-
-                       return charsToRead;
-               }
-
-               public override string ReadLine ()
-               {
-                       // Reads until next \r or \n or \r\n, otherwise return null
-
-                       if (source == null)
-                               ObjectDisposedException ();
-
-                       if (nextChar >= source.Length)
-                               return null;
-
-                       if (cr_lf == null)
-                               cr_lf = new char [] { '\n', '\r' };
-                       
-                       int readto = source.IndexOfAny (cr_lf, nextChar);
-                       
-                       if (readto == -1)
-                               return ReadToEnd ();
-
-                       bool consecutive = source[readto] == '\r'
-                               && readto + 1 < source.Length
-                               && source[readto + 1] == '\n';
-
-                       string nextLine = source.Substring (nextChar, readto - nextChar);
-                       nextChar = readto + ((consecutive) ? 2 : 1);
-                       return nextLine;
-               }
-
-               public override string ReadToEnd ()
-               {
-                       if (source == null)
-                               ObjectDisposedException ();
-                       string toEnd = source.Substring (nextChar, sourceLength - nextChar);
-                       nextChar = sourceLength;
-                       return toEnd;
-               }
-
-               //
-               // All async methods return finished task with a result as it's faster
-               // than setting up async call
-               //
-               public override Task<int> ReadAsync (char[] buffer, int index, int count)
-               {
-                       return Task.FromResult (Read (buffer, index, count));
-               }
-
-               public override Task<int> ReadBlockAsync (char[] buffer, int index, int count)
-               {
-                       return Task.FromResult (ReadBlock (buffer, index, count));
-               }
-
-               public override Task<string> ReadLineAsync ()
-               {
-                       return Task.FromResult (ReadLine ());
-               }
-
-               public override Task<string> ReadToEndAsync ()
-               {
-                       return Task.FromResult (ReadToEnd ());
-               }
-
-               static void ObjectDisposedException ()
-               {
-                       throw new ObjectDisposedException ("StringReader", 
-                                                          Locale.GetText ("Cannot read from a closed StringReader"));
-               }
-       }
-}
diff --git a/mcs/class/corlib/System.IO/StringWriter.cs b/mcs/class/corlib/System.IO/StringWriter.cs
deleted file mode 100644 (file)
index 6bd8360..0000000
+++ /dev/null
@@ -1,187 +0,0 @@
-//\r
-// System.IO.StringWriter\r
-//\r
-// Authors\r
-//     Marcin Szczepanski (marcins@zipworld.com.au)\r
-//     Sebastien Pouliot  <sebastien@ximian.com>\r
-//     Marek Safar (marek.safar@gmail.com)\r
-//\r
-//\r
-// Copyright (C) 2004 Novell, Inc (http://www.novell.com)\r
-// Copyright 2011 Xamarin Inc.\r
-//\r
-// Permission is hereby granted, free of charge, to any person obtaining\r
-// a copy of this software and associated documentation files (the\r
-// "Software"), to deal in the Software without restriction, including\r
-// without limitation the rights to use, copy, modify, merge, publish,\r
-// distribute, sublicense, and/or sell copies of the Software, and to\r
-// permit persons to whom the Software is furnished to do so, subject to\r
-// the following conditions:\r
-// \r
-// The above copyright notice and this permission notice shall be\r
-// included in all copies or substantial portions of the Software.\r
-// \r
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE\r
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\r
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION\r
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r
-//\r
-\r
-using System.Globalization;\r
-using System.Text;\r
-using System.Runtime.InteropServices;\r
-using System.Threading.Tasks;\r
-\r
-namespace System.IO\r
-{\r
-       [Serializable]\r
-       [ComVisible (true)]\r
-       [MonoLimitation ("Serialization format not compatible with .NET")]\r
-       public class StringWriter : TextWriter\r
-       {\r
-               private StringBuilder internalString;\r
-               private bool disposed;\r
-\r
-               public StringWriter ()\r
-                       : this (new StringBuilder ())\r
-               {\r
-               }\r
-\r
-               public StringWriter (IFormatProvider formatProvider)\r
-                       : this (new StringBuilder (), formatProvider)\r
-               {\r
-               }\r
-\r
-               public StringWriter (StringBuilder sb)\r
-                       : this (sb, null)\r
-               {\r
-               }\r
-\r
-               public StringWriter (StringBuilder sb, IFormatProvider formatProvider)\r
-               {\r
-                       if (sb == null)\r
-                               throw new ArgumentNullException ("sb");\r
-\r
-                       internalString = sb;\r
-                       internalFormatProvider = formatProvider;\r
-               }\r
-\r
-               public override Encoding Encoding {\r
-                       get {\r
-                               return Encoding.Unicode;\r
-                       }\r
-               }\r
-\r
-               public override void Close ()\r
-               {\r
-                       Dispose (true);\r
-                       disposed = true;\r
-               }\r
-\r
-               protected override void Dispose (bool disposing)\r
-               {\r
-                       // MS.NET doesn't clear internal buffer.\r
-                       // internalString = null;\r
-                       base.Dispose (disposing);\r
-                       disposed = true;\r
-               }\r
-\r
-               public virtual StringBuilder GetStringBuilder ()\r
-               {\r
-                       return internalString;\r
-               }\r
-\r
-               public override string ToString ()\r
-               {\r
-                       return internalString.ToString ();\r
-               }\r
-\r
-               public override void Write (char value)\r
-               {\r
-                       if (disposed) {\r
-                               throw new ObjectDisposedException ("StringReader",\r
-                                       Locale.GetText ("Cannot write to a closed StringWriter"));\r
-                       }\r
-\r
-                       internalString.Append (value);\r
-               }\r
-\r
-               public override void Write (string value)\r
-               {\r
-                       if (disposed) {\r
-                               throw new ObjectDisposedException ("StringReader",\r
-                                       Locale.GetText ("Cannot write to a closed StringWriter"));\r
-                       }\r
-\r
-                       internalString.Append (value);\r
-               }\r
-\r
-               public override void Write (char[] buffer, int index, int count)\r
-               {\r
-                       if (disposed) {\r
-                               throw new ObjectDisposedException ("StringReader",\r
-                                       Locale.GetText ("Cannot write to a closed StringWriter"));\r
-                       }\r
-                       if (buffer == null)\r
-                               throw new ArgumentNullException ("buffer");\r
-                       if (index < 0)\r
-                               throw new ArgumentOutOfRangeException ("index", "< 0");\r
-                       if (count < 0)\r
-                               throw new ArgumentOutOfRangeException ("count", "< 0");\r
-                       // re-ordered to avoid possible integer overflow\r
-                       if (index > buffer.Length - count)\r
-                               throw new ArgumentException ("index + count > buffer.Length");\r
-\r
-                       internalString.Append (buffer, index, count);\r
-               }\r
-\r
-               public override Task FlushAsync ()\r
-               {\r
-                       // it appears to do nothing\r
-                       return TaskConstants.Finished;\r
-               }\r
-\r
-               //\r
-               // All async methods return finished task with a result as it's faster\r
-               // than setting up async call\r
-               //\r
-               public override Task WriteAsync (char value)\r
-               {\r
-                       Write (value);\r
-                       return TaskConstants.Finished;\r
-               }\r
-\r
-               public override Task WriteAsync (char[] buffer, int index, int count)\r
-               {\r
-                       Write (buffer, index, count);\r
-                       return TaskConstants.Finished;\r
-               }\r
-\r
-               public override Task WriteAsync (string value)\r
-               {\r
-                       Write (value);\r
-                       return TaskConstants.Finished;\r
-               }\r
-\r
-               public override Task WriteLineAsync (char value)\r
-               {\r
-                       WriteLine (value);\r
-                       return TaskConstants.Finished;\r
-               }\r
-\r
-               public override Task WriteLineAsync (char[] buffer, int index, int count)\r
-               {\r
-                       WriteLine (buffer, index, count);\r
-                       return TaskConstants.Finished;\r
-               }\r
-\r
-               public override Task WriteLineAsync (string value)\r
-               {\r
-                       WriteLine (value);\r
-                       return TaskConstants.Finished;\r
-               }\r
-       }\r
-}
\ No newline at end of file
diff --git a/mcs/class/corlib/System.IO/TextReader.cs b/mcs/class/corlib/System.IO/TextReader.cs
deleted file mode 100644 (file)
index 6618209..0000000
+++ /dev/null
@@ -1,285 +0,0 @@
-//
-// System.IO.TextReader
-//
-// Authors:
-//   Marcin Szczepanski (marcins@zipworld.com.au)
-//   Miguel de Icaza (miguel@gnome.org)
-//   Marek Safar (marek.safar@gmail.com)
-
-//
-// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
-// Copyright 2011 Xamarin Inc.
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-// 
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-// 
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using System;
-using System.Runtime.InteropServices;
-using System.Threading.Tasks;
-
-namespace System.IO {
-
-       [Serializable]
-       [ComVisible (true)]
-#if NET_2_1
-       public abstract class TextReader : IDisposable {
-#else
-       public abstract class TextReader : MarshalByRefObject, IDisposable {
-#endif
-
-               sealed class NullTextReader : TextReader
-               {
-                       public override string ReadLine ()
-                       {
-                               return null;
-                       }
-
-                       public override string ReadToEnd ()
-                       {
-                               return String.Empty;
-                       }
-               }
-
-               public static readonly TextReader Null = new NullTextReader ();
-
-               protected TextReader()
-               {
-               }
-               
-               public virtual void Close()
-               { 
-                       Dispose(true);
-               }
-
-               public void Dispose ()
-               {
-                       Dispose(true);
-               }
-
-               protected virtual void Dispose (bool disposing)
-               {
-                       if (disposing){
-                               // If we are explicitly disposed, we can avoid finalization.
-                               GC.SuppressFinalize (this);
-                       }
-                       return;
-               }
-               
-               public virtual int Peek()
-               {
-                       return -1;
-               }
-               
-               public virtual int Read()
-               {
-                       return -1;
-               }
-               
-               public virtual int Read ([In, Out] char[] buffer, int index, int count)
-               {
-                       int c, i;
-                       
-                       for (i = 0; i < count; i++) {
-                               if ((c = Read ()) == -1)
-                                       return i;
-                               buffer [index + i] = (char)c;
-                       }
-                       
-                       return i;
-               }
-               
-               public virtual int ReadBlock ([In, Out] char [] buffer, int index, int count)
-               {
-                       int total_read_count = 0;
-                       int current_read_count;
-
-                       do {
-                               current_read_count = Read (buffer, index, count);
-                               index += current_read_count;
-                               total_read_count += current_read_count;
-                               count -= current_read_count;
-                       } while (current_read_count != 0 && count > 0);
-
-                       return total_read_count;
-               }
-
-               public virtual string ReadLine ()
-               { 
-                       var result = new System.Text.StringBuilder ();
-                       int c;
-
-                       while ((c = Read ()) != -1){
-                               // check simple character line ending
-                               if (c == '\n')
-                                       break;
-                               if (c == '\r') {
-                                       if (Peek () == '\n') 
-                                               Read ();
-                                       break;
-                               }
-                               result.Append ((char) c);
-                       }
-                       if (c == -1 && result.Length == 0)
-                               return null;
-                       
-                       return result.ToString ();
-               }
-
-               public virtual string ReadToEnd ()
-               { 
-                       var result = new System.Text.StringBuilder ();
-                       int c;
-                       while ((c = Read ()) != -1)
-                               result.Append ((char) c);
-                       return result.ToString ();
-               }
-
-               public static TextReader Synchronized (TextReader reader)
-               {
-                       if (reader == null)
-                               throw new ArgumentNullException ("reader is null");
-                       if (reader is SynchronizedReader)
-                               return reader;
-
-                       return new SynchronizedReader (reader);
-               }
-
-               //
-               // Use tuple to pack the arguments because it's faster than
-               // setting up anonymous method container with an instance delegate
-               //
-               public virtual Task<int> ReadAsync (char[] buffer, int index, int count)
-               {
-                       return Task.Factory.StartNew (l => {
-                               var t = (Tuple<TextReader, char[], int, int>) l;
-                               return t.Item1.Read (t.Item2, t.Item3, t.Item4);
-                       }, Tuple.Create (this, buffer, index, count));
-               }
-
-               public virtual Task<int> ReadBlockAsync (char[] buffer, int index, int count)
-               {
-                       return Task.Factory.StartNew (l => {
-                               var t = (Tuple<TextReader, char[], int, int>) l;
-                               return t.Item1.ReadBlock (t.Item2, t.Item3, t.Item4);
-                       }, Tuple.Create (this, buffer, index, count));
-               }
-
-               public virtual Task<string> ReadLineAsync ()
-               {
-                       return Task.Factory.StartNew (l => ((TextReader) l).ReadLine (), this);
-               }
-
-               public virtual Task<string> ReadToEndAsync ()
-               {
-                       return Task.Factory.StartNew (l => ((TextReader) l).ReadToEnd (), this);
-               }
-       }
-
-       //
-       // Synchronized Reader implementation, used internally.
-       //
-       [Serializable]
-       sealed class SynchronizedReader : TextReader
-       {
-               readonly TextReader reader;
-               
-               public SynchronizedReader (TextReader reader)
-               {
-                       this.reader = reader;
-               }
-
-               public override void Close ()
-               {
-                       lock (this){
-                               reader.Close ();
-                       }
-               }
-
-               public override int Peek ()
-               {
-                       lock (this){
-                               return reader.Peek ();
-                       }
-               }
-
-               public override int ReadBlock (char [] buffer, int index, int count)
-               {
-                       lock (this){
-                               return reader.ReadBlock (buffer, index, count);
-                       }
-               }
-
-               public override string ReadLine ()
-               {
-                       lock (this){
-                               return reader.ReadLine ();
-                       }
-               }
-
-               public override string ReadToEnd ()
-               {
-                       lock (this){
-                               return reader.ReadToEnd ();
-                       }
-               }
-
-               public override int Read ()
-               {
-                       lock (this){
-                               return reader.Read ();
-                       }
-               }
-
-               public override int Read (char [] buffer, int index, int count)
-               {
-                       lock (this){
-                               return reader.Read (buffer, index, count);
-                       }
-               }
-
-               public override Task<int> ReadAsync (char[] buffer, int index, int count)
-               {
-                       lock (this) {
-                               return reader.ReadAsync (buffer, index, count);
-                       }
-               }
-
-               public override Task<int> ReadBlockAsync (char[] buffer, int index, int count)
-               {
-                       lock (this) {
-                               return reader.ReadBlockAsync (buffer, index, count);
-                       }
-               }
-
-               public override Task<string> ReadLineAsync ()
-               {
-                       lock (this) {
-                               return reader.ReadLineAsync ();
-                       }
-               }
-
-               public override Task<string> ReadToEndAsync ()
-               {
-                       lock (this) {
-                               return reader.ReadToEndAsync ();
-                       }
-               }
-       }
-}
diff --git a/mcs/class/corlib/System.IO/TextWriter.cs b/mcs/class/corlib/System.IO/TextWriter.cs
deleted file mode 100644 (file)
index bedf269..0000000
+++ /dev/null
@@ -1,803 +0,0 @@
-//
-// System.IO.TextWriter.cs
-//
-// Authors:
-//   Marcin Szczepanski (marcins@zipworld.com.au)
-//   Miguel de Icaza (miguel@gnome.org)
-//   Paolo Molaro (lupus@ximian.com)
-//   Marek Safar (marek.safar@gmail.com)
-
-//
-// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
-// Copyright 2011 Xamarin Inc.
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-// 
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-// 
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using System.Text;
-using System.Runtime.InteropServices;
-using System.Threading.Tasks;
-
-namespace System.IO
-{
-
-       [Serializable]
-       [ComVisible (true)]
-#if NET_2_1
-       public abstract class TextWriter : IDisposable {
-#else
-       public abstract class TextWriter : MarshalByRefObject, IDisposable
-       {
-#endif
-               //
-               // Null version of the TextWriter, for the `Null' instance variable
-               //
-               sealed class NullTextWriter : TextWriter
-               {
-                       public override Encoding Encoding
-                       {
-                               get
-                               {
-                                       return Encoding.Default;
-                               }
-                       }
-
-                       public override void Write (string s)
-                       {
-                       }
-                       public override void Write (char value)
-                       {
-                       }
-                       public override void Write (char[] value, int index, int count)
-                       {
-                       }
-               }
-
-               protected TextWriter ()
-               {
-                       CoreNewLine = System.Environment.NewLine.ToCharArray ();
-               }
-
-               protected TextWriter (IFormatProvider formatProvider)
-               {
-                       CoreNewLine = System.Environment.NewLine.ToCharArray ();
-                       internalFormatProvider = formatProvider;
-               }
-
-               protected char[] CoreNewLine;
-
-               internal IFormatProvider internalFormatProvider;
-
-               public static readonly TextWriter Null = new NullTextWriter ();
-
-               public abstract Encoding Encoding { get; }
-
-               public virtual IFormatProvider FormatProvider {
-                       get {
-                               return internalFormatProvider;
-                       }
-               }
-
-               public virtual string NewLine {
-                       get {
-                               return new string (CoreNewLine);
-                       }
-
-                       set {
-                               if (value == null)
-                                       value = Environment.NewLine;
-
-                               CoreNewLine = value.ToCharArray ();
-                       }
-               }
-
-               public virtual void Close ()
-               {
-                       Dispose (true);
-               }
-
-               protected virtual void Dispose (bool disposing)
-               {
-                       if (disposing) {
-                               // If we are explicitly disposed, we can avoid finalization.
-                               GC.SuppressFinalize (this);
-                       }
-               }
-               public void Dispose ()
-               {
-                       Dispose (true);
-
-                       // If we are explicitly disposed, we can avoid finalization.
-                       GC.SuppressFinalize (this);
-               }
-
-               public virtual void Flush ()
-               {
-                       // do nothing
-               }
-
-               public static TextWriter Synchronized (TextWriter writer)
-               {
-                       return Synchronized (writer, false);
-               }
-
-               internal static TextWriter Synchronized (TextWriter writer, bool neverClose)
-               {
-                       if (writer == null)
-                               throw new ArgumentNullException ("writer is null");
-
-                       if (writer is SynchronizedWriter)
-                               return writer;
-
-                       return new SynchronizedWriter (writer, neverClose);
-               }
-
-               public virtual void Write (bool value)
-               {
-                       Write (value.ToString ());
-               }
-
-               public virtual void Write (char value)
-               {
-                       // Do nothing
-               }
-
-               public virtual void Write (char[] buffer)
-               {
-                       if (buffer == null)
-                               return;
-                       Write (buffer, 0, buffer.Length);
-               }
-
-               public virtual void Write (decimal value)
-               {
-                       Write (value.ToString (internalFormatProvider));
-               }
-
-               public virtual void Write (double value)
-               {
-                       Write (value.ToString (internalFormatProvider));
-               }
-
-               public virtual void Write (int value)
-               {
-                       Write (value.ToString (internalFormatProvider));
-               }
-
-               public virtual void Write (long value)
-               {
-                       Write (value.ToString (internalFormatProvider));
-               }
-
-               public virtual void Write (object value)
-               {
-                       if (value != null)
-                               Write (value.ToString ());
-               }
-
-               public virtual void Write (float value)
-               {
-                       Write (value.ToString (internalFormatProvider));
-               }
-
-               public virtual void Write (string value)
-               {
-                       if (value != null)
-                               Write (value.ToCharArray ());
-               }
-
-               [CLSCompliant (false)]
-               public virtual void Write (uint value)
-               {
-                       Write (value.ToString (internalFormatProvider));
-               }
-
-               [CLSCompliant (false)]
-               public virtual void Write (ulong value)
-               {
-                       Write (value.ToString (internalFormatProvider));
-               }
-
-               public virtual void Write (string format, object arg0)
-               {
-                       Write (String.Format (format, arg0));
-               }
-
-               public virtual void Write (string format, params object[] arg)
-               {
-                       Write (String.Format (format, arg));
-               }
-
-               public virtual void Write (char[] buffer, int index, int count)
-               {
-                       if (buffer == null)
-                               throw new ArgumentNullException ("buffer");
-                       if (index < 0 || index > buffer.Length)
-                               throw new ArgumentOutOfRangeException ("index");
-                       // re-ordered to avoid possible integer overflow
-                       if (count < 0 || (index > buffer.Length - count))
-                               throw new ArgumentOutOfRangeException ("count");
-
-                       for (; count > 0; --count, ++index) {
-                               Write (buffer[index]);
-                       }
-               }
-
-               public virtual void Write (string format, object arg0, object arg1)
-               {
-                       Write (String.Format (format, arg0, arg1));
-               }
-
-               public virtual void Write (string format, object arg0, object arg1, object arg2)
-               {
-                       Write (String.Format (format, arg0, arg1, arg2));
-               }
-
-               public virtual void WriteLine ()
-               {
-                       Write (CoreNewLine);
-               }
-
-               public virtual void WriteLine (bool value)
-               {
-                       Write (value);
-                       WriteLine ();
-               }
-
-               public virtual void WriteLine (char value)
-               {
-                       Write (value);
-                       WriteLine ();
-               }
-
-               public virtual void WriteLine (char[] buffer)
-               {
-                       Write (buffer);
-                       WriteLine ();
-               }
-
-               public virtual void WriteLine (decimal value)
-               {
-                       Write (value);
-                       WriteLine ();
-               }
-
-               public virtual void WriteLine (double value)
-               {
-                       Write (value);
-                       WriteLine ();
-               }
-
-               public virtual void WriteLine (int value)
-               {
-                       Write (value);
-                       WriteLine ();
-               }
-
-               public virtual void WriteLine (long value)
-               {
-                       Write (value);
-                       WriteLine ();
-               }
-
-               public virtual void WriteLine (object value)
-               {
-                       Write (value);
-                       WriteLine ();
-               }
-
-               public virtual void WriteLine (float value)
-               {
-                       Write (value);
-                       WriteLine ();
-               }
-
-               public virtual void WriteLine (string value)
-               {
-                       Write (value);
-                       WriteLine ();
-               }
-
-               [CLSCompliant (false)]
-               public virtual void WriteLine (uint value)
-               {
-                       Write (value);
-                       WriteLine ();
-               }
-
-               [CLSCompliant (false)]
-               public virtual void WriteLine (ulong value)
-               {
-                       Write (value);
-                       WriteLine ();
-               }
-
-               public virtual void WriteLine (string format, object arg0)
-               {
-                       Write (format, arg0);
-                       WriteLine ();
-               }
-
-               public virtual void WriteLine (string format, params object[] arg)
-               {
-                       Write (format, arg);
-                       WriteLine ();
-               }
-
-               public virtual void WriteLine (char[] buffer, int index, int count)
-               {
-                       Write (buffer, index, count);
-                       WriteLine ();
-               }
-
-               public virtual void WriteLine (string format, object arg0, object arg1)
-               {
-                       Write (format, arg0, arg1);
-                       WriteLine ();
-               }
-
-               public virtual void WriteLine (string format, object arg0, object arg1, object arg2)
-               {
-                       Write (format, arg0, arg1, arg2);
-                       WriteLine ();
-               }
-
-               public virtual Task FlushAsync ()
-               {
-                       return Task.Factory.StartNew (l => ((TextWriter)l).Flush (), this);
-               }
-
-               //
-               // Use tuple to pack the arguments because it's faster than
-               // setting up anonymous method container with an instance delegate
-               //
-               public virtual Task WriteAsync (char value)
-               {
-                       return Task.Factory.StartNew (l => {
-                               var t = (Tuple<TextWriter, char>) l;
-                               t.Item1.Write (t.Item2);
-                       }, Tuple.Create (this, value));
-               }
-
-               public Task WriteAsync (char[] buffer)
-               {
-                       if (buffer == null)
-                               return TaskConstants.Finished;
-
-                       return WriteAsync (buffer, 0, buffer.Length);
-               }
-
-               public virtual Task WriteAsync (char[] buffer, int index, int count)
-               {
-                       return Task.Factory.StartNew (l => {
-                               var t = (Tuple<TextWriter, char[], int, int>) l;
-                               t.Item1.Write (t.Item2, t.Item3, t.Item4);
-                       }, Tuple.Create (this, buffer, index, count));
-               }
-
-               public virtual Task WriteAsync (string value)
-               {
-                       return Task.Factory.StartNew (l => {
-                               var t = (Tuple<TextWriter, string>) l;
-                               t.Item1.Write (t.Item2);
-                       }, Tuple.Create (this, value));
-               }
-
-               public virtual Task WriteLineAsync ()
-               {
-                       return WriteAsync (CoreNewLine);
-               }
-
-               public virtual Task WriteLineAsync (char value)
-               {
-                       return Task.Factory.StartNew (l => {
-                               var t = (Tuple<TextWriter, char>) l;
-                               t.Item1.WriteLine (t.Item2);
-                       }, Tuple.Create (this, value));
-               }
-
-               public Task WriteLineAsync (char[] buffer)
-               {
-                       return Task.Factory.StartNew (l => {
-                               var t = (Tuple<TextWriter, char[]>) l;
-                               t.Item1.WriteLine (t.Item2);
-                       }, Tuple.Create (this, buffer));
-               }
-
-               public virtual Task WriteLineAsync (char[] buffer, int index, int count)
-               {
-                       return Task.Factory.StartNew (l => {
-                               var t = (Tuple<TextWriter, char[], int, int>) l;
-                               t.Item1.WriteLine (t.Item2, t.Item3, t.Item4);
-                       }, Tuple.Create (this, buffer, index, count));
-               }
-
-               public virtual Task WriteLineAsync (string value)
-               {
-                       return Task.Factory.StartNew (l => {
-                               var t = (Tuple<TextWriter, string>) l;
-                               t.Item1.WriteLine (t.Item2);
-                       }, Tuple.Create (this, value));
-               }
-       }
-
-       //
-       // Sychronized version of the TextWriter.
-       //
-       [Serializable]
-       sealed class SynchronizedWriter : TextWriter
-       {
-               private TextWriter writer;
-               private bool neverClose;
-
-               public SynchronizedWriter (TextWriter writer)
-                       : this (writer, false)
-               {
-               }
-
-               public SynchronizedWriter (TextWriter writer, bool neverClose)
-               {
-                       this.writer = writer;
-                       this.neverClose = neverClose;
-               }
-
-               public override void Close ()
-               {
-                       if (neverClose)
-                               return;
-                       lock (this) {
-                               writer.Close ();
-                       }
-               }
-
-               public override void Flush ()
-               {
-                       lock (this) {
-                               writer.Flush ();
-                       }
-               }
-
-               #region Write methods
-               public override void Write (bool value)
-               {
-                       lock (this) {
-                               writer.Write (value);
-                       }
-               }
-
-               public override void Write (char value)
-               {
-                       lock (this) {
-                               writer.Write (value);
-                       }
-               }
-
-               public override void Write (char[] value)
-               {
-                       lock (this) {
-                               writer.Write (value);
-                       }
-               }
-
-               public override void Write (Decimal value)
-               {
-                       lock (this) {
-                               writer.Write (value);
-                       }
-               }
-
-               public override void Write (int value)
-               {
-                       lock (this) {
-                               writer.Write (value);
-                       }
-               }
-
-               public override void Write (long value)
-               {
-                       lock (this) {
-                               writer.Write (value);
-                       }
-               }
-
-               public override void Write (object value)
-               {
-                       lock (this) {
-                               writer.Write (value);
-                       }
-               }
-
-               public override void Write (float value)
-               {
-                       lock (this) {
-                               writer.Write (value);
-                       }
-               }
-
-               public override void Write (string value)
-               {
-                       lock (this) {
-                               writer.Write (value);
-                       }
-               }
-
-               public override void Write (uint value)
-               {
-                       lock (this) {
-                               writer.Write (value);
-                       }
-               }
-
-               public override void Write (ulong value)
-               {
-                       lock (this) {
-                               writer.Write (value);
-                       }
-               }
-
-               public override void Write (string format, object value)
-               {
-                       lock (this) {
-                               writer.Write (format, value);
-                       }
-               }
-
-               public override void Write (string format, object[] value)
-               {
-                       lock (this) {
-                               writer.Write (format, value);
-                       }
-               }
-
-               public override void Write (char[] buffer, int index, int count)
-               {
-                       lock (this) {
-                               writer.Write (buffer, index, count);
-                       }
-               }
-
-               public override void Write (string format, object arg0, object arg1)
-               {
-                       lock (this) {
-                               writer.Write (format, arg0, arg1);
-                       }
-               }
-
-               public override void Write (string format, object arg0, object arg1, object arg2)
-               {
-                       lock (this) {
-                               writer.Write (format, arg0, arg1, arg2);
-                       }
-               }
-               #endregion
-               #region WriteLine methods
-               public override void WriteLine ()
-               {
-                       lock (this) {
-                               writer.WriteLine ();
-                       }
-               }
-
-               public override void WriteLine (bool value)
-               {
-                       lock (this) {
-                               writer.WriteLine (value);
-                       }
-               }
-
-               public override void WriteLine (char value)
-               {
-                       lock (this) {
-                               writer.WriteLine (value);
-                       }
-               }
-
-               public override void WriteLine (char[] value)
-               {
-                       lock (this) {
-                               writer.WriteLine (value);
-                       }
-               }
-
-               public override void WriteLine (Decimal value)
-               {
-                       lock (this) {
-                               writer.WriteLine (value);
-                       }
-               }
-
-               public override void WriteLine (double value)
-               {
-                       lock (this) {
-                               writer.WriteLine (value);
-                       }
-               }
-
-               public override void WriteLine (int value)
-               {
-                       lock (this) {
-                               writer.WriteLine (value);
-                       }
-               }
-
-               public override void WriteLine (long value)
-               {
-                       lock (this) {
-                               writer.WriteLine (value);
-                       }
-               }
-
-               public override void WriteLine (object value)
-               {
-                       lock (this) {
-                               writer.WriteLine (value);
-                       }
-               }
-
-               public override void WriteLine (float value)
-               {
-                       lock (this) {
-                               writer.WriteLine (value);
-                       }
-               }
-
-               public override void WriteLine (string value)
-               {
-                       lock (this) {
-                               writer.WriteLine (value);
-                       }
-               }
-
-               public override void WriteLine (uint value)
-               {
-                       lock (this) {
-                               writer.WriteLine (value);
-                       }
-               }
-
-               public override void WriteLine (ulong value)
-               {
-                       lock (this) {
-                               writer.WriteLine (value);
-                       }
-               }
-
-               public override void WriteLine (string format, object value)
-               {
-                       lock (this) {
-                               writer.WriteLine (format, value);
-                       }
-               }
-
-               public override void WriteLine (string format, object[] value)
-               {
-                       lock (this) {
-                               writer.WriteLine (format, value);
-                       }
-               }
-
-               public override void WriteLine (char[] buffer, int index, int count)
-               {
-                       lock (this) {
-                               writer.WriteLine (buffer, index, count);
-                       }
-               }
-
-               public override void WriteLine (string format, object arg0, object arg1)
-               {
-                       lock (this) {
-                               writer.WriteLine (format, arg0, arg1);
-                       }
-               }
-
-               public override void WriteLine (string format, object arg0, object arg1, object arg2)
-               {
-                       lock (this) {
-                               writer.WriteLine (format, arg0, arg1, arg2);
-                       }
-               }
-               #endregion
-
-               public override Task FlushAsync ()
-               {
-                       lock (this) {
-                               return writer.FlushAsync ();
-                       }
-               }
-
-               public override Task WriteAsync (char value)
-               {
-                       lock (this) {
-                               return writer.WriteAsync (value);
-                       }
-               }
-
-               public override Task WriteAsync (char[] buffer, int index, int count)
-               {
-                       lock (this) {
-                               return writer.WriteAsync (buffer, index, count);
-                       }
-               }
-
-               public override Task WriteAsync (string value)
-               {
-                       lock (this) {
-                               return writer.WriteAsync (value);
-                       }
-               }
-
-               public override Task WriteLineAsync ()
-               {
-                       lock (this) {
-                               return writer.WriteLineAsync ();
-                       }
-               }
-
-               public override Task WriteLineAsync (char value)
-               {
-                       lock (this) {
-                               return writer.WriteLineAsync (value);
-                       }
-               }
-
-               public override Task WriteLineAsync (char[] buffer, int index, int count)
-               {
-                       lock (this) {
-                               return writer.WriteLineAsync (buffer, index, count);
-                       }
-               }
-
-               public override Task WriteLineAsync (string value)
-               {
-                       lock (this) {
-                               return writer.WriteLineAsync (value);
-                       }
-               }
-               public override Encoding Encoding {
-                       get {
-                               lock (this) {
-                                       return writer.Encoding;
-                               }
-                       }
-               }
-
-               public override IFormatProvider FormatProvider {
-                       get {
-                               lock (this) {
-                                       return writer.FormatProvider;
-                               }
-                       }
-               }
-
-               public override string NewLine {
-                       get {
-                               lock (this) {
-                                       return writer.NewLine;
-                               }
-                       }
-
-                       set {
-                               lock (this) {
-                                       writer.NewLine = value;
-                               }
-                       }
-               }
-       }
-}
index e04caf7685e757a4e2e15864a1e0e9b59d445a95..d657303dd51e2761a63558af6b056f5ea264bc04 100644 (file)
@@ -52,7 +52,7 @@ namespace System.IO {
 */
                public UnexceptionalStreamWriter (Stream stream,
                                                  Encoding encoding)
-                       : base (stream, encoding)
+                       : base (stream, encoding, DefaultBufferSize, true)
                {
                }
 /*
index b44767bdf05afb0e3fad41a0ba62c143de7b8941..51b94b8aaafb14d1f5ba28dbde86d80a7d860c07 100644 (file)
@@ -41,7 +41,7 @@ namespace System.IO
        public class UnmanagedMemoryStream : Stream
        {
                long length;
-               bool closed;
+               internal bool closed;
                long capacity;
                FileAccess fileaccess;
                IntPtr initial_pointer;
index f1ba85efdd76de8d9cf04bf3c0715fb3d7515dcb..c3bb5a3fbf10cd6c2983d638f4e374d6bec8f2ed 100644 (file)
@@ -58,6 +58,31 @@ namespace System.Reflection {
                        public event ModuleResolveEventHandler ModuleResolve;
                }
 
+               internal class UnmanagedMemoryStreamForModule : UnmanagedMemoryStream
+               {
+                       Module module;
+
+                       public unsafe UnmanagedMemoryStreamForModule (byte* pointer, long length, Module module)
+                               : base (pointer, length)
+                       {
+                               this.module = module;
+                       }
+
+                       protected override void Dispose (bool disposing)
+                       {
+                               if (!closed) {
+                                       /* 
+                                        * The returned pointer points inside metadata, so
+                                        * we have to increase the refcount of the module, and decrease
+                                        * it when the stream is finalized.
+                                        */
+                                       module = null;
+                               }
+
+                               base.Dispose (disposing);
+                       }
+               }
+
                // Note: changes to fields must be reflected in _MonoReflectionAssembly struct (object-internals.h)
 #pragma warning disable 649
                private IntPtr _mono_assembly;
@@ -304,14 +329,8 @@ namespace System.Reflection {
                        else {
                                UnmanagedMemoryStream stream;
                                unsafe {
-                                       stream = new UnmanagedMemoryStream ((byte*) data, size);
+                                       stream = new UnmanagedMemoryStreamForModule ((byte*) data, size, module);
                                }
-                               /* 
-                                * The returned pointer points inside metadata, so
-                                * we have to increase the refcount of the module, and decrease
-                                * it when the stream is finalized.
-                                */
-                               stream.Closed += new EventHandler (new ResourceCloseHandler (module).OnClose);
                                return stream;
                        }
                }
@@ -705,21 +724,6 @@ namespace System.Reflection {
                                return null;
                }
 
-               private class ResourceCloseHandler {
-#pragma warning disable 169, 414
-                       Module module;
-#pragma warning restore 169, 414                       
-
-                       public ResourceCloseHandler (Module module) {
-                               this.module = module;
-                       }
-
-                       public void OnClose (object sender, EventArgs e) {
-                               // The module dtor will take care of things
-                               module = null;
-                       }
-               }
-
                [MonoTODO ("Currently it always returns zero")]
                [ComVisible (false)]
                public
index f73a8f8683d1cb581d5bb82119fffa9cc0706926..4acd3b5325603b62440614da2fac018d5194f868 100644 (file)
@@ -96,6 +96,26 @@ namespace System.Resources
                                ResourceValue = value;
                        }
                }
+
+               unsafe class HGlobalUnmanagedMemoryStream : UnmanagedMemoryStream
+               {
+                       IntPtr ptr;
+
+                       public HGlobalUnmanagedMemoryStream (byte* pointer, long length, IntPtr ptr)
+                               : base (pointer, length, length, FileAccess.ReadWrite)
+                       {
+                               this.ptr = ptr;
+                       }
+
+                       protected override void Dispose (bool disposing)
+                       {
+                               if (!closed) {
+                                       Marshal.FreeHGlobal (ptr);
+                               }
+
+                               base.Dispose (disposing);
+                       }
+               }
                
                BinaryReader reader;
                object readerLock = new object ();
@@ -448,12 +468,7 @@ namespace System.Resources
                                        } else {
                                                IntPtr ptr = Marshal.AllocHGlobal ((int) slen);
                                                byte* addr = (byte*) ptr.ToPointer ();
-                                               UnmanagedMemoryStream ms = new UnmanagedMemoryStream (addr, slen, slen, FileAccess.ReadWrite);
-                                               // The memory resource must be freed
-                                               // when the stream is disposed.
-                                               ms.Closed += delegate (object o, EventArgs e) {
-                                                       Marshal.FreeHGlobal (ptr);
-                                               };
+                                               UnmanagedMemoryStream ms = new HGlobalUnmanagedMemoryStream (addr, slen, ptr);
 
                                                byte [] bytes = new byte [slen < 1024 ? slen : 1024];
                                                while (slen > 0 ) {
index 1d685ea757d6b16e3f3cb4acc37293ac9681aec2..c08313b278fd1ee0bd9a4425621eb3014f573494 100644 (file)
@@ -112,6 +112,10 @@ namespace System.Security.Permissions {
                        throw new NotImplementedException ();
                }
 
+               internal FileIOPermission (FileIOPermissionAccess access, string[] pathList, bool checkForDuplicates, bool needFullPath)
+               {
+               }
+
                public FileIOPermissionAccess AllFiles {
                        get { return m_AllFilesAccess; } 
                        set {
diff --git a/mcs/class/corlib/System.Text/EncodingHelper.cs b/mcs/class/corlib/System.Text/EncodingHelper.cs
new file mode 100644 (file)
index 0000000..f077e44
--- /dev/null
@@ -0,0 +1,195 @@
+using System;
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Security;
+
+namespace System.Text
+{
+
+internal static class EncodingHelper
+{
+       //
+       // Only internal, to be used by the class libraries: Unmarked and non-input-validating
+       //
+       internal static Encoding UTF8Unmarked {
+               get {
+                       if (utf8EncodingWithoutMarkers == null) {
+                               lock (lockobj){
+                                       if (utf8EncodingWithoutMarkers == null){
+                                               utf8EncodingWithoutMarkers = new UTF8Encoding (false, false);
+                                               utf8EncodingWithoutMarkers.setReadOnly ();
+                                       }
+                               }
+                       }
+
+                       return utf8EncodingWithoutMarkers;
+               }
+       }
+       
+       //
+       // Only internal, to be used by the class libraries: Unmarked and non-input-validating
+       //
+       internal static Encoding UTF8UnmarkedUnsafe {
+               get {
+                       if (utf8EncodingUnsafe == null) {
+                               lock (lockobj){
+                                       if (utf8EncodingUnsafe == null){
+                                               utf8EncodingUnsafe = new UTF8Encoding (false, false);
+                                               utf8EncodingUnsafe.setReadOnly (false);
+                                               utf8EncodingUnsafe.DecoderFallback = new DecoderReplacementFallback (String.Empty);
+                                               utf8EncodingUnsafe.setReadOnly ();
+                                       }
+                               }
+                       }
+
+                       return utf8EncodingUnsafe;
+               }
+       }
+
+       // Get the standard big-endian UTF-32 encoding object.
+       internal static Encoding BigEndianUTF32
+       {
+               get {
+                       if (bigEndianUTF32Encoding == null) {
+                               lock (lockobj) {
+                                       if (bigEndianUTF32Encoding == null) {
+                                               bigEndianUTF32Encoding = new UTF32Encoding (true, true);
+                                               bigEndianUTF32Encoding.setReadOnly ();
+                                       }
+                               }
+                       }
+
+                       return bigEndianUTF32Encoding;
+               }
+       }
+       static volatile Encoding utf8EncodingWithoutMarkers;
+       static volatile Encoding utf8EncodingUnsafe;
+       static volatile Encoding bigEndianUTF32Encoding;
+       static readonly object lockobj = new object ();
+
+       [MethodImpl (MethodImplOptions.InternalCall)]
+       extern internal static string InternalCodePage (ref int code_page);
+
+       internal static Encoding GetDefaultEncoding ()
+       {
+               Encoding enc = null;
+                                               // See if the underlying system knows what
+                                               // code page handler we should be using.
+                                               int code_page = 1;
+                                               
+                                               string code_page_name = InternalCodePage (ref code_page);
+                                               try {
+                                                       if (code_page == -1)
+                                                               enc = Encoding.GetEncoding (code_page_name);
+                                                       else {
+                                                               // map the codepage from internal to our numbers
+                                                               code_page = code_page & 0x0fffffff;
+                                                               switch (code_page){
+                                                               case 1: code_page = 20127; break; // ASCIIEncoding.ASCII_CODE_PAGE
+                                                               case 2: code_page = 65007; break; // UTF7Encoding.UTF7_CODE_PAGE
+                                                               case 3: code_page = 65001; break; // UTF8Encoding.UTF8_CODE_PAGE
+                                                               case 4: code_page = 1200; break; // UnicodeEncoding.UNICODE_CODE_PAGE
+                                                               case 5: code_page = 1201; break; // UnicodeEncoding.BIG_UNICODE_CODE_PAGE
+                                                               case 6: code_page = 1252; break; // Latin1Encoding.ISOLATIN_CODE_PAGE
+                                                               }
+                                                               enc = Encoding.GetEncoding (code_page);
+                                                       }
+                                               } catch (NotSupportedException) {
+                                                       // code_page is not supported on underlying platform
+                                                       enc = EncodingHelper.UTF8Unmarked;
+                                               } catch (ArgumentException) {
+                                                       // code_page_name is not a valid code page, or is 
+                                                       // not supported by underlying OS
+                                                       enc = EncodingHelper.UTF8Unmarked;
+                                               }
+               return enc;
+       }
+
+       // Loaded copy of the "I18N" assembly.  We need to move
+       // this into a class in "System.Private" eventually.
+       private static Assembly i18nAssembly;
+       private static bool i18nDisabled;
+
+       // Invoke a specific method on the "I18N" manager object.
+       // Returns NULL if the method failed.
+       internal static Object InvokeI18N (String name, params Object[] args)
+       {
+               lock (lockobj) {
+                       // Bail out if we previously detected that there
+                       // is insufficent engine support for I18N handling.
+                       if (i18nDisabled) {
+                               return null;
+                       }
+
+                       // Find or load the "I18N" assembly.
+                       if (i18nAssembly == null) {
+                               try {
+                                       try {
+                                               i18nAssembly = Assembly.Load (Consts.AssemblyI18N);
+                                       } catch (NotImplementedException) {
+                                               // Assembly loading unsupported by the engine.
+                                               i18nDisabled = true;
+                                               return null;
+                                       }
+                                       if (i18nAssembly == null) {
+                                               return null;
+                                       }
+                               } catch (SystemException) {
+                                       return null;
+                               }
+                       }
+
+                       // Find the "I18N.Common.Manager" class.
+                       Type managerClass;
+                       try {
+                               managerClass = i18nAssembly.GetType ("I18N.Common.Manager");
+                       } catch (NotImplementedException) {
+                               // "GetType" is not supported by the engine.
+                               i18nDisabled = true;
+                               return null;
+                       }
+                       if (managerClass == null) {
+                               return null;
+                       }
+
+                       // Get the value of the "PrimaryManager" property.
+                       Object manager;
+                       try {
+                               manager = managerClass.InvokeMember
+                                               ("PrimaryManager",
+                                                BindingFlags.GetProperty |
+                                                       BindingFlags.Static |
+                                                       BindingFlags.Public,
+                                                null, null, null, null, null, null);
+                               if (manager == null) {
+                                       return null;
+                               }
+                       } catch (MissingMethodException) {
+                               return null;
+                       } catch (SecurityException) {
+                               return null;
+                       } catch (NotImplementedException) {
+                               // "InvokeMember" is not supported by the engine.
+                               i18nDisabled = true;
+                               return null;
+                       }
+
+                       // Invoke the requested method on the manager.
+                       try {
+                               return managerClass.InvokeMember
+                                               (name,
+                                                BindingFlags.InvokeMethod |
+                                                       BindingFlags.Instance |
+                                                       BindingFlags.Public,
+                                                null, manager, args, null, null, null);
+                       } catch (MissingMethodException) {
+                               return null;
+                       } catch (SecurityException) {
+                               return null;
+                       }
+               }
+       }
+}
+
+}
\ No newline at end of file
index ab3911286bb14e71ace61188a76803f60206cfca..1fb0165530be8c7b308557fe756ed2e2accceb0e 100644 (file)
@@ -31,6 +31,11 @@ using System;
 [Serializable]
 internal class Latin1Encoding : Encoding
 {
+       // until we change the callers:
+       internal static string _ (string arg) {
+               return arg;
+       }
+
        // Magic number used by Windows for the ISO Latin1 code page.
        internal const int ISOLATIN_CODE_PAGE = 28591;
 
index 46d02b6194bbc9123b9e800d016cb2d2f42106f6..0a80e11cfcb36c8df504ef42da678ec195a8b332 100644 (file)
@@ -114,5 +114,10 @@ namespace System {
 
                [MethodImplAttribute (MethodImplOptions.InternalCall)]
                internal extern static bool BlockCopyInternal (Array src, int src_offset, Array dest, int dest_offset, int count);
+
+               internal static bool InternalBlockCopy (Array src, int src_offset, Array dest, int dest_offset, int count)
+               {
+                       return BlockCopyInternal (src, src_offset, dest, dest_offset, count);
+               }
        }
 }
index 85436f8be30a8f46802e781b6ad687e44fff7e9a..5eaa353dc6c71bdb1c1e06b5ee60e8b07a4046d8 100644 (file)
@@ -39,8 +39,8 @@ namespace System.IO {
        class CStreamWriter : StreamWriter {
                TermInfoDriver driver;
 
-               public CStreamWriter (Stream stream, Encoding encoding)
-                       : base (stream, encoding)
+               public CStreamWriter (Stream stream, Encoding encoding, bool leaveOpen)
+                       : base (stream, encoding, DefaultBufferSize, leaveOpen)
                {
                        driver = (TermInfoDriver) ConsoleDriver.driver;
                }
index c0cc6f85e0775ed821ed52817a241796d73301c3..deb3eaf4bf76735cd197474d7f5775dcfda30b09 100644 (file)
@@ -125,11 +125,11 @@ namespace System
                                // UTF-8 ZWNBSP (zero-width non-breaking space).
                                //
                                int code_page = 0;
-                               Encoding.InternalCodePage (ref code_page);
+                               EncodingHelper.InternalCodePage (ref code_page);
 
                                if (code_page != -1 && ((code_page & 0x0fffffff) == 3 // UTF8Encoding.UTF8_CODE_PAGE
                                        || ((code_page & 0x10000000) != 0)))
-                                       inputEncoding = outputEncoding = Encoding.UTF8Unmarked;
+                                       inputEncoding = outputEncoding = EncodingHelper.UTF8Unmarked;
                                else
                                        inputEncoding = outputEncoding = Encoding.Default;
                        }
@@ -141,13 +141,13 @@ namespace System
                {
 #if !NET_2_1
                        if (!Environment.IsRunningOnWindows && ConsoleDriver.IsConsole) {
-                               StreamWriter w = new CStreamWriter (OpenStandardOutput (0), outputEncoding);
+                               StreamWriter w = new CStreamWriter (OpenStandardOutput (0), outputEncoding, true);
                                w.AutoFlush = true;
-                               stdout = TextWriter.Synchronized (w, true);
+                               stdout = TextWriter.Synchronized (w);
 
-                               w = new CStreamWriter (OpenStandardOutput (0), outputEncoding);
+                               w = new CStreamWriter (OpenStandardOutput (0), outputEncoding, true);
                                w.AutoFlush = true;
-                               stderr = TextWriter.Synchronized (w, true);
+                               stderr = TextWriter.Synchronized (w);
                                
                                stdin = new CStreamReader (OpenStandardInput (0), inputEncoding);
                        } else {
@@ -161,7 +161,7 @@ namespace System
                                stdout = new UnexceptionalStreamWriter (OpenStandardOutput (0), outputEncoding);
                                ((StreamWriter)stdout).AutoFlush = true;
 #endif
-                               stdout = TextWriter.Synchronized (stdout, true);
+                               stdout = TextWriter.Synchronized (stdout);
 
 #if MONOTOUCH && FULL_AOT_RUNTIME
                                stderr = new NSLogWriter ();
@@ -169,7 +169,7 @@ namespace System
                                stderr = new UnexceptionalStreamWriter (OpenStandardError (0), outputEncoding); 
                                ((StreamWriter)stderr).AutoFlush = true;
 #endif
-                               stderr = TextWriter.Synchronized (stderr, true);
+                               stderr = TextWriter.Synchronized (stderr);
 
                                stdin = new UnexceptionalStreamReader (OpenStandardInput (0), inputEncoding);
                                stdin = TextReader.Synchronized (stdin);
@@ -212,7 +212,7 @@ namespace System
                        try {
                                return new FileStream (handle, access, false, bufferSize, false, bufferSize == 0);
                        } catch (IOException) {
-                               return new NullStream ();
+                               return Stream.Null;
                        }
                }
 
index 42ba5d91bfc007c2b966e4751c3c21409b8ec739..fcef4169705e4ffa0a64bf24a6b516780e70b0f6 100644 (file)
@@ -51,6 +51,7 @@ using System.Runtime.ConstrainedExecution;
 using System.Runtime.InteropServices;
 using Mono.Globalization.Unicode;
 
+using System.Diagnostics.Contracts;
 
 namespace System
 {
@@ -3222,5 +3223,51 @@ namespace System
 
                [MethodImplAttribute (MethodImplOptions.InternalCall)]
                private extern static int GetLOSLimit ();
+
+#region "from referencesource" // and actually we replaced some parts.
+
+        // Helper for encodings so they can talk to our buffer directly
+        // stringLength must be the exact size we'll expect
+        [System.Security.SecurityCritical]  // auto-generated
+        unsafe static internal String CreateStringFromEncoding(
+            byte* bytes, int byteLength, Encoding encoding)
+        {
+            Contract.Requires(bytes != null);
+            Contract.Requires(byteLength >= 0);
+
+            // Get our string length
+            int stringLength = encoding.GetCharCount(bytes, byteLength, null);
+            Contract.Assert(stringLength >= 0, "stringLength >= 0");
+            
+            // They gave us an empty string if they needed one
+            // 0 bytelength might be possible if there's something in an encoder
+            if (stringLength == 0)
+                return String.Empty;
+            
+            String s = FastAllocateString(stringLength);
+            fixed(char* pTempChars = &s.start_char)
+            {
+                int doubleCheck = encoding.GetChars(bytes, byteLength, pTempChars, stringLength, null);
+                Contract.Assert(stringLength == doubleCheck, 
+                    "Expected encoding.GetChars to return same length as encoding.GetCharCount");
+            }
+
+            return s;
+        }
+
+               // our own implementation for CLR icall.
+               unsafe internal static int nativeCompareOrdinalIgnoreCaseWC (string name, sbyte *strBBytes)
+               {
+                       for (int i = 0; i < name.Length; i++) {
+                               sbyte b = *(strBBytes + i);
+                               if (b < 0)
+                                       throw new ArgumentException ();
+                               int ret = char.ToUpper ((char) b) - char.ToUpper (name [i]);
+                               if (ret != 0)
+                                       return ret;
+                       }
+                       return 0;
+               }
+#endregion
        }
 }
index 3690222a66186053e53bdd5c06ee926f0394d59c..5ab662ab0618133752ae4d0f439c447c3e6df049 100644 (file)
@@ -176,7 +176,7 @@ namespace System {
 
                        if (!(Console.stdout is CStreamWriter)) {
                                // Application set its own stdout, we need a reference to the real stdout
-                               stdout = new CStreamWriter (Console.OpenStandardOutput (0), Console.OutputEncoding);
+                               stdout = new CStreamWriter (Console.OpenStandardOutput (0), Console.OutputEncoding, false);
                                ((StreamWriter) stdout).AutoFlush = true;
                        } else {
                                stdout = (CStreamWriter) Console.stdout;
index 5d221a4d7b0b6fb01c717a04fab595c3ce043573..811f44db62c8d2d7b324dfb9243131f18ec17a0d 100644 (file)
@@ -568,6 +568,29 @@ public class BinaryWriterTest {
                Assert.AreEqual (new byte[] { 0 }, stream.ToArray (), "#7");
        }
 
+       [Test]
+       public void AsynchronousModeWrites ()
+       {
+               string filename = Path.Combine (TempFolder, "myfilename");
+
+               using (var file = new FileStream (filename, FileMode.CreateNew,
+                                         FileAccess.Write, FileShare.Read, 4096, FileOptions.Asynchronous))
+               using (var writer = new BinaryWriter (file)) {
+                       writer.Write (new byte[] { 0xCC, 0xDD } );
+                       writer.Write (new byte[] { 0xAA } );
+               }
+
+               using (var inputStream = new FileStream (filename, FileMode.Open))
+               {
+                       using (var reader = new BinaryReader (inputStream)) {
+                               var l = reader.ReadByte ();
+                               Assert.AreEqual (0xCC, l);
+
+                               Assert.AreEqual (3, inputStream.Length);
+                       }
+               }
+       }
+
        [Test]
        public void BaseStreamCallsFlush ()
        {
diff --git a/mcs/class/corlib/Test/System.Reflection/VisibilityTest.cs b/mcs/class/corlib/Test/System.Reflection/VisibilityTest.cs
new file mode 100644 (file)
index 0000000..3dcb3ae
--- /dev/null
@@ -0,0 +1,98 @@
+// VisibilityTest.cs
+//
+//
+// Author:
+//       Marius Ungureanu <marius.ungureanu@xamarin.com>
+//
+// Copyright (c) 2015 Xamarin, Inc (http://www.xamarin.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+#if !MONOTOUCH
+
+using System;
+using System.Linq;
+using System.Reflection;
+using NUnit.Framework;
+
+namespace MonoTests.System.Reflection.VisibilityTypes
+{
+       [TestFixture]
+       public class VisibilityTests
+       {
+               [Test]
+               public void TestsExportedTypes ()
+               {
+                       var types = typeof (VisibilityTests).Assembly.GetExportedTypes ();
+
+                       // Test visibility means that the class is public by applying and on the 'public' visibility of the nested items.
+                       CollectionAssert.DoesNotContain (types, typeof (InternalClass));
+                       CollectionAssert.Contains (types, typeof (PublicClass));
+
+                       CollectionAssert.DoesNotContain (types, Type.GetType ("MonoTests.System.Reflection.VisibilityTypes.VisibilityTests+InternalClass+InternalNested", true));
+                       CollectionAssert.DoesNotContain (types, Type.GetType ("MonoTests.System.Reflection.VisibilityTypes.VisibilityTests+InternalClass+PrivateNested", true));
+                       CollectionAssert.DoesNotContain (types, Type.GetType ("MonoTests.System.Reflection.VisibilityTypes.VisibilityTests+InternalClass+ProtectedNested", true));
+                       CollectionAssert.DoesNotContain (types, Type.GetType ("MonoTests.System.Reflection.VisibilityTypes.VisibilityTests+InternalClass+PublicNested", true));
+
+                       CollectionAssert.DoesNotContain (types, Type.GetType ("MonoTests.System.Reflection.VisibilityTypes.VisibilityTests+PublicClass+InternalNested", true));
+                       CollectionAssert.DoesNotContain (types, Type.GetType ("MonoTests.System.Reflection.VisibilityTypes.VisibilityTests+PublicClass+PrivateNested", true));
+                       CollectionAssert.DoesNotContain (types, Type.GetType ("MonoTests.System.Reflection.VisibilityTypes.VisibilityTests+PublicClass+ProtectedNested", true));
+                       CollectionAssert.Contains (types, Type.GetType ("MonoTests.System.Reflection.VisibilityTypes.VisibilityTests+PublicClass+PublicNested", true));
+               }
+
+               [Test]
+               public void TestsModuleTypes ()
+               {
+                       var types = typeof (VisibilityTests).Module.GetTypes ();
+
+                       // Test that all the types defined exist.
+                       CollectionAssert.Contains (types, typeof (InternalClass));
+                       CollectionAssert.Contains (types, typeof (PublicClass));
+
+                       CollectionAssert.Contains (types, Type.GetType ("MonoTests.System.Reflection.VisibilityTypes.VisibilityTests+InternalClass+InternalNested", true));
+                       CollectionAssert.Contains (types, Type.GetType ("MonoTests.System.Reflection.VisibilityTypes.VisibilityTests+InternalClass+PrivateNested", true));
+                       CollectionAssert.Contains (types, Type.GetType ("MonoTests.System.Reflection.VisibilityTypes.VisibilityTests+InternalClass+ProtectedNested", true));
+                       CollectionAssert.Contains (types, Type.GetType ("MonoTests.System.Reflection.VisibilityTypes.VisibilityTests+InternalClass+PublicNested", true));
+
+                       CollectionAssert.Contains (types, Type.GetType ("MonoTests.System.Reflection.VisibilityTypes.VisibilityTests+PublicClass+InternalNested", true));
+                       CollectionAssert.Contains (types, Type.GetType ("MonoTests.System.Reflection.VisibilityTypes.VisibilityTests+PublicClass+PrivateNested", true));
+                       CollectionAssert.Contains (types, Type.GetType ("MonoTests.System.Reflection.VisibilityTypes.VisibilityTests+PublicClass+ProtectedNested", true));
+                       CollectionAssert.Contains (types, Type.GetType ("MonoTests.System.Reflection.VisibilityTypes.VisibilityTests+PublicClass+PublicNested", true));
+               }
+
+               class InternalClass
+               {
+                       internal class InternalNested {}
+                       private class PrivateNested {}
+                       protected class ProtectedNested {}
+                       public class PublicNested {}
+               }
+
+               public class PublicClass
+               {
+                       internal class InternalNested {}
+                       private class PrivateNested {}
+                       protected class ProtectedNested {}
+                       public class PublicNested {}
+               }
+       }
+}
+
+#endif
+
index 4745e09b1e8378125f555dd80219447f50767194..16fca588d1e4a395222bdd3c7e335fba2b898143 100644 (file)
@@ -253,7 +253,7 @@ namespace MonoTests.System.Text
                        var chars = new char[] { '9', '8', '7', '6', '5' };
                        var ret = enc.GetChars (bytes, 0, bytes.Length, chars, 0);
                        
-                       Assert.That (ret, Is.EqualTo (4), "ret"); // FIXME: Wrong it should be 2
+                       Assert.That (ret, Is.EqualTo (2), "ret");
                        Assert.That (chars [0], Is.EqualTo ('0'), "chars[0]");
                        Assert.That (chars [1], Is.EqualTo ('1'), "chars[1]");
                        Assert.That (chars [2], Is.EqualTo ('7'), "chars[2]");
index 87e6c80fa8040898c0cb0dfbadd652e3f9daa0d9..6fa8643985af4311ea4a649c4de0b465deba45be 100644 (file)
@@ -57,7 +57,7 @@ namespace MonoTests.System.Text
                public void GetEncodingForAllInfo ()
                {
                        foreach (EncodingInfo i in Encoding.GetEncodings ())
-                               Assert.IsNotNull (i.GetEncoding (), "codepage " + i);
+                               Assert.IsNotNull (i.GetEncoding (), "codepage " + i.CodePage);
                }
 
                void GetEncoding (int id, List<int> list) {
index 6cb02f57f1e6f0bc9ad4a8eb3b6309d3b28f0e04..d5a310ee5638bd2ac1c54d939f8eac7ecbe63d1f 100644 (file)
@@ -9,18 +9,17 @@ namespace MonoTests.System.Text
        public class UTF32EncodingTest
        {
                [Test] // GetByteCount (Char [])
-               [Category ("NotDotNet")] // A1/B1 return 24 on MS
                public void GetByteCount1 ()
                {
                        char [] chars = new char[] { 'z', 'a', '\u0306',
                                '\u01FD', '\u03B2', '\uD8FF', '\uDCFF' };
 
                        UTF32Encoding le = new UTF32Encoding (false, true);
-                       Assert.AreEqual (28, le.GetByteCount (chars), "#A1");
+                       Assert.AreEqual (24, le.GetByteCount (chars), "#A1");
                        Assert.AreEqual (0, le.GetByteCount (new char [0]), "#A2");
 
                        UTF32Encoding be = new UTF32Encoding (true, true);
-                       Assert.AreEqual (28, be.GetByteCount (chars), "#B1");
+                       Assert.AreEqual (24, be.GetByteCount (chars), "#B1");
                        Assert.AreEqual (0, be.GetByteCount (new char [0]), "#B2");
                }
 
@@ -40,17 +39,16 @@ namespace MonoTests.System.Text
                }
 
                [Test] // GetByteCount (String)
-               [Category ("NotDotNet")] // A1/B1 return 24 on MS
                public void GetByteCount2 ()
                {
                        string s = "za\u0306\u01FD\u03B2\uD8FF\uDCFF";
 
                        UTF32Encoding le = new UTF32Encoding (false, true);
-                       Assert.AreEqual (28, le.GetByteCount (s), "#A1");
+                       Assert.AreEqual (24, le.GetByteCount (s), "#A1");
                        Assert.AreEqual (0, le.GetByteCount (string.Empty), "#A2");
 
                        UTF32Encoding be = new UTF32Encoding (true, true);
-                       Assert.AreEqual (28, be.GetByteCount (s), "#B1");
+                       Assert.AreEqual (24, be.GetByteCount (s), "#B1");
                        Assert.AreEqual (0, be.GetByteCount (string.Empty), "#B2");
                }
 
index 3b112fc57dbd7932f696a171520b8aa1a07f4e3a..2dbe7fb39fee3bd46979b67f4d3ef260cb83e39f 100644 (file)
@@ -269,7 +269,7 @@ namespace MonoTests.System.Text
 
                [Test]
                [ExpectedException (typeof (ArgumentException))]
-               [Category ("NotDotNet")] // MS bug
+               [Ignore ("referencesource bug")]
                public void Bug77315 ()
                {
                        string s = new UTF7Encoding ().GetString (
index 54460afd4e3b835e58c8794a4bb358f41414c54d..82aab2be0613795941937c7499286cc7e067d308 100644 (file)
@@ -1156,5 +1156,46 @@ namespace MonoTests.System.Text
                        data = new byte [] { 0xF4, 0x8F, 0xB0, 0xC0 };
                        t.TestDecoderFallback (data, "??", new byte [] { 0xF4, 0x8F, 0xB0 }, new byte [] { 0xC0 });
                }
+
+               [Test]
+               public void DecoderBug23771 ()
+               {
+                       var input = "\u733F"; // 'mono' on Japanese, 3bytes in UTF-8.
+                       var encoded = Encoding.UTF8.GetBytes (input);
+                       var decoder = Encoding.UTF8.GetDecoder ();
+                       var chars = new char [10]; // Just enough space to decode.
+                       var result = new StringBuilder ();
+                       var bytes = new byte [1]; // Simulates chunked input bytes.
+                       // Specify encoded bytes separetely.
+                       foreach (var b in encoded) {
+                               bytes [0] = b;
+                               int bytesUsed, charsUsed;
+                               bool completed;
+                               decoder.Convert (bytes, 0, bytes.Length, chars, 0, chars.Length, false, out bytesUsed, out charsUsed, out completed);
+                               result.Append (chars, 0, charsUsed);
+                               // Expected outputs are written in bottom.
+                               //Debug.Print ("bytesUsed:{0}, charsUsed:{1}, completed:{2}, result:'{3}'", bytesUsed, charsUsed, completed, result);
+                       }
+
+                       // Expected: NO assertion error.
+                       Assert.AreEqual (input, result.ToString (), "#1");
+
+                       /*
+                        * Expected Debug outputs are:
+                        * bytesUsed:1, charsUsed:0, completed:True, result:''
+                        * bytesUsed:1, charsUsed:0, completed:True, result:''
+                        * bytesUsed:1, charsUsed:1, completed:True, result:'猿'
+                        * 
+                        * -- Note: '猿' is U+733F (1char in UTF-16)
+                        * 
+                        * Actual Debug output are:
+                        * bytesUsed:3, charsUsed:1, completed:False, result:'�'
+                        * bytesUsed:3, charsUsed:1, completed:False, result:'��'
+                        * bytesUsed:3, charsUsed:1, completed:False, result:'���'
+                        * 
+                        * All output parameters are not match.
+                        * -- Note: '�' is decoder fallback char (U+FFFD)
+                        */
+               }
        }
 }
index 7920657da047e45b4a9abb471b52304abf10b9b0..d3241be3857225ed94ea26529291c9243e866732 100644 (file)
@@ -157,9 +157,9 @@ namespace MonoTests.System.Threading.Tasks
                        var mre = new ManualResetEventSlim (false);
 
                        Task[] tasks = new Task[3];
-                       tasks[0] = new Task (() => { Thread.Sleep (0); Assert.IsTrue (mre.Wait (3000)); });
-                       tasks[1] = new Task (() => { Assert.IsTrue (mre.Wait (3000)); });
-                       tasks[2] = new Task (() => { Assert.IsTrue (mre.Wait (3000)); });
+                       tasks[0] = new Task (() => { Thread.Sleep (0); Assert.IsTrue (mre.Wait (5000)); });
+                       tasks[1] = new Task (() => { Assert.IsTrue (mre.Wait (5000)); });
+                       tasks[2] = new Task (() => { Assert.IsTrue (mre.Wait (5000)); });
 
                        bool ran = false;
                        Task cont = factory.ContinueWhenAll (tasks, ts => {
@@ -172,7 +172,7 @@ namespace MonoTests.System.Threading.Tasks
 
                        mre.Set ();
 
-                       Assert.IsTrue (cont.Wait (1000), "#1");
+                       Assert.IsTrue (cont.Wait (3000), "#1");
                        Assert.IsTrue (ran, "#2");
                }
 
@@ -180,7 +180,7 @@ namespace MonoTests.System.Threading.Tasks
                public void ContinueWhenAll_WithMixedCompletionState ()
                {
                        var mre = new ManualResetEventSlim ();
-                       var task = Task.Factory.StartNew (() => mre.Wait (200));
+                       var task = Task.Factory.StartNew (() => mre.Wait (1000));
                        var contFailed = task.ContinueWith (t => {}, TaskContinuationOptions.OnlyOnFaulted);
                        var contCanceled = task.ContinueWith (t => {}, TaskContinuationOptions.OnlyOnCanceled);
                        var contSuccess = task.ContinueWith (t => {}, TaskContinuationOptions.OnlyOnRanToCompletion);
@@ -189,7 +189,7 @@ namespace MonoTests.System.Threading.Tasks
                        var cont = Task.Factory.ContinueWhenAll (new Task[] { contFailed, contCanceled, contSuccess }, _ => ran = true);
 
                        mre.Set ();
-                       cont.Wait (200);
+                       cont.Wait (3000);
 
                        Assert.IsTrue (ran);
                        Assert.AreEqual (TaskStatus.RanToCompletion, cont.Status);
@@ -261,8 +261,8 @@ namespace MonoTests.System.Threading.Tasks
                        var t2 = new ManualResetEvent (false);
 
                        var tasks = new Task[2] {
-                               Task.Factory.StartNew (() => { t1.WaitOne (3000); }),
-                               Task.Factory.StartNew (() => { t2.WaitOne (3000); })
+                               Task.Factory.StartNew (() => { t1.WaitOne (5000); }),
+                               Task.Factory.StartNew (() => { t2.WaitOne (5000); })
                        };
 
                        bool ran = false;
@@ -276,7 +276,7 @@ namespace MonoTests.System.Threading.Tasks
 
                        t1.Set ();
 
-                       Assert.IsTrue (cont.Wait (2000), "#10");
+                       Assert.IsTrue (cont.Wait (3000), "#10");
                        Assert.IsTrue (ran, "#11");
 
                        t2.Set ();
index 5e791a64467c5945d84ad1887eb7e803b5a76ffa..4b26ebaca5b41e04544cccb17d54ff429d21c620 100644 (file)
@@ -310,7 +310,6 @@ System.Diagnostics.SymbolStore/SymLanguageType.cs
 System.Diagnostics.SymbolStore/SymLanguageVendor.cs
 System.Globalization/CalendarAlgorithmType.cs
 System.Globalization/CalendarWeekRule.cs
-System.Globalization/CodePageDataItem.cs
 System.Globalization/CompareInfo.cs
 System.Globalization/CompareOptions.cs
 System.Globalization/CultureInfo.cs
@@ -332,7 +331,6 @@ System.Globalization/TextInfo.cs
 System.Globalization/UnicodeCategory.cs
 System.IO/BinaryReader.cs
 System.IO/BinaryWriter.cs
-System.IO/BufferedStream.cs
 System.IO/Directory.cs
 System.IO/DirectoryInfo.cs
 System.IO/DirectoryNotFoundException.cs
@@ -354,7 +352,6 @@ System.IO/FileStreamAsyncResult.cs
 System.IO/FileSystemInfo.cs
 System.IO/IOException.cs
 System.IO/LogcatTextWriter.cs
-System.IO/MemoryStream.cs
 System.IO/MonoIO.cs
 System.IO/MonoIOError.cs
 System.IO/MonoFileType.cs
@@ -364,13 +361,6 @@ System.IO/PathTooLongException.cs
 System.IO/SearchOption.cs
 System.IO/SearchPattern.cs
 System.IO/SeekOrigin.cs
-System.IO/Stream.cs
-System.IO/StreamReader.cs
-System.IO/StreamWriter.cs
-System.IO/StringReader.cs
-System.IO/StringWriter.cs
-System.IO/TextReader.cs
-System.IO/TextWriter.cs
 System.IO/UnexceptionalStreamReader.cs
 System.IO/UnexceptionalStreamWriter.cs
 System.IO/UnmanagedMemoryAccessor.cs
@@ -1344,37 +1334,32 @@ System.Security.Principal/WindowsBuiltInRole.cs
 System.Security.Principal/WindowsIdentity.cs
 System.Security.Principal/WindowsImpersonationContext.cs
 System.Security.Principal/WindowsPrincipal.cs
-System.Text/ASCIIEncoding.cs
-System.Text/CodePageEncoding.cs
-System.Text/Decoder.cs
-System.Text/DecoderExceptionFallback.cs
-System.Text/DecoderExceptionFallbackBuffer.cs
-System.Text/DecoderFallback.cs
-System.Text/DecoderFallbackBuffer.cs
-System.Text/DecoderFallbackException.cs
-System.Text/DecoderReplacementFallback.cs
-System.Text/DecoderReplacementFallbackBuffer.cs
-System.Text/Encoder.cs
-System.Text/EncoderExceptionFallback.cs
-System.Text/EncoderExceptionFallbackBuffer.cs
-System.Text/EncoderFallback.cs
-System.Text/EncoderFallbackBuffer.cs
-System.Text/EncoderFallbackException.cs
-System.Text/EncoderReplacementFallback.cs
-System.Text/EncoderReplacementFallbackBuffer.cs
-System.Text/Encoding.cs
-System.Text/EncodingEncoder.cs
-System.Text/EncodingDecoder.cs
-System.Text/EncodingInfo.cs
-System.Text/Latin1Encoding.cs
-System.Text/MLangCodePageEncoding.cs
+System.Text/EncodingHelper.cs
 System.Text/NormalizationForm.cs
 System.Text/StringBuilder.cs
-System.Text/SurrogateEncoder.cs
-System.Text/UnicodeEncoding.cs
-System.Text/UTF7Encoding.cs
-System.Text/UTF8Encoding.cs
-System.Text/UTF32Encoding.cs
+System.Text/Latin1Encoding.cs
+../../../external/referencesource/mscorlib/system/text/asciiencoding.cs
+../../../external/referencesource/mscorlib/system/text/codepageencoding.cs
+../../../external/referencesource/mscorlib/system/text/decoderbestfitfallback.cs
+../../../external/referencesource/mscorlib/system/text/decoder.cs
+../../../external/referencesource/mscorlib/system/text/decodernls.cs
+../../../external/referencesource/mscorlib/system/text/decoderexceptionfallback.cs
+../../../external/referencesource/mscorlib/system/text/decoderfallback.cs
+../../../external/referencesource/mscorlib/system/text/decoderreplacementfallback.cs
+../../../external/referencesource/mscorlib/system/text/encoderbestfitfallback.cs
+../../../external/referencesource/mscorlib/system/text/encoder.cs
+../../../external/referencesource/mscorlib/system/text/encodernls.cs
+../../../external/referencesource/mscorlib/system/text/encoderexceptionfallback.cs
+../../../external/referencesource/mscorlib/system/text/encoderfallback.cs
+../../../external/referencesource/mscorlib/system/text/encoderreplacementfallback.cs
+../../../external/referencesource/mscorlib/system/text/encoding.cs
+../../../external/referencesource/mscorlib/system/text/encodinginfo.cs
+../../../external/referencesource/mscorlib/system/text/mlangcodepageencoding.cs
+../../../external/referencesource/mscorlib/system/text/surrogateencoder.cs
+../../../external/referencesource/mscorlib/system/text/unicodeencoding.cs
+../../../external/referencesource/mscorlib/system/text/utf32encoding.cs
+../../../external/referencesource/mscorlib/system/text/utf7encoding.cs
+../../../external/referencesource/mscorlib/system/text/utf8encoding.cs
 System.Threading/AsyncFlowControl.cs
 System.Threading/CompressedStack.cs
 System.Threading/ContextCallback.cs
@@ -1421,6 +1406,7 @@ System.Collections.Concurrent/ConcurrentOrderedList.cs
 ../Mono.Parallel/Mono.Threading/AtomicBoolean.cs
 System.Threading/ThreadLocal.cs
 
+ReferenceSources/__ConsoleStream.cs
 ReferenceSources/Array.cs
 ReferenceSources/BCLDebug.cs
 ReferenceSources/CalendarData.cs
@@ -1429,12 +1415,13 @@ ReferenceSources/CultureData.cs
 ReferenceSources/Environment.cs
 ReferenceSources/ExecutionContext.cs
 ReferenceSources/HashHelpers.cs
-ReferenceSources/mscorlib.txt.cs
 ReferenceSources/ParseNumbers.cs
 ReferenceSources/TimeZoneInfoOptions.cs
 ReferenceSources/AppDomain.cs
 ReferenceSources/CLRConfig.cs
 ReferenceSources/JitHelpers.cs
+ReferenceSources/EncodingDataItem.cs
+ReferenceSources/EncodingTable.cs
 
 ../../../external/referencesource/mscorlib/system/__hresults.cs
 ../../../external/referencesource/mscorlib/system/AggregateException.cs
@@ -1573,6 +1560,17 @@ ReferenceSources/JitHelpers.cs
 ../../../external/referencesource/mscorlib/system/globalization/thaibuddhistcalendar.cs
 ../../../external/referencesource/mscorlib/system/globalization/umalquracalendar.cs
 
+../../../external/referencesource/mscorlib/system/io/__error.cs
+../../../external/referencesource/mscorlib/system/io/bufferedstream.cs
+../../../external/referencesource/mscorlib/system/io/memorystream.cs
+../../../external/referencesource/mscorlib/system/io/stream.cs
+../../../external/referencesource/mscorlib/system/io/streamreader.cs
+../../../external/referencesource/mscorlib/system/io/streamwriter.cs
+../../../external/referencesource/mscorlib/system/io/stringreader.cs
+../../../external/referencesource/mscorlib/system/io/stringwriter.cs
+../../../external/referencesource/mscorlib/system/io/textreader.cs
+../../../external/referencesource/mscorlib/system/io/textwriter.cs
+
 ../../../external/referencesource/mscorlib/system/runtime/versioning/binarycompatibility.cs
 ../../../external/referencesource/mscorlib/system/runtime/versioning/targetframeworkid.cs
 
@@ -1661,6 +1659,7 @@ ReferenceSources/JitHelpers.cs
 ../../../external/referencesource/mscorlib/system/threading/timeout.cs
 ../../../external/referencesource/mscorlib/system/threading/waithandlecannotbeopenedexception.cs
 
+../../../external/referencesource/mscorlib/system/threading/Tasks/BeginEndAwaitableAdapter.cs
 ../../../external/referencesource/mscorlib/system/threading/Tasks/TaskFactory.cs
 ../../../external/referencesource/mscorlib/system/threading/Tasks/FutureFactory.cs
 ../../../external/referencesource/mscorlib/system/threading/Tasks/TaskScheduler.cs
@@ -1677,4 +1676,6 @@ ReferenceSources/JitHelpers.cs
 ../../../external/referencesource/mscorlib/system/threading/Tasks/TaskExceptionHolder.cs
 ../../../external/referencesource/mscorlib/system/threading/Tasks/ConcurrentExclusiveSchedulerPair.cs
 ../../../external/referencesource/mscorlib/system/threading/Tasks/ProducerConsumerQueues.cs
+../../../external/referencesource/mscorlib/system/threading/Tasks/TaskToApm.cs
+
 
index e03f139adb91307cbb7a2e5a9ca39a3695a19ba1..33dabcf9c99e45c16e513a4e4c8867662c17de26 100644 (file)
@@ -148,6 +148,7 @@ System.Reflection/ParameterInfoTest.cs
 System.Reflection/PropertyInfoTest.cs
 System.Reflection/ReflectedTypeTest.cs
 System.Reflection/TypeDelegatorTest.cs
+System.Reflection/VisibilityTest.cs
 System.Reflection.Emit/AssemblyBuilderTest.cs
 System.Reflection.Emit/AssemblyBuilderAccessTest.cs
 System.Reflection.Emit/ConstructorBuilderTest.cs
diff --git a/mcs/errors/cs0135-2.cs b/mcs/errors/cs0135-2.cs
deleted file mode 100644 (file)
index 788e3c0..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-// CS0135: `i' conflicts with a declaration in a child block
-// Line: 10
-
-delegate int F (int i);
-class Foo {
-       static int i;
-       static void Main ()
-       {
-               F f = delegate (int i) { return i; };
-               i = 0;
-       }
-}
diff --git a/mcs/errors/cs0135-3.cs b/mcs/errors/cs0135-3.cs
deleted file mode 100644 (file)
index bc1a8c2..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-// CS0135: `i' conflicts with a declaration in a child block
-// Line: 9
-
-delegate int F (int i);
-class Foo {
-       static int i;
-       static void Main ()
-       {
-               i = 0;
-               F f = delegate (int i) { return i; };
-       }
-}
diff --git a/mcs/errors/cs0135-4.cs b/mcs/errors/cs0135-4.cs
deleted file mode 100644 (file)
index 62e6e62..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-// CS0135: `test' conflicts with a declaration in a child block
-// Line: 13
-
-class ClassMain
-{
-       static bool test = true;
-
-       public static void Main ()
-       {
-               if (true) {
-                       const bool test = false;
-               }
-               test = false;
-       }
-}
-
diff --git a/mcs/errors/cs0135-5.cs b/mcs/errors/cs0135-5.cs
deleted file mode 100644 (file)
index 8e75a88..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-// CS0135: `bar' conflicts with a declaration in a child block
-// Line: 13
-
-public class Foo
-{
-       public static class Nested
-       {
-               static int bar ()
-               {
-                       return 0;
-               }
-               
-               public static void Bar ()
-               {
-                       var i = bar ();
-                       {
-                               bool bar = false;
-                       }
-               } 
-       }
-}
-
diff --git a/mcs/errors/cs0135-6.cs b/mcs/errors/cs0135-6.cs
deleted file mode 100644 (file)
index fd4a007..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-// CS0135: `bar' conflicts with a declaration in a child block
-// Line: 13
-
-public class Foo
-{
-       public static class Nested
-       {
-               class bar
-               {
-                       public static int value;
-               }
-               
-               public static void Bar ()
-               {
-                       {
-                               bool bar = false;
-                       }
-                       
-                       var i = bar.value;
-               } 
-       }
-}
-
diff --git a/mcs/errors/cs0135-7.cs b/mcs/errors/cs0135-7.cs
deleted file mode 100644 (file)
index 4a61197..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-// CS0135: `x' conflicts with a declaration in a child block
-// Line: 18
-
-public class Test
-{
-       Test x;
-
-       void Foo ()
-       {
-               {
-                       string x = "dd";
-               }
-
-               {
-                       x = null;
-               }
-
-               x = new Test ();
-       }
-
-       public static void Main () { }
-}
\ No newline at end of file
diff --git a/mcs/errors/cs0135.cs b/mcs/errors/cs0135.cs
deleted file mode 100644 (file)
index 8366f70..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
-// CS0135: `test' conflicts with a declaration in a child block
-// Line: 11
-
-class ClassMain {
-        static bool test = true;
-    
-        public static void Main() {
-                if (true) {
-                        bool test = false;
-                }
-                test = false;
-        }
-}
-
diff --git a/mcs/errors/cs0573-3.cs b/mcs/errors/cs0573-3.cs
new file mode 100644 (file)
index 0000000..e3faa9b
--- /dev/null
@@ -0,0 +1,9 @@
+// CS0573: 'S': Structs cannot have instance property or field initializers
+// Line: 8
+
+using System;
+
+struct S
+{
+       event Action E = null;
+}
\ No newline at end of file
index ca9e6fb7df4d6431d2a0a5ac7e9b317e878dc76a..e794d9a7612f074249e34a3bd3078db0d86d9b17 100644 (file)
@@ -2090,7 +2090,12 @@ namespace Mono.CSharp {
                                }
                        }
 
-                       ec.Emit (OpCodes.Ldstr, Value);
+                       var str = Value;
+                       if (ec.Module.GetResourceStrings != null && !ec.Module.GetResourceStrings.TryGetValue (str, out str)) {
+                               str = Value;
+                       }
+
+                       ec.Emit (OpCodes.Ldstr, str);
                }
 
                public override void EncodeAttributeValue (IMemberContext rc, AttributeEncoder enc, TypeSpec targetType, TypeSpec parameterType)
index d6f4a51e3708a3982427460cb719095f44995607..1f44fc2d566f552bfa6d025befb483173c70b08a 100644 (file)
@@ -3611,12 +3611,12 @@ member_initializer
 
                lbag.AddLocation ($$, GetLocation ($3));
          }
-       | OPEN_BRACKET_EXPR expression_list CLOSE_BRACKET ASSIGN initializer_value
+       | OPEN_BRACKET_EXPR argument_list CLOSE_BRACKET ASSIGN initializer_value
          {
                if (lang_version < LanguageVersion.V_6)
                        FeatureIsNotAvailable (GetLocation ($1), "dictionary initializer");
 
-               $$ = new DictionaryElementInitializer ((List<Expression>)$2, (Expression) $5, GetLocation ($1));
+               $$ = new DictionaryElementInitializer ((Arguments)$2, (Expression) $5, GetLocation ($1));
                lbag.AddLocation ($$, GetLocation ($3), GetLocation ($4));
          }
        | OPEN_BRACE CLOSE_BRACE
index 9f55f368256aae961d4d26d2154aa6a9807b8143..994fdb8afd54bae3e36c1a69098dec28ce132305 100644 (file)
@@ -362,6 +362,9 @@ namespace Mono.CSharp
 #endif
                        module.InitializePredefinedTypes ();
 
+                       if (settings.GetResourceStrings != null)
+                               module.LoadGetResourceStrings (settings.GetResourceStrings);
+
                        tr.Start (TimeReporter.TimerType.ModuleDefinitionTotal);
                        module.Define ();
                        tr.Stop (TimeReporter.TimerType.ModuleDefinitionTotal);
index a6aada45ef0f71270b077ffdb81cee28c1a72a25..19d041818bf74e1231169460b192e7431338c4ed 100644 (file)
@@ -996,6 +996,11 @@ namespace Mono.CSharp {
                        return members;
                }
 
+               protected static void Error_NamedArgument (NamedArgument na, Report Report)
+               {
+                       Report.Error (1742, na.Location, "An element access expression cannot use named argument");
+               }
+
                protected virtual void Error_NegativeArrayIndex (ResolveContext ec, Location loc)
                {
                        throw new NotImplementedException ();
@@ -1169,7 +1174,7 @@ namespace Mono.CSharp {
                        if (source.type.BuiltinType == BuiltinTypeSpec.Type.Dynamic) {
                                Arguments args = new Arguments (1);
                                args.Add (new Argument (source));
-                               return new DynamicConversion (btypes.Int, CSharpBinderFlags.ConvertArrayIndex, args, loc).Resolve (ec);
+                               return new DynamicConversion (btypes.Int, CSharpBinderFlags.ConvertArrayIndex, args, source.loc).Resolve (ec);
                        }
 
                        Expression converted;
@@ -1206,6 +1211,27 @@ namespace Mono.CSharp {
                        return new ArrayIndexCast (converted, btypes.Int).Resolve (ec);
                }
 
+               public Expression MakePointerAccess (ResolveContext rc, TypeSpec type, Arguments args)
+               {
+                       if (args.Count != 1){
+                               rc.Report.Error (196, loc, "A pointer must be indexed by only one value");
+                               return null;
+                       }
+
+                       var arg = args [0];
+                       if (arg is NamedArgument)
+                               Error_NamedArgument ((NamedArgument) arg, rc.Report);
+
+                       var index = arg.Expr.Resolve (rc);
+                       if (index == null)
+                               return null;
+
+                       index = ConvertExpressionToArrayIndex (rc, index, true);
+
+                       Expression p = new PointerArithmetic (Binary.Operator.Addition, this, index, type, loc);
+                       return new Indirection (p, loc);
+               }
+
                //
                // Derived classes implement this method by cloning the fields that
                // could become altered during the Resolve stage
@@ -2812,12 +2838,6 @@ namespace Mono.CSharp {
                                                        ErrorIsInaccesible (rc, me.GetSignatureForError (), loc);
                                                }
                                        } else {
-                                               // LAMESPEC: again, ignores InvocableOnly
-                                               if (variable != null) {
-                                                       rc.Report.SymbolRelatedToPreviousError (variable.Location, Name);
-                                                       rc.Report.Error (135, loc, "`{0}' conflicts with a declaration in a child block", Name);
-                                               }
-
                                                //
                                                // MemberLookup does not check accessors availability, this is actually needed for properties only
                                                //
@@ -2856,11 +2876,6 @@ namespace Mono.CSharp {
                                //
                                if ((restrictions & MemberLookupRestrictions.InvocableOnly) == 0 && !variable_found) {
                                        if (IsPossibleTypeOrNamespace (rc)) {
-                                               if (variable != null) {
-                                                       rc.Report.SymbolRelatedToPreviousError (variable.Location, Name);
-                                                       rc.Report.Error (135, loc, "`{0}' conflicts with a declaration in a child block", Name);
-                                               }
-
                                                return ResolveAsTypeOrNamespace (rc, false);
                                        }
                                }
index c72137b46e3a8370ed08d64c09314cb652b37d7f..fc415dadd8b89ac639251d0a4bafa5a9be1add51 100644 (file)
@@ -10195,13 +10195,13 @@ namespace Mono.CSharp
                                };
 
                        if (type.IsPointer)
-                               return MakePointerAccess (ec, type);
+                               return Expr.MakePointerAccess (ec, type, Arguments);
 
                        FieldExpr fe = Expr as FieldExpr;
                        if (fe != null) {
                                var ff = fe.Spec as FixedFieldSpec;
                                if (ff != null) {
-                                       return MakePointerAccess (ec, ff.ElementType);
+                                       return Expr.MakePointerAccess (ec, ff.ElementType, Arguments);
                                }
                        }
 
@@ -10243,27 +10243,6 @@ namespace Mono.CSharp
                        return ConditionalAccess || Expr.HasConditionalAccess ();
                }
 
-               Expression MakePointerAccess (ResolveContext rc, TypeSpec type)
-               {
-                       if (Arguments.Count != 1){
-                               rc.Report.Error (196, loc, "A pointer must be indexed by only one value");
-                               return null;
-                       }
-
-                       var arg = Arguments[0];
-                       if (arg is NamedArgument)
-                               Error_NamedArgument ((NamedArgument) arg, rc.Report);
-
-                       var index = arg.Expr.Resolve (rc);
-                       if (index == null)
-                               return null;
-
-                       index = ConvertExpressionToArrayIndex (rc, index, true);
-
-                       Expression p = new PointerArithmetic (Binary.Operator.Addition, Expr, index, type, loc);
-                       return new Indirection (p, loc);
-               }
-               
                protected override Expression DoResolve (ResolveContext rc)
                {
                        Expression expr;
@@ -10300,11 +10279,6 @@ namespace Mono.CSharp
                        throw new Exception ("Should never be reached");
                }
 
-               public static void Error_NamedArgument (NamedArgument na, Report Report)
-               {
-                       Report.Error (1742, na.Location, "An element access expression cannot use named argument");
-               }
-
                public override void FlowAnalysis (FlowAnalysisContext fc)
                {
                        Expr.FlowAnalysis (fc);
@@ -11767,12 +11741,10 @@ namespace Mono.CSharp
        {
                readonly Arguments args;
 
-               public DictionaryElementInitializer (List<Expression> arguments, Expression initializer, Location loc)
+               public DictionaryElementInitializer (Arguments arguments, Expression initializer, Location loc)
                        : base (null, initializer, loc)
                {
-                       this.args = new Arguments (arguments.Count);
-                       foreach (var arg in arguments)
-                               this.args.Add (new Argument (arg));
+                       this.args = arguments;
                }
 
                public override Expression CreateExpressionTree (ResolveContext ec)
@@ -11791,6 +11763,11 @@ namespace Mono.CSharp
                                return true;
                        }
 
+                       if (type.IsPointer) {
+                               target = init.MakePointerAccess (rc, type, args);
+                               return true;
+                       }
+
                        var indexers = MemberCache.FindMembers (type, MemberCache.IndexerNameAlias, false);
                        if (indexers == null && type.BuiltinType != BuiltinTypeSpec.Type.Dynamic) {
                                ElementAccess.Error_CannotApplyIndexing (rc, type, loc);
index 3bf9599a3d591559f084f7663165ddd4d7e82f03..da6b0c11ab56b9ab6eda6b3123dff78bbf71082a 100644 (file)
@@ -246,7 +246,10 @@ namespace Mono.CSharp
                        : base (compiler)
                {
                        this.importer = importer;
-                       domain = new Universe (UniverseOptions.MetadataOnly | UniverseOptions.ResolveMissingMembers | UniverseOptions.DisableFusion | UniverseOptions.DecodeVersionInfoAttributeBlobs);
+                       domain = new Universe (UniverseOptions.MetadataOnly | UniverseOptions.ResolveMissingMembers | 
+                               UniverseOptions.DisableFusion | UniverseOptions.DecodeVersionInfoAttributeBlobs |
+                               UniverseOptions.DeterministicOutput);
+                       
                        domain.AssemblyResolve += AssemblyReferenceResolver;
                        loaded_names = new List<Tuple<AssemblyName, string, Assembly>> ();
 
index c8c6b73e60aa3f212a457940c91da8cfbfbc9994..bfae5985a0345f1d5058e6e6586618d0fd185ba1 100644 (file)
@@ -52,6 +52,7 @@ namespace Mono.CSharp
                BACKING_FIELD                   = 0x200000,
                DEBUGGER_HIDDEN                 = 0x400000,
                DEBUGGER_STEP_THROUGH   = 0x800000,
+               AutoProperty                    = 0x1000000,
 
                AccessibilityMask = PUBLIC | PROTECTED | INTERNAL | PRIVATE,
                AllowedExplicitImplFlags = UNSAFE | EXTERN,
index 138ec61638f00ed03c0955b9f90684c96516fde6..3a9377c7547bc94531acc0df743eeb868d2e07e7 100644 (file)
@@ -16,6 +16,9 @@ using System.Collections.Generic;
 using System.Runtime.InteropServices;
 using Mono.CompilerServices.SymbolWriter;
 using System.Linq;
+using System.IO;
+using System.Security.Cryptography;
+using Mono.Security.Cryptography;
 
 #if STATIC
 using IKVM.Reflection;
@@ -39,13 +42,14 @@ namespace Mono.CSharp
                sealed class StaticDataContainer : CompilerGeneratedContainer
                {
                        readonly Dictionary<int, Struct> size_types;
-                       int fields;
+                       readonly Dictionary<string, FieldSpec> data_hashes;
 
                        public StaticDataContainer (ModuleContainer module)
-                               : base (module, new MemberName ("<PrivateImplementationDetails>" + module.builder.ModuleVersionId.ToString ("B"), Location.Null),
+                               : base (module, new MemberName ("<PrivateImplementationDetails>", Location.Null),
                                        Modifiers.STATIC | Modifiers.INTERNAL)
                        {
                                size_types = new Dictionary<int, Struct> ();
+                               data_hashes = new Dictionary<string, FieldSpec> (StringComparer.Ordinal);
                        }
 
                        public override void CloseContainer ()
@@ -76,13 +80,27 @@ namespace Mono.CSharp
                                        size_type.TypeBuilder.__SetLayout (1, data.Length);
                                }
 
-                               var name = "$field-" + fields.ToString ("X");
-                               ++fields;
-                               const Modifiers fmod = Modifiers.STATIC | Modifiers.INTERNAL;
-                               var fbuilder = TypeBuilder.DefineField (name, size_type.CurrentType.GetMetaInfo (), ModifiersExtensions.FieldAttr (fmod) | FieldAttributes.HasFieldRVA);
-                               fbuilder.__SetDataAndRVA (data);
+                               FieldSpec fs;
+                               var data_hash = GenerateDataFieldName (data);
+                               if (!data_hashes.TryGetValue (data_hash, out fs)) {
+                                       var name = "$field-" + data_hash;
+                                       const Modifiers fmod = Modifiers.STATIC | Modifiers.INTERNAL | Modifiers.READONLY;
+                                       var fbuilder = TypeBuilder.DefineField (name, size_type.CurrentType.GetMetaInfo (), ModifiersExtensions.FieldAttr (fmod) | FieldAttributes.HasFieldRVA);
+                                       fbuilder.__SetDataAndRVA (data);
 
-                               return new FieldSpec (CurrentType, null, size_type.CurrentType, fbuilder, fmod);
+                                       fs = new FieldSpec (CurrentType, null, size_type.CurrentType, fbuilder, fmod);
+                                       data_hashes.Add (data_hash, fs);
+                               }
+
+                               return fs;
+                       }
+
+                       static string GenerateDataFieldName (byte[] bytes)
+                       {
+                               using (var hashProvider = new SHA1CryptoServiceProvider ())
+                               {
+                                       return CryptoConvert.ToHex (hashProvider.ComputeHash (bytes));
+                               }
                        }
                }
 
@@ -413,6 +431,8 @@ namespace Mono.CSharp
                        }
                }
 
+               public Dictionary<string, string> GetResourceStrings { get; private set; }
+
                #endregion
 
                public override void Accept (StructuralVisitor visitor)
@@ -716,5 +736,31 @@ namespace Mono.CSharp
                        // TODO: This setter is quite ugly but I have not found a way around it yet
                        this.assembly = assembly;
                }
+
+               public void LoadGetResourceStrings (string fileName)
+               {
+                       if (!File.Exists (fileName)) {
+                               Report.Error (1566, "Error reading resource file `{0}'", fileName);
+                               return;
+                       }
+
+                       foreach (var l in File.ReadLines (fileName)) {
+                               if (GetResourceStrings == null)
+                                       GetResourceStrings = new Dictionary<string, string> ();
+
+                               var line = l.Trim ();
+                               if (line.Length == 0 || line [0] == '#' || line [0] == ';')
+                                       continue;
+                               
+                               var epos = line.IndexOf ('=');
+                               if (epos < 0)
+                                       continue;
+
+                               var key = line.Substring (0, epos).Trim ();
+                               var value = line.Substring (epos + 1).Trim ();
+
+                               GetResourceStrings [key] = value;
+                       }
+               }
        }
 }
index d52b1da393ea05e99971a02458a74f56cb66fbd9..1d46ab2dab8b87ed13f9e871bd5459a3ee07f6a4 100644 (file)
@@ -557,7 +557,7 @@ namespace Mono.CSharp
                                        ok = false;
                                }
 
-                               if (Get.IsCompilerGenerated) {
+                               if ((ModFlags & Modifiers.AutoProperty) != 0) {
                                        Report.Error (8080, Location, "`{0}': Auto-implemented properties must override all accessors of the overridden property",
                                                GetSignatureForError ());
                                        ok = false;
@@ -867,6 +867,7 @@ namespace Mono.CSharp
                        }
 
                        if (auto) {
+                               ModFlags |= Modifiers.AutoProperty;
                                if (Get == null) {
                                        Report.Error (8051, Location, "Auto-implemented property `{0}' must have get accessor",
                                                GetSignatureForError ());
index 9ba66c1613e6e861e7b548e13cddf1e5ab0bd741..42156d77ba9ab630a1abc513ac49c84cb28aee97 100644 (file)
@@ -150,6 +150,8 @@ namespace Mono.CSharp {
                public bool BreakOnInternalError;
                #endregion
 
+               public string GetResourceStrings;
+
                public bool ShowFullPaths;
 
                //
@@ -1448,7 +1450,7 @@ namespace Mono.CSharp {
                                return ParseResult.Success;
 
                        default:
-                               if (arg.StartsWith ("--fatal", StringComparison.Ordinal)){
+                               if (arg.StartsWith ("--fatal", StringComparison.Ordinal)) {
                                        int fatal = 1;
                                        if (arg.StartsWith ("--fatal=", StringComparison.Ordinal))
                                                int.TryParse (arg.Substring (8), out fatal);
@@ -1476,6 +1478,17 @@ namespace Mono.CSharp {
                                        return ParseResult.Success;
                                }
 
+                               if (arg.StartsWith ("--getresourcestrings:", StringComparison.Ordinal)) {
+                                       string file = arg.Substring (21).Trim ();
+                                       if (file.Length < 1) {
+                                               Error_RequiresArgument (arg);
+                                               return ParseResult.Error;
+                                       }
+
+                                       settings.GetResourceStrings = file;
+                                       return ParseResult.Success;
+                               }
+
                                return ParseResult.UnknownOption;
                        }
                }
diff --git a/mcs/tests/gtest-autoproperty-16.cs b/mcs/tests/gtest-autoproperty-16.cs
new file mode 100644 (file)
index 0000000..6676261
--- /dev/null
@@ -0,0 +1,13 @@
+abstract class A
+{
+       public abstract int Foo { get; }
+}
+
+class B : A
+{
+       public override int Foo => 1;
+
+       public static void Main ()
+       {
+       }
+}
\ No newline at end of file
diff --git a/mcs/tests/test-914.cs b/mcs/tests/test-914.cs
new file mode 100644 (file)
index 0000000..8366f70
--- /dev/null
@@ -0,0 +1,14 @@
+// CS0135: `test' conflicts with a declaration in a child block
+// Line: 11
+
+class ClassMain {
+        static bool test = true;
+    
+        public static void Main() {
+                if (true) {
+                        bool test = false;
+                }
+                test = false;
+        }
+}
+
diff --git a/mcs/tests/test-915.cs b/mcs/tests/test-915.cs
new file mode 100644 (file)
index 0000000..b793698
--- /dev/null
@@ -0,0 +1,13 @@
+class ClassMain
+{
+       static bool test = true;
+
+       public static void Main ()
+       {
+               if (true) {
+                       const int test = 0;
+               }
+               test = false;
+       }
+}
+
diff --git a/mcs/tests/test-916.cs b/mcs/tests/test-916.cs
new file mode 100644 (file)
index 0000000..f63c1c2
--- /dev/null
@@ -0,0 +1,19 @@
+public class Foo
+{
+       public static class Nested
+       {
+               static int bar ()
+               {
+                       return 0;
+               }
+               
+               public static void Main ()
+               {
+                       var i = bar ();
+                       {
+                               bool bar = false;
+                       }
+               } 
+       }
+}
+
diff --git a/mcs/tests/test-917.cs b/mcs/tests/test-917.cs
new file mode 100644 (file)
index 0000000..6c82172
--- /dev/null
@@ -0,0 +1,20 @@
+public class Foo
+{
+       public static class Nested
+       {
+               class bar
+               {
+                       public static int value;
+               }
+               
+               public static void Main ()
+               {
+                       {
+                               bool bar = false;
+                       }
+                       
+                       var i = bar.value;
+               } 
+       }
+}
+
diff --git a/mcs/tests/test-918.cs b/mcs/tests/test-918.cs
new file mode 100644 (file)
index 0000000..e8e0f9f
--- /dev/null
@@ -0,0 +1,19 @@
+public class Test
+{
+       Test x;
+
+       void Foo ()
+       {
+               {
+                       string x = "dd";
+               }
+
+               {
+                       x = null;
+               }
+
+               x = new Test ();
+       }
+
+       public static void Main () { }
+}
\ No newline at end of file
diff --git a/mcs/tests/test-anon-174.cs b/mcs/tests/test-anon-174.cs
new file mode 100644 (file)
index 0000000..ef038d0
--- /dev/null
@@ -0,0 +1,9 @@
+delegate int F (int i);
+class Foo {
+       static int i;
+       static void Main ()
+       {
+               F f = delegate (int i) { return i; };
+               i = 0;
+       }
+}
diff --git a/mcs/tests/test-anon-175.cs b/mcs/tests/test-anon-175.cs
new file mode 100644 (file)
index 0000000..8dd625a
--- /dev/null
@@ -0,0 +1,9 @@
+delegate int F (int i);
+class Foo {
+       static int i;
+       static void Main ()
+       {
+               i = 0;
+               F f = delegate (int i) { return i; };
+       }
+}
diff --git a/mcs/tests/test-dictinit-04.cs b/mcs/tests/test-dictinit-04.cs
new file mode 100644 (file)
index 0000000..570e77c
--- /dev/null
@@ -0,0 +1,29 @@
+// Compiler options: -unsafe
+
+unsafe class C
+{
+       int* X;
+
+       static int Main()
+       {
+               var ptrs = new[] { 0 };
+
+               fixed (int* p = ptrs) {
+                       new C (p) {
+                               X = {
+                                       [0] = 1
+                               }
+                       };
+               }
+
+               if (ptrs [0] != 1)
+                       return 1;
+
+               return 0;
+       }
+
+       C (int* x)
+       {
+               X = x;
+       }
+}
\ No newline at end of file
index c38d69a64dbc4b171ad4fcb2677e57b6ceffce18..8aebc062dffef663cc28ad0ef1a14ee6e8c5585f 100644 (file)
       </method>\r
     </type>\r
   </test>\r
+  <test name="gtest-autoproperty-16.cs">\r
+    <type name="A">\r
+      <method name="Int32 get_Foo()" attrs="3526">\r
+        <size>0</size>\r
+      </method>\r
+      <method name="Void .ctor()" attrs="6276">\r
+        <size>7</size>\r
+      </method>\r
+    </type>\r
+    <type name="B">\r
+      <method name="Int32 get_Foo()" attrs="2246">\r
+        <size>9</size>\r
+      </method>\r
+      <method name="Void Main()" attrs="150">\r
+        <size>2</size>\r
+      </method>\r
+      <method name="Void .ctor()" attrs="6278">\r
+        <size>7</size>\r
+      </method>\r
+    </type>\r
+  </test>\r
   <test name="gtest-collectioninit-01.cs">\r
     <type name="Test">\r
       <method name="Void TestList(System.Collections.Generic.List`1[System.Int32], Int32)" attrs="145">\r
       </method>\r
     </type>\r
   </test>\r
+  <test name="test-914.cs">\r
+    <type name="ClassMain">\r
+      <method name="Void Main()" attrs="150">\r
+        <size>12</size>\r
+      </method>\r
+      <method name="Void .ctor()" attrs="6278">\r
+        <size>7</size>\r
+      </method>\r
+      <method name="Void .cctor()" attrs="6289">\r
+        <size>7</size>\r
+      </method>\r
+    </type>\r
+  </test>\r
+  <test name="test-915.cs">\r
+    <type name="ClassMain">\r
+      <method name="Void Main()" attrs="150">\r
+        <size>10</size>\r
+      </method>\r
+      <method name="Void .ctor()" attrs="6278">\r
+        <size>7</size>\r
+      </method>\r
+      <method name="Void .cctor()" attrs="6289">\r
+        <size>7</size>\r
+      </method>\r
+    </type>\r
+  </test>\r
+  <test name="test-916.cs">\r
+    <type name="Foo">\r
+      <method name="Void .ctor()" attrs="6278">\r
+        <size>7</size>\r
+      </method>\r
+    </type>\r
+    <type name="Foo+Nested">\r
+      <method name="Int32 bar()" attrs="145">\r
+        <size>10</size>\r
+      </method>\r
+      <method name="Void Main()" attrs="150">\r
+        <size>12</size>\r
+      </method>\r
+    </type>\r
+  </test>\r
+  <test name="test-917.cs">\r
+    <type name="Foo">\r
+      <method name="Void .ctor()" attrs="6278">\r
+        <size>7</size>\r
+      </method>\r
+    </type>\r
+    <type name="Foo+Nested">\r
+      <method name="Void Main()" attrs="150">\r
+        <size>12</size>\r
+      </method>\r
+    </type>\r
+    <type name="Foo+Nested+bar">\r
+      <method name="Void .ctor()" attrs="6278">\r
+        <size>7</size>\r
+      </method>\r
+    </type>\r
+  </test>\r
+  <test name="test-918.cs">\r
+    <type name="Test">\r
+      <method name="Void Foo()" attrs="129">\r
+        <size>30</size>\r
+      </method>\r
+      <method name="Void Main()" attrs="150">\r
+        <size>2</size>\r
+      </method>\r
+      <method name="Void .ctor()" attrs="6278">\r
+        <size>7</size>\r
+      </method>\r
+    </type>\r
+  </test>\r
   <test name="test-92.cs">\r
     <type name="Outer">\r
       <method name="Void .ctor()" attrs="6278">\r
       </method>\r
     </type>\r
   </test>\r
+  <test name="test-anon-174.cs">\r
+    <type name="F">\r
+      <method name="Int32 Invoke(Int32)" attrs="454">\r
+        <size>0</size>\r
+      </method>\r
+      <method name="System.IAsyncResult BeginInvoke(Int32, System.AsyncCallback, System.Object)" attrs="454">\r
+        <size>0</size>\r
+      </method>\r
+      <method name="Int32 EndInvoke(System.IAsyncResult)" attrs="454">\r
+        <size>0</size>\r
+      </method>\r
+      <method name="Void .ctor(Object, IntPtr)" attrs="6278">\r
+        <size>0</size>\r
+      </method>\r
+    </type>\r
+    <type name="Foo">\r
+      <method name="Void Main()" attrs="145">\r
+        <size>38</size>\r
+      </method>\r
+      <method name="Int32 &lt;Main&gt;m__0(Int32)" attrs="145">\r
+        <size>10</size>\r
+      </method>\r
+      <method name="Void .ctor()" attrs="6278">\r
+        <size>7</size>\r
+      </method>\r
+    </type>\r
+  </test>\r
+  <test name="test-anon-175.cs">\r
+    <type name="F">\r
+      <method name="Int32 Invoke(Int32)" attrs="454">\r
+        <size>0</size>\r
+      </method>\r
+      <method name="System.IAsyncResult BeginInvoke(Int32, System.AsyncCallback, System.Object)" attrs="454">\r
+        <size>0</size>\r
+      </method>\r
+      <method name="Int32 EndInvoke(System.IAsyncResult)" attrs="454">\r
+        <size>0</size>\r
+      </method>\r
+      <method name="Void .ctor(Object, IntPtr)" attrs="6278">\r
+        <size>0</size>\r
+      </method>\r
+    </type>\r
+    <type name="Foo">\r
+      <method name="Void Main()" attrs="145">\r
+        <size>38</size>\r
+      </method>\r
+      <method name="Int32 &lt;Main&gt;m__0(Int32)" attrs="145">\r
+        <size>10</size>\r
+      </method>\r
+      <method name="Void .ctor()" attrs="6278">\r
+        <size>7</size>\r
+      </method>\r
+    </type>\r
+  </test>\r
   <test name="test-anon-18.cs">\r
     <type name="A">\r
       <method name="Void Invoke()" attrs="454">\r
       </method>\r
     </type>\r
   </test>\r
+  <test name="test-dictinit-04.cs">\r
+    <type name="C">\r
+      <method name="Int32 Main()" attrs="145">\r
+        <size>84</size>\r
+      </method>\r
+      <method name="Void .ctor(Int32*)" attrs="6273">\r
+        <size>15</size>\r
+      </method>\r
+    </type>\r
+  </test>\r
   <test name="test-ex-filter-01.cs">\r
     <type name="X">\r
       <method name="Int32 Main()" attrs="150">\r
index 0bd565669e58084c61d3e9ab7e94fdeae5653265..5ca44838988162ebe9194dd113829ca3bf25913b 100644 (file)
@@ -12,6 +12,7 @@
        </PropertyGroup>
 
        <Target Name="ImplicitlyExpandTargetFramework"
+               Condition="'$(ImplicitlyExpandTargetFramework)' == 'true'"
                DependsOnTargets="$(ImplicitlyExpandTargetFrameworkDependsOn)">
 
                <ItemGroup>
index fcf17c001b9ffb9b531f6cec7ce17fa087fb3d8e..6d6875b6742d7db93f39464bb2561ca356117aad 100644 (file)
@@ -12,7 +12,7 @@ gc_lib=$(LIBGC_STATIC_LIBS)
 endif
 
 runtime_lib=   \
-       ../mini/$(LIBMONO_LA) \
+       $(metadata_lib) \
        $(top_builddir)/mono/io-layer/libwapi.la        \
        $(top_builddir)/mono/utils/libmonoutils.la \
        $(GLIB_LIBS) $(LIBICONV) \
@@ -50,6 +50,7 @@ monodis_LDADD =                       \
        libmonodis.a                    \
        $(runtime_lib)                  \
        $(LLVM_LIBS)                    \
+       $(LLVM_LDFLAGS)                 \
        $(GLIB_LIBS)                    \
        $(LIBICONV)
 
index 8f739af8484e28954d721716e6807d9957d4ca4f..489f60d91dc0f678f09230511106b84b20144100 100644 (file)
@@ -370,7 +370,7 @@ typedef struct {
        void (*object_queued_for_finalization) (MonoObject *object);
 } MonoGCFinalizerCallbacks;
 
-void mono_gc_register_finalizer_callbacks (MonoGCFinalizerCallbacks *callbacks);
+MONO_API void mono_gc_register_finalizer_callbacks (MonoGCFinalizerCallbacks *callbacks);
 
 
 #ifdef HOST_WIN32
index 29edd2afa0de071afbda4ba39fceec73183bf30b..c6ac27f86297146a790505b50c154039a7c5c2f9 100644 (file)
@@ -806,8 +806,8 @@ ICALL(STRING_10, "InternalIntern", ves_icall_System_String_InternalIntern)
 ICALL(STRING_11, "InternalIsInterned", ves_icall_System_String_InternalIsInterned)
 ICALL(STRING_12, "InternalSetLength", ves_icall_System_String_InternalSetLength)
 
-ICALL_TYPE(TENC, "System.Text.Encoding", TENC_1)
-ICALL(TENC_1, "InternalCodePage", ves_icall_System_Text_Encoding_InternalCodePage)
+ICALL_TYPE(TENC, "System.Text.EncodingHelper", TENC_1)
+ICALL(TENC_1, "InternalCodePage", ves_icall_System_Text_EncodingHelper_InternalCodePage)
 
 ICALL_TYPE(ILOCK, "System.Threading.Interlocked", ILOCK_1)
 ICALL(ILOCK_1, "Add(int&,int)", ves_icall_System_Threading_Interlocked_Add_Int)
index 838894339eb63bb6903a8ded99f7338ba22274d8..54e573f60b79356158a6342567777dee901634e0 100644 (file)
@@ -5018,6 +5018,21 @@ ves_icall_System_Reflection_Assembly_LoadPermissions (MonoReflectionAssembly *as
        return result;  
 }
 
+static gboolean
+mono_module_type_is_visible (MonoTableInfo *tdef, MonoImage *image, int type)
+{
+       guint32 attrs, visibility;
+       do {
+               attrs = mono_metadata_decode_row_col (tdef, type - 1, MONO_TYPEDEF_FLAGS);
+               visibility = attrs & TYPE_ATTRIBUTE_VISIBILITY_MASK;
+               if (visibility != TYPE_ATTRIBUTE_PUBLIC && visibility != TYPE_ATTRIBUTE_NESTED_PUBLIC)
+                       return FALSE;
+
+       } while ((type = mono_metadata_token_index (mono_metadata_nested_in_typedef (image, type))));
+
+       return TRUE;
+}
+
 static MonoArray*
 mono_module_get_types (MonoDomain *domain, MonoImage *image, MonoArray **exceptions, MonoBoolean exportedOnly)
 {
@@ -5025,15 +5040,12 @@ mono_module_get_types (MonoDomain *domain, MonoImage *image, MonoArray **excepti
        MonoClass *klass;
        MonoTableInfo *tdef = &image->tables [MONO_TABLE_TYPEDEF];
        int i, count;
-       guint32 attrs, visibility;
 
        /* we start the count from 1 because we skip the special type <Module> */
        if (exportedOnly) {
                count = 0;
                for (i = 1; i < tdef->rows; ++i) {
-                       attrs = mono_metadata_decode_row_col (tdef, i, MONO_TYPEDEF_FLAGS);
-                       visibility = attrs & TYPE_ATTRIBUTE_VISIBILITY_MASK;
-                       if (visibility == TYPE_ATTRIBUTE_PUBLIC || visibility == TYPE_ATTRIBUTE_NESTED_PUBLIC)
+                       if (mono_module_type_is_visible (tdef, image, i + 1))
                                count++;
                }
        } else {
@@ -5043,9 +5055,7 @@ mono_module_get_types (MonoDomain *domain, MonoImage *image, MonoArray **excepti
        *exceptions = mono_array_new (domain, mono_defaults.exception_class, count);
        count = 0;
        for (i = 1; i < tdef->rows; ++i) {
-               attrs = mono_metadata_decode_row_col (tdef, i, MONO_TYPEDEF_FLAGS);
-               visibility = attrs & TYPE_ATTRIBUTE_VISIBILITY_MASK;
-               if (!exportedOnly || (visibility == TYPE_ATTRIBUTE_PUBLIC || visibility == TYPE_ATTRIBUTE_NESTED_PUBLIC)) {
+               if (!exportedOnly || mono_module_type_is_visible (tdef, image, i + 1)) {
                        MonoError error;
                        klass = mono_class_get_checked (image, (i + 1) | MONO_TOKEN_TYPE_DEF, &error);
                        g_assert (!mono_loader_get_last_error ()); /* Plug any leaks */
@@ -6505,7 +6515,7 @@ static const char *encodings [] = {
  * returns the code page as a string
  */
 ICALL_EXPORT MonoString*
-ves_icall_System_Text_Encoding_InternalCodePage (gint32 *int_code_page) 
+ves_icall_System_Text_EncodingHelper_InternalCodePage (gint32 *int_code_page) 
 {
        const char *cset;
        const char *p;
index 0015944addc727142b261358d890d3b970ff6fb3..9307c0040fb4302892a37591034d8a96e6b9a6f1 100644 (file)
@@ -9544,10 +9544,11 @@ static int elem_addr_cache_next = 0;
  * @rank: rank of the array type
  * @elem_size: size in bytes of an element of an array.
  *
- * Returns a MonoMethd that implements the code to get the address
+ * Returns a MonoMethod that implements the code to get the address
  * of an element in a multi-dimenasional array of @rank dimensions.
  * The returned method takes an array as the first argument and then
  * @rank indexes for the @rank dimensions.
+ * If ELEM_SIZE is 0, read the array size from the array object.
  */
 MonoMethod*
 mono_marshal_get_array_address (int rank, int elem_size)
@@ -9556,6 +9557,7 @@ mono_marshal_get_array_address (int rank, int elem_size)
        MonoMethodBuilder *mb;
        MonoMethodSignature *sig;
        WrapperInfo *info;
+       char *name;
        int i, bounds, ind, realidx;
        int branch_pos, *branch_positions;
        int cached;
@@ -9583,7 +9585,9 @@ mono_marshal_get_array_address (int rank, int elem_size)
                sig->params [i + 1] = &mono_defaults.int32_class->byval_arg;
        }
 
-       mb = mono_mb_new (mono_defaults.object_class, "ElementAddr", MONO_WRAPPER_MANAGED_TO_MANAGED);
+       name = g_strdup_printf ("ElementAddr_%d", elem_size);
+       mb = mono_mb_new (mono_defaults.object_class, name, MONO_WRAPPER_MANAGED_TO_MANAGED);
+       g_free (name);
        
 #ifndef DISABLE_JIT
        bounds = mono_mb_add_local (mb, &mono_defaults.int_class->byval_arg);
@@ -9651,8 +9655,24 @@ mono_marshal_get_array_address (int rank, int elem_size)
        mono_mb_emit_ldarg (mb, 0);
        mono_mb_emit_ldflda (mb, MONO_STRUCT_OFFSET (MonoArray, vector));
        mono_mb_emit_ldloc (mb, ind);
-       mono_mb_emit_icon (mb, elem_size);
-       mono_mb_emit_byte (mb, CEE_MUL);
+       if (elem_size) {
+               mono_mb_emit_icon (mb, elem_size);
+       } else {
+               /* Load arr->vtable->klass->sizes.element_class */
+               mono_mb_emit_ldarg (mb, 0);
+               mono_mb_emit_byte (mb, CEE_CONV_I);
+               mono_mb_emit_icon (mb, MONO_STRUCT_OFFSET (MonoObject, vtable));
+               mono_mb_emit_byte (mb, CEE_ADD);
+               mono_mb_emit_byte (mb, CEE_LDIND_I);
+               mono_mb_emit_icon (mb, MONO_STRUCT_OFFSET (MonoVTable, klass));
+               mono_mb_emit_byte (mb, CEE_ADD);
+               mono_mb_emit_byte (mb, CEE_LDIND_I);
+               /* sizes is an union, so this reads sizes.element_size */
+               mono_mb_emit_icon (mb, MONO_STRUCT_OFFSET (MonoClass, sizes));
+               mono_mb_emit_byte (mb, CEE_ADD);
+               mono_mb_emit_byte (mb, CEE_LDIND_I4);
+       }
+               mono_mb_emit_byte (mb, CEE_MUL);
        mono_mb_emit_byte (mb, CEE_ADD);
        mono_mb_emit_byte (mb, CEE_RET);
 
index 46fcf99836dac6a0b857938021f7ec06c8db9665..f75453571d043d92656e568f5feae6f6a6911bde 100644 (file)
@@ -331,6 +331,9 @@ mono_debug_lookup_method (MonoMethod *method)
 {
        MonoDebugMethodInfo *minfo;
 
+       if (mono_debug_format == MONO_DEBUG_FORMAT_NONE)
+               return NULL;
+
        mono_debugger_lock ();
        minfo = mono_debug_lookup_method_internal (method);
        mono_debugger_unlock ();
index 7fb5790528113236fad27acfb003e8166ed23055..ec6eb18540d8c7ce10b89079eafc851c7718d4aa 100644 (file)
@@ -186,6 +186,9 @@ DECL_OFFSET(MonoLMF, fregs)
 #elif defined(TARGET_ARM64)
 DECL_OFFSET(MonoLMF, pc)
 DECL_OFFSET(MonoLMF, gregs)
+DECL_OFFSET(DynCallArgs, fpregs)
+DECL_OFFSET(DynCallArgs, n_fpargs)
+DECL_OFFSET(DynCallArgs, n_fpret)
 #endif
 
 #ifdef TARGET_AMD64
index 47d86bbd5e11af17cb2cc3c96eac99ece0a9ae42..45b756cd10d9efdf64f540b951d958c2411a6e18 100644 (file)
@@ -524,7 +524,7 @@ mono_gc_alloc_vector (MonoVTable *vtable, size_t size, uintptr_t max_length)
                /*This doesn't require fencing since EXIT_CRITICAL_REGION already does it for us*/
                arr->max_length = (mono_array_size_t)max_length;
                EXIT_CRITICAL_REGION;
-               return arr;
+               goto done;
        }
        EXIT_CRITICAL_REGION;
 #endif
@@ -539,8 +539,11 @@ mono_gc_alloc_vector (MonoVTable *vtable, size_t size, uintptr_t max_length)
 
        arr->max_length = (mono_array_size_t)max_length;
 
+
        UNLOCK_GC;
 
+ done:
+       SGEN_ASSERT (6, SGEN_ALIGN_UP (size) == SGEN_ALIGN_UP (sgen_par_object_get_size (vtable, (MonoObject*)arr)), "Vector has incorrect size.");
        return arr;
 }
 
@@ -564,7 +567,7 @@ mono_gc_alloc_array (MonoVTable *vtable, size_t size, uintptr_t max_length, uint
                bounds = (MonoArrayBounds*)((char*)arr + size - bounds_size);
                arr->bounds = bounds;
                EXIT_CRITICAL_REGION;
-               return arr;
+               goto done;
        }
        EXIT_CRITICAL_REGION;
 #endif
@@ -584,6 +587,8 @@ mono_gc_alloc_array (MonoVTable *vtable, size_t size, uintptr_t max_length, uint
 
        UNLOCK_GC;
 
+ done:
+       SGEN_ASSERT (6, SGEN_ALIGN_UP (size) == SGEN_ALIGN_UP (sgen_par_object_get_size (vtable, (MonoObject*)arr)), "Array has incorrect size.");
        return arr;
 }
 
index daa071e9d6dfc9b8822572836353bbda6eb06e40..2a658f7870f091b8198a00074a614cb4a11d250f 100644 (file)
@@ -61,9 +61,9 @@ typedef struct {
        void (*cross_references) (int num_sccs, MonoGCBridgeSCC **sccs, int num_xrefs, MonoGCBridgeXRef *xrefs);
 } MonoGCBridgeCallbacks;
 
-void mono_gc_register_bridge_callbacks (MonoGCBridgeCallbacks *callbacks);
+MONO_API void mono_gc_register_bridge_callbacks (MonoGCBridgeCallbacks *callbacks);
 
-void mono_gc_wait_for_bridge_processing (void);
+MONO_API void mono_gc_wait_for_bridge_processing (void);
 
 MONO_END_DECLS
 
index 25015bd1ae664996e4f2bdd0aaac0279fd1d9928..2bc393ad0acbc8c13d072411f089d1e526df48b6 100644 (file)
@@ -823,7 +823,11 @@ sgen_par_object_get_size (MonoVTable *vtable, MonoObject* o)
                MonoArray *array = (MonoArray*)o;
                size_t size = sizeof (MonoArray) + element_size * mono_array_length_fast (array);
 
-               if (descr & VECTOR_KIND_ARRAY) {
+               /*
+                * Non-vector arrays with a single dimension whose lower bound is zero are
+                * allocated without bounds.
+                */
+               if ((descr & VECTOR_KIND_ARRAY) && array->bounds) {
                        size += sizeof (mono_array_size_t) - 1;
                        size &= ~(sizeof (mono_array_size_t) - 1);
                        size += sizeof (MonoArrayBounds) * vtable->klass->rank;
index 36769f35cb2d7aca67fef29ccf08623703d5ad21..fa1ed01c024978a4e2f650a4dd4f9be18bfaa58d 100644 (file)
@@ -57,6 +57,7 @@ sgen_suspend_thread (SgenThreadInfo *info)
 
        CloseHandle (handle);
 
+#if !defined(MONO_CROSS_COMPILE)
 #ifdef USE_MONO_CTX
        memset (&info->ctx, 0, sizeof (MonoContext));
 #ifdef TARGET_AMD64
@@ -103,6 +104,7 @@ sgen_suspend_thread (SgenThreadInfo *info)
        info->regs [7] = context.Esp;
        info->stopped_ip = (gpointer)context.Eip;
        info->stack_start = (char*)context.Esp - REDZONE_SIZE;
+#endif
 #endif
 
        /* Notify the JIT */
index ad1a4b3239da02b72e3a6c255ec97cc9a23e6fca..c0f9dcf10e22ba190582985dc59d59bcb3425fb6 100755 (executable)
@@ -156,7 +156,7 @@ endif
 if LOADED_LLVM
 lib_LTLIBRARIES += libmono-llvm.la
 libmono_llvm_la_SOURCES = mini-llvm.c mini-llvm-cpp.cpp
-libmono_llvm_la_LIBADD = $(LLVM_LIBS) $(LLVM_LDFLAGS)
+libmono_llvm_la_LIBADD = $(GLIB_LIBS) $(LLVM_LIBS) $(LLVM_LDFLAGS)
 if PLATFORM_DARWIN
 libmono_llvm_la_LDFLAGS=-Wl,-undefined -Wl,suppress -Wl,-flat_namespace
 else
@@ -660,12 +660,15 @@ rcheck: mono $(regtests)
 if NACL_CODEGEN
        for i in $(regtests); do echo "running test $$i"; $(RUNTIME) $$i --exclude 'NaClDisable' || exit 1; done
 else
-       $(RUNTIME) --regression $(regtests)
+       -($(RUNTIME) --regression $(regtests); echo $$? > regressionexitcode.out) | ./emitnunit.pl
+       exit $$(cat regressionexitcode.out)
 endif
 
 check-seq-points: mono $(regtests)
-       for i in $(regtests); do ./test_op_il_seq_point.sh $$i || exit 1; done
-       for i in $(regtests); do ./test_op_il_seq_point.sh $$i --aot || exit 1; done
+       rm -f TestResults_op_il_seq_point.xml
+       for i in $(regtests); do ./test_op_il_seq_point.sh $$i || (./test_op_il_seq_point_headerfooter.sh; exit 1) || exit 1; done
+       for i in $(regtests); do ./test_op_il_seq_point.sh $$i --aot || (./test_op_il_seq_point_headerfooter.sh; exit 1) || exit 1; done
+       ./test_op_il_seq_point_headerfooter.sh
 
 gctest: mono gc-test.exe
        MONO_DEBUG_OPTIONS=clear-nursery-at-gc $(RUNTIME) --regression gc-test.exe
@@ -727,7 +730,7 @@ docu: mini.sgm
 check-local: rcheck check-seq-points
 
 clean-local:
-       rm -f mono a.out gmon.out *.o buildver-boehm.h buildver-sgen.h test.exe
+       rm -f mono a.out gmon.out *.o buildver-boehm.h buildver-sgen.h test.exe regressionexitcode.out TestResults_op_il_seq_point.xml*
 
 pkgconfigdir = $(libdir)/pkgconfig
 
@@ -750,6 +753,7 @@ EXTRA_DIST = TestDriver.cs ldscript ldscript.mono \
        $(darwin_sources) Info.plist            \
        $(posix_sources)                                        \
        test_op_il_seq_point.sh                 \
+       test_op_il_seq_point_headerfooter.sh    \
        Makefile.am.in
 
 version.h: Makefile
index b48bb5d87f5d07a811567a8e2213087e9a879b1c..443415a1b7da5d771e0ac1772fef683380b0a46c 100644 (file)
@@ -50,6 +50,7 @@
 #include <mono/utils/mono-compiler.h>
 #include <mono/utils/mono-time.h>
 #include <mono/utils/mono-mmap.h>
+#include <mono/utils/json.h>
 
 #include "mini.h"
 #include "seq-points.h"
@@ -639,7 +640,7 @@ emit_code_bytes (MonoAotCompile *acfg, const guint8* buf, int size)
 
 /* ARCHITECTURE SPECIFIC CODE */
 
-#if defined(TARGET_X86) || defined(TARGET_AMD64) || defined(TARGET_ARM) || defined(TARGET_POWERPC)
+#if defined(TARGET_X86) || defined(TARGET_AMD64) || defined(TARGET_ARM) || defined(TARGET_POWERPC) || defined(TARGET_ARM64)
 #define EMIT_DWARF_INFO 1
 #endif
 
@@ -5010,6 +5011,7 @@ emit_method_code (MonoAotCompile *acfg, MonoCompile *cfg)
                 * - it allows the setting of breakpoints of aot-ed methods.
                 */
                debug_sym = get_debug_sym (method, "", acfg->method_label_hash);
+               cfg->asm_debug_symbol = g_strdup (debug_sym);
 
                if (acfg->need_no_dead_strip)
                        fprintf (acfg->fp, "    .no_dead_strip %s\n", debug_sym);
@@ -5858,7 +5860,7 @@ emit_plt (MonoAotCompile *acfg)
                if (acfg->llvm && !acfg->thumb_mixed) {
                        emit_label (acfg, plt_entry->llvm_symbol);
                        if (acfg->llvm_separate) {
-                               emit_global (acfg, plt_entry->llvm_symbol, TRUE);
+                               emit_global_inner (acfg, plt_entry->llvm_symbol, TRUE);
 #if defined(TARGET_MACH)
                                fprintf (acfg->fp, ".private_extern %s\n", plt_entry->llvm_symbol);
 #endif
@@ -6824,8 +6826,12 @@ compile_method (MonoAotCompile *acfg, MonoMethod *method)
                                        }
                                        add_generic_class_with_depth (acfg, m->klass, depth + 5, "method");
                                }
-                               if (m->wrapper_type == MONO_WRAPPER_MANAGED_TO_MANAGED && !strcmp (m->name, "ElementAddr"))
-                                       add_extra_method_with_depth (acfg, m, depth + 1);
+                               if (m->wrapper_type == MONO_WRAPPER_MANAGED_TO_MANAGED) {
+                                       WrapperInfo *info = mono_marshal_get_wrapper_info (m);
+
+                                       if (info && info->subtype == WRAPPER_SUBTYPE_ELEMENT_ADDR)
+                                               add_extra_method_with_depth (acfg, m, depth + 1);
+                               }
                                break;
                        }
                        case MONO_PATCH_INFO_VTABLE: {
@@ -7186,7 +7192,7 @@ emit_llvm_file (MonoAotCompile *acfg)
         * return OverwriteComplete;
         * Here, if 'Earlier' refers to a memset, and Later has no size info, it mistakenly thinks the memset is redundant.
         */
-       opts = g_strdup ("-targetlibinfo -no-aa -basicaa -notti -instcombine -simplifycfg -sroa -domtree -early-cse -lazy-value-info -correlated-propagation -simplifycfg -instcombine -simplifycfg -reassociate -domtree -loops -loop-simplify -lcssa -loop-rotate -licm -lcssa -loop-unswitch -instcombine -scalar-evolution -loop-simplify -lcssa -indvars -loop-idiom -loop-deletion -loop-unroll -memdep -gvn -memdep -memcpyopt -sccp -instcombine -lazy-value-info -correlated-propagation -domtree -memdep -adce -simplifycfg -instcombine -strip-dead-prototypes -domtree -verify");
+       opts = g_strdup ("-targetlibinfo -no-aa -basicaa -notti -instcombine -simplifycfg -inline-cost -inline -sroa -domtree -early-cse -lazy-value-info -correlated-propagation -simplifycfg -instcombine -simplifycfg -reassociate -domtree -loops -loop-simplify -lcssa -loop-rotate -licm -lcssa -loop-unswitch -instcombine -scalar-evolution -loop-simplify -lcssa -indvars -loop-idiom -loop-deletion -loop-unroll -memdep -gvn -memdep -memcpyopt -sccp -instcombine -lazy-value-info -correlated-propagation -domtree -memdep -adce -simplifycfg -instcombine -strip-dead-prototypes -domtree -verify");
 #if 1
        command = g_strdup_printf ("%sopt -f %s -o \"%s.opt.bc\" \"%s.bc\"", acfg->aot_opts.llvm_path, opts, acfg->tmpbasename, acfg->tmpbasename);
        aot_printf (acfg, "Executing opt: %s\n", command);
@@ -7333,11 +7339,8 @@ emit_code (MonoAotCompile *acfg)
                        emit_method_code (acfg, cfg);
        }
 
-       sprintf (symbol, "methods_end");
        emit_section_change (acfg, ".text", 0);
        emit_alignment_code (acfg, 8);
-       emit_label (acfg, symbol);
-
        emit_label (acfg, "jit_code_end");
 
        /* To distinguish it from the next symbol */
@@ -7445,6 +7448,7 @@ emit_code (MonoAotCompile *acfg)
 #endif
                }
        }
+       emit_int32 (acfg, 0);
 }
 
 static void
@@ -8312,7 +8316,6 @@ emit_file_info (MonoAotCompile *acfg)
                emit_pointer (acfg, "llvm_got_info_offsets");
        else
                emit_pointer (acfg, NULL);
-       emit_pointer (acfg, "methods_end");
        emit_pointer (acfg, "unwind_info");
        emit_pointer (acfg, "mem_end");
        emit_pointer (acfg, "image_table");
@@ -8484,7 +8487,7 @@ emit_dwarf_info (MonoAotCompile *acfg)
 
                sprintf (symbol2, "%sme_%x", acfg->temp_prefix, i);
 
-               mono_dwarf_writer_emit_method (acfg->dwarf, cfg, cfg->method, cfg->asm_symbol, symbol2, cfg->jit_info->code_start, cfg->jit_info->code_size, cfg->args, cfg->locals, cfg->unwind_ops, mono_debug_find_method (cfg->jit_info->d.method, mono_domain_get ()));
+               mono_dwarf_writer_emit_method (acfg->dwarf, cfg, cfg->method, cfg->asm_symbol, symbol2, cfg->asm_debug_symbol, cfg->jit_info->code_start, cfg->jit_info->code_size, cfg->args, cfg->locals, cfg->unwind_ops, mono_debug_find_method (cfg->jit_info->d.method, mono_domain_get ()));
        }
 #endif
 }
@@ -8904,7 +8907,158 @@ acfg_free (MonoAotCompile *acfg)
        g_free (acfg);
 }
 
-#include "aot_dump.c"
+#define WRAPPER(e,n) n,
+static const char* const
+wrapper_type_names [MONO_WRAPPER_NUM + 1] = {
+#include "mono/metadata/wrapper-types.h"
+       NULL
+};
+
+static G_GNUC_UNUSED const char*
+get_wrapper_type_name (int type)
+{
+       return wrapper_type_names [type];
+}
+
+//#define DUMP_PLT
+//#define DUMP_GOT
+
+static void aot_dump (MonoAotCompile *acfg)
+{
+       FILE *dumpfile;
+       char * dumpname;
+
+       JsonWriter writer;
+       json_writer_init (&writer);
+
+       json_writer_object_begin(&writer);
+
+       // Methods
+       json_writer_indent (&writer);
+       json_writer_object_key(&writer, "methods");
+       json_writer_array_begin (&writer);
+
+       int i;
+       for (i = 0; i < acfg->nmethods; ++i) {
+               MonoCompile *cfg;
+               MonoMethod *method;
+               MonoClass *klass;
+
+               cfg = acfg->cfgs [i];
+               if (!cfg)
+                       continue;
+
+               method = cfg->orig_method;
+
+               json_writer_indent (&writer);
+               json_writer_object_begin(&writer);
+
+               json_writer_indent (&writer);
+               json_writer_object_key(&writer, "name");
+               json_writer_printf (&writer, "\"%s\",\n", method->name);
+
+               json_writer_indent (&writer);
+               json_writer_object_key(&writer, "signature");
+               json_writer_printf (&writer, "\"%s\",\n", mono_method_full_name (method,
+                       /*signature=*/TRUE));
+
+               json_writer_indent (&writer);
+               json_writer_object_key(&writer, "code_size");
+               json_writer_printf (&writer, "\"%d\",\n", cfg->code_size);
+
+               klass = method->klass;
+
+               json_writer_indent (&writer);
+               json_writer_object_key(&writer, "class");
+               json_writer_printf (&writer, "\"%s\",\n", klass->name);
+
+               json_writer_indent (&writer);
+               json_writer_object_key(&writer, "namespace");
+               json_writer_printf (&writer, "\"%s\",\n", klass->name_space);
+
+               json_writer_indent (&writer);
+               json_writer_object_key(&writer, "wrapper_type");
+               json_writer_printf (&writer, "\"%s\",\n", get_wrapper_type_name(method->wrapper_type));
+
+               json_writer_indent_pop (&writer);
+               json_writer_indent (&writer);
+               json_writer_object_end (&writer);
+               json_writer_printf (&writer, ",\n");
+       }
+
+       json_writer_indent_pop (&writer);
+       json_writer_indent (&writer);
+       json_writer_array_end (&writer);
+       json_writer_printf (&writer, ",\n");
+
+       // PLT entries
+#ifdef DUMP_PLT
+       json_writer_indent_push (&writer);
+       json_writer_indent (&writer);
+       json_writer_object_key(&writer, "plt");
+       json_writer_array_begin (&writer);
+
+       for (i = 0; i < acfg->plt_offset; ++i) {
+               MonoPltEntry *plt_entry = NULL;
+               MonoJumpInfo *ji;
+
+               if (i == 0)
+                       /* 
+                        * The first plt entry is unused.
+                        */
+                       continue;
+
+               plt_entry = g_hash_table_lookup (acfg->plt_offset_to_entry, GUINT_TO_POINTER (i));
+               ji = plt_entry->ji;
+
+               json_writer_indent (&writer);
+               json_writer_printf (&writer, "{ ");
+               json_writer_object_key(&writer, "symbol");
+               json_writer_printf (&writer, "\"%s\" },\n", plt_entry->symbol);
+       }
+
+       json_writer_indent_pop (&writer);
+       json_writer_indent (&writer);
+       json_writer_array_end (&writer);
+       json_writer_printf (&writer, ",\n");
+#endif
+
+       // GOT entries
+#ifdef DUMP_GOT
+       json_writer_indent_push (&writer);
+       json_writer_indent (&writer);
+       json_writer_object_key(&writer, "got");
+       json_writer_array_begin (&writer);
+
+       json_writer_indent_push (&writer);
+       for (i = 0; i < acfg->got_info.got_patches->len; ++i) {
+               MonoJumpInfo *ji = g_ptr_array_index (acfg->got_info.got_patches, i);
+
+               json_writer_indent (&writer);
+               json_writer_printf (&writer, "{ ");
+               json_writer_object_key(&writer, "patch_name");
+               json_writer_printf (&writer, "\"%s\" },\n", get_patch_name (ji->type));
+       }
+
+       json_writer_indent_pop (&writer);
+       json_writer_indent (&writer);
+       json_writer_array_end (&writer);
+       json_writer_printf (&writer, ",\n");
+#endif
+
+       json_writer_indent_pop (&writer);
+       json_writer_indent (&writer);
+       json_writer_object_end (&writer);
+
+       dumpname = g_strdup_printf ("%s.json", g_path_get_basename (acfg->image->name));
+       dumpfile = fopen (dumpname, "w+");
+       g_free (dumpname);
+
+       fprintf (dumpfile, "%s", writer.text->str);
+       fclose (dumpfile);
+
+       json_writer_destroy (&writer);
+}
 
 int
 mono_compile_assembly (MonoAssembly *ass, guint32 opts, const char *aot_options)
@@ -9207,6 +9361,7 @@ mono_compile_assembly (MonoAssembly *ass, guint32 opts, const char *aot_options)
                                cfg->asm_symbol = get_debug_sym (cfg->orig_method, "", acfg->method_label_hash);
                        else
                                cfg->asm_symbol = g_strdup_printf ("%s%sm_%x", acfg->temp_prefix, acfg->llvm_label_prefix, method_index);
+                       cfg->asm_debug_symbol = cfg->asm_symbol;
                }
        }
 
index 69f12c09858a8c22440883df7a995f87197d1cdc..5167e5fbf7e17269bce4aafb0b661eade48bbca8 100644 (file)
@@ -96,9 +96,12 @@ typedef struct MonoAotModule {
        gboolean plt_inited;
        guint8 *mem_begin;
        guint8 *mem_end;
+       /* Points to either the start of JIT compiler or LLVM compiled code */
        guint8 *code;
-       guint8 *code_start;
-       guint8 *code_end;
+       guint8 *jit_code_start;
+       guint8 *jit_code_end;
+       guint8 *llvm_code_start;
+       guint8 *llvm_code_end;
        guint8 *plt;
        guint8 *plt_end;
        guint8 *blob;
@@ -200,6 +203,9 @@ static mono_mutex_t aot_page_mutex;
 static void
 init_plt (MonoAotModule *info);
 
+static void
+compute_llvm_code_range (MonoAotModule *amodule, guint8 **code_start, guint8 **code_end);
+
 /*****************************************************/
 /*                 AOT RUNTIME                       */
 /*****************************************************/
@@ -1914,7 +1920,8 @@ load_aot_module (MonoAssembly *assembly, gpointer user_data)
        /* Mask out thumb interop bit */
        amodule->code = (void*)((mgreg_t)amodule->code & ~1);
 #endif
-       amodule->code_end = info->methods_end;
+       amodule->jit_code_start = info->jit_code_start;
+       amodule->jit_code_end = info->jit_code_end;
        amodule->method_info_offsets = info->method_info_offsets;
        amodule->ex_info_offsets = info->ex_info_offsets;
        amodule->class_info_offsets = info->class_info_offsets;
@@ -1937,7 +1944,6 @@ load_aot_module (MonoAssembly *assembly, gpointer user_data)
        amodule->thumb_end = info->thumb_end;
 
        /* Compute code_offsets from the method addresses */
-       amodule->code_start = amodule->code;
        amodule->code_offsets = g_malloc0 (amodule->info.nmethods * sizeof (gint32));
        for (i = 0; i < amodule->info.nmethods; ++i) {
                /* method_addresses () contains a table of branches, since the ios linker can update those correctly */
@@ -1949,17 +1955,6 @@ load_aot_module (MonoAssembly *assembly, gpointer user_data)
                        amodule->code_offsets [i] = 0xffffffff;
                else
                        amodule->code_offsets [i] = (char*)addr - (char*)amodule->code;
-               /*
-                * FIXME: When using a separate llvm object file,
-                * need to add separate symbols to denote the beginning and
-                * end of llvm compiled code.
-                */
-               // FIXME: Update both code and code_end
-               // FIXME: Last method
-               if ((guint8*)addr > (guint8*)amodule->code_end)
-                       amodule->code_end = addr;
-               if ((guint8*)addr < (guint8*)amodule->code_start)
-                       amodule->code_start = addr;
        }
 
        if (make_unreadable) {
@@ -1981,15 +1976,25 @@ load_aot_module (MonoAssembly *assembly, gpointer user_data)
 #endif
        }
 
+       /* Compute the boundaries of LLVM code */
+       if (info->flags & MONO_AOT_FILE_FLAG_WITH_LLVM)
+               compute_llvm_code_range (amodule, &amodule->llvm_code_start, &amodule->llvm_code_end);
+
        mono_aot_lock ();
 
-       aot_code_low_addr = MIN (aot_code_low_addr, (gsize)amodule->code_start);
-       aot_code_high_addr = MAX (aot_code_high_addr, (gsize)amodule->code_end);
+       aot_code_low_addr = MIN (aot_code_low_addr, (gsize)amodule->jit_code_start);
+       aot_code_high_addr = MAX (aot_code_high_addr, (gsize)amodule->jit_code_end);
+       if (amodule->llvm_code_start) {
+               aot_code_low_addr = MIN (aot_code_low_addr, (gsize)amodule->llvm_code_start);
+               aot_code_high_addr = MAX (aot_code_high_addr, (gsize)amodule->llvm_code_end);
+       }
 
        g_hash_table_insert (aot_modules, assembly, amodule);
        mono_aot_unlock ();
 
-       mono_jit_info_add_aot_module (assembly->image, amodule->code, amodule->code_end);
+       mono_jit_info_add_aot_module (assembly->image, amodule->jit_code_start, amodule->jit_code_end);
+       if (amodule->llvm_code_start)
+               mono_jit_info_add_aot_module (assembly->image, amodule->llvm_code_start, amodule->llvm_code_end);
 
        assembly->image->aot_module = amodule;
 
@@ -2343,6 +2348,42 @@ mono_aot_get_class_from_name (MonoImage *image, const char *name_space, const ch
        return TRUE;
 }
 
+/* Compute the boundaries of the LLVM code for AMODULE. */
+static void
+compute_llvm_code_range (MonoAotModule *amodule, guint8 **code_start, guint8 **code_end)
+{
+       guint8 *p;
+       int version, fde_count;
+       gint32 *table;
+
+       g_assert (amodule->mono_eh_frame);
+
+       p = amodule->mono_eh_frame;
+
+       /* p points to data emitted by LLVM in DwarfException::EmitMonoEHFrame () */
+
+       /* Header */
+       version = *p;
+       g_assert (version == 3);
+       p ++;
+       p ++;
+       p = ALIGN_PTR_TO (p, 4);
+
+       fde_count = *(guint32*)p;
+       p += 4;
+       table = (gint32*)p;
+
+       if (fde_count > 1) {
+               /* mono_aot_personality () */
+               g_assert (table [0] == -1);
+               *code_start = amodule->code + amodule->code_offsets [table [2]];
+               *code_end = amodule->code + amodule->code_offsets [table [(fde_count - 1) * 2]] + table [fde_count * 2];
+       } else {
+               *code_start = NULL;
+               *code_end = NULL;
+       }
+}
+
 /*
  * decode_mono_eh_frame:
  *
@@ -2401,7 +2442,7 @@ decode_llvm_mono_eh_frame (MonoAotModule *amodule, MonoDomain *domain,
                g_assert (table [(pos * 2)] != -1);
                offset1 = amodule->code_offsets [table [(pos * 2)]];
                if (pos + 1 == fde_count) {
-                       offset2 = amodule->code_end - amodule->code;
+                       offset2 = amodule->llvm_code_end - amodule->llvm_code_start;
                } else {
                        g_assert (table [(pos + 1) * 2] != -1);
                        offset2 = amodule->code_offsets [table [(pos + 1) * 2]];
@@ -2741,6 +2782,7 @@ decode_exception_debug_info (MonoAotModule *amodule, MonoDomain *domain,
                                        entry->from = decode_value (p, &p);
                                entry->to = decode_value (p, &p);
                        }
+                       gi->has_this = 1;
                } else {
                        if (from_llvm) {
                                gi->has_this = this_reg != -1;
@@ -2816,6 +2858,13 @@ decode_exception_debug_info (MonoAotModule *amodule, MonoDomain *domain,
        return jinfo;
 }
 
+static gboolean
+amodule_contains_code_addr (MonoAotModule *amodule, guint8 *code)
+{
+       return (code >= amodule->jit_code_start && code <= amodule->jit_code_end) ||
+               (code >= amodule->llvm_code_start && code <= amodule->llvm_code_end);
+}
+
 /*
  * mono_aot_get_unwind_info:
  *
@@ -2835,13 +2884,13 @@ mono_aot_get_unwind_info (MonoJitInfo *ji, guint32 *unwind_info_len)
        g_assert (amodule);
        g_assert (ji->from_aot);
 
-       if (!(code >= amodule->code && code <= amodule->code_end)) {
+       if (!amodule_contains_code_addr (amodule, code)) {
                /* ji belongs to a different aot module than amodule */
                mono_aot_lock ();
                g_assert (ji_to_amodule);
                amodule = g_hash_table_lookup (ji_to_amodule, ji);
                g_assert (amodule);
-               g_assert (code >= amodule->code && code <= amodule->code_end);
+               g_assert (amodule_contains_code_addr (amodule, code));
                mono_aot_unlock ();
        }
 
@@ -2926,7 +2975,7 @@ mono_aot_find_jit_info (MonoDomain *domain, MonoImage *image, gpointer addr)
        MonoAotModule *amodule = image->aot_module;
        MonoMethod *method = NULL;
        MonoJitInfo *jinfo;
-       guint8 *code, *ex_info, *p;
+       guint8 *code, *code_end, *ex_info, *p;
        guint32 *table;
        int nmethods;
        gint32 *code_offsets;
@@ -2942,6 +2991,9 @@ mono_aot_find_jit_info (MonoDomain *domain, MonoImage *image, gpointer addr)
                /* FIXME: */
                return NULL;
 
+       if (!amodule_contains_code_addr (amodule, addr))
+               return NULL;
+
        async = mono_thread_info_is_async_context ();
 
        offset = (guint8*)addr - amodule->code;
@@ -2975,8 +3027,7 @@ mono_aot_find_jit_info (MonoDomain *domain, MonoImage *image, gpointer addr)
        code_offsets = amodule->sorted_code_offsets;
        offsets_len = amodule->sorted_code_offsets_len;
 
-       if (offsets_len > 0 && (offset < code_offsets [0] || offset >= (amodule->code_end - amodule->code)))
-               return NULL;
+       code_end = amodule->jit_code_end > amodule->llvm_code_end ? amodule->jit_code_end : amodule->llvm_code_end;
 
        /* Binary search in the sorted_code_offsets table */
        left = 0;
@@ -2985,10 +3036,14 @@ mono_aot_find_jit_info (MonoDomain *domain, MonoImage *image, gpointer addr)
                pos = (left + right) / 2;
 
                offset1 = code_offsets [(pos * 2)];
-               if (pos + 1 == offsets_len)
-                       offset2 = amodule->code_end - amodule->code;
-               else
+               if (pos + 1 == offsets_len) {
+                       if (amodule->code + offset1 >= amodule->jit_code_start && amodule->code + offset1 < amodule->jit_code_end)
+                               offset2 = amodule->jit_code_end - amodule->code;
+                       else
+                               offset2 = amodule->llvm_code_end - amodule->code;
+               } else {
                        offset2 = code_offsets [(pos + 1) * 2];
+               }
 
                if (offset < offset1)
                        right = pos;
@@ -3020,10 +3075,14 @@ mono_aot_find_jit_info (MonoDomain *domain, MonoImage *image, gpointer addr)
        code = &amodule->code [amodule->code_offsets [method_index]];
        ex_info = &amodule->blob [mono_aot_get_offset (amodule->ex_info_offsets, method_index)];
 
-       if (pos == offsets_len - 1)
-               code_len = amodule->code_end - code;
-       else
+       if (pos == offsets_len - 1) {
+               if (code >= amodule->jit_code_start && code < amodule->jit_code_end)
+                       code_len = amodule->jit_code_end - code;
+               else
+                       code_len = amodule->llvm_code_end - code;
+       } else {
                code_len = code_offsets [(pos + 1) * 2] - code_offsets [pos * 2];
+       }
 
        g_assert ((guint8*)code <= (guint8*)addr && (guint8*)addr < (guint8*)code + code_len);
 
@@ -4069,7 +4128,7 @@ find_aot_module_cb (gpointer key, gpointer value, gpointer user_data)
        FindAotModuleUserData *data = (FindAotModuleUserData*)user_data;
        MonoAotModule *aot_module = (MonoAotModule*)value;
 
-       if ((data->addr >= (guint8*)(aot_module->code_start)) && (data->addr < (guint8*)(aot_module->code_end)))
+       if (amodule_contains_code_addr (aot_module, data->addr))
                data->module = aot_module;
 }
 
diff --git a/mono/mini/aot_dump.c b/mono/mini/aot_dump.c
deleted file mode 100644 (file)
index 8dbefcd..0000000
+++ /dev/null
@@ -1,287 +0,0 @@
-/*
- * aot-dump.c: mono Ahead of Time compiler JSON dumping
- *
- * Author:
- *   Joao Matos (joao.matos@xamarin.com)
- *
- * Copyright 2015 Xamarin Inc (http://www.xamarin.com)
- */
-
-#ifndef MONO_SMALL_CONFIG
-
-#define JSON_INDENT_VALUE 2
-
-typedef struct JsonWriter {
-       GString* text;
-       int indent;
-} JsonWriter;
-
-static void json_writer_init (JsonWriter* writer) MONO_INTERNAL;
-static void json_writer_destroy (JsonWriter* writer);
-static void json_writer_indent(JsonWriter* writer);
-static void json_writer_indent_push(JsonWriter* writer);
-static void json_writer_indent_pop(JsonWriter* writer);
-static void json_writer_vprintf(JsonWriter* writer, const gchar *format, va_list args);
-static void json_writer_printf(JsonWriter* writer, const gchar *format, ...);
-static void json_writer_array_begin(JsonWriter* writer);
-static void json_writer_array_end(JsonWriter* writer);
-static void json_writer_object_begin(JsonWriter* writer);
-static void json_writer_object_end(JsonWriter* writer);
-static void json_writer_object_key(JsonWriter* writer, const gchar* format, ...);
-
-static void json_writer_init (JsonWriter* writer)
-{
-       g_assert (writer && "Expected a valid JSON writer instance");
-
-       writer->text = g_string_new ("");
-       writer->indent = 0;
-}
-
-static void json_writer_destroy (JsonWriter* writer)
-{
-       g_assert (writer && "Expected a valid JSON writer instance");
-       g_string_free (writer->text, /*free_segment=*/TRUE);
-}
-
-static void json_writer_indent_push(JsonWriter* writer)
-{
-       g_assert (writer && "Expected a valid JSON writer instance");
-       writer->indent += JSON_INDENT_VALUE;
-}
-
-static void json_writer_indent_pop(JsonWriter* writer)
-{
-       g_assert (writer && "Expected a valid JSON writer instance");
-       writer->indent -= JSON_INDENT_VALUE;
-}
-
-static void json_writer_indent(JsonWriter* writer)
-{
-       g_assert (writer && "Expected a valid JSON writer instance");
-
-       int i = 0;
-       for (i = 0; i < writer->indent; ++i)
-               g_string_append_c (writer->text, ' ');
-}
-
-static void json_writer_vprintf(JsonWriter* writer, const gchar *format, va_list args)
-{
-       g_assert (writer && "Expected a valid JSON writer instance");
-       g_string_append_vprintf (writer->text, format, args);
-}
-
-static void json_writer_printf(JsonWriter* writer, const gchar *format, ...)
-{
-       g_assert (writer && "Expected a valid JSON writer instance");
-
-       va_list args;
-       va_start (args, format);
-
-       g_string_append_vprintf (writer->text, format, args);
-
-       va_end (args);
-}
-
-static void json_writer_array_begin(JsonWriter* writer)
-{
-       g_assert (writer && "Expected a valid JSON writer instance");
-       g_string_append_printf (writer->text, "[\n");
-       writer->indent += JSON_INDENT_VALUE;
-}
-
-static void json_writer_array_end(JsonWriter* writer)
-{
-       g_assert (writer && "Expected a valid JSON writer instance");
-       g_string_append_printf (writer->text, "]");
-       writer->indent -= JSON_INDENT_VALUE;
-}
-
-static void json_writer_object_begin(JsonWriter* writer)
-{
-       g_assert (writer && "Expected a valid JSON writer instance");
-       json_writer_printf (writer, "{\n");
-       writer->indent += JSON_INDENT_VALUE;
-}
-
-static void json_writer_object_end(JsonWriter* writer)
-{
-       g_assert (writer && "Expected a valid JSON writer instance");
-       json_writer_printf (writer, "}");
-}
-
-static void json_writer_object_key(JsonWriter* writer, const gchar* format, ...)
-{
-       g_assert (writer && "Expected a valid JSON writer instance");
-
-       va_list args;
-       va_start (args, format);
-
-       g_string_append_printf (writer->text, "\"");
-       json_writer_vprintf (writer, format, args);
-       g_string_append_printf (writer->text, "\" : ");
-
-       va_end (args);
-}
-
-#define WRAPPER(e,n) n,
-static const char* const
-wrapper_type_names [MONO_WRAPPER_NUM + 1] = {
-#include "mono/metadata/wrapper-types.h"
-       NULL
-};
-
-static G_GNUC_UNUSED const char*
-get_wrapper_type_name (int type)
-{
-       return wrapper_type_names [type];
-}
-
-//#define DUMP_PLT
-//#define DUMP_GOT
-
-static void aot_dump (MonoAotCompile *acfg)
-{
-       FILE *dumpfile;
-       char * dumpname;
-
-       JsonWriter writer;
-       json_writer_init (&writer);
-
-       json_writer_object_begin(&writer);
-
-       // Methods
-       json_writer_indent (&writer);
-       json_writer_object_key(&writer, "methods");
-       json_writer_array_begin (&writer);
-
-       int i;
-       for (i = 0; i < acfg->nmethods; ++i) {
-               MonoCompile *cfg;
-               MonoMethod *method;
-               MonoClass *klass;
-               int index;
-
-               cfg = acfg->cfgs [i];
-               if (!cfg)
-                       continue;
-
-               method = cfg->orig_method;
-
-               json_writer_indent (&writer);
-               json_writer_object_begin(&writer);
-
-               json_writer_indent (&writer);
-               json_writer_object_key(&writer, "name");
-               json_writer_printf (&writer, "\"%s\",\n", method->name);
-
-               json_writer_indent (&writer);
-               json_writer_object_key(&writer, "signature");
-               json_writer_printf (&writer, "\"%s\",\n", mono_method_full_name (method,
-                       /*signature=*/TRUE));
-
-               json_writer_indent (&writer);
-               json_writer_object_key(&writer, "code_size");
-               json_writer_printf (&writer, "\"%d\",\n", cfg->code_size);
-
-               klass = method->klass;
-
-               json_writer_indent (&writer);
-               json_writer_object_key(&writer, "class");
-               json_writer_printf (&writer, "\"%s\",\n", klass->name);
-
-               json_writer_indent (&writer);
-               json_writer_object_key(&writer, "namespace");
-               json_writer_printf (&writer, "\"%s\",\n", klass->name_space);
-
-               json_writer_indent (&writer);
-               json_writer_object_key(&writer, "wrapper_type");
-               json_writer_printf (&writer, "\"%s\",\n", get_wrapper_type_name(method->wrapper_type));
-
-               json_writer_indent_pop (&writer);
-               json_writer_indent (&writer);
-               json_writer_object_end (&writer);
-               json_writer_printf (&writer, ",\n");
-       }
-
-       json_writer_indent_pop (&writer);
-       json_writer_indent (&writer);
-       json_writer_array_end (&writer);
-       json_writer_printf (&writer, ",\n");
-
-       // PLT entries
-#ifdef DUMP_PLT
-       json_writer_indent_push (&writer);
-       json_writer_indent (&writer);
-       json_writer_object_key(&writer, "plt");
-       json_writer_array_begin (&writer);
-
-       for (i = 0; i < acfg->plt_offset; ++i) {
-               MonoPltEntry *plt_entry = NULL;
-               MonoJumpInfo *ji;
-
-               if (i == 0)
-                       /* 
-                        * The first plt entry is unused.
-                        */
-                       continue;
-
-               plt_entry = g_hash_table_lookup (acfg->plt_offset_to_entry, GUINT_TO_POINTER (i));
-               ji = plt_entry->ji;
-
-               json_writer_indent (&writer);
-               json_writer_printf (&writer, "{ ");
-               json_writer_object_key(&writer, "symbol");
-               json_writer_printf (&writer, "\"%s\" },\n", plt_entry->symbol);
-       }
-
-       json_writer_indent_pop (&writer);
-       json_writer_indent (&writer);
-       json_writer_array_end (&writer);
-       json_writer_printf (&writer, ",\n");
-#endif
-
-       // GOT entries
-#ifdef DUMP_GOT
-       json_writer_indent_push (&writer);
-       json_writer_indent (&writer);
-       json_writer_object_key(&writer, "got");
-       json_writer_array_begin (&writer);
-
-       json_writer_indent_push (&writer);
-       for (i = 0; i < acfg->got_info.got_patches->len; ++i) {
-               MonoJumpInfo *ji = g_ptr_array_index (acfg->got_info.got_patches, i);
-
-               json_writer_indent (&writer);
-               json_writer_printf (&writer, "{ ");
-               json_writer_object_key(&writer, "patch_name");
-               json_writer_printf (&writer, "\"%s\" },\n", get_patch_name (ji->type));
-       }
-
-       json_writer_indent_pop (&writer);
-       json_writer_indent (&writer);
-       json_writer_array_end (&writer);
-       json_writer_printf (&writer, ",\n");
-#endif
-
-       json_writer_indent_pop (&writer);
-       json_writer_indent (&writer);
-       json_writer_object_end (&writer);
-
-       dumpname = g_strdup_printf ("%s.json", g_path_get_basename (acfg->image->name));
-       dumpfile = fopen (dumpname, "w+");
-       g_free (dumpname);
-
-       fprintf (dumpfile, "%s", writer.text->str);
-       fclose (dumpfile);
-
-       json_writer_destroy (&writer);
-}
-
-#else
-
-static void aot_dump (MonoAotCompile *acfg)
-{
-
-}
-
-#endif
\ No newline at end of file
index 4be4026aadeed22ca9f8c3c0efef8193364e7e67..b4e3e858d8964f501867f513f280fc03e709dbdd 100644 (file)
@@ -1860,8 +1860,11 @@ mono_main (int argc, char* argv[])
                   fprintf (stderr, "This mono runtime is compiled for cross-compiling. Only the --aot option is supported.\n");
                   exit (1);
        }
-#if SIZEOF_VOID_P == 8 && defined(TARGET_ARM)
-       fprintf (stderr, "Can't cross-compile on 64 bit platforms to arm.\n");
+#if SIZEOF_VOID_P == 8 && (defined(TARGET_ARM) || defined(TARGET_X86))
+       fprintf (stderr, "Can't cross-compile on 64-bit platforms to 32-bit architecture.\n");
+       exit (1);
+#elif SIZEOF_VOID_P == 4 && (defined(TARGET_ARM64) || defined(TARGET_AMD64))
+       fprintf (stderr, "Can't cross-compile on 32-bit platforms to 64-bit architecture.\n");
        exit (1);
 #endif
 #endif
index d79b0cae34813477b8614dbdb929e830055e6ce4..c9c3b120000d38480d243672922254dc0f66d6cf 100644 (file)
@@ -30,6 +30,9 @@
 
 #include <mono/utils/freebsd-dwarf.h>
 
+#define DW_AT_MIPS_linkage_name 0x2007
+#define DW_LNE_set_prologue_end 0x0a
+
 typedef struct {
        MonoMethod *method;
        char *start_symbol, *end_symbol;
@@ -455,6 +458,9 @@ static int compile_unit_attr [] = {
 
 static int subprogram_attr [] = {
        DW_AT_name         , DW_FORM_string,
+       DW_AT_MIPS_linkage_name, DW_FORM_string,
+       DW_AT_decl_file    , DW_FORM_udata,
+       DW_AT_decl_line    , DW_FORM_udata,
 #ifndef TARGET_IOS
        DW_AT_description  , DW_FORM_string,
 #endif
@@ -1666,14 +1672,6 @@ emit_line_number_info (MonoDwarfWriter *w, MonoMethod *method,
                                emit_pointer_unaligned (w, start_symbol);
                        else
                                emit_pointer_value (w, code);
-
-                       /* 
-                        * The prolog+initlocals region does not have a line number, this
-                        * makes them belong to the first line of the method.
-                        */
-                       emit_byte (w, DW_LNS_advance_line);
-                       //printf ("FIRST: %d %d %d\n", prev_line, loc->row, il_offset);
-                       emit_sleb128 (w, (gint32)loc->row - (gint32)prev_line);
                        first = FALSE;
                }
 
@@ -1697,7 +1695,10 @@ emit_line_number_info (MonoDwarfWriter *w, MonoMethod *method,
                        }
                }
 
-               if (loc->row != prev_line && !first) {
+               if (loc->row != prev_line) {
+                       if (prev_native_offset == 0)
+                               emit_byte (w, DW_LNE_set_prologue_end);
+
                        //printf ("X: %p(+0x%x) %d %s:%d(+%d)\n", code + i, addr_diff, loc->il_offset, loc->source_file, loc->row, line_diff);
                        emit_advance_op (w, line_diff, addr_diff);
 
@@ -1824,13 +1825,16 @@ find_vmv (MonoCompile *cfg, MonoInst *ins)
 }
 
 void
-mono_dwarf_writer_emit_method (MonoDwarfWriter *w, MonoCompile *cfg, MonoMethod *method, char *start_symbol, char *end_symbol, guint8 *code, guint32 code_size, MonoInst **args, MonoInst **locals, GSList *unwind_info, MonoDebugMethodJitInfo *debug_info)
+mono_dwarf_writer_emit_method (MonoDwarfWriter *w, MonoCompile *cfg, MonoMethod *method, char *start_symbol, char *end_symbol, char *linkage_name,
+                                                          guint8 *code, guint32 code_size, MonoInst **args, MonoInst **locals, GSList *unwind_info, MonoDebugMethodJitInfo *debug_info)
 {
        char *name;
        MonoMethodSignature *sig;
        MonoMethodHeader *header;
        char **names;
        MonoDebugLocalsInfo *locals_info;
+       MonoDebugMethodInfo *minfo;
+       MonoDebugSourceLocation *loc = NULL;
        int i;
        guint8 buf [128];
        guint8 *p;
@@ -1862,13 +1866,32 @@ mono_dwarf_writer_emit_method (MonoDwarfWriter *w, MonoCompile *cfg, MonoMethod
                emit_type (w, header->locals [i]);
        }
 
+       minfo = mono_debug_lookup_method (method);
+       if (minfo)
+               loc = mono_debug_symfile_lookup_location (minfo, 0);
+
        /* Subprogram */
        names = g_new0 (char *, sig->param_count);
        mono_method_get_param_names (method, (const char **) names);
 
        emit_uleb128 (w, ABBREV_SUBPROGRAM);
+       /* DW_AT_name */
        name = mono_method_full_name (method, FALSE);
        emit_string (w, name);
+       /* DW_AT_MIPS_linkage_name */
+       if (linkage_name)
+               emit_string (w, linkage_name);
+       else
+               emit_string (w, "");
+       /* DW_AT_decl_file/DW_AT_decl_line */
+       if (loc) {
+               int file_index = add_line_number_file_name (w, loc->source_file, 0, 0);
+               emit_uleb128 (w, file_index + 1);
+               emit_uleb128 (w, loc->row);
+       } else {
+               emit_uleb128 (w, 0);
+               emit_uleb128 (w, 0);
+       }
 #ifndef TARGET_IOS
        emit_string (w, name);
 #endif
index c10bbfe431b02a21412e4f669321eeeb57168e38..0d8573f1b5737fcd593347272aff121c80ba5a4a 100644 (file)
@@ -33,7 +33,8 @@ int mono_dwarf_writer_get_il_file_line_index (MonoDwarfWriter *w) MONO_INTERNAL;
 void mono_dwarf_writer_emit_trampoline (MonoDwarfWriter *w, const char *tramp_name, char *start_symbol, char *end_symbol, guint8 *code, guint32 code_size, GSList *unwind_info) MONO_INTERNAL;
 
 void
-mono_dwarf_writer_emit_method (MonoDwarfWriter *w, MonoCompile *cfg, MonoMethod *method, char *start_symbol, char *end_symbol, guint8 *code, guint32 code_size, MonoInst **args, MonoInst **locals, GSList *unwind_info, MonoDebugMethodJitInfo *debug_info) MONO_INTERNAL;
+mono_dwarf_writer_emit_method (MonoDwarfWriter *w, MonoCompile *cfg, MonoMethod *method, char *start_symbol, char *end_symbol, char *linkage_name,
+                                                          guint8 *code, guint32 code_size, MonoInst **args, MonoInst **locals, GSList *unwind_info, MonoDebugMethodJitInfo *debug_info) MONO_INTERNAL;
 
 char *
 mono_dwarf_escape_path (const char *name);
diff --git a/mono/mini/emitnunit.pl b/mono/mini/emitnunit.pl
new file mode 100755 (executable)
index 0000000..b511e7d
--- /dev/null
@@ -0,0 +1,76 @@
+#!/usr/bin/perl
+use strict;
+use warnings;
+use Cwd;
+use POSIX qw(strftime uname locale_h);
+use Net::Domain qw(hostname hostfqdn);
+use locale;
+
+my $line;
+foreach $line (<STDIN>) {
+    chomp ($line);
+    print "$line\n";
+    if ($line =~ /^Overall results:/) {
+        # do magic nunit emission here
+        # failures look like:
+        #    Overall results: tests: 19992, failed: 48, opt combinations: 24 (pass: 99.76%)
+        # passes look like:
+        #    Overall results: tests: 20928, 100% pass, opt combinations: 24
+        my @words = split (/ /, $line);
+        my $failed;
+        my $successbool;
+        my $total = $words[3];
+        my $mylocale = setlocale (LC_CTYPE);
+        $mylocale = substr($mylocale, 0, index($mylocale, '.'));
+        $mylocale =~ s/_/-/;
+        if ($line =~ /failed:/) {
+            $failed = $words[5];
+        } else {
+            $failed = "0,";
+        }
+        chop ($failed);
+        chop ($total);
+        if ($failed > 0) {
+            $successbool = "False";
+        } else {
+            $successbool = "True";
+        }
+        open (my $nunitxml, '>', 'TestResults_regression.xml') or die "Could not write to 'TestResults_regression.xml' $!";
+        print $nunitxml "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"no\"?>\n";
+        print $nunitxml "<!--This file represents the results of running a test suite-->\n";
+        print $nunitxml "<test-results name=\"regression-tests.dummy\" total=\"$total\" failures=\"$failed\" not-run=\"0\" date=\"" . strftime ("%F", localtime) . "\" time=\"" . strftime ("%T", localtime) . "\">\n";
+        print $nunitxml "  <environment nunit-version=\"2.4.8.0\" clr-version=\"4.0.30319.17020\" os-version=\"Unix " . (uname ())[2]  . "\" platform=\"Unix\" cwd=\"" . getcwd . "\" machine-name=\"" . hostname . "\" user=\"" . getpwuid ($<) . "\" user-domain=\"" . hostfqdn  . "\" />\n";
+        print $nunitxml "  <culture-info current-culture=\"$mylocale\" current-uiculture=\"$mylocale\" />\n";
+        print $nunitxml "  <test-suite name=\"regression-tests.dummy\" success=\"$successbool\" time=\"0\" asserts=\"0\">\n";
+        print $nunitxml "    <results>\n";
+        print $nunitxml "      <test-suite name=\"MonoTests\" success=\"$successbool\" time=\"0\" asserts=\"0\">\n";
+        print $nunitxml "        <results>\n";
+        print $nunitxml "          <test-suite name=\"regressions\" success=\"$successbool\" time=\"0\" asserts=\"0\">\n";
+        print $nunitxml "            <results>\n";
+        print $nunitxml "              <test-case name=\"MonoTests.regressions.100percentsuccess\" executed=\"True\" success=\"$successbool\" time=\"0\" asserts=\"0\"";
+        if ( $failed > 0) {
+        print $nunitxml ">\n";
+        print $nunitxml "                <failure>\n";
+        print $nunitxml "                  <message><![CDATA[";
+        foreach $line (<STDIN>) {
+            chomp ($line);
+            print "$line\n";
+        }
+        print $nunitxml "]]></message>\n";
+        print $nunitxml "                  <stack-trace>\n";
+        print $nunitxml "                  </stack-trace>\n";
+        print $nunitxml "                </failure>\n";
+        print $nunitxml "              </test-case>\n";
+        } else {
+        print $nunitxml " />\n";
+        }
+        print $nunitxml "            </results>\n";
+        print $nunitxml "          </test-suite>\n";
+        print $nunitxml "        </results>\n";
+        print $nunitxml "      </test-suite>\n";
+        print $nunitxml "    </results>\n";
+        print $nunitxml "  </test-suite>\n";
+        print $nunitxml "</test-results>\n";
+        close $nunitxml;
+    }
+}
index d0ee4fac40dcf89a0cfa392493aba69e6847775b..ea146bda57d13777695b38460d3fa0c067173748 100644 (file)
@@ -1575,6 +1575,124 @@ public class Tests
                        return 1;
                return 0;
        }
+
+       struct EmptyStruct {
+       }
+
+       public struct BStruct {
+               public int a, b, c, d;
+       }
+
+       interface IFoo3<T> {
+               int Bytes (T t, int dummy1, int a2, int a3, int a4, int a5, int a6, int a7, int dummy8,
+                                  byte b1, byte b2, byte b3, byte b4, byte b5, byte b6, byte b7, byte b8);
+               int SBytes (T t, int dummy1, int a2, int a3, int a4, int a5, int a6, int a7, int dummy8,
+                                       sbyte b1, sbyte b2, sbyte b3, sbyte b4);
+               int Shorts (T t, int dummy1, int a2, int a3, int a4, int a5, int a6, int a7, int dummy8,
+                                       short b1, short b2, short b3, short b4);
+               int UShorts (T t, int dummy1, int a2, int a3, int a4, int a5, int a6, int a7, int dummy8,
+                                       ushort b1, ushort b2, ushort b3, ushort b4);
+               int Ints (T t, int dummy1, int a2, int a3, int a4, int a5, int a6, int a7, int dummy8,
+                                 int i1, int i2, int i3, int i4);
+               int UInts (T t, int dummy1, int a2, int a3, int a4, int a5, int a6, int a7, int dummy8,
+                                  uint i1, uint i2, uint i3, uint i4);
+               int Structs (T t, int dummy1, int a2, int a3, int a4, int a5, int a6, int a7, int dummy8,
+                                        BStruct s);
+       }
+
+       class Foo3<T> : IFoo3<T> {
+               public int Bytes (T t, int dummy1, int a2, int a3, int a4, int a5, int a6, int a7, int dummy8,
+                                                 byte b1, byte b2, byte b3, byte b4, byte b5, byte b6, byte b7, byte b8) {
+                       return b1 + b2 + b3 + b4 + b5 + b6 + b7 + b8;
+               }
+               public int SBytes (T t, int dummy1, int a2, int a3, int a4, int a5, int a6, int a7, int dummy8,
+                                                 sbyte b1, sbyte b2, sbyte b3, sbyte b4) {
+                       return b1 + b2 + b3 + b4;
+               }
+               public int Shorts (T t, int dummy1, int a2, int a3, int a4, int a5, int a6, int a7, int dummy8,
+                                                  short b1, short b2, short b3, short b4) {
+                       return b1 + b2 + b3 + b4;
+               }
+               public int UShorts (T t, int dummy1, int a2, int a3, int a4, int a5, int a6, int a7, int dummy8,
+                                                       ushort b1, ushort b2, ushort b3, ushort b4) {
+                       return b1 + b2 + b3 + b4;
+               }
+               public int Ints (T t, int a1, int a2, int a3, int a4, int a5, int a6, int a7, int a8,
+                                                  int i1, int i2, int i3, int i4) {
+                       return i1 + i2 + i3 + i4;
+               }
+               public int UInts (T t, int a1, int a2, int a3, int a4, int a5, int a6, int a7, int a8,
+                                                 uint i1, uint i2, uint i3, uint i4) {
+                       return (int)(i1 + i2 + i3 + i4);
+               }
+               public int Structs (T t, int dummy1, int a2, int a3, int a4, int a5, int a6, int a7, int dummy8,
+                                                       BStruct s) {
+                       return s.a + s.b + s.c + s.d;
+               }
+       }
+
+       // Passing small normal arguments on the stack
+       public static int test_0_arm64_small_stack_args () {
+               IFoo3<EmptyStruct> o = (IFoo3<EmptyStruct>)Activator.CreateInstance (typeof (Foo3<>).MakeGenericType (new Type [] { typeof (EmptyStruct) }));
+               int res = o.Bytes (new EmptyStruct (), 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8);
+               if (res != 36)
+                       return 1;
+               int res2 = o.SBytes (new EmptyStruct (), 1, 2, 3, 4, 5, 6, 7, 8, -1, -2, -3, -4);
+               if (res2 != -10)
+                       return 2;
+               int res3 = o.Shorts (new EmptyStruct (), 1, 2, 3, 4, 5, 6, 7, 8, -1, -2, -3, -4);
+               if (res3 != -10)
+                       return 3;
+               int res4 = o.UShorts (new EmptyStruct (), 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4);
+               if (res4 != 10)
+                       return 4;
+               int res5 = o.Ints (new EmptyStruct (), 1, 2, 3, 4, 5, 6, 7, 8, -1, -2, -3, -4);
+               if (res5 != -10)
+                       return 5;
+               int res6 = o.UInts (new EmptyStruct (), 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4);
+               if (res6 != 10)
+                       return 6;
+               return 0;
+       }
+
+       // Passing vtype normal arguments on the stack
+       public static int test_0_arm64_vtype_stack_args () {
+               IFoo3<EmptyStruct> o = (IFoo3<EmptyStruct>)Activator.CreateInstance (typeof (Foo3<>).MakeGenericType (new Type [] { typeof (EmptyStruct) }));
+               int res = o.Structs (new EmptyStruct (), 1, 2, 3, 4, 5, 6, 7, 8, new BStruct () { a = 1, b = 2, c = 3, d = 4 });
+               if (res != 10)
+                       return 1;
+               return 0;
+       }
+
+       interface IFoo4<T> {
+               T Get(T[,] arr, T t);
+       }
+
+       class Foo4<T> : IFoo4<T> {
+               public T Get(T[,] arr, T t) {
+                       arr [1, 1] = t;
+                       return arr [1, 1];
+               }
+       }
+
+       struct AStruct {
+               public int a, b;
+       }
+
+       public static int test_0_multi_dim_arrays_2 () {
+               IFoo4<int> foo = new Foo4<int> ();
+               var arr = new int [10, 10];
+               int res = foo.Get (arr, 10);
+               if (res != 10)
+                       return 1;
+
+               IFoo4<AStruct> foo2 = new Foo4<AStruct> ();
+               var arr2 = new AStruct [10, 10];
+               var res2 = foo2.Get (arr2, new AStruct () { a = 1, b = 2 });
+               if (res2.a != 1 || res2.b != 2)
+                       return 2;
+               return 0;
+       }
 }
 
 // #13191
index 4e316f6db021d3d0eec80b212950cedbc9472535..85b6ba04001d48715d8385c4b0eb0d7d504e253a 100644 (file)
@@ -861,7 +861,7 @@ mono_analyze_liveness2 (MonoCompile *cfg)
        if (disabled)
                return;
 
-       if (cfg->num_bblocks >= (1 << (32 - BB_ID_SHIFT)))
+       if (cfg->num_bblocks >= (1 << (32 - BB_ID_SHIFT - 1)))
                /* Ranges would overflow */
                return;
 
index 56047489f80de54825131ade3e99a250399ce5ea..2fc0f49c9a9bb269b5d931bdb4619ff2bb11536c 100755 (executable)
@@ -5276,20 +5276,24 @@ mini_emit_ldelema_ins (MonoCompile *cfg, MonoMethod *cmethod, MonoInst **sp, uns
        MonoInst *addr;
        MonoMethod *addr_method;
        int element_size;
+       MonoClass *eclass = cmethod->klass->element_class;
 
        rank = mono_method_signature (cmethod)->param_count - (is_set? 1: 0);
 
        if (rank == 1)
-               return mini_emit_ldelema_1_ins (cfg, cmethod->klass->element_class, sp [0], sp [1], TRUE);
+               return mini_emit_ldelema_1_ins (cfg, eclass, sp [0], sp [1], TRUE);
 
 #ifndef MONO_ARCH_EMULATE_MUL_DIV
        /* emit_ldelema_2 depends on OP_LMUL */
-       if (rank == 2 && (cfg->opt & MONO_OPT_INTRINS)) {
-               return mini_emit_ldelema_2_ins (cfg, cmethod->klass->element_class, sp [0], sp [1], sp [2]);
+       if (rank == 2 && (cfg->opt & MONO_OPT_INTRINS) && !mini_is_gsharedvt_variable_klass (cfg, eclass)) {
+               return mini_emit_ldelema_2_ins (cfg, eclass, sp [0], sp [1], sp [2]);
        }
 #endif
 
-       element_size = mono_class_array_element_size (cmethod->klass->element_class);
+       if (mini_is_gsharedvt_variable_klass (cfg, eclass))
+               element_size = 0;
+       else
+               element_size = mono_class_array_element_size (eclass);
        addr_method = mono_marshal_get_array_address (rank, element_size);
        addr = mono_emit_method_call (cfg, addr_method, sp, NULL);
 
@@ -9160,7 +9164,8 @@ mono_method_to_ir (MonoCompile *cfg, MonoMethod *method, MonoBasicBlock *start_b
                         * This needs to be used for all generic calls, not just ones with a gsharedvt signature, to avoid
                         * patching gshared method addresses into a gsharedvt method.
                         */
-                       if (cmethod && cfg->gsharedvt && (mini_is_gsharedvt_signature (cfg, fsig) || cmethod->is_inflated || cmethod->klass->generic_class)) {
+                       if (cmethod && cfg->gsharedvt && (mini_is_gsharedvt_signature (cfg, fsig) || cmethod->is_inflated || cmethod->klass->generic_class) &&
+                               !(cmethod->klass->rank && cmethod->klass->byval_arg.type != MONO_TYPE_SZARRAY)) {
                                MonoRgctxInfoType info_type;
 
                                if (virtual) {
@@ -9186,10 +9191,6 @@ mono_method_to_ir (MonoCompile *cfg, MonoMethod *method, MonoBasicBlock *start_b
                                        }
                                }
 
-                               if (cmethod->klass->rank && cmethod->klass->byval_arg.type != MONO_TYPE_SZARRAY)
-                                       /* test_0_multi_dim_arrays () in gshared.cs */
-                                       GSHAREDVT_FAILURE (*ip);
-
                                if ((cmethod->klass->parent == mono_defaults.multicastdelegate_class) && (!strcmp (cmethod->name, "Invoke")))
                                        keep_this_alive = sp [0];
 
@@ -9309,6 +9310,8 @@ mono_method_to_ir (MonoCompile *cfg, MonoMethod *method, MonoBasicBlock *start_b
                                        EMIT_NEW_STORE_MEMBASE_TYPE (cfg, ins, fsig->params [fsig->param_count - 1], addr->dreg, 0, val->dreg);
                                        if (cfg->gen_write_barriers && val->type == STACK_OBJ && !(val->opcode == OP_PCONST && val->inst_c0 == 0))
                                                emit_write_barrier (cfg, addr, val);
+                                       if (cfg->gen_write_barriers && mini_is_gsharedvt_klass (cfg, cmethod->klass))
+                                               GSHAREDVT_FAILURE (*ip);
                                } else if (strcmp (cmethod->name, "Get") == 0) { /* array Get */
                                        addr = mini_emit_ldelema_ins (cfg, cmethod, sp, ip, FALSE);
 
index fe1cc21b73826459c9686f4a6e673e0c6cf9af41..ea04525ff14fa08ed11e769046fd1cecfb098102 100644 (file)
@@ -971,7 +971,7 @@ mono_arch_init (void)
         */
        const char *soft = g_getenv ("MONO_ARM_FORCE_SOFT_FLOAT");
 
-       if (!strncmp (soft, "1", 1))
+       if (soft && !strncmp (soft, "1", 1))
                arm_fpu = MONO_ARM_FPU_NONE;
 #endif
 #endif
index 04b2ec30be4410daf07787972101d26be1eb25c5..92a22729dfa44dc0a75e8e150f19e8ce64ab78c5 100644 (file)
@@ -580,6 +580,7 @@ mono_print_ins_index (int i, MonoInst *ins)
        case OP_IOR_IMM:
        case OP_IXOR_IMM:
        case OP_SUB_IMM:
+       case OP_STORE_MEMBASE_IMM:
                printf (" [%d]", (int)ins->inst_imm);
                break;
        case OP_ADD_IMM:
index 0e0bfc6fb5ee34e3d60382f9b5a59da715a23171..aa3657cb4d7db62e01e44f062951292f19e2cae4 100644 (file)
@@ -1156,22 +1156,32 @@ sig_to_llvm_sig_full (EmitContext *ctx, MonoMethodSignature *sig, LLVMCallInfo *
        ret_type = type_to_llvm_type (ctx, rtype);
        CHECK_FAILURE (ctx);
 
-       if (cinfo && cinfo->ret.storage == LLVMArgVtypeInReg) {
-               /* LLVM models this by returning an aggregate value */
-               if (cinfo->ret.pair_storage [0] == LLVMArgInIReg && cinfo->ret.pair_storage [1] == LLVMArgNone) {
-                       LLVMTypeRef members [2];
-
-                       members [0] = IntPtrType ();
-                       ret_type = LLVMStructType (members, 1, FALSE);
-               } else {
-                       g_assert_not_reached ();
+       if (cinfo) {
+               if (cinfo->ret.storage == LLVMArgVtypeInReg) {
+                       /* LLVM models this by returning an aggregate value */
+                       if (cinfo->ret.pair_storage [0] == LLVMArgInIReg && cinfo->ret.pair_storage [1] == LLVMArgNone) {
+                               LLVMTypeRef members [2];
+
+                               members [0] = IntPtrType ();
+                               ret_type = LLVMStructType (members, 1, FALSE);
+                       } else {
+                               g_assert_not_reached ();
+                       }
+               } else if (cinfo->ret.storage == LLVMArgVtypeByVal) {
+                       /* Vtype returned normally by val */
+               } else if (cinfo->ret.storage == LLVMArgFpStruct) {
+                       /* Vtype returned as a fp struct */
+                       LLVMTypeRef members [16];
+
+                       /* Have to create our own structure since we don't map fp structures to LLVM fp structures yet */
+                       for (i = 0; i < cinfo->ret.nslots; ++i)
+                               members [i] = cinfo->ret.esize == 8 ? LLVMDoubleType () : LLVMFloatType ();
+                       ret_type = LLVMStructType (members, cinfo->ret.nslots, FALSE);
+               } else if (mini_type_is_vtype (ctx->cfg, rtype)) {
+                       g_assert (cinfo->ret.storage == LLVMArgVtypeRetAddr);
+                       vretaddr = TRUE;
+                       ret_type = LLVMVoidType ();
                }
-       } else if (cinfo && cinfo->ret.storage == LLVMArgVtypeByVal) {
-               /* Vtype returned normally by val */
-       } else if (cinfo && mini_type_is_vtype (ctx->cfg, rtype)) {
-               g_assert (cinfo->ret.storage == LLVMArgVtypeRetAddr);
-               vretaddr = TRUE;
-               ret_type = LLVMVoidType ();
        }
 
        pindexes = g_new0 (int, sig->param_count);
@@ -1226,7 +1236,14 @@ sig_to_llvm_sig_full (EmitContext *ctx, MonoMethodSignature *sig, LLVMCallInfo *
                if (vretaddr && vret_arg_pindex == pindex)
                        param_types [pindex ++] = IntPtrType ();
                pindexes [i] = pindex;
-               if (ainfo && ainfo->storage == LLVMArgVtypeInReg) {
+
+               if (!ainfo) {
+                       param_types [pindex ++] = type_to_llvm_arg_type (ctx, sig->params [i]);
+                       continue;
+               }
+
+               switch (ainfo->storage) {
+               case LLVMArgVtypeInReg:
                        for (j = 0; j < 2; ++j) {
                                switch (ainfo->pair_storage [j]) {
                                case LLVMArgInIReg:
@@ -1238,23 +1255,29 @@ sig_to_llvm_sig_full (EmitContext *ctx, MonoMethodSignature *sig, LLVMCallInfo *
                                        g_assert_not_reached ();
                                }
                        }
-               } else if (ainfo && ainfo->storage == LLVMArgVtypeByVal) {
+                       break;
+               case LLVMArgVtypeByVal:
                        param_types [pindex] = type_to_llvm_arg_type (ctx, sig->params [i]);
                        CHECK_FAILURE (ctx);
                        param_types [pindex] = LLVMPointerType (param_types [pindex], 0);
                        pindex ++;
-               } else if (ainfo && ainfo->storage == LLVMArgAsIArgs) {
+                       break;
+               case LLVMArgAsIArgs:
                        param_types [pindex] = LLVMArrayType (IntPtrType (), ainfo->nslots);
                        pindex ++;
-               } else if (ainfo && ainfo->storage == LLVMArgAsFpArgs) {
+                       break;
+               case LLVMArgAsFpArgs: {
                        int j;
 
                        for (j = 0; j < ainfo->nslots; ++j)
                                param_types [pindex + j] = ainfo->esize == 8 ? LLVMDoubleType () : LLVMFloatType ();
                        pindex += ainfo->nslots;
-               } else {
+                       break;
+               }
+               default:
                        param_types [pindex ++] = type_to_llvm_arg_type (ctx, sig->params [i]);
-               }                       
+                       break;
+               }
        }
        if (vretaddr && vret_arg_pindex == pindex)
                param_types [pindex ++] = IntPtrType ();
@@ -1969,7 +1992,9 @@ emit_entry_bb (EmitContext *ctx, LLVMBuilderRef builder)
                LLVMArgInfo *ainfo = &linfo->args [i + sig->hasthis];
                int reg = cfg->args [i + sig->hasthis]->dreg;
 
-               if (ainfo->storage == LLVMArgVtypeInReg || ainfo->storage == LLVMArgAsFpArgs) {
+               switch (ainfo->storage) {
+               case LLVMArgVtypeInReg:
+               case LLVMArgAsFpArgs: {
                        LLVMValueRef args [8];
                        int j;
 
@@ -1993,22 +2018,29 @@ emit_entry_bb (EmitContext *ctx, LLVMBuilderRef builder)
                                /* Treat these as normal values */
                                ctx->values [reg] = LLVMBuildLoad (builder, ctx->addresses [reg], "");
                        }
-               } else if (ainfo->storage == LLVMArgVtypeByVal) {
+                       break;
+               }
+               case LLVMArgVtypeByVal: {
                        ctx->addresses [reg] = LLVMGetParam (ctx->lmethod, ctx->pindexes [i]);
 
                        if (MONO_CLASS_IS_SIMD (ctx->cfg, mono_class_from_mono_type (sig->params [i]))) {
                                /* Treat these as normal values */
                                ctx->values [reg] = LLVMBuildLoad (builder, ctx->addresses [reg], "");
                        }
-               } else if (ainfo->storage == LLVMArgAsIArgs) {
+                       break;
+               }
+               case LLVMArgAsIArgs: {
                        LLVMValueRef arg = LLVMGetParam (ctx->lmethod, ctx->pindexes [i]);
 
                        ctx->addresses [reg] = build_alloca (ctx, sig->params [i]);
 
                        /* The argument is received as an array of ints, store it into the real argument */
                        LLVMBuildStore (ctx->builder, arg, convert (ctx, ctx->addresses [reg], LLVMPointerType (LLVMTypeOf (arg), 0)));
-               } else {
+                       break;
+               }
+               default:
                        ctx->values [reg] = convert_full (ctx, ctx->values [reg], llvm_type_to_stack_type (cfg, type_to_llvm_type (ctx, sig->params [i])), type_is_unsigned (ctx, sig->params [i]));
+                       break;
                }
        }
 
@@ -2289,7 +2321,9 @@ process_call (EmitContext *ctx, MonoBasicBlock *bb, LLVMBuilderRef *builder_ref,
                regpair = (guint32)(gssize)(l->data);
                reg = regpair & 0xffffff;
                args [pindex] = values [reg];
-               if (ainfo->storage == LLVMArgVtypeInReg || ainfo->storage == LLVMArgAsFpArgs) {
+               switch (ainfo->storage) {
+               case LLVMArgVtypeInReg:
+               case LLVMArgAsFpArgs: {
                        guint32 nargs;
 
                        g_assert (addresses [reg]);
@@ -2298,18 +2332,23 @@ process_call (EmitContext *ctx, MonoBasicBlock *bb, LLVMBuilderRef *builder_ref,
 
                        // FIXME: alignment
                        // FIXME: Get rid of the VMOVE
-               } else if (ainfo->storage == LLVMArgVtypeByVal) {
+                       break;
+               }
+               case LLVMArgVtypeByVal:
                        g_assert (addresses [reg]);
                        args [pindex] = addresses [reg];
-               } else if (ainfo->storage == LLVMArgAsIArgs) {
+                       break;
+               case LLVMArgAsIArgs:
                        g_assert (addresses [reg]);
                        args [pindex] = LLVMBuildLoad (ctx->builder, convert (ctx, addresses [reg], LLVMPointerType (LLVMArrayType (IntPtrType (), ainfo->nslots), 0)), "");
-               } else {
+                       break;
+               default:
                        g_assert (args [pindex]);
                        if (i == 0 && sig->hasthis)
                                args [pindex] = convert (ctx, args [pindex], ThisType ());
                        else
                                args [pindex] = convert (ctx, args [pindex], type_to_llvm_arg_type (ctx, sig->params [i - sig->hasthis]));
+                       break;
                }
 
                l = l->next;
@@ -2351,24 +2390,40 @@ process_call (EmitContext *ctx, MonoBasicBlock *bb, LLVMBuilderRef *builder_ref,
        /*
         * Convert the result
         */
-       if (cinfo && cinfo->ret.storage == LLVMArgVtypeInReg) {
-               LLVMValueRef regs [2];
+       if (cinfo) {
+               switch (cinfo->ret.storage) {
+               case LLVMArgVtypeInReg: {
+                       LLVMValueRef regs [2];
 
-               if (!addresses [ins->dreg])
-                       addresses [ins->dreg] = build_alloca (ctx, sig->ret);
+                       if (!addresses [ins->dreg])
+                               addresses [ins->dreg] = build_alloca (ctx, sig->ret);
 
-               regs [0] = LLVMBuildExtractValue (builder, lcall, 0, "");
-               if (cinfo->ret.pair_storage [1] != LLVMArgNone)
-                       regs [1] = LLVMBuildExtractValue (builder, lcall, 1, "");
-                                       
-               emit_args_to_vtype (ctx, builder, sig->ret, addresses [ins->dreg], &cinfo->ret, regs);
-       } else if (cinfo && cinfo->ret.storage == LLVMArgVtypeByVal) {
-               if (!addresses [call->inst.dreg])
-                       addresses [call->inst.dreg] = build_alloca (ctx, sig->ret);
-               LLVMBuildStore (builder, lcall, addresses [call->inst.dreg]);
-       } else if (sig->ret->type != MONO_TYPE_VOID && !vretaddr) {
-               /* If the method returns an unsigned value, need to zext it */
-               values [ins->dreg] = convert_full (ctx, lcall, llvm_type_to_stack_type (cfg, type_to_llvm_type (ctx, sig->ret)), type_is_unsigned (ctx, sig->ret));
+                       regs [0] = LLVMBuildExtractValue (builder, lcall, 0, "");
+                       if (cinfo->ret.pair_storage [1] != LLVMArgNone)
+                               regs [1] = LLVMBuildExtractValue (builder, lcall, 1, "");
+                       emit_args_to_vtype (ctx, builder, sig->ret, addresses [ins->dreg], &cinfo->ret, regs);
+                       break;
+               }
+               case LLVMArgVtypeByVal:
+                       if (!addresses [call->inst.dreg])
+                               addresses [call->inst.dreg] = build_alloca (ctx, sig->ret);
+                       LLVMBuildStore (builder, lcall, addresses [call->inst.dreg]);
+                       break;
+               case LLVMArgFpStruct:
+                       if (!addresses [call->inst.dreg])
+                               addresses [call->inst.dreg] = build_alloca (ctx, sig->ret);
+                       LLVMBuildStore (builder, lcall, convert_full (ctx, addresses [call->inst.dreg], LLVMPointerType (LLVMTypeOf (lcall), 0), FALSE));
+                       break;
+               default:
+                       if (sig->ret->type != MONO_TYPE_VOID && !vretaddr)
+                               /* If the method returns an unsigned value, need to zext it */
+                               values [ins->dreg] = convert_full (ctx, lcall, llvm_type_to_stack_type (cfg, type_to_llvm_type (ctx, sig->ret)), type_is_unsigned (ctx, sig->ret));
+                       break;
+               }
+       } else {
+               if (sig->ret->type != MONO_TYPE_VOID && !vretaddr)
+                       /* If the method returns an unsigned value, need to zext it */
+                       values [ins->dreg] = convert_full (ctx, lcall, llvm_type_to_stack_type (cfg, type_to_llvm_type (ctx, sig->ret)), type_is_unsigned (ctx, sig->ret));
        }
 
        if (vretaddr) {
@@ -2685,6 +2740,16 @@ process_bb (EmitContext *ctx, MonoBasicBlock *bb)
                                break;
                        }
 
+                       if (linfo->ret.storage == LLVMArgFpStruct) {
+                               LLVMTypeRef ret_type = LLVMGetReturnType (LLVMGetElementType (LLVMTypeOf (method)));
+                               LLVMValueRef retval;
+
+                               g_assert (addresses [ins->sreg1]);
+                               retval = LLVMBuildLoad (builder, convert (ctx, addresses [ins->sreg1], LLVMPointerType (ret_type, 0)), "");
+                               LLVMBuildRet (builder, retval);
+                               break;
+                       }
+
                        if (!lhs || ctx->is_dead [ins->sreg1]) {
                                /* 
                                 * The method did not set its return value, probably because it
@@ -2956,6 +3021,29 @@ process_bb (EmitContext *ctx, MonoBasicBlock *bb)
                        lhs = convert (ctx, lhs, regtype_to_llvm_type (spec [MONO_INST_DEST]));
                        rhs = convert (ctx, rhs, regtype_to_llvm_type (spec [MONO_INST_DEST]));
 
+#ifdef MONO_ARCH_NEED_DIV_CHECK
+                       switch (ins->opcode) {
+                       case OP_IDIV:
+                       case OP_LDIV:
+                       case OP_IREM:
+                       case OP_LREM:
+                       case OP_IDIV_UN:
+                       case OP_LDIV_UN:
+                       case OP_IREM_UN:
+                       case OP_LREM_UN: {
+                               LLVMValueRef cmp;
+
+                               cmp = LLVMBuildICmp (builder, LLVMIntEQ, rhs, LLVMConstInt (LLVMTypeOf (rhs), 0, FALSE), "");
+                               emit_cond_system_exception (ctx, bb, "DivideByZeroException", cmp);
+                               CHECK_FAILURE (ctx);
+                               builder = ctx->builder;
+                               break;
+                       }
+                       default:
+                               break;
+                       }
+#endif
+
                        switch (ins->opcode) {
                        case OP_IADD:
                        case OP_LADD:
@@ -3690,6 +3778,7 @@ process_bb (EmitContext *ctx, MonoBasicBlock *bb)
                case OP_ATOMIC_LOAD_U8:
                case OP_ATOMIC_LOAD_R4:
                case OP_ATOMIC_LOAD_R8: {
+                       LLVM_FAILURE (ctx, "atomic mono.load intrinsic");
 #if LLVM_API_VERSION >= 4
                        int size;
                        gboolean sext, zext;
@@ -3733,6 +3822,7 @@ process_bb (EmitContext *ctx, MonoBasicBlock *bb)
                case OP_ATOMIC_STORE_U8:
                case OP_ATOMIC_STORE_R4:
                case OP_ATOMIC_STORE_R8: {
+                       LLVM_FAILURE (ctx, "atomic mono.load intrinsic");
 #if LLVM_API_VERSION >= 4
                        int size;
                        gboolean sext, zext;
@@ -4813,6 +4903,9 @@ mono_llvm_emit_method (MonoCompile *cfg)
                if (clause->flags != MONO_EXCEPTION_CLAUSE_FINALLY && clause->flags != MONO_EXCEPTION_CLAUSE_NONE)
                        LLVM_FAILURE (ctx, "non-finally/catch clause.");
        }
+       if (header->num_clauses || (cfg->method->iflags & METHOD_IMPL_ATTRIBUTE_NOINLINING))
+               /* We can't handle inlined methods with clauses */
+               LLVMAddFunctionAttr (method, LLVMNoInlineAttribute);
 
        if (linfo->rgctx_arg) {
                ctx->rgctx_arg = LLVMGetParam (method, sinfo.rgctx_arg_pindex);
@@ -5733,6 +5826,7 @@ mono_llvm_create_aot_module (const char *got_symbol, gboolean external_symbols,
                lbuilder = LLVMCreateBuilder ();
                LLVMPositionBuilderAtEnd (lbuilder, lbb);
                LLVMBuildRetVoid (lbuilder);
+               mark_as_used (&aot_module, personality);
        }
 
        aot_module.llvm_types = g_hash_table_new (NULL, NULL);
index 6ca7bec56698cc3219e6362f9cbcb840ff4048dd..aaaaf9af7a6a2f2efa7e13e3c727e4eb4dba2035 100755 (executable)
 #endif
 
 /* Version number of the AOT file format */
-#define MONO_AOT_FILE_VERSION 107
+#define MONO_AOT_FILE_VERSION 108
 
 //TODO: This is x86/amd64 specific.
 #define mono_simd_shuffle_mask(a,b,c,d) ((a) | ((b) << 2) | ((c) << 4) | ((d) << 6))
@@ -199,7 +199,6 @@ typedef struct MonoAotFileInfo
        gpointer extra_method_table;
        gpointer got_info_offsets;
        gpointer llvm_got_info_offsets;
-       gpointer methods_end;
        gpointer unwind_info;
        gpointer mem_end;
        gpointer image_table;
@@ -706,7 +705,12 @@ typedef enum {
        /* Vtype passed as one int array argument */
        LLVMArgAsIArgs,
        /* Vtype passed as a set of fp arguments */
-       LLVMArgAsFpArgs
+       LLVMArgAsFpArgs,
+       /*
+        * Only for returns, a structure which
+        * consists of floats/doubles.
+        */
+       LLVMArgFpStruct,
 } LLVMArgStorage;
 
 typedef struct {
@@ -718,12 +722,14 @@ typedef struct {
         */
        LLVMArgStorage pair_storage [8];
        /*
-        * Only if storage == LLVMArgAsIArgs/LLVMArgAsFpArgs.
+        * Only if storage == LLVMArgAsIArgs/LLVMArgAsFpArgs/LLVMArgFpStruct.
         * If storage == LLVMArgAsFpArgs, this is the number of arguments
         * used to pass the value.
+        * If storage == LLVMArgFpStruct, this is the number of fields
+        * in the structure.
         */
        int nslots;
-       /* Only if storage == LLVMArgAsFpArgs (4/8) */
+       /* Only if storage == LLVMArgAsFpArgs/LLVMArgFpStruct (4/8) */
        int esize;
 } LLVMArgInfo;
 
@@ -1610,6 +1616,7 @@ typedef struct {
        guint32 got_offset, ex_info_offset, method_info_offset, method_index;
        /* Symbol used to refer to this method in generated assembly */
        char *asm_symbol;
+       char *asm_debug_symbol;
        char *llvm_method_name;
        int castclass_cache_index;
 
@@ -2588,7 +2595,7 @@ void     mono_resume_unwind                     (MonoContext *ctx) MONO_LLVM_INT
 MonoJitInfo * mono_find_jit_info                (MonoDomain *domain, MonoJitTlsData *jit_tls, MonoJitInfo *res, MonoJitInfo *prev_ji, MonoContext *ctx, MonoContext *new_ctx, char **trace, MonoLMF **lmf, int *native_offset, gboolean *managed) MONO_INTERNAL;
 
 typedef gboolean (*MonoExceptionFrameWalk)      (MonoMethod *method, gpointer ip, size_t native_offset, gboolean managed, gpointer user_data);
-gboolean mono_exception_walk_trace              (MonoException *ex, MonoExceptionFrameWalk func, gpointer user_data);
+MONO_API gboolean mono_exception_walk_trace     (MonoException *ex, MonoExceptionFrameWalk func, gpointer user_data);
 void mono_restore_context                       (MonoContext *ctx) MONO_INTERNAL;
 guint8* mono_jinfo_get_unwind_info              (MonoJitInfo *ji, guint32 *unwind_info_len) MONO_INTERNAL;
 int  mono_jinfo_get_epilog_size                 (MonoJitInfo *ji) MONO_INTERNAL;
@@ -2620,7 +2627,7 @@ void mono_set_cast_details                      (MonoClass *from, MonoClass *to)
  * If no hook has been installed, the runtime will print a message before aborting.
  */
 typedef void  (*MonoUnhandledExceptionFunc)         (MonoObject *exc, gpointer user_data);
-void          mono_install_unhandled_exception_hook (MonoUnhandledExceptionFunc func, gpointer user_data);
+MONO_API void mono_install_unhandled_exception_hook (MonoUnhandledExceptionFunc func, gpointer user_data);
 void          mono_invoke_unhandled_exception_hook  (MonoObject *exc);
 
 /* Dominator/SSA methods */
@@ -2789,9 +2796,9 @@ void mono_cfg_add_try_hole (MonoCompile *cfg, MonoExceptionClause *clause, guint
 
 void mono_cfg_set_exception (MonoCompile *cfg, int type) MONO_INTERNAL;
 gboolean mini_type_is_reference (MonoCompile *cfg, MonoType *type) MONO_INTERNAL;
-gboolean mini_type_is_vtype (MonoCompile *cfg, MonoType *t); /* should be internal but it's used by llvm */
-gboolean mini_type_var_is_vt (MonoCompile *cfg, MonoType *type); /* should be internal but it's used by llvm */
-gboolean mini_is_gsharedvt_klass (MonoCompile *cfg, MonoClass *klass); /* should be internal but it's used by llvm */
+gboolean mini_type_is_vtype (MonoCompile *cfg, MonoType *t) MONO_LLVM_INTERNAL;
+gboolean mini_type_var_is_vt (MonoCompile *cfg, MonoType *type) MONO_LLVM_INTERNAL;
+gboolean mini_is_gsharedvt_klass (MonoCompile *cfg, MonoClass *klass) MONO_LLVM_INTERNAL;
 gboolean mini_is_gsharedvt_type (MonoCompile *cfg, MonoType *t) MONO_INTERNAL;
 gboolean mini_is_gsharedvt_signature (MonoCompile *cfg, MonoMethodSignature *sig) MONO_INTERNAL;
 gboolean mini_is_gsharedvt_type_gsctx (MonoGenericSharingContext *gsctx, MonoType *t) MONO_INTERNAL;
index 9866dbba4b81ae671d38e99753fa1b1f76d9fb4c..d29b282e2ba2889f6753055501a717ea08383f64 100755 (executable)
@@ -85,10 +85,28 @@ while read line; do
        fi
 done < $TMP_FILE
 
+echo -n "              <test-case name=\"MonoTests.op_il_seq_point.${TEST_FILE}${USE_AOT}\" executed=\"True\" time=\"0\" asserts=\"0\" success=\"" >> TestResults_op_il_seq_point.xml
+
 if [ $CHANGES != 0 ]
 then
        METHOD_NAME=$(get_method_name "$METHOD")
 
+       echo "False\">" >> TestResults_op_il_seq_point.xml
+       echo "                <failure>" >> TestResults_op_il_seq_point.xml
+       echo -n "                  <message><![CDATA[" >> TestResults_op_il_seq_point.xml
+       echo "Detected OP_IL_SEQ_POINT incompatibility on $TEST_FILE" >> TestResults_op_il_seq_point.xml
+       echo "  $CHANGES methods differ when sequence points are enabled." >> TestResults_op_il_seq_point.xml
+       echo '  This is probably caused by a runtime optimization that is not handling OP_IL_SEQ_POINT' >> TestResults_op_il_seq_point.xml
+       echo '' >> TestResults_op_il_seq_point.xml
+       echo "Diff $METHOD_NAME" >> TestResults_op_il_seq_point.xml
+       echo "Without IL_OP_SEQ_POINT                                                         With IL_OP_SEQ_POINT" >> TestResults_op_il_seq_point.xml
+       echo -n "$(diff_method $MONO_PATH $RUNTIME $TEST_FILE $METHOD_NAME $USE_AOT)" >> TestResults_op_il_seq_point.xml
+       echo "]]></message>" >> TestResults_op_il_seq_point.xml
+       echo "                  <stack-trace>" >> TestResults_op_il_seq_point.xml
+       echo "                  </stack-trace>" >> TestResults_op_il_seq_point.xml
+       echo "                </failure>" >> TestResults_op_il_seq_point.xml
+       echo "              </test-case>" >> TestResults_op_il_seq_point.xml
+
        echo ''
        echo "Detected OP_IL_SEQ_POINT incompatibility on $TEST_FILE"
        echo "  $CHANGES methods differ when sequence points are enabled."
@@ -99,4 +117,6 @@ then
        echo "Without IL_OP_SEQ_POINT                                                         With IL_OP_SEQ_POINT"
        echo "$(diff_method $MONO_PATH $RUNTIME $TEST_FILE $METHOD_NAME $USE_AOT)"
        exit 1
+else
+       echo "True\" />" >> TestResults_op_il_seq_point.xml
 fi
diff --git a/mono/mini/test_op_il_seq_point_headerfooter.sh b/mono/mini/test_op_il_seq_point_headerfooter.sh
new file mode 100755 (executable)
index 0000000..2eea27b
--- /dev/null
@@ -0,0 +1,40 @@
+#!/bin/sh
+
+TOTAL=$(grep -c "<test-case" TestResults_op_il_seq_point.xml)
+FAILURES=$(grep -c "<failure>" TestResults_op_il_seq_point.xml)
+if [ "$FAILURES" -eq "0" ]
+then
+       PASS="True"
+else
+       PASS="False"
+fi
+MYLOCALE=$(echo $LANG | cut -f1 -d'.')
+MYUNAME=$(uname -r)
+MYHOSTNAME=$(hostname -s)
+MYFQDN=$(hostname -f)
+MYDATE=$(date +%F)
+MYTIME=$(date +%T)
+
+echo "            </results>" >> TestResults_op_il_seq_point.xml
+echo "          </test-suite>" >> TestResults_op_il_seq_point.xml
+echo "        </results>" >> TestResults_op_il_seq_point.xml
+echo "      </test-suite>" >> TestResults_op_il_seq_point.xml
+echo "    </results>" >> TestResults_op_il_seq_point.xml
+echo "  </test-suite>" >> TestResults_op_il_seq_point.xml
+echo "</test-results>" >> TestResults_op_il_seq_point.xml
+
+echo "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"no\"?>" > TestResults_op_il_seq_point.xml.header
+echo "<!--This file represents the results of running a test suite-->" >> TestResults_op_il_seq_point.xml.header
+echo "<test-results name=\"regression-tests.dummy\" total=\"${TOTAL}\" failures=\"${FAILURES}\" not-run=\"0\" date=\"${MYDATE}\" time=\"${MYTIME}\">" >> TestResults_op_il_seq_point.xml.header
+echo "  <environment nunit-version=\"2.4.8.0\" clr-version=\"4.0.30319.17020\" os-version=\"Unix ${MYUNAME}\" platform=\"Unix\" cwd=\"${PWD}\" machine-name=\"${MYHOSTNAME}\" user=\"${USER}\" user-domain=\"${MYFQDN}\" />" >> TestResults_op_il_seq_point.xml.header
+echo "  <culture-info current-culture=\"${MYLOCALE}\" current-uiculture=\"${MYLOCALE}\" />" >> TestResults_op_il_seq_point.xml.header
+echo "  <test-suite name=\"op_il_seq_point-tests.dummy\" success=\"${PASS}\" time=\"0\" asserts=\"0\">" >> TestResults_op_il_seq_point.xml.header
+echo "    <results>" >> TestResults_op_il_seq_point.xml.header
+echo "      <test-suite name=\"MonoTests\" success=\"${PASS}\" time=\"0\" asserts=\"0\">" >> TestResults_op_il_seq_point.xml.header
+echo "        <results>" >> TestResults_op_il_seq_point.xml.header
+echo "          <test-suite name=\"op_il_seq_point\" success=\"${PASS}\" time=\"0\" asserts=\"0\">" >> TestResults_op_il_seq_point.xml.header
+echo "            <results>" >> TestResults_op_il_seq_point.xml.header
+
+cat TestResults_op_il_seq_point.xml.header TestResults_op_il_seq_point.xml > TestResults_op_il_seq_point.xml.new
+mv TestResults_op_il_seq_point.xml.new TestResults_op_il_seq_point.xml
+rm -f TestResults_op_il_seq_point.xml.header
index 167b2b9e2b74b4702849aa58139508437c3ccfc8..10f73decb3863798827d05d44d27240e835fde05 100644 (file)
@@ -290,7 +290,8 @@ mono_save_xdebug_info (MonoCompile *cfg)
                xdebug_method_count ++;
 
                dmji = mono_debug_find_method (jinfo_get_method (cfg->jit_info), mono_domain_get ());;
-               mono_dwarf_writer_emit_method (xdebug_writer, cfg, jinfo_get_method (cfg->jit_info), NULL, NULL, cfg->jit_info->code_start, cfg->jit_info->code_size, cfg->args, cfg->locals, cfg->unwind_ops, dmji);
+               mono_dwarf_writer_emit_method (xdebug_writer, cfg, jinfo_get_method (cfg->jit_info), NULL, NULL, NULL,
+                                                                          cfg->jit_info->code_start, cfg->jit_info->code_size, cfg->args, cfg->locals, cfg->unwind_ops, dmji);
                mono_debug_free_method_jit_info (dmji);
 
 #if 0
@@ -319,7 +320,8 @@ mono_save_xdebug_info (MonoCompile *cfg)
 
                mono_loader_lock ();
                dmji = mono_debug_find_method (jinfo_get_method (cfg->jit_info), mono_domain_get ());
-               mono_dwarf_writer_emit_method (xdebug_writer, cfg, jinfo_get_method (cfg->jit_info), NULL, NULL, cfg->jit_info->code_start, cfg->jit_info->code_size, cfg->args, cfg->locals, cfg->unwind_ops, dmji);
+               mono_dwarf_writer_emit_method (xdebug_writer, cfg, jinfo_get_method (cfg->jit_info), NULL, NULL, NULL,
+                                                                          cfg->jit_info->code_start, cfg->jit_info->code_size, cfg->args, cfg->locals, cfg->unwind_ops, dmji);
                mono_debug_free_method_jit_info (dmji);
                fflush (xdebug_fp);
                mono_loader_unlock ();
index 07634ef6b9635c3f1335f7789e1f7695e676aca5..0d5e28553c7f8cd1e6c8b1e29487dafb81f476df 100644 (file)
@@ -62,17 +62,13 @@ libmono_profiler_aot_la_LIBADD = $(LIBMONO) $(GLIB_LIBS) $(LIBICONV)
 libmono_profiler_iomap_la_SOURCES = mono-profiler-iomap.c
 libmono_profiler_iomap_la_LIBADD = $(LIBMONO) $(GLIB_LIBS) $(LIBICONV)
 libmono_profiler_log_la_SOURCES = proflog.c
-libmono_profiler_log_la_LIBADD = $(LIBMONO) $(Z_LIBS)
+libmono_profiler_log_la_LIBADD = $(LIBMONO) $(GLIB_LIBS) $(Z_LIBS)
 if HAVE_VTUNE
 libmono_profiler_vtune_la_SOURCES = mono-profiler-vtune.c
 libmono_profiler_vtune_la_CFLAGS = $(VTUNE_CFLAGS)
 libmono_profiler_vtune_la_LIBADD = $(VTUNE_LIBS) $(LIBMONO) $(GLIB_LIBS) $(LIBICONV)
 endif
 
-if PLATFORM_ANDROID
-libmono_profiler_log_la_LIBADD += $(GLIB_LIBS)
-endif
-
 mprof_report_SOURCES = decode.c
 mprof_report_LDADD = $(Z_LIBS)
 
index 7e16bc60ffac240fb43f9dd351173dc9ccacf4a6..8003b5666666f3f32aee3016854dcfdaa8d6a08a 100644 (file)
@@ -123,6 +123,8 @@ monoutils_sources = \
        mono-conc-hashtable.c   \
        sha1.h          \
        sha1.c  \
+       json.h  \
+       json.c  \
        networking.c    \
        networking-posix.c      \
        networking-fallback.c   \
diff --git a/mono/utils/json.c b/mono/utils/json.c
new file mode 100644 (file)
index 0000000..4de3e9f
--- /dev/null
@@ -0,0 +1,104 @@
+/*
+ * json.c: JSON writer
+ *
+ * Author:
+ *   Joao Matos (joao.matos@xamarin.com)
+ *
+ * Copyright 2015 Xamarin Inc (http://www.xamarin.com)
+ */
+
+#include <mono/utils/json.h>
+
+void json_writer_init (JsonWriter* writer)
+{
+       g_assert (writer && "Expected a valid JSON writer instance");
+
+       writer->text = g_string_new ("");
+       writer->indent = 0;
+}
+
+void json_writer_destroy (JsonWriter* writer)
+{
+       g_assert (writer && "Expected a valid JSON writer instance");
+       g_string_free (writer->text, /*free_segment=*/TRUE);
+}
+
+void json_writer_indent_push(JsonWriter* writer)
+{
+       g_assert (writer && "Expected a valid JSON writer instance");
+       writer->indent += JSON_INDENT_VALUE;
+}
+
+void json_writer_indent_pop(JsonWriter* writer)
+{
+       g_assert (writer && "Expected a valid JSON writer instance");
+       writer->indent -= JSON_INDENT_VALUE;
+}
+
+void json_writer_indent(JsonWriter* writer)
+{
+       g_assert (writer && "Expected a valid JSON writer instance");
+
+       int i = 0;
+       for (i = 0; i < writer->indent; ++i)
+               g_string_append_c (writer->text, ' ');
+}
+
+void json_writer_vprintf(JsonWriter* writer, const gchar *format, va_list args)
+{
+       g_assert (writer && "Expected a valid JSON writer instance");
+       g_string_append_vprintf (writer->text, format, args);
+}
+
+void json_writer_printf(JsonWriter* writer, const gchar *format, ...)
+{
+       g_assert (writer && "Expected a valid JSON writer instance");
+
+       va_list args;
+       va_start (args, format);
+
+       g_string_append_vprintf (writer->text, format, args);
+
+       va_end (args);
+}
+
+void json_writer_array_begin(JsonWriter* writer)
+{
+       g_assert (writer && "Expected a valid JSON writer instance");
+       g_string_append_printf (writer->text, "[\n");
+       writer->indent += JSON_INDENT_VALUE;
+}
+
+void json_writer_array_end(JsonWriter* writer)
+{
+       g_assert (writer && "Expected a valid JSON writer instance");
+       g_string_append_printf (writer->text, "]");
+       writer->indent -= JSON_INDENT_VALUE;
+}
+
+void json_writer_object_begin(JsonWriter* writer)
+{
+       g_assert (writer && "Expected a valid JSON writer instance");
+       json_writer_printf (writer, "{\n");
+       writer->indent += JSON_INDENT_VALUE;
+}
+
+void json_writer_object_end(JsonWriter* writer)
+{
+       g_assert (writer && "Expected a valid JSON writer instance");
+       json_writer_printf (writer, "}");
+}
+
+void json_writer_object_key(JsonWriter* writer, const gchar* format, ...)
+{
+       g_assert (writer && "Expected a valid JSON writer instance");
+
+       va_list args;
+       va_start (args, format);
+
+       g_string_append_printf (writer->text, "\"");
+       json_writer_vprintf (writer, format, args);
+       g_string_append_printf (writer->text, "\" : ");
+
+       va_end (args);
+}
diff --git a/mono/utils/json.h b/mono/utils/json.h
new file mode 100644 (file)
index 0000000..5e5a06a
--- /dev/null
@@ -0,0 +1,35 @@
+/*
+ * json.h: JSON writer
+ *
+ * Author:
+ *   Joao Matos (joao.matos@xamarin.com)
+ *
+ * Copyright 2015 Xamarin Inc (http://www.xamarin.com)
+ */
+
+#ifndef __MONO_UTILS_JSON_H__
+#define __MONO_UTILS_JSON_H__
+
+ #include <glib.h>
+
+#define JSON_INDENT_VALUE 2
+
+typedef struct JsonWriter {
+       GString* text;
+       int indent;
+} JsonWriter;
+
+void json_writer_init (JsonWriter* writer);
+void json_writer_destroy (JsonWriter* writer);
+void json_writer_indent(JsonWriter* writer);
+void json_writer_indent_push(JsonWriter* writer);
+void json_writer_indent_pop(JsonWriter* writer);
+void json_writer_vprintf(JsonWriter* writer, const gchar *format, va_list args);
+void json_writer_printf(JsonWriter* writer, const gchar *format, ...);
+void json_writer_array_begin(JsonWriter* writer);
+void json_writer_array_end(JsonWriter* writer);
+void json_writer_object_begin(JsonWriter* writer);
+void json_writer_object_end(JsonWriter* writer);
+void json_writer_object_key(JsonWriter* writer, const gchar* format, ...);
+
+#endif
index a910e917d7f2d253b03ba665b517210ce9c7b6e6..24c92fbae5207e3a548351a40dfcdce30562b266 100644 (file)
@@ -244,7 +244,7 @@ typedef SSIZE_T ssize_t;
 #if !defined(_MSC_VER) && !defined(PLATFORM_SOLARIS) && !defined(_WIN32) && !defined(__CYGWIN__) && !defined(MONOTOUCH) && HAVE_VISIBILITY_HIDDEN
 #define MONO_INTERNAL __attribute__ ((visibility ("hidden")))
 #if MONO_LLVM_LOADED
-#define MONO_LLVM_INTERNAL 
+#define MONO_LLVM_INTERNAL MONO_API
 #else
 #define MONO_LLVM_INTERNAL MONO_INTERNAL
 #endif
index 409c405f7f2cee6564d1bb9d8d07485e166be0c0..03dbff849701f2137a966d7f0957e33a531b3edc 100644 (file)
@@ -359,7 +359,7 @@ mono_threads_add_async_job (THREAD_INFO_TYPE *info, MonoAsyncJob job) MONO_INTER
 MonoAsyncJob
 mono_threads_consume_async_jobs (void) MONO_INTERNAL;
 
-void
+MONO_API void
 mono_threads_attach_tools_thread (void);
 
 
index 681f758ed7ec9308ffc177bc7022f98f49faff2a..a091267ea896a81a1d73d318bf8f266ea67ad41f 100644 (file)
@@ -73,6 +73,7 @@
     <ClCompile Include="..\mono\utils\mono-hwcap.c" />\r
     <ClCompile Include="..\mono\utils\mono-hwcap-x86.c" />\r
     <ClCompile Include="..\mono\utils\bsearch.c" />\r
+    <ClInclude Include="..\mono\utils\json.c" />    \r
   </ItemGroup>\r
   <ItemGroup>\r
     <ClInclude Include="..\mono\utils\dlmalloc.h" />\r
     <ClInclude Include="..\mono\utils\mono-hwcap.h" />\r
     <ClInclude Include="..\mono\utils\mono-hwcap-x86.h" />\r
     <ClInclude Include="..\mono\utils\bsearch.h" />\r
+    <ClInclude Include="..\mono\utils\json.h" />\r
   </ItemGroup>\r
   <ItemGroup>\r
     <MASM Include="..\mono\utils\win64.asm">\r
index 60b4036396213371311c9beeed78e78876abd830..49967e6eefb4356903817f8b26b27bc520a659a5 100644 (file)
@@ -688,8 +688,8 @@ class MsbuildGenerator {
                const string condition_unix    = "Condition=\" '$(OS)' != 'Windows_NT' \"";
                const string condition_windows = "Condition=\" '$(OS)' == 'Windows_NT' \"";
                prebuild =
-                       "    <PreBuildEvent " + condition_unix + ">\n" + prebuild_unix + "\n    </PreBuildEvent>\n" +
-                       "    <PreBuildEvent " + condition_windows + ">\n" + prebuild_windows + "\n    </PreBuildEvent>\n";
+                       "    <PreBuildEvent " + condition_unix + ">" + NewLine + prebuild_unix + NewLine + "    </PreBuildEvent>" + NewLine +
+                       "    <PreBuildEvent " + condition_windows + ">" + NewLine + prebuild_windows + NewLine + "    </PreBuildEvent>" + NewLine;
 
                var all_args = new Queue<string []> ();
                all_args.Enqueue (flags.Split ());
@@ -853,8 +853,8 @@ class MsbuildGenerator {
                string postbuild_windows = string.Empty;
 
                var postbuild =  
-                       "    <PostBuildEvent " + condition_unix + ">\n" + postbuild_unix + "\n    </PostBuildEvent>\n" +
-                       "    <PostBuildEvent " + condition_windows + ">\n" + postbuild_windows + "\n    </PostBuildEvent>";
+                       "    <PostBuildEvent " + condition_unix + ">" + NewLine + postbuild_unix + NewLine + "    </PostBuildEvent>" + NewLine +
+                       "    <PostBuildEvent " + condition_windows + ">" + NewLine + postbuild_windows + NewLine + "    </PostBuildEvent>";
                        
 
                bool basic_or_build = (library.Contains ("-basic") || library.Contains ("-build"));
@@ -866,13 +866,13 @@ class MsbuildGenerator {
                string strongNameSection = "";
                if (StrongNameKeyFile != null){
                        strongNameSection = String.Format (
-                               "  <PropertyGroup>\n" +
-                               "    <SignAssembly>true</SignAssembly>\n" +
+                               "  <PropertyGroup>" + NewLine +
+                               "    <SignAssembly>true</SignAssembly>" + NewLine +
                                "{1}" +
-                               "  </PropertyGroup>\n" + 
-                               "  <PropertyGroup>\n" + 
-                               "    <AssemblyOriginatorKeyFile>{0}</AssemblyOriginatorKeyFile>\n" +
-                               "  </PropertyGroup>", StrongNameKeyFile, StrongNameDelaySign ? "    <DelaySign>true</DelaySign>\n" : "");
+                               "  </PropertyGroup>" + NewLine +
+                               "  <PropertyGroup>" + NewLine +
+                               "    <AssemblyOriginatorKeyFile>{0}</AssemblyOriginatorKeyFile>" + NewLine +
+                               "  </PropertyGroup>", StrongNameKeyFile, StrongNameDelaySign ? "    <DelaySign>true</DelaySign>" + NewLine : "");
                }
                Csproj.output = template.
                        Replace ("@SIGNATURE@", strongNameSection).