Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/mcs/class
diff options
context:
space:
mode:
authorRodrigo Kumpera <kumpera@gmail.com>2013-03-01 19:54:09 +0400
committerRodrigo Kumpera <kumpera@gmail.com>2013-03-01 19:54:09 +0400
commitabe9dc62066232dcd3b6e8ba70df575fd2ee342f (patch)
treebfff098c8f34a03c7efade64bb743feafaa16e34 /mcs/class
parent93e2d1dc48339be472300910e9290939ee253177 (diff)
Revert "Fix object::GetType when remoting is enabled."
This reverts commit 93e2d1dc48339be472300910e9290939ee253177.
Diffstat (limited to 'mcs/class')
-rw-r--r--mcs/class/Mono.Security/Test/Mono.Math/ArithmeticBigTest.cs16
-rw-r--r--mcs/class/Mono.Security/Test/Mono.Math/SearchGeneratorTest.cs2
-rw-r--r--mcs/class/Mono.Security/Test/Mono.Security.Authenticode/AuthenticodeDeformatterTest.cs2
-rw-r--r--mcs/class/Mono.Security/Test/Mono.Security.Authenticode/PrivateKeyTest.cs8
-rw-r--r--mcs/class/Mono.Security/Test/Mono.Security.Authenticode/SoftwarePublisherCertificateTest.cs18
-rw-r--r--mcs/class/Mono.Security/Test/Mono.Security/StrongNameTest.cs9
-rw-r--r--mcs/class/System.Net.Http/Test/System.Net.Http/HttpClientTest.cs6
-rw-r--r--mcs/class/System.Net.Http/Test/System.Net.Http/StreamContentTest.cs2
-rw-r--r--mcs/class/System.Net.Http/Test/System.Net.Http/StringContentTest.cs3
-rw-r--r--mcs/class/System.Web.Extensions/System.Web.Script.Serialization/JsonSerializer.cs4
-rw-r--r--mcs/class/System.XML/Test/System.Xml.Schema/XmlSchemaTests.cs1
-rw-r--r--mcs/class/System.XML/Test/System.Xml.Serialization.Advanced/SchemaImporterExtensionCollectionTests.cs2
-rw-r--r--mcs/class/System.XML/Test/System.Xml.Serialization.Advanced/SchemaImporterExtensionTests.cs2
-rw-r--r--mcs/class/System.XML/Test/System.Xml.Serialization/SoapSchemaExporterTests.cs4
-rw-r--r--mcs/class/System.XML/Test/System.Xml.Serialization/XmlCodeExporterTests.cs4
-rw-r--r--mcs/class/System.XML/Test/System.Xml.Serialization/XmlSchemaExporterTests.cs4
-rw-r--r--mcs/class/System.XML/Test/System.Xml.Serialization/XmlSchemaImporterTests.cs55
-rw-r--r--mcs/class/System.XML/Test/System.Xml.Serialization/XmlSerializerTests.cs4
-rw-r--r--mcs/class/System.XML/Test/System.Xml/XmlDocumentEventTests.cs5
-rw-r--r--mcs/class/System.XML/Test/System.Xml/XmlSecureResolverCas.cs4
-rw-r--r--mcs/class/System.XML/Test/System.Xml/XmlSecureResolverTests.cs3
-rw-r--r--mcs/class/System.XML/Test/System.Xml/XmlUrlResolverTests.cs8
-rw-r--r--mcs/class/System.XML/Test/System.Xml/XmlWriterSettingsTests.cs1
-rw-r--r--mcs/class/System.Xml.Linq/Test/System.Xml.Linq/XAttributeTest.cs8
-rw-r--r--mcs/class/System.Xml.Linq/Test/System.Xml.Linq/XElementTest.cs8
-rw-r--r--mcs/class/System.Xml.Linq/Test/System.Xml.Schema/ExtensionsTest.cs4
-rw-r--r--mcs/class/corlib/System.Collections.ObjectModel/ReadOnlyDictionary.cs441
-rw-r--r--mcs/class/corlib/System.IO/Path.cs2
-rw-r--r--mcs/class/corlib/System.Text/Decoder.cs9
-rw-r--r--mcs/class/corlib/System.Text/UTF8Encoding.cs10
-rw-r--r--mcs/class/corlib/Test/System.IO/PathTest.cs2
-rw-r--r--mcs/class/corlib/Test/System.Text/DecoderTest.cs17
-rw-r--r--mcs/class/corlib/Test/System.Text/UTF8EncodingTest.cs32
-rw-r--r--mcs/class/corlib/corlib.dll.sources1
-rw-r--r--mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Compiler/HoistedLocals.cs4
35 files changed, 620 insertions, 85 deletions
diff --git a/mcs/class/Mono.Security/Test/Mono.Math/ArithmeticBigTest.cs b/mcs/class/Mono.Security/Test/Mono.Math/ArithmeticBigTest.cs
index 94ff296ced5..ac05640807f 100644
--- a/mcs/class/Mono.Security/Test/Mono.Math/ArithmeticBigTest.cs
+++ b/mcs/class/Mono.Security/Test/Mono.Math/ArithmeticBigTest.cs
@@ -179,48 +179,48 @@ namespace MonoTests.Mono.Math.Arithmetic.Big {
[Test]
public void AgtB ()
{
- Assertion.Assert(A > B);
+ Assert.IsTrue(A > B);
}
[Test]
public void ANotLtB ()
{
- Assertion.Assert(!(A < B));
+ Assert.IsTrue(!(A < B));
}
[Test]
public void BNotGtA ()
{
- Assertion.Assert(!(B > A));
+ Assert.IsTrue(!(B > A));
}
[Test]
public void AltB ()
{
- Assertion.Assert(B < A);
+ Assert.IsTrue(B < A);
}
[Test]
public void AeqA ()
{
- Assertion.Assert(A == A);
+ Assert.AreEqual(A, A);
}
[Test]
public void BeqB ()
{
- Assertion.Assert(B == B);
+ Assert.AreEqual(B, B);
}
[Test]
public void AneqB ()
{
- Assertion.Assert(A != B);
+ Assert.AreNotEqual(A, B);
}
[Test]
public void BneqA ()
{
- Assertion.Assert(B != A);
+ Assert.AreNotEqual(B, A);
}
#endregion
diff --git a/mcs/class/Mono.Security/Test/Mono.Math/SearchGeneratorTest.cs b/mcs/class/Mono.Security/Test/Mono.Math/SearchGeneratorTest.cs
index 189dbd9d0df..80434f9983c 100644
--- a/mcs/class/Mono.Security/Test/Mono.Math/SearchGeneratorTest.cs
+++ b/mcs/class/Mono.Security/Test/Mono.Math/SearchGeneratorTest.cs
@@ -62,7 +62,7 @@ namespace MonoTests.Mono.Math {
for (int i = 0; i < 5; i++) {
ContextData ctx = new ContextData (128, (uint)r.Next (int.MinValue, int.MaxValue));
BigInteger p = GenerateNewPrime (128, ctx);
- Assertion.Assert (p.TestBit (1));
+ Assert.IsTrue (p.TestBit (1));
uint d = ctx.testData;
for (uint j = 128 - 2; d > 0; j--, d >>= 1)
Assertion.AssertEquals ((d&1) == 1, p.TestBit (j));
diff --git a/mcs/class/Mono.Security/Test/Mono.Security.Authenticode/AuthenticodeDeformatterTest.cs b/mcs/class/Mono.Security/Test/Mono.Security.Authenticode/AuthenticodeDeformatterTest.cs
index d15087aef00..0a1fd9f3d1a 100644
--- a/mcs/class/Mono.Security/Test/Mono.Security.Authenticode/AuthenticodeDeformatterTest.cs
+++ b/mcs/class/Mono.Security/Test/Mono.Security.Authenticode/AuthenticodeDeformatterTest.cs
@@ -678,7 +678,7 @@ namespace MonoTests.Mono.Security.Authenticode {
private string WriteFile ()
{
- string filename = "helloworld_signed.exe";
+ string filename = Path.Combine (Path.GetTempPath (), "helloworld_signed.exe");
try {
if (File.Exists (filename)) {
File.Delete (filename);
diff --git a/mcs/class/Mono.Security/Test/Mono.Security.Authenticode/PrivateKeyTest.cs b/mcs/class/Mono.Security/Test/Mono.Security.Authenticode/PrivateKeyTest.cs
index ee8145cff6b..0f529496e11 100644
--- a/mcs/class/Mono.Security/Test/Mono.Security.Authenticode/PrivateKeyTest.cs
+++ b/mcs/class/Mono.Security/Test/Mono.Security.Authenticode/PrivateKeyTest.cs
@@ -96,7 +96,13 @@ public class PrivateKeyTest : Assertion {
Assert (msg, a);
}
- private const string testfile = "test.pvk";
+ string testfile;
+
+ [TestFixtureSetUp]
+ public void FixtureSetup ()
+ {
+ testfile = Path.Combine (Path.GetTempPath (), "test.pvk");
+ }
[TearDown]
public void TearDown ()
diff --git a/mcs/class/Mono.Security/Test/Mono.Security.Authenticode/SoftwarePublisherCertificateTest.cs b/mcs/class/Mono.Security/Test/Mono.Security.Authenticode/SoftwarePublisherCertificateTest.cs
index 6e6adce2b86..11136a48904 100644
--- a/mcs/class/Mono.Security/Test/Mono.Security.Authenticode/SoftwarePublisherCertificateTest.cs
+++ b/mcs/class/Mono.Security/Test/Mono.Security.Authenticode/SoftwarePublisherCertificateTest.cs
@@ -381,7 +381,13 @@ namespace MonoTests.Mono.Security.Authenticode {
0x77, 0xEF, 0xEC, 0x17, 0x92, 0xC7, 0xD6, 0xCD, 0xE1, 0x2A, 0x2E, 0xE7,
0xF3, 0xED, 0x7F, 0x66, 0x86, 0x31, 0x00 };
- private const string testfile = "test.spc";
+ string testfile;
+
+ [TestFixtureSetUp]
+ public void FixtureSetup ()
+ {
+ testfile = Path.Combine (Path.GetTempPath (), "test.spc");
+ }
[TearDown]
public void TearDown ()
@@ -397,11 +403,11 @@ namespace MonoTests.Mono.Security.Authenticode {
if (unicode) {
data = Encoding.Unicode.GetBytes (s);
} else if (pem) {
- string b64pem = "-----BEGIN PKCS7-----\n" + s + "\n-----END PKCS7-----";
- data = Encoding.ASCII.GetBytes (b64pem);
- using (FileStream fs = File.Create ("bad.pem")) {
- fs.Write (data, 0, data.Length);
- }
+ //string b64pem = "-----BEGIN PKCS7-----\n" + s + "\n-----END PKCS7-----";
+ //data = Encoding.ASCII.GetBytes (b64pem);
+ //using (FileStream fs = File.Create ("bad.pem")) {
+ // fs.Write (data, 0, data.Length);
+ //}
} else {
data = Encoding.ASCII.GetBytes (s);
}
diff --git a/mcs/class/Mono.Security/Test/Mono.Security/StrongNameTest.cs b/mcs/class/Mono.Security/Test/Mono.Security/StrongNameTest.cs
index 43bc7a5fbb9..05e013cd4aa 100644
--- a/mcs/class/Mono.Security/Test/Mono.Security/StrongNameTest.cs
+++ b/mcs/class/Mono.Security/Test/Mono.Security/StrongNameTest.cs
@@ -127,8 +127,8 @@ namespace MonoTests.Mono.Security {
AssertEquals ("key.PublicKeyToken", sn1.PublicKeyToken, sn2.PublicKeyToken);
}
- private const string Signed = "hellosigned.exe";
- private const string Delay = "hellodelay.exe";
+ string Signed;
+ string Delay;
private StrongName sn;
private static byte[] signedData = {
0x4D, 0x5A, 0x90, 0x00, 0x03, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
@@ -787,11 +787,16 @@ namespace MonoTests.Mono.Security {
[SetUp]
public void SetUp ()
{
+ Signed = Path.Combine (Path.GetTempPath (), "hellosigned.exe");
+ Delay = Path.Combine (Path.GetTempPath (), "hellodelay.exe");
+
sn = new StrongName (key);
// write hellosigned.exe to disk
FileStream fs = File.OpenWrite (Signed);
fs.Write (signedData, 0, signedData.Length);
fs.Close ();
+
+
// write hellodelay.exe to disk
fs = File.OpenWrite (Delay);
fs.Write (delayData, 0, delayData.Length);
diff --git a/mcs/class/System.Net.Http/Test/System.Net.Http/HttpClientTest.cs b/mcs/class/System.Net.Http/Test/System.Net.Http/HttpClientTest.cs
index c5a8dc430ad..6651be4a64f 100644
--- a/mcs/class/System.Net.Http/Test/System.Net.Http/HttpClientTest.cs
+++ b/mcs/class/System.Net.Http/Test/System.Net.Http/HttpClientTest.cs
@@ -525,7 +525,7 @@ namespace MonoTests.System.Net.Http
client.SendAsync (request, HttpCompletionOption.ResponseContentRead).Wait (WaitTimeout);
Assert.Fail ("#2");
} catch (AggregateException e) {
- Assert.IsInstanceOfType (typeof (HttpRequestException), e.InnerException, "#3");
+ Assert.IsTrue (e.InnerException is HttpRequestException, "#3");
}
} finally {
@@ -699,7 +699,7 @@ namespace MonoTests.System.Net.Http
client.GetByteArrayAsync (LocalServer).Wait (WaitTimeout);
Assert.Fail ("#1");
} catch (AggregateException e) {
- Assert.IsInstanceOfType (typeof (HttpRequestException), e.InnerException, "#2");
+ Assert.IsTrue (e.InnerException is HttpRequestException , "#2");
}
} finally {
listener.Close ();
@@ -726,7 +726,7 @@ namespace MonoTests.System.Net.Http
client.GetStringAsync (LocalServer).Wait (WaitTimeout);
Assert.Fail ("#1");
} catch (AggregateException e) {
- Assert.IsInstanceOfType (typeof (HttpRequestException), e.InnerException, "#2");
+ Assert.IsTrue (e.InnerException is HttpRequestException, "#2");
}
} finally {
listener.Abort ();
diff --git a/mcs/class/System.Net.Http/Test/System.Net.Http/StreamContentTest.cs b/mcs/class/System.Net.Http/Test/System.Net.Http/StreamContentTest.cs
index b4a541afab2..edd4b839c16 100644
--- a/mcs/class/System.Net.Http/Test/System.Net.Http/StreamContentTest.cs
+++ b/mcs/class/System.Net.Http/Test/System.Net.Http/StreamContentTest.cs
@@ -331,7 +331,7 @@ namespace MonoTests.System.Net.Http
Assert.IsTrue (sc.LoadIntoBufferAsync (50).Wait (200));
Assert.Fail ("#1");
} catch (AggregateException e) {
- Assert.IsInstanceOfType (typeof (HttpRequestException), e.InnerException, "#2");
+ Assert.IsTrue (e.InnerException is HttpRequestException, "#2");
}
}
diff --git a/mcs/class/System.Net.Http/Test/System.Net.Http/StringContentTest.cs b/mcs/class/System.Net.Http/Test/System.Net.Http/StringContentTest.cs
index 51a077176b8..f031fc3ea8e 100644
--- a/mcs/class/System.Net.Http/Test/System.Net.Http/StringContentTest.cs
+++ b/mcs/class/System.Net.Http/Test/System.Net.Http/StringContentTest.cs
@@ -61,9 +61,10 @@ namespace MonoTests.System.Net.Http
var s = new StringContent ("aaa", null, "multipart/*");
Assert.AreEqual ("Content-Type: multipart/*; charset=utf-8\r\n", s.Headers.ToString ());
-
+#if !MOBILE
s = new StringContent ("aaa", Encoding.GetEncoding (852), "multipart/*");
Assert.AreEqual ("Content-Type: multipart/*; charset=ibm852\r\n", s.Headers.ToString ());
+#endif
}
[Test]
diff --git a/mcs/class/System.Web.Extensions/System.Web.Script.Serialization/JsonSerializer.cs b/mcs/class/System.Web.Extensions/System.Web.Script.Serialization/JsonSerializer.cs
index 42d59afb18e..595727220ee 100644
--- a/mcs/class/System.Web.Extensions/System.Web.Script.Serialization/JsonSerializer.cs
+++ b/mcs/class/System.Web.Extensions/System.Web.Script.Serialization/JsonSerializer.cs
@@ -431,12 +431,12 @@ namespace System.Web.Script.Serialization
void WriteValue (StringBuilder output, float value)
{
- StringBuilderExtensions.AppendCount (output, maxJsonLength, value.ToString ("r"));
+ StringBuilderExtensions.AppendCount (output, maxJsonLength, value.ToString ("r", CultureInfo.InvariantCulture));
}
void WriteValue (StringBuilder output, double value)
{
- StringBuilderExtensions.AppendCount (output, maxJsonLength, value.ToString ("r"));
+ StringBuilderExtensions.AppendCount (output, maxJsonLength, value.ToString ("r", CultureInfo.InvariantCulture));
}
void WriteValue (StringBuilder output, Guid value)
diff --git a/mcs/class/System.XML/Test/System.Xml.Schema/XmlSchemaTests.cs b/mcs/class/System.XML/Test/System.Xml.Schema/XmlSchemaTests.cs
index 0e91387a4be..779c8bd1e1e 100644
--- a/mcs/class/System.XML/Test/System.Xml.Schema/XmlSchemaTests.cs
+++ b/mcs/class/System.XML/Test/System.Xml.Schema/XmlSchemaTests.cs
@@ -173,6 +173,7 @@ namespace MonoTests.System.Xml
}
[Test]
+ [Category ("MobileNotWorking")]
public void TestSimpleMutualImport ()
{
XmlReader r = new XmlTextReader ("Test/XmlFiles/xsd/inter-inc-1.xsd");
diff --git a/mcs/class/System.XML/Test/System.Xml.Serialization.Advanced/SchemaImporterExtensionCollectionTests.cs b/mcs/class/System.XML/Test/System.Xml.Serialization.Advanced/SchemaImporterExtensionCollectionTests.cs
index 718e62c1fff..20b0d5dbaf8 100644
--- a/mcs/class/System.XML/Test/System.Xml.Serialization.Advanced/SchemaImporterExtensionCollectionTests.cs
+++ b/mcs/class/System.XML/Test/System.Xml.Serialization.Advanced/SchemaImporterExtensionCollectionTests.cs
@@ -28,7 +28,7 @@
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
-#if NET_2_0
+#if !MOBILE
using System;
using System.CodeDom;
diff --git a/mcs/class/System.XML/Test/System.Xml.Serialization.Advanced/SchemaImporterExtensionTests.cs b/mcs/class/System.XML/Test/System.Xml.Serialization.Advanced/SchemaImporterExtensionTests.cs
index 5b8d9de6dcc..7311fbb27e8 100644
--- a/mcs/class/System.XML/Test/System.Xml.Serialization.Advanced/SchemaImporterExtensionTests.cs
+++ b/mcs/class/System.XML/Test/System.Xml.Serialization.Advanced/SchemaImporterExtensionTests.cs
@@ -28,7 +28,7 @@
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
-#if NET_2_0
+#if !MOBILE
using System;
using System.CodeDom;
diff --git a/mcs/class/System.XML/Test/System.Xml.Serialization/SoapSchemaExporterTests.cs b/mcs/class/System.XML/Test/System.Xml.Serialization/SoapSchemaExporterTests.cs
index 9f0e0191135..b1c7597c150 100644
--- a/mcs/class/System.XML/Test/System.Xml.Serialization/SoapSchemaExporterTests.cs
+++ b/mcs/class/System.XML/Test/System.Xml.Serialization/SoapSchemaExporterTests.cs
@@ -7,6 +7,8 @@
// (C) 2005 Novell
//
+#if !MOBILE
+
using System;
using System.Collections;
using System.Globalization;
@@ -1159,3 +1161,5 @@ namespace MonoTests.System.XmlSerialization
}
}
}
+
+#endif \ No newline at end of file
diff --git a/mcs/class/System.XML/Test/System.Xml.Serialization/XmlCodeExporterTests.cs b/mcs/class/System.XML/Test/System.Xml.Serialization/XmlCodeExporterTests.cs
index 25a1ecf74bf..91f0ed1d282 100644
--- a/mcs/class/System.XML/Test/System.Xml.Serialization/XmlCodeExporterTests.cs
+++ b/mcs/class/System.XML/Test/System.Xml.Serialization/XmlCodeExporterTests.cs
@@ -8,6 +8,8 @@
// (C) 2006 Novell
//
+#if !MOBILE
+
using System;
using System.CodeDom;
using System.CodeDom.Compiler;
@@ -1304,3 +1306,5 @@ namespace MonoTests.System.XmlSerialization
}
}
}
+
+#endif
diff --git a/mcs/class/System.XML/Test/System.Xml.Serialization/XmlSchemaExporterTests.cs b/mcs/class/System.XML/Test/System.Xml.Serialization/XmlSchemaExporterTests.cs
index f8713258a0f..fc55852869d 100644
--- a/mcs/class/System.XML/Test/System.Xml.Serialization/XmlSchemaExporterTests.cs
+++ b/mcs/class/System.XML/Test/System.Xml.Serialization/XmlSchemaExporterTests.cs
@@ -1783,11 +1783,9 @@ namespace MonoTests.System.XmlSerialization
[Test]
#if NET_2_0
[Category ("NotWorking")] // support for XmlSchemaProvider is not implemented
-#else
- [Category ("NotWorking")] // mark it NotWorking until fixes have landed in svn
#endif
public void ExportXmlSerializable_SchemaProvider1 () {
- XmlSchemas schemas = schemas = Export (typeof (PrimitiveSchemaProvider));
+ XmlSchemas schemas = Export (typeof (PrimitiveSchemaProvider));
Assert.AreEqual (1, schemas.Count, "#1");
StringWriter sw = new StringWriter ();
diff --git a/mcs/class/System.XML/Test/System.Xml.Serialization/XmlSchemaImporterTests.cs b/mcs/class/System.XML/Test/System.Xml.Serialization/XmlSchemaImporterTests.cs
index 80958667639..fe4838cb2e9 100644
--- a/mcs/class/System.XML/Test/System.Xml.Serialization/XmlSchemaImporterTests.cs
+++ b/mcs/class/System.XML/Test/System.Xml.Serialization/XmlSchemaImporterTests.cs
@@ -39,8 +39,9 @@ using System.IO;
using System.Xml;
using System.Xml.Schema;
using System.Xml.Serialization;
+#if !MOBILE
using Microsoft.CSharp;
-
+#endif
using NUnit.Framework;
using MonoTests.System.Xml.TestClasses;
@@ -891,6 +892,8 @@ namespace MonoTests.System.Xml.Serialization
Assert.AreEqual ("UInt16", map.TypeName, "#6");
}
+#if !MOBILE
+
[Test]
public void ImportTypeMapping_EnumSimpleContent ()
{
@@ -1075,30 +1078,6 @@ namespace MonoTests.System.Xml.Serialization
return null;
}
- private static XmlSchemas ExportType (Type type)
- {
- XmlReflectionImporter ri = new XmlReflectionImporter ("NS" + type.Name);
- XmlSchemas schemas = new XmlSchemas ();
- XmlSchemaExporter sx = new XmlSchemaExporter (schemas);
- XmlTypeMapping tm = ri.ImportTypeMapping (type);
- sx.ExportTypeMapping (tm);
- return schemas;
- }
-
- private static ArrayList GetXmlQualifiedNames (XmlSchemas schemas)
- {
- ArrayList qnames = new ArrayList ();
-
- foreach (XmlSchema schema in schemas) {
- if (!schema.IsCompiled) schema.Compile (null);
- foreach (XmlSchemaObject ob in schema.Items)
- if (ob is XmlSchemaElement)
- qnames.Add (((XmlSchemaElement) ob).QualifiedName);
- }
-
- return qnames;
- }
-
[Test]
[ExpectedException (typeof (InvalidOperationException))]
public void ImportTypeMappingNonExistent ()
@@ -1238,5 +1217,31 @@ namespace MonoTests.System.Xml.Serialization
xss.Add (XmlSchema.Read (new XmlTextReader (new StringReader (xsd)), null));
return new XmlSchemaImporter (xss);
}
+
+#endif
+
+ private static ArrayList GetXmlQualifiedNames (XmlSchemas schemas)
+ {
+ ArrayList qnames = new ArrayList ();
+
+ foreach (XmlSchema schema in schemas) {
+ if (!schema.IsCompiled) schema.Compile (null);
+ foreach (XmlSchemaObject ob in schema.Items)
+ if (ob is XmlSchemaElement)
+ qnames.Add (((XmlSchemaElement) ob).QualifiedName);
+ }
+
+ return qnames;
+ }
+
+ private static XmlSchemas ExportType (Type type)
+ {
+ XmlReflectionImporter ri = new XmlReflectionImporter ("NS" + type.Name);
+ XmlSchemas schemas = new XmlSchemas ();
+ XmlSchemaExporter sx = new XmlSchemaExporter (schemas);
+ XmlTypeMapping tm = ri.ImportTypeMapping (type);
+ sx.ExportTypeMapping (tm);
+ return schemas;
+ }
}
}
diff --git a/mcs/class/System.XML/Test/System.Xml.Serialization/XmlSerializerTests.cs b/mcs/class/System.XML/Test/System.Xml.Serialization/XmlSerializerTests.cs
index a7f00ab1e24..ed63ede99fa 100644
--- a/mcs/class/System.XML/Test/System.Xml.Serialization/XmlSerializerTests.cs
+++ b/mcs/class/System.XML/Test/System.Xml.Serialization/XmlSerializerTests.cs
@@ -2187,8 +2187,7 @@ namespace MonoTests.System.XmlSerialization
ser.Deserialize (new XmlTextReader (xml, XmlNodeType.Document, null));
}
-#if NET_2_0
-#if !TARGET_JVM
+#if !TARGET_JVM && !MOBILE
[Test]
public void GenerateSerializerGenerics ()
{
@@ -2266,7 +2265,6 @@ namespace MonoTests.System.XmlSerialization
Assert.AreEqual (TestEnumWithNulls.bb, w.nenum.Value);
Assert.AreEqual (t, w.ndate.Value);
}
-#endif
[Test]
public void SerializeBase64Binary()
diff --git a/mcs/class/System.XML/Test/System.Xml/XmlDocumentEventTests.cs b/mcs/class/System.XML/Test/System.Xml/XmlDocumentEventTests.cs
index 4df96725fbb..657d672e5bc 100644
--- a/mcs/class/System.XML/Test/System.Xml/XmlDocumentEventTests.cs
+++ b/mcs/class/System.XML/Test/System.Xml/XmlDocumentEventTests.cs
@@ -18,11 +18,6 @@ namespace MonoTests.System.Xml
[TestFixture]
public class XmlDocumentEventTests
{
- public static void Main ()
- {
- new XmlDocumentEventTests ().InsertingOrder ();
- }
-
private StringBuilder eventLogBuilder = new StringBuilder ();
private XmlDocument GetEventDocument ()
diff --git a/mcs/class/System.XML/Test/System.Xml/XmlSecureResolverCas.cs b/mcs/class/System.XML/Test/System.Xml/XmlSecureResolverCas.cs
index d8035e4d010..52de90d1414 100644
--- a/mcs/class/System.XML/Test/System.Xml/XmlSecureResolverCas.cs
+++ b/mcs/class/System.XML/Test/System.Xml/XmlSecureResolverCas.cs
@@ -27,6 +27,8 @@
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
+#if !MOBILE
+
using NUnit.Framework;
using System;
@@ -82,3 +84,5 @@ namespace MonoCasTests.System.Xml {
}
}
}
+
+#endif \ No newline at end of file
diff --git a/mcs/class/System.XML/Test/System.Xml/XmlSecureResolverTests.cs b/mcs/class/System.XML/Test/System.Xml/XmlSecureResolverTests.cs
index 0603a694d42..c97407de984 100644
--- a/mcs/class/System.XML/Test/System.Xml/XmlSecureResolverTests.cs
+++ b/mcs/class/System.XML/Test/System.Xml/XmlSecureResolverTests.cs
@@ -8,6 +8,8 @@
// Copyright (C) 2004-2005 Novell, Inc (http://www.novell.com)
//
+#if !MOBILE
+
using System;
using System.Collections;
using System.IO;
@@ -132,3 +134,4 @@ namespace MonoTestsXml
}
}
+#endif
diff --git a/mcs/class/System.XML/Test/System.Xml/XmlUrlResolverTests.cs b/mcs/class/System.XML/Test/System.Xml/XmlUrlResolverTests.cs
index 17e94fc1567..59752547bc0 100644
--- a/mcs/class/System.XML/Test/System.Xml/XmlUrlResolverTests.cs
+++ b/mcs/class/System.XML/Test/System.Xml/XmlUrlResolverTests.cs
@@ -104,19 +104,17 @@ namespace MonoTests.System.Xml
#if NET_4_5
[Test]
- [Category("Async")]
public void TestAsync ()
{
var loc = Assembly.GetExecutingAssembly ().Location;
Uri resolved = resolver.ResolveUri (null, loc);
Assert.AreEqual ("file", resolved.Scheme);
var task = resolver.GetEntityAsync (resolved, null, typeof (Stream));
- Assert.That (task.Wait (3000));
- Assert.IsInstanceOfType (typeof (Stream), task.Result);
+ Assert.IsTrue (task.Wait (3000));
+ Assert.IsTrue (task.Result is Stream);
}
[Test]
- [Category("Async")]
public void TestAsyncError ()
{
var loc = Assembly.GetExecutingAssembly ().Location;
@@ -129,7 +127,7 @@ namespace MonoTests.System.Xml
} catch (Exception ex) {
if (ex is AggregateException)
ex = ((AggregateException) ex).InnerException;
- Assert.IsInstanceOfType (typeof (XmlException), ex);
+ Assert.IsTrue (ex is XmlException);
}
}
#endif
diff --git a/mcs/class/System.XML/Test/System.Xml/XmlWriterSettingsTests.cs b/mcs/class/System.XML/Test/System.Xml/XmlWriterSettingsTests.cs
index 6ade78b4461..bd5cb6af26f 100644
--- a/mcs/class/System.XML/Test/System.Xml/XmlWriterSettingsTests.cs
+++ b/mcs/class/System.XML/Test/System.Xml/XmlWriterSettingsTests.cs
@@ -47,6 +47,7 @@ namespace MonoTests.System.Xml
}
[Test]
+ [Category ("MobileNotWorking")]
public void EncodingTest ()
{
// For Stream it makes sense
diff --git a/mcs/class/System.Xml.Linq/Test/System.Xml.Linq/XAttributeTest.cs b/mcs/class/System.Xml.Linq/Test/System.Xml.Linq/XAttributeTest.cs
index 15bad621e9c..7d1e8302b68 100644
--- a/mcs/class/System.Xml.Linq/Test/System.Xml.Linq/XAttributeTest.cs
+++ b/mcs/class/System.Xml.Linq/Test/System.Xml.Linq/XAttributeTest.cs
@@ -451,7 +451,7 @@ namespace MonoTests.System.Xml.Linq
Assert.IsNotNull ((double?) new XAttribute (m), "m:double?:null");
Assert.AreEqual (double.NegativeInfinity, ((double?) new XAttribute (m)).Value, "m:double?:value");
Assert.IsNotNull ((double?) new XAttribute (n), "n:double?:null");
- Assert.IsNaN (((double?) new XAttribute (n)).Value, "n:double?:value");
+ Assert.AreEqual (double.NaN, ((double?) new XAttribute (n)).Value, "n:double?:value");
Assert.IsNotNull ((float?) new XAttribute (a), "a:float?:null");
Assert.AreEqual (7f, ((float?) new XAttribute (a)).Value, "a:float?:value");
Assert.IsNotNull ((float?) new XAttribute (b), "b:float?:null");
@@ -473,7 +473,7 @@ namespace MonoTests.System.Xml.Linq
Assert.IsNotNull ((float?) new XAttribute (m), "m:float?:null");
Assert.AreEqual (float.NegativeInfinity, ((float?) new XAttribute (m)).Value, "m:float?:value");
Assert.IsNotNull ((float?) new XAttribute (n), "n:float?:null");
- Assert.IsNaN (((float?) new XAttribute (n)).Value, "n:float?:value");
+ Assert.AreEqual (float.NaN, ((float?) new XAttribute (n)).Value, "n:float?:value");
AssertThrows<FormatException> (() => { Guid? z = (Guid?) new XAttribute (a); }, "a:Guid?");
AssertThrows<FormatException> (() => { Guid? z = (Guid?) new XAttribute (b); }, "b:Guid?");
AssertThrows<FormatException> (() => { Guid? z = (Guid?) new XAttribute (c); }, "c:Guid?");
@@ -629,7 +629,7 @@ namespace MonoTests.System.Xml.Linq
Assert.AreEqual (double.PositiveInfinity, (double) new XAttribute (i), "i:double");
Assert.AreEqual (double.NegativeInfinity, (double) new XAttribute (M), "M:double");
Assert.AreEqual (double.NegativeInfinity, (double) new XAttribute (m), "m:double");
- Assert.IsNaN (((double) new XAttribute (n)), "n:double");
+ Assert.AreEqual (double.NaN, ((double) new XAttribute (n)), "n:double");
Assert.AreEqual (7f, (float) new XAttribute (a), "a:float");
Assert.AreEqual (42f, (float) new XAttribute (b), "b:float");
Assert.AreEqual (123f, (float) new XAttribute (c), "c:float");
@@ -640,7 +640,7 @@ namespace MonoTests.System.Xml.Linq
Assert.AreEqual (float.PositiveInfinity, (float) new XAttribute (i), "i:float");
Assert.AreEqual (float.NegativeInfinity, (float) new XAttribute (M), "M:float");
Assert.AreEqual (float.NegativeInfinity, (float) new XAttribute (m), "m:float");
- Assert.IsNaN (((float) new XAttribute (n)), "n:float");
+ Assert.AreEqual (float.NaN, ((float) new XAttribute (n)), "n:float");
AssertThrows<FormatException> (() => { Guid z = (Guid) new XAttribute (a); }, "a:Guid");
AssertThrows<FormatException> (() => { Guid z = (Guid) new XAttribute (b); }, "b:Guid");
AssertThrows<FormatException> (() => { Guid z = (Guid) new XAttribute (c); }, "c:Guid");
diff --git a/mcs/class/System.Xml.Linq/Test/System.Xml.Linq/XElementTest.cs b/mcs/class/System.Xml.Linq/Test/System.Xml.Linq/XElementTest.cs
index 59a38543164..5a5f255094c 100644
--- a/mcs/class/System.Xml.Linq/Test/System.Xml.Linq/XElementTest.cs
+++ b/mcs/class/System.Xml.Linq/Test/System.Xml.Linq/XElementTest.cs
@@ -907,7 +907,7 @@ namespace MonoTests.System.Xml.Linq
Assert.IsNotNull ((double?) new XElement (m), "m:double?:null");
Assert.AreEqual (double.NegativeInfinity, ((double?) new XElement (m)).Value, "m:double?:value");
Assert.IsNotNull ((double?) new XElement (n), "n:double?:null");
- Assert.IsNaN (((double?) new XElement (n)).Value, "n:double?:value");
+ Assert.AreEqual (double.NaN, ((double?) new XElement (n)).Value, "n:double?:value");
Assert.IsNotNull ((float?) new XElement (a), "a:float?:null");
Assert.AreEqual (7f, ((float?) new XElement (a)).Value, "a:float?:value");
Assert.IsNotNull ((float?) new XElement (b), "b:float?:null");
@@ -929,7 +929,7 @@ namespace MonoTests.System.Xml.Linq
Assert.IsNotNull ((float?) new XElement (m), "m:float?:null");
Assert.AreEqual (float.NegativeInfinity, ((float?) new XElement (m)).Value, "m:float?:value");
Assert.IsNotNull ((float?) new XElement (n), "n:float?:null");
- Assert.IsNaN (((float?) new XElement (n)).Value, "n:float?:value");
+ Assert.AreEqual (float.NaN, ((float?) new XElement (n)).Value, "n:float?:value");
AssertThrows<FormatException> (() => { Guid? z = (Guid?) new XElement (a); }, "a:Guid?");
AssertThrows<FormatException> (() => { Guid? z = (Guid?) new XElement (b); }, "b:Guid?");
AssertThrows<FormatException> (() => { Guid? z = (Guid?) new XElement (c); }, "c:Guid?");
@@ -1085,7 +1085,7 @@ namespace MonoTests.System.Xml.Linq
Assert.AreEqual (double.PositiveInfinity, (double) new XElement (i), "i:double");
Assert.AreEqual (double.NegativeInfinity, (double) new XElement (M), "M:double");
Assert.AreEqual (double.NegativeInfinity, (double) new XElement (m), "m:double");
- Assert.IsNaN (((double) new XElement (n)), "n:double");
+ Assert.AreEqual (double.NaN, ((double) new XElement (n)), "n:double");
Assert.AreEqual (7f, (float) new XElement (a), "a:float");
Assert.AreEqual (42f, (float) new XElement (b), "b:float");
Assert.AreEqual (13f, (float) new XElement (c), "c:float");
@@ -1096,7 +1096,7 @@ namespace MonoTests.System.Xml.Linq
Assert.AreEqual (float.PositiveInfinity, (float) new XElement (i), "i:float");
Assert.AreEqual (float.NegativeInfinity, (float) new XElement (M), "M:float");
Assert.AreEqual (float.NegativeInfinity, (float) new XElement (m), "m:float");
- Assert.IsNaN (((float) new XElement (n)), "n:float");
+ Assert.AreEqual (float.NaN, ((float) new XElement (n)), "n:float");
AssertThrows<FormatException> (() => { Guid z = (Guid) new XElement (a); }, "a:Guid");
AssertThrows<FormatException> (() => { Guid z = (Guid) new XElement (b); }, "b:Guid");
AssertThrows<FormatException> (() => { Guid z = (Guid) new XElement (c); }, "c:Guid");
diff --git a/mcs/class/System.Xml.Linq/Test/System.Xml.Schema/ExtensionsTest.cs b/mcs/class/System.Xml.Linq/Test/System.Xml.Schema/ExtensionsTest.cs
index 2ed1b5dedb6..da577e644ef 100644
--- a/mcs/class/System.Xml.Linq/Test/System.Xml.Schema/ExtensionsTest.cs
+++ b/mcs/class/System.Xml.Linq/Test/System.Xml.Schema/ExtensionsTest.cs
@@ -9,6 +9,8 @@
// (C) Stefan Prutianu
//
+#if !MOBILE
+
using NUnit.Framework;
using System;
using System.Xml;
@@ -467,3 +469,5 @@ namespace MonoTests.System.Xml.Schema
}
}
+
+#endif \ No newline at end of file
diff --git a/mcs/class/corlib/System.Collections.ObjectModel/ReadOnlyDictionary.cs b/mcs/class/corlib/System.Collections.ObjectModel/ReadOnlyDictionary.cs
new file mode 100644
index 00000000000..a012b56dd06
--- /dev/null
+++ b/mcs/class/corlib/System.Collections.ObjectModel/ReadOnlyDictionary.cs
@@ -0,0 +1,441 @@
+//
+// ReadOnlyDictionary.cs
+//
+// Authors:
+// Martin Baulig <martin.baulig@xamarin.com>
+// Marek Safar (marek.safar@gmail.com)
+//
+// Copyright (c) 2013 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 NET_4_5
+using System;
+using System.Collections.Generic;
+using System.Diagnostics;
+
+namespace System.Collections.ObjectModel {
+
+ [Serializable]
+ [DebuggerDisplay ("Count={Count}")]
+ [DebuggerTypeProxy (typeof (CollectionDebuggerView<,>))]
+ public class ReadOnlyDictionary<TKey, TValue> : IDictionary<TKey, TValue>, IDictionary,
+ IReadOnlyDictionary<TKey, TValue>
+ {
+ readonly IDictionary<TKey, TValue> inner;
+
+ public ReadOnlyDictionary (IDictionary<TKey, TValue> dictionary)
+ {
+ if (dictionary == null)
+ throw new ArgumentNullException ("dictionary");
+
+ this.inner = dictionary;
+ }
+
+ protected IDictionary<TKey, TValue> Dictionary {
+ get {
+ return inner;
+ }
+ }
+
+ public bool ContainsKey (TKey key)
+ {
+ return inner.ContainsKey (key);
+ }
+
+ public bool TryGetValue (TKey key, out TValue value)
+ {
+ return inner.TryGetValue (key, out value);
+ }
+
+ public TValue this [TKey key] {
+ get {
+ return inner [key];
+ }
+ }
+
+ public KeyCollection Keys {
+ get {
+ return new KeyCollection (inner.Keys);
+ }
+ }
+
+ public ValueCollection Values {
+ get {
+ return new ValueCollection (inner.Values);
+ }
+ }
+
+ #region IEnumerable<KeyValuePair<TKey, TValue>> implementation
+ public IEnumerator<KeyValuePair<TKey, TValue>> GetEnumerator ()
+ {
+ return inner.GetEnumerator ();
+ }
+ #endregion
+ #region IEnumerable implementation
+ IEnumerator IEnumerable.GetEnumerator ()
+ {
+ return inner.GetEnumerator ();
+ }
+ #endregion
+
+ #region IDictionary<TKey, TValue> implementation
+
+ void IDictionary<TKey, TValue>.Add (TKey key, TValue value)
+ {
+ throw new NotSupportedException ();
+ }
+
+ bool IDictionary<TKey, TValue>.Remove (TKey key)
+ {
+ throw new NotSupportedException ();
+ }
+
+ TValue IDictionary<TKey, TValue>.this [TKey key] {
+ get {
+ return inner [key];
+ }
+ set {
+ throw new NotSupportedException ();
+ }
+ }
+
+ ICollection<TKey> IDictionary<TKey, TValue>.Keys {
+ get {
+ return Keys;
+ }
+ }
+
+ ICollection<TValue> IDictionary<TKey, TValue>.Values {
+ get {
+ return Values;
+ }
+ }
+
+ #endregion
+
+ #region IDictionary implementation
+
+ void IDictionary.Add (object key, object value)
+ {
+ throw new NotSupportedException ();
+ }
+
+ void IDictionary.Clear ()
+ {
+ throw new NotSupportedException ();
+ }
+
+ bool IDictionary.Contains (object key)
+ {
+ return ((IDictionary)inner).Contains (key);
+ }
+
+ IDictionaryEnumerator IDictionary.GetEnumerator ()
+ {
+ return ((IDictionary)inner).GetEnumerator ();
+ }
+
+ void IDictionary.Remove (object key)
+ {
+ throw new NotSupportedException ();
+ }
+
+ bool IDictionary.IsFixedSize {
+ get {
+ return true;
+ }
+ }
+
+ bool IDictionary.IsReadOnly {
+ get {
+ return true;
+ }
+ }
+
+ object IDictionary.this [object key] {
+ get {
+ return ((IDictionary)inner)[key];
+ }
+ set {
+ throw new NotSupportedException ();
+ }
+ }
+
+ ICollection IDictionary.Keys {
+ get {
+ return Keys;
+ }
+ }
+
+ ICollection IDictionary.Values {
+ get {
+ return Values;
+ }
+ }
+
+ #endregion
+
+ #region ICollection implementation
+
+ void ICollection.CopyTo (Array array, int index)
+ {
+ ((ICollection)inner).CopyTo (array, index);
+ }
+
+ #endregion
+
+ #region ICollection<KeyValuePair<TKey, TValue>> implementation
+
+ void ICollection<KeyValuePair<TKey, TValue>>.Add (KeyValuePair<TKey, TValue> item)
+ {
+ throw new NotSupportedException ();
+ }
+
+ void ICollection<KeyValuePair<TKey, TValue>>.Clear ()
+ {
+ throw new NotSupportedException ();
+ }
+
+ bool ICollection<KeyValuePair<TKey, TValue>>.Contains (KeyValuePair<TKey, TValue> item)
+ {
+ return ((ICollection<KeyValuePair<TKey, TValue>>)inner).Contains (item);
+ }
+
+ void ICollection<KeyValuePair<TKey, TValue>>.CopyTo (KeyValuePair<TKey, TValue>[] array, int arrayIndex)
+ {
+ ((ICollection<KeyValuePair<TKey, TValue>>)inner).CopyTo (array, arrayIndex);
+ }
+
+ bool ICollection<KeyValuePair<TKey, TValue>>.Remove (KeyValuePair<TKey, TValue> item)
+ {
+ throw new NotSupportedException ();
+ }
+
+ bool ICollection<KeyValuePair<TKey, TValue>>.IsReadOnly {
+ get {
+ return true;
+ }
+ }
+
+ #endregion
+
+ #region ICollection implementation
+
+ public int Count {
+ get {
+ return inner.Count;
+ }
+ }
+
+ bool ICollection.IsSynchronized {
+ get {
+ return false;
+ }
+ }
+
+ object ICollection.SyncRoot {
+ get {
+ throw new NotSupportedException ();
+ }
+ }
+
+ #endregion
+
+ IEnumerable<TKey> IReadOnlyDictionary<TKey, TValue>.Keys {
+ get {
+ return Keys;
+ }
+ }
+
+ IEnumerable<TValue> IReadOnlyDictionary<TKey, TValue>.Values {
+ get {
+ return Values;
+ }
+ }
+
+ [Serializable]
+ [DebuggerDisplay ("Count={Count}")]
+ [DebuggerTypeProxy (typeof (CollectionDebuggerView<,>))]
+ public sealed class KeyCollection : ICollection<TKey>, IEnumerable<TKey>, ICollection, IEnumerable
+ {
+ readonly ICollection<TKey> collection;
+
+ internal KeyCollection (ICollection<TKey> collection)
+ {
+ this.collection = collection;
+ }
+
+ public void CopyTo (TKey [] array, int arrayIndex)
+ {
+ collection.CopyTo (array, arrayIndex);
+ }
+
+ public IEnumerator<TKey> GetEnumerator ()
+ {
+ return collection.GetEnumerator ();
+ }
+
+ void ICollection<TKey>.Add (TKey item)
+ {
+ throw new NotSupportedException ("this is a read-only collection");
+ }
+
+ void ICollection<TKey>.Clear ()
+ {
+ throw new NotSupportedException ("this is a read-only collection");
+ }
+
+ bool ICollection<TKey>.Contains (TKey item)
+ {
+ return collection.Contains (item);
+ }
+
+ bool ICollection<TKey>.Remove (TKey item)
+ {
+ throw new NotSupportedException ("this is a read-only collection");
+ }
+
+ void ICollection.CopyTo (Array array, int index)
+ {
+ var target = array as TKey [];
+ if (target != null) {
+ CopyTo (target, index);
+ return;
+ }
+
+ throw new NotImplementedException ();
+ }
+
+ IEnumerator IEnumerable.GetEnumerator ()
+ {
+ return collection.GetEnumerator ();
+ }
+
+ public int Count {
+ get {
+ return collection.Count;
+ }
+ }
+
+ bool ICollection<TKey>.IsReadOnly {
+ get {
+ return true;
+ }
+ }
+
+ bool ICollection.IsSynchronized {
+ get {
+ return false;
+ }
+ }
+
+ object ICollection.SyncRoot {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+ }
+
+ [Serializable]
+ [DebuggerDisplay ("Count={Count}")]
+ [DebuggerTypeProxy (typeof (CollectionDebuggerView<,>))]
+ public sealed class ValueCollection : ICollection<TValue>, IEnumerable<TValue>, ICollection, IEnumerable
+ {
+ readonly ICollection<TValue> collection;
+
+ internal ValueCollection (ICollection<TValue> collection)
+ {
+ this.collection = collection;
+ }
+
+ public void CopyTo (TValue [] array, int arrayIndex)
+ {
+ collection.CopyTo (array, arrayIndex);
+ }
+
+ public IEnumerator<TValue> GetEnumerator ()
+ {
+ return collection.GetEnumerator ();
+ }
+
+ void ICollection<TValue>.Add (TValue item)
+ {
+ throw new NotSupportedException ("this is a read-only collection");
+ }
+
+ void ICollection<TValue>.Clear ()
+ {
+ throw new NotSupportedException ("this is a read-only collection");
+ }
+
+ bool ICollection<TValue>.Contains (TValue item)
+ {
+ return collection.Contains (item);
+ }
+
+ bool ICollection<TValue>.Remove (TValue item)
+ {
+ throw new NotSupportedException ("this is a read-only collection");
+ }
+
+ void ICollection.CopyTo (Array array, int index)
+ {
+ var target = array as TValue [];
+ if (target != null) {
+ CopyTo (target, index);
+ return;
+ }
+
+ throw new NotImplementedException ();
+ }
+
+ IEnumerator IEnumerable.GetEnumerator ()
+ {
+ return collection.GetEnumerator ();
+ }
+
+ public int Count {
+ get {
+ return collection.Count;
+ }
+ }
+
+ bool ICollection<TValue>.IsReadOnly {
+ get {
+ return true;
+ }
+ }
+
+ bool ICollection.IsSynchronized {
+ get {
+ return false;
+ }
+ }
+
+ object ICollection.SyncRoot {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+ }
+ }
+}
+#endif
+
diff --git a/mcs/class/corlib/System.IO/Path.cs b/mcs/class/corlib/System.IO/Path.cs
index 95ba4ee3d3e..57c33d3732b 100644
--- a/mcs/class/corlib/System.IO/Path.cs
+++ b/mcs/class/corlib/System.IO/Path.cs
@@ -222,6 +222,8 @@ namespace System.IO {
if (l >= 2 && DirectorySeparatorChar == '\\' && ret [l - 1] == VolumeSeparatorChar)
return ret + DirectorySeparatorChar;
+ else if (l == 1 && DirectorySeparatorChar == '\\' && path.Length >= 2 && path [nLast] == VolumeSeparatorChar)
+ return ret + VolumeSeparatorChar;
else {
//
// Important: do not use CanonicalizePath here, use
diff --git a/mcs/class/corlib/System.Text/Decoder.cs b/mcs/class/corlib/System.Text/Decoder.cs
index fe715c33796..cf2e6f23efc 100644
--- a/mcs/class/corlib/System.Text/Decoder.cs
+++ b/mcs/class/corlib/System.Text/Decoder.cs
@@ -149,7 +149,10 @@ public abstract class Decoder
out int bytesUsed, out int charsUsed, out bool completed)
{
CheckArguments (bytes, byteIndex, byteCount);
- CheckArguments (chars, charIndex);
+ if (chars == null)
+ throw new ArgumentNullException ("chars");
+ if (charIndex < 0)
+ throw new ArgumentOutOfRangeException ("charIndex");
if (charCount < 0 || chars.Length < charIndex + charCount)
throw new ArgumentOutOfRangeException ("charCount");
@@ -169,7 +172,7 @@ public abstract class Decoder
{
if (chars == null)
throw new ArgumentNullException ("chars");
- if (charIndex < 0 || chars.Length <= charIndex)
+ if (charIndex < 0 || chars.Length < charIndex)
throw new ArgumentOutOfRangeException ("charIndex");
}
@@ -177,7 +180,7 @@ public abstract class Decoder
{
if (bytes == null)
throw new ArgumentNullException ("bytes");
- if (byteIndex < 0 || bytes.Length <= byteIndex)
+ if (byteIndex < 0)
throw new ArgumentOutOfRangeException ("byteIndex");
if (byteCount < 0 || bytes.Length < byteIndex + byteCount)
throw new ArgumentOutOfRangeException ("byteCount");
diff --git a/mcs/class/corlib/System.Text/UTF8Encoding.cs b/mcs/class/corlib/System.Text/UTF8Encoding.cs
index fd5e83be04e..bdd80e8a626 100644
--- a/mcs/class/corlib/System.Text/UTF8Encoding.cs
+++ b/mcs/class/corlib/System.Text/UTF8Encoding.cs
@@ -663,7 +663,7 @@ fail_no_space:
throw new ArgumentOutOfRangeException ("charIndex", _("ArgRange_Array"));
}
- if (charIndex == chars.Length)
+ if (charIndex == chars.Length && byteCount == 0)
return 0;
fixed (char* cptr = chars) {
@@ -688,10 +688,14 @@ fail_no_space:
if (leftOverCount == 0) {
int end = byteIndex + byteCount;
for (; byteIndex < end; posn++, byteIndex++, byteCount--) {
- if (bytes [byteIndex] < 0x80)
+ if (bytes [byteIndex] < 0x80) {
+ if (posn >= length) {
+ throw new ArgumentException (_("Arg_InsufficientSpace"), "chars");
+ }
chars [posn] = (char) bytes [byteIndex];
- else
+ } else {
break;
+ }
}
}
diff --git a/mcs/class/corlib/Test/System.IO/PathTest.cs b/mcs/class/corlib/Test/System.IO/PathTest.cs
index fb53d803b88..77822ac98c4 100644
--- a/mcs/class/corlib/Test/System.IO/PathTest.cs
+++ b/mcs/class/corlib/Test/System.IO/PathTest.cs
@@ -280,6 +280,8 @@ namespace MonoTests.System.IO
Assert.AreEqual (@"C:\dir", Path.GetDirectoryName (@"C:\dir\"), "#B5");
Assert.AreEqual (@"C:\dir", Path.GetDirectoryName (@"C:\dir\dir"), "#B6");
Assert.AreEqual (@"C:\dir\dir", Path.GetDirectoryName (@"C:\dir\dir\"), "#B7");
+ Assert.AreEqual (@"C:", Path.GetDirectoryName (@"C:foo.txt"), "#B8");
+ Assert.AreEqual (@"C:dir", Path.GetDirectoryName (@"C:dir\"), "#B9");
Assert.AreEqual ("\\foo\\bar", Path.GetDirectoryName ("/foo//bar/dingus"), "#C1");
Assert.AreEqual ("foo\\bar", Path.GetDirectoryName ("foo/bar/"), "#C2");
diff --git a/mcs/class/corlib/Test/System.Text/DecoderTest.cs b/mcs/class/corlib/Test/System.Text/DecoderTest.cs
index 3da0846360b..6cf0306d823 100644
--- a/mcs/class/corlib/Test/System.Text/DecoderTest.cs
+++ b/mcs/class/corlib/Test/System.Text/DecoderTest.cs
@@ -98,5 +98,22 @@ namespace MonoTests.System.Text
}
}
#endif
+
+ [Test]
+ public void Bug10789 ()
+ {
+ byte[] bytes = new byte[100];
+ char[] chars = new char[100];
+
+ Decoder conv = Encoding.UTF8.GetDecoder ();
+ int charsUsed, bytesUsed;
+ bool completed;
+
+ conv.Convert (bytes, 0, 0, chars, 100, 0, false, out bytesUsed, out charsUsed, out completed);
+
+ Assert.IsTrue (completed, "#1");
+ Assert.AreEqual (0, charsUsed, "#2");
+ Assert.AreEqual (0, bytesUsed, "#3");
+ }
}
}
diff --git a/mcs/class/corlib/Test/System.Text/UTF8EncodingTest.cs b/mcs/class/corlib/Test/System.Text/UTF8EncodingTest.cs
index 0b0ae720602..1f53af7e3eb 100644
--- a/mcs/class/corlib/Test/System.Text/UTF8EncodingTest.cs
+++ b/mcs/class/corlib/Test/System.Text/UTF8EncodingTest.cs
@@ -1164,5 +1164,37 @@ namespace MonoTests.System.Text
}
}
#endif
+
+ [Test]
+ [ExpectedException (typeof (ArgumentException))]
+ public void Bug10788()
+ {
+ byte[] bytes = new byte[4096];
+ char[] chars = new char[10];
+
+ Encoding.UTF8.GetDecoder ().GetChars (bytes, 0, 4096, chars, 9, false);
+ }
+
+ [Test]
+ public void Bug10789()
+ {
+ byte[] bytes = new byte[4096];
+ char[] chars = new char[10];
+
+ try {
+ Encoding.UTF8.GetDecoder ().GetChars (bytes, 0, 1, chars, 10, false);
+ Assert.Fail ("ArgumentException is expected #1");
+ } catch (ArgumentException) {
+ }
+
+ try {
+ Encoding.UTF8.GetDecoder ().GetChars (bytes, 0, 1, chars, 11, false);
+ Assert.Fail ("ArgumentOutOfRangeException is expected #2");
+ } catch (ArgumentOutOfRangeException) {
+ }
+
+ int charactersWritten = Encoding.UTF8.GetDecoder ().GetChars (bytes, 0, 0, chars, 10, false);
+ Assert.AreEqual (0, charactersWritten, "#3");
+ }
}
}
diff --git a/mcs/class/corlib/corlib.dll.sources b/mcs/class/corlib/corlib.dll.sources
index eafb48667df..4d9560fc138 100644
--- a/mcs/class/corlib/corlib.dll.sources
+++ b/mcs/class/corlib/corlib.dll.sources
@@ -1562,6 +1562,7 @@ System.Collections.Generic/List.cs
System.Collections.ObjectModel/Collection.cs
System.Collections.ObjectModel/KeyedCollection.cs
System.Collections.ObjectModel/ReadOnlyCollection.cs
+System.Collections.ObjectModel/ReadOnlyDictionary.cs
System/Action.cs
System/ArraySegment.cs
System/Comparison.cs
diff --git a/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Compiler/HoistedLocals.cs b/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Compiler/HoistedLocals.cs
index b6db15ad2e2..ddb304be986 100644
--- a/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Compiler/HoistedLocals.cs
+++ b/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Compiler/HoistedLocals.cs
@@ -64,7 +64,7 @@ namespace System.Linq.Expressions.Compiler {
internal readonly HoistedLocals Parent;
// A mapping of hoisted variables to their indexes in the array
- internal readonly ReadOnlyDictionary<Expression, int> Indexes;
+ internal readonly System.Dynamic.Utils.ReadOnlyDictionary<Expression, int> Indexes;
// The variables, in the order they appear in the array
internal readonly ReadOnlyCollection<ParameterExpression> Variables;
@@ -87,7 +87,7 @@ namespace System.Linq.Expressions.Compiler {
SelfVariable = Expression.Variable(typeof(object[]), null);
Parent = parent;
Variables = vars;
- Indexes = new ReadOnlyDictionary<Expression, int>(indexes);
+ Indexes = new System.Dynamic.Utils.ReadOnlyDictionary<Expression, int>(indexes);
}
internal ParameterExpression ParentVariable {