Branch: refs/heads/master
Home:
https://github.com/mono/mono
Compare:
https://github.com/mono/mono/compare/e2f8c217676b...77b1b54d3236
Commit: 1fd6e9a4ffdaa587fc488f0dc79e0933c209a138
Author: Marek Safar <
marek...@gmail.com> (marek-safar)
Date: 2013-04-24 08:29:45 GMT
URL:
https://github.com/mono/mono/commit/1fd6e9a4ffdaa587fc488f0dc79e0933c209a138
Fix quoted values parsing for custom tostring formats. Fixes #11739
Changed paths:
M mcs/class/corlib/System/NumberFormatter.cs
M mcs/class/corlib/Test/System/NumberFormatterTest.cs
Modified: mcs/class/corlib/System/NumberFormatter.cs
===================================================================
@@ -1956,19 +1956,19 @@ public static void GetActiveSection (string format, ref bool positive, bool zero
int[] lens = new int [3];
int index = 0;
int lastPos = 0;
- char literal = '\0';
+ bool quoted = false;
+
for (int i = 0; i < format.Length; i++) {
char c = format [i];
- if (c == literal || (literal == '\0' && (c == '\"' || c == '\''))) {
- if (literal == '\0')
- literal = c;
- else
- literal = '\0';
+ if (c == '\"' || c == '\'') {
+ if (i == 0 || format [i - 1] != '\\')
+ quoted = !quoted;
+
continue;
}
- if (literal == '\0' && format [i] == ';' && (i == 0 || format [i - 1] != '\\')) {
+ if (c == ';' && !quoted && (i == 0 || format [i - 1] != '\\')) {
lens [index++] = i - lastPos;
lastPos = i + 1;
if (index == 3)
Modified: mcs/class/corlib/Test/System/NumberFormatterTest.cs
===================================================================
@@ -4367,5 +4367,15 @@ public void Test17000 ()
{
Assert.AreEqual ("", 0.0.ToString ("X99", _nfi) , "#01");
}
+
+ [Test]
+ public void Test18000 ()
+ {
+ string formatString = "p 00.0000\\';n 0000.00\\';0.#\\'";
+
+ Assert.AreEqual ("p 08.3266'", 8.32663472.ToString (formatString, CultureInfo.InvariantCulture), "#1");
+ Assert.AreEqual ("n 0001.13'", (-1.1345343).ToString (formatString, CultureInfo.InvariantCulture), "#2");
+ Assert.AreEqual ("0'", 0.0.ToString (formatString, CultureInfo.InvariantCulture), "#3");
+ }
}
}
Commit: 262c9e227cb0ea2acea29689ecc826b4c71827ad
Author: Marek Safar <
marek...@gmail.com> (marek-safar)
Date: 2013-04-24 08:29:45 GMT
URL:
https://github.com/mono/mono/commit/262c9e227cb0ea2acea29689ecc826b4c71827ad
Don't catch aggregate exception handle predicate exceptions. Fixes #11867
Changed paths:
M mcs/class/corlib/System/AggregateException.cs
M mcs/class/corlib/Test/System/AggregateExceptionTests.cs
Modified: mcs/class/corlib/System/AggregateException.cs
===================================================================
@@ -1,6 +1,11 @@
+//
// AggregateException.cs
//
+// Authors:
+// Marek Safar (
marek...@gmail.com)
+//
// Copyright (c) 2008 Jérémie "Garuma" Laval
+// 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
@@ -30,7 +35,6 @@
namespace System
{
-
[System.SerializableAttribute]
[System.Diagnostics.DebuggerDisplay ("Count = {InnerExceptions.Count}")]
public class AggregateException : Exception
@@ -103,15 +107,15 @@ public AggregateException Flatten ()
public void Handle (Func<Exception, bool> predicate)
{
+ if (predicate == null)
+ throw new ArgumentNullException ("predicate");
+
List<Exception> failed = new List<Exception> ();
foreach (var e in innerExceptions) {
- try {
- if (!predicate (e))
- failed.Add (e);
- } catch {
- throw new AggregateException (failed);
- }
+ if (!predicate (e))
+ failed.Add (e);
}
+
if (failed.Count > 0)
throw new AggregateException (failed);
}
Modified: mcs/class/corlib/Test/System/AggregateExceptionTests.cs
===================================================================
@@ -84,6 +84,30 @@ public void InitializationWithNullValuesTest ()
Throws (typeof (ArgumentNullException), () => new AggregateException ((Exception[])null));
}
+ [Test]
+ [ExpectedException (typeof (ArgumentNullException))]
+ public void Handle_Invalid ()
+ {
+ e.Handle (null);
+ }
+
+ [Test]
+ public void Handle_AllHandled ()
+ {
+ e.Handle (l => true);
+ }
+
+ [Test]
+ public void Handle_Unhandled ()
+ {
+ try {
+ e.Handle (l => l is AggregateException);
+ Assert.Fail ();
+ } catch (AggregateException e) {
+ Assert.AreEqual (1, e.InnerExceptions.Count);
+ }
+ }
+
static void Throws (Type t, Action action)
{
Exception e = null;
Commit: b013a778a2c1754b54368ddedb724e31bc681015
Author: Marek Safar <
marek...@gmail.com> (marek-safar)
Date: 2013-04-24 08:29:46 GMT
URL:
https://github.com/mono/mono/commit/b013a778a2c1754b54368ddedb724e31bc681015
Remove double verification checks
Changed paths:
M mcs/class/corlib/System.IO/FileStream.cs
Modified: mcs/class/corlib/System.IO/FileStream.cs
===================================================================
@@ -404,13 +404,6 @@ internal FileStream (string path, FileMode mode, FileAccess access, FileShare sh
return(buf_start + buf_offset);
}
set {
- if (handle == MonoIO.InvalidHandle)
- throw new ObjectDisposedException ("Stream has been closed");
-
- if(CanSeek == false) {
- throw new NotSupportedException("The stream does not support seeking");
- }
-
if(value < 0) {
throw new ArgumentOutOfRangeException("Attempt to set the position to a negative value");
}
Commit: 71a77b33c26aeddeb51abecffa5a2b7fc75d1d56
Author: Marek Safar <
marek...@gmail.com> (marek-safar)
Date: 2013-04-24 08:29:46 GMT
URL:
https://github.com/mono/mono/commit/71a77b33c26aeddeb51abecffa5a2b7fc75d1d56
Task.Yield needs to continue on synchronization context if there is any. Fixes #11908
Changed paths:
M mcs/class/corlib/System.Runtime.CompilerServices/YieldAwaitable.cs
Modified: mcs/class/corlib/System.Runtime.CompilerServices/YieldAwaitable.cs
===================================================================
@@ -46,34 +46,40 @@ public struct YieldAwaiter : ICriticalNotifyCompletion
public void OnCompleted (Action continuation)
{
- if (continuation == null)
- throw new ArgumentNullException ("continuation");
-
- if (TaskScheduler.Current == TaskScheduler.Default) {
- //
- // Pass continuation as an argument to avoid allocating
- // hoisting class
- //
- ThreadPool.QueueUserWorkItem (l => ((Action) l) (), continuation);
- } else {
- new Task (continuation).Start (TaskScheduler.Current);
- }
+ OnCompleted (continuation, false);
}
-
+
public void UnsafeOnCompleted (Action continuation)
{
+ OnCompleted (continuation, true);
+ }
+
+ void OnCompleted (Action continuation, bool isUnsafe)
+ {
if (continuation == null)
throw new ArgumentNullException ("continuation");
+ var ctx = SynchronizationContext.Current;
+ if (ctx != null) {
+ ctx.Post (l => ((Action) l) (), continuation);
+ return;
+ }
+
if (TaskScheduler.Current == TaskScheduler.Default) {
//
- // Pass the continuation as an argument to avoid allocating
+ // Pass continuation as an argument to avoid allocating
// hoisting class
//
- ThreadPool.UnsafeQueueUserWorkItem (l => ((Action) l) (), continuation);
- } else {
- new Task (continuation).Start (TaskScheduler.Current);
+ WaitCallback callBack = l => ((Action) l) ();
+ if (isUnsafe) {
+ ThreadPool.UnsafeQueueUserWorkItem (callBack, continuation);
+ } else {
+ ThreadPool.QueueUserWorkItem (callBack, continuation);
+ }
+ return;
}
+
+ new Task (continuation).Start (TaskScheduler.Current);
}
public void GetResult ()
Commit: 77b1b54d32365461f73c9f41796e401079066e14
Author: Marek Safar <
marek...@gmail.com> (marek-safar)
Date: 2013-04-24 08:29:47 GMT
URL:
https://github.com/mono/mono/commit/77b1b54d32365461f73c9f41796e401079066e14
Don't check public token on missing references. Fixes #11796
Changed paths:
M mcs/mcs/assembly.cs
Added paths:
A mcs/errors/cs1705-2.cs
Added: mcs/errors/cs1705-2.cs
===================================================================
@@ -0,0 +1,11 @@
+// CS1705: Assembly `CS1705-lib, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' references `CS1705-lib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=36f3ae7e947792e3' which has a higher version number than imported assembly `CS1705-lib, Version=1.0.0.0, Culture=neutral, PublicKeyToken=36f3ae7e947792e3'
+// Line: 0
+// Compiler options: -r:CS1705-lib.dll -r:dlls/second/CS1705-lib.dll -keyfile:key.snk
+
+class C
+{
+ public static void Main ()
+ {
+ A.Test (new B ());
+ }
+}
Modified: mcs/mcs/assembly.cs
===================================================================
@@ -370,7 +370,7 @@ void CheckReferencesPublicToken ()
// no working SRE API
foreach (var entry in Importer.Assemblies) {
var a = entry as ImportedAssemblyDefinition;
- if (a == null)
+ if (a == null || a.IsMissing)
continue;
if (public_key != null && !a.HasStrongName) {