Compare commits

...
Author SHA1 Message Date
Miguel de Icaza 3e427fe0ef Force use of 4.0.0.0 version for System.Net.Http 2014-04-29 16:45:33 -04:00
Rolf Bjarne Kvinge 2d13830146 Properly preserve VPF registers in iOS. Fixes #17793. 2014-02-17 13:38:35 -05:00
Zoltan Varga d02edc4281 [arm] Use d0/d1 as fp scratch regs on non-hard float platforms. Hopefully fixes #17597. 2014-02-10 20:37:04 -05:00
Atsushi Eno ae86e67f1b fix bug #16744 - null values on nullable value types were not handled in deserializer. 2014-02-10 20:35:22 -05:00
Marek Safar e3a4ce1117 [corlib] Improve 85aaf9b074 change 2014-02-03 18:18:42 +01:00
Marek Safar 6ee3fd4e87 [corlib] Hunting down rare Task.WaitAll race 2014-02-03 18:18:29 +01:00
Marek Safar b95d8a65b9 [corlib] Mark all promise-style task exceptions observed. Fixes #17015 2014-02-03 18:18:06 +01:00
Marek Safar 8c73578428 [corlib] Promise style tasks cannot be started manually. Fixes #16857 2014-02-03 18:16:10 +01:00
Marek Safar cceaabac62 [corlib] Don't inline await continuations when the context does not allow it. Fixes #16548 2014-02-03 18:15:24 +01:00
Marek Safar 693da9b0bb Revert "[corlib] Mark all promise-style task exceptions observed. Fixes #17015"
This reverts commit 2007e2b9c4.
2014-02-03 18:14:52 +01:00
Zoltan Varga 04f55b81b2 [jit] Fix dwarf line number info generation, make AOT use it again instead of the .loc/.file directives of GAS, since CLANG only supports those with assembly, not with .byte directives. Fixes part of #15202. 2014-01-21 11:13:32 +01:00
Zoltan Varga dbd7eedb92 [aot] Give the compilation unit entries in the DWARF debug info different names, the osx tools seem to need this (#15202). 2014-01-21 11:13:32 +01:00
Rolf Bjarne Kvinge 2007e2b9c4 [corlib] Mark all promise-style task exceptions observed. Fixes #17015 2014-01-07 17:36:46 +01:00
Sebastien Pouliot 552554e9f2 Revert "[gsharedvt] Avoid using gsharedvt trampolines for calls with a non-variable signature."
This reverts commit 38b6a9dffd.
2013-12-12 18:02:49 -05:00
Martin Baulig 5f0b43c260 [corlib]: Add stubs for the remaining `System.Runtime.InteropServices.WindowsRuntime' APIs. 2013-12-12 17:34:49 -05:00
Martin Baulig 335769d7f1 [PCL]: Add new 'System.Runtime.InteropServices.WindowsRuntime' Facade Assembly.
FIXME: This is only a stub, the only type currently present is
       `System.Runtime.InteropServices.WindowsRuntime.EventRegistrationToken',
       which is only a stub.
2013-12-12 17:34:40 -05:00
Martin Baulig 265ec9665d [corlib]: Add 'System.Runtime.InteropServices.WindowsRuntime.EventRegistrationToken' stub. 2013-12-12 17:34:32 -05:00
Martin Baulig dd390c5e03 [PCL]: Add "System.Dynamic.Runtime.dll" Facade Assembly to MonoTouch.
Added the type-forwarder for `ConditionalWeakTable<T,V>', put all the
others inside a `!FULL_AOT_RUNTIME' conditional, then enabled this in
the MonoTouch build.
2013-12-12 17:34:22 -05:00
Sebastien Pouliot e33b302618 [tests] Fix some corlib unit tests to run successfully on iOS 2013-12-12 17:32:17 -05:00
44 changed files with 1175 additions and 50 deletions

No files matched your search

+9 -2
View File
@@ -2,11 +2,18 @@ MCS_BUILD_DIR = ../../build
thisdir = class/Facades
monotouch_SUBDIRS = System.Collections.Concurrent System.Collections System.ComponentModel.Annotations System.ComponentModel.EventBasedAsync System.ComponentModel System.Diagnostics.Contracts System.Diagnostics.Debug System.Diagnostics.Tools System.Globalization System.IO System.Linq.Expressions System.Linq.Parallel System.Linq.Queryable System.Linq System.Net.NetworkInformation System.Net.Primitives System.Net.Requests System.ObjectModel System.Reflection.Extensions System.Reflection.Primitives System.Reflection System.Resources.ResourceManager System.Runtime.Extensions System.Runtime.InteropServices System.Runtime.Numerics System.Runtime.Serialization.Json System.Runtime.Serialization.Primitives System.Runtime.Serialization.Xml System.Runtime System.Security.Principal System.ServiceModel.Http System.ServiceModel.Primitives System.Text.Encoding.Extensions System.Text.Encoding System.Text.RegularExpressions System.Threading.Tasks.Parallel System.Threading.Tasks System.Threading System.Xml.ReaderWriter System.Xml.XDocument System.Xml.XmlSerializer
monotouch_SUBDIRS = System.Collections.Concurrent System.Collections System.ComponentModel.Annotations System.ComponentModel.EventBasedAsync System.ComponentModel \
System.Diagnostics.Contracts System.Diagnostics.Debug System.Diagnostics.Tools System.Dynamic.Runtime System.Globalization System.IO System.Linq.Expressions \
System.Linq.Parallel System.Linq.Queryable System.Linq System.Net.NetworkInformation System.Net.Primitives System.Net.Requests System.ObjectModel \
System.Reflection.Extensions System.Reflection.Primitives System.Reflection System.Resources.ResourceManager System.Runtime.Extensions \
System.Runtime.InteropServices System.Runtime.InteropServices.WindowsRuntime System.Runtime.Numerics System.Runtime.Serialization.Json \
System.Runtime.Serialization.Primitives System.Runtime.Serialization.Xml System.Runtime System.Security.Principal System.ServiceModel.Http \
System.ServiceModel.Primitives System.Text.Encoding.Extensions System.Text.Encoding System.Text.RegularExpressions System.Threading.Tasks.Parallel \
System.Threading.Tasks System.Threading System.Xml.ReaderWriter System.Xml.XDocument System.Xml.XmlSerializer
mobile_static_SUBDIRS = $(monotouch_SUBDIRS)
net_4_5_SUBDIRS = $(monotouch_SUBDIRS) System.Dynamic.Runtime System.Reflection.Emit.ILGeneration System.Reflection.Emit.Lightweight System.Reflection.Emit
net_4_5_SUBDIRS = $(monotouch_SUBDIRS) System.Reflection.Emit.ILGeneration System.Reflection.Emit.Lightweight System.Reflection.Emit
monodroid_SUBDIRS = $(net_4_5_SUBDIRS)
@@ -19,7 +19,7 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
//
#if !FULL_AOT_RUNTIME
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Dynamic.BinaryOperationBinder))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Dynamic.BindingRestrictions))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Dynamic.CallInfo))]
@@ -46,4 +46,6 @@
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.CompilerServices.CallSiteBinder))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.CompilerServices.CallSiteHelpers))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.CompilerServices.DynamicAttribute))]
#endif
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.CompilerServices.ConditionalWeakTable<,>))]
@@ -0,0 +1,41 @@
//
// 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.
//
using System;
using System.Reflection;
using System.Runtime.CompilerServices;
[assembly: AssemblyTitle ("System.Runtime.InteropServices.WindowsRuntime.dll")]
[assembly: AssemblyDescription ("System.Runtime.InteropServices.WindowsRuntime.dll")]
[assembly: AssemblyDefaultAlias ("System.Runtime.InteropServices.WindowsRuntime.dll")]
[assembly: AssemblyCompany ("Xamarin, Inc.")]
[assembly: AssemblyProduct ("Mono Common Language Infrastructure")]
[assembly: AssemblyCopyright ("Copyright (c) 2013 Xamarin Inc. (http://www.xamarin.com)")]
[assembly: AssemblyVersion ("4.0.0.0")]
[assembly: AssemblyInformationalVersion ("4.0.0.0")]
[assembly: AssemblyFileVersion ("4.0.0.0")]
[assembly: AssemblyDelaySign (true)]
[assembly: AssemblyKeyFile ("../../msfinal.pub")]
[assembly: ReferenceAssembly]
@@ -0,0 +1,22 @@
MCS_BUILD_DIR = ../../../build
thisdir = class/Facades/System.Runtime.InteropServices.WindowsRuntime
SUBDIRS =
include $(MCS_BUILD_DIR)/rules.make
LIBRARY_SUBDIR = Facades
LIBRARY_INSTALL_DIR = $(mono_libdir)/mono/$(FRAMEWORK_VERSION)/Facades
LIBRARY = System.Runtime.InteropServices.WindowsRuntime.dll
KEY_FILE = ../../msfinal.pub
SIGN_FLAGS = /delaysign /keyfile:$(KEY_FILE) /nowarn:1616,1699
LIB_MCS_FLAGS = $(SIGN_FLAGS) /r:mscorlib
PLATFORM_DEBUG_FLAGS =
NO_TEST = yes
include $(MCS_BUILD_DIR)/library.make
@@ -0,0 +1,30 @@
//
// 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.
//
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.InteropServices.WindowsRuntime.DefaultInterfaceAttribute))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.InteropServices.WindowsRuntime.EventRegistrationToken))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.InteropServices.WindowsRuntime.EventRegistrationTokenTable<>))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.InteropServices.WindowsRuntime.IActivationFactory))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.InteropServices.WindowsRuntime.InterfaceImplementedInVersionAttribute))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.InteropServices.WindowsRuntime.ReadOnlyArrayAttribute))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.InteropServices.WindowsRuntime.ReturnValueNameAttribute))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.InteropServices.WindowsRuntime.WindowsRuntimeMarshal))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.InteropServices.WindowsRuntime.WriteOnlyArrayAttribute))]
@@ -44,10 +44,10 @@ using System.Runtime.InteropServices;
[assembly: AssemblyCompany (Consts.MonoCompany)]
[assembly: AssemblyProduct (Consts.MonoProduct)]
[assembly: AssemblyCopyright (Consts.MonoCopyright)]
[assembly: AssemblyVersion (Consts.FxVersion)]
[assembly: SatelliteContractVersion (Consts.FxVersion)]
[assembly: AssemblyInformationalVersion (Consts.FxFileVersion)]
[assembly: AssemblyFileVersion (Consts.FxFileVersion)]
[assembly: AssemblyVersion ("4.0.0.0")]
[assembly: SatelliteContractVersion ("4.0.0.0")]
[assembly: AssemblyInformationalVersion ("4.0.50524.0")]
[assembly: AssemblyFileVersion ("4.0.50524.0")]
[assembly: NeutralResourcesLanguage ("en-US")]
[assembly: CLSCompliant (true)]
@@ -99,29 +99,27 @@ namespace System.Runtime.Serialization.Json
throw new XmlException ("Invalid JSON char");
return Char.Parse(c);
case TypeCode.Single:
return reader.ReadElementContentAsFloat ();
case TypeCode.Double:
return reader.ReadElementContentAsDouble ();
case TypeCode.Decimal:
return reader.ReadElementContentAsDecimal ();
return ReadValueType (type, nullable);
case TypeCode.Byte:
case TypeCode.SByte:
case TypeCode.Int16:
case TypeCode.Int32:
case TypeCode.UInt16:
if (type.IsEnum)
return Enum.ToObject (type, Convert.ChangeType (reader.ReadElementContentAsLong (), Enum.GetUnderlyingType (type), null));
else
return Convert.ChangeType (reader.ReadElementContentAsDecimal (), type, null);
case TypeCode.UInt32:
case TypeCode.Int64:
case TypeCode.UInt64:
if (type.IsEnum)
return Enum.ToObject (type, Convert.ChangeType (reader.ReadElementContentAsLong (), Enum.GetUnderlyingType (type), null));
else
return Convert.ChangeType (reader.ReadElementContentAsDecimal (), type, null);
return ReadValueType (type, nullable);
case TypeCode.UInt64:
if (type.IsEnum)
return Enum.ToObject (type, Convert.ChangeType (reader.ReadElementContentAsDecimal (), Enum.GetUnderlyingType (type), null));
else
return ReadValueType (type, nullable);
case TypeCode.Boolean:
return reader.ReadElementContentAsBoolean ();
return ReadValueType (type, nullable);
case TypeCode.DateTime:
// it does not use ReadElementContentAsDateTime(). Different string format.
var s = reader.ReadElementContentAsString ();
@@ -187,6 +185,13 @@ namespace System.Runtime.Serialization.Json
return ReadInstanceDrivenObject ();
}
}
object ReadValueType (Type type, bool nullable)
{
string s = reader.ReadElementContentAsString ();
return nullable && s.Trim ().Length == 0 ? null : Convert.ChangeType (s, type, null);
}
Type GetRuntimeType (string name)
{
@@ -69,14 +69,14 @@ namespace System.Runtime.CompilerServices
public static AsyncTaskMethodBuilder Create ()
{
var task = new Task<object> (TaskActionInvoker.Empty, null, CancellationToken.None, TaskCreationOptions.None, null);
var task = new Task<object> (TaskActionInvoker.Promise, null, CancellationToken.None, TaskCreationOptions.None, null);
task.SetupScheduler (TaskScheduler.Current);
return new AsyncTaskMethodBuilder (task);
}
public void SetException (Exception exception)
{
if (Task.TrySetException (new AggregateException (exception), exception is OperationCanceledException))
if (Task.TrySetException (new AggregateException (exception), exception is OperationCanceledException, true))
return;
throw new InvalidOperationException ("The task has already completed");
@@ -69,14 +69,14 @@ namespace System.Runtime.CompilerServices
public static AsyncTaskMethodBuilder<TResult> Create ()
{
var task = new Task<TResult> (TaskActionInvoker.Empty, null, CancellationToken.None, TaskCreationOptions.None, null);
var task = new Task<TResult> (TaskActionInvoker.Promise, null, CancellationToken.None, TaskCreationOptions.None, null);
task.SetupScheduler (TaskScheduler.Current);
return new AsyncTaskMethodBuilder<TResult> (task);
}
public void SetException (Exception exception)
{
if (Task.TrySetException (new AggregateException (exception), exception is OperationCanceledException))
if (Task.TrySetException (new AggregateException (exception), exception is OperationCanceledException, true))
return;
throw new InvalidOperationException ("The task has already completed");
@@ -83,13 +83,13 @@ namespace System.Runtime.CompilerServices
} else {
IContinuation cont;
Task cont_task;
if (continueOnSourceContext && TaskScheduler.Current != TaskScheduler.Default) {
if (continueOnSourceContext && !TaskScheduler.IsDefault) {
cont_task = new Task (TaskActionInvoker.Create (continuation), null, CancellationToken.None, TaskCreationOptions.None, null);
cont_task.SetupScheduler (TaskScheduler.Current);
cont = new SchedulerAwaitContinuation (cont_task);
} else {
cont_task = null;
cont = new ActionContinuation (continuation);
cont = new AwaiterActionContinuation (continuation);
}
//
@@ -65,7 +65,7 @@ namespace System.Runtime.CompilerServices
return;
}
if (TaskScheduler.Current == TaskScheduler.Default) {
if (TaskScheduler.IsDefault) {
//
// Pass continuation as an argument to avoid allocating
// hoisting class
@@ -0,0 +1,46 @@
#if NET_4_5
//
// DefaultInterfaceAttribute.cs
//
// Author:
// Martin Baulig <[email protected]>
//
// 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.
using System;
using System.Runtime.CompilerServices;
namespace System.Runtime.InteropServices.WindowsRuntime
{
[AttributeUsageAttribute(AttributeTargets.Class|AttributeTargets.Interface, AllowMultiple = false, Inherited = false)]
public sealed class DefaultInterfaceAttribute : Attribute
{
public Type DefaultInterface {
get;
private set;
}
public DefaultInterfaceAttribute (Type defaultInterface)
{
DefaultInterface = defaultInterface;
}
}
}
#endif
@@ -0,0 +1,53 @@
#if NET_4_5
//
// DesignerNamespaceResolveEventArgs.cs
//
// Author:
// Martin Baulig <[email protected]>
//
// 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.
using System;
using System.Collections.ObjectModel;
using System.Runtime.CompilerServices;
namespace System.Runtime.InteropServices.WindowsRuntime
{
[ComVisibleAttribute(false)]
public class DesignerNamespaceResolveEventArgs : EventArgs
{
public DesignerNamespaceResolveEventArgs (string namespaceName)
{
NamespaceName = namespaceName;
ResolvedAssemblyFiles = new Collection<string> ();
}
public string NamespaceName {
get;
private set;
}
public Collection<string> ResolvedAssemblyFiles {
get;
private set;
}
}
}
#endif
@@ -0,0 +1,59 @@
#if NET_4_5
//
// EventRegistrationToken.cs
//
// Author:
// Martin Baulig <[email protected]>
//
// 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.
using System;
using System.Runtime.CompilerServices;
namespace System.Runtime.InteropServices.WindowsRuntime
{
public struct EventRegistrationToken
{
#pragma warning disable 0649
long value;
#pragma warning restore 0649
public static bool operator == (EventRegistrationToken left, EventRegistrationToken right)
{
return left.value == right.value;
}
public static bool operator != (EventRegistrationToken left, EventRegistrationToken right)
{
return left.value != right.value;
}
public override bool Equals (object obj)
{
return ((EventRegistrationToken)obj).value == value;
}
public override int GetHashCode ()
{
return unchecked ((int)value);
}
}
}
#endif
@@ -0,0 +1,68 @@
#if NET_4_5
//
// EventRegistrationTokenTable.cs
//
// Author:
// Martin Baulig <[email protected]>
//
// 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.
using System;
using System.Runtime.CompilerServices;
namespace System.Runtime.InteropServices.WindowsRuntime
{
[MonoTODO]
public sealed class EventRegistrationTokenTable<T>
where T : class
{
public EventRegistrationTokenTable ()
{
throw new NotImplementedException ();
}
public T InvocationList {
get { throw new NotImplementedException (); }
set { throw new NotImplementedException (); }
}
public EventRegistrationToken AddEventHandler (T handler)
{
throw new NotImplementedException ();
}
public static EventRegistrationTokenTable<T> GetOrCreateEventRegistrationTokenTable(ref EventRegistrationTokenTable<T> refEventTable)
{
throw new NotImplementedException ();
}
public void RemoveEventHandler (T handler)
{
throw new NotImplementedException ();
}
public void RemoveEventHandler (EventRegistrationToken token)
{
throw new NotImplementedException ();
}
}
}
#endif
@@ -0,0 +1,38 @@
#if NET_4_5
//
// IActivationFactory.cs
//
// Author:
// Martin Baulig <[email protected]>
//
// 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.
using System;
using System.Runtime.CompilerServices;
namespace System.Runtime.InteropServices.WindowsRuntime
{
[Guid("00000035-0000-0000-C000-000000000046")]
public interface IActivationFactory
{
object ActivateInstance ();
}
}
#endif
@@ -0,0 +1,71 @@
#if NET_4_5
//
// InterfaceImplementedInVersionAttribute.cs
//
// Author:
// Martin Baulig <[email protected]>
//
// 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.
using System;
using System.Runtime.CompilerServices;
namespace System.Runtime.InteropServices.WindowsRuntime
{
[AttributeUsageAttribute(AttributeTargets.Class|AttributeTargets.Interface, AllowMultiple = false, Inherited = false)]
public sealed class InterfaceImplementedInVersionAttribute : Attribute
{
public InterfaceImplementedInVersionAttribute (Type interfaceType, byte majorVersion, byte minorVersion,
byte buildVersion, byte revisionVersion)
{
InterfaceType = interfaceType;
MajorVersion = majorVersion;
MinorVersion = minorVersion;
BuildVersion = buildVersion;
RevisionVersion = revisionVersion;
}
public byte BuildVersion {
get;
private set;
}
public Type InterfaceType {
get;
private set;
}
public byte MajorVersion {
get;
private set;
}
public byte MinorVersion {
get;
private set;
}
public byte RevisionVersion {
get;
private set;
}
}
}
#endif
@@ -0,0 +1,60 @@
#if NET_4_5
//
// NamespaceResolveEventArgs.cs
//
// Author:
// Martin Baulig <[email protected]>
//
// 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.
using System;
using System.Reflection;
using System.Collections.ObjectModel;
using System.Runtime.CompilerServices;
namespace System.Runtime.InteropServices.WindowsRuntime
{
[ComVisibleAttribute(false)]
public class NamespaceResolveEventArgs : EventArgs
{
public NamespaceResolveEventArgs (string namespaceName, Assembly requestingAssembly)
{
NamespaceName = namespaceName;
RequestingAssembly = requestingAssembly;
ResolvedAssemblies = new Collection<Assembly> ();
}
public string NamespaceName {
get;
private set;
}
public Assembly RequestingAssembly {
get;
private set;
}
public Collection<Assembly> ResolvedAssemblies {
get;
private set;
}
}
}
#endif
@@ -0,0 +1,37 @@
#if NET_4_5
//
// ReadOnlyArrayAttribute.cs
//
// Author:
// Martin Baulig <[email protected]>
//
// 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.
using System;
using System.Runtime.CompilerServices;
namespace System.Runtime.InteropServices.WindowsRuntime
{
[AttributeUsageAttribute(AttributeTargets.Parameter, Inherited = false, AllowMultiple = false)]
public sealed class ReadOnlyArrayAttribute : Attribute
{
}
}
#endif
@@ -0,0 +1,44 @@
//
// ReturnValueNameAttribute.cs
//
// Author:
// Martin Baulig <[email protected]>
//
// 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.
using System;
using System.Runtime.CompilerServices;
namespace System.Runtime.InteropServices.WindowsRuntime
{
[AttributeUsageAttribute(AttributeTargets.Delegate|AttributeTargets.ReturnValue, AllowMultiple = false, Inherited = false)]
public sealed class ReturnValueNameAttribute : Attribute
{
public ReturnValueNameAttribute (string name)
{
Name = name;
}
public string Name {
get;
private set;
}
}
}
@@ -0,0 +1,72 @@
#if NET_4_5
//
// WindowsRuntimeMarshal.cs
//
// Author:
// Martin Baulig <[email protected]>
//
// 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.
using System;
using System.Runtime.CompilerServices;
namespace System.Runtime.InteropServices.WindowsRuntime
{
[MonoTODO]
public static class WindowsRuntimeMarshal
{
public static void AddEventHandler<T> ( Func<T, EventRegistrationToken> addMethod, Action<EventRegistrationToken> removeMethod, T handler)
{
throw new NotImplementedException ();
}
public static void FreeHString (IntPtr ptr)
{
throw new NotImplementedException ();
}
public static IActivationFactory GetActivationFactory (Type type)
{
throw new NotImplementedException ();
}
public static string PtrToStringHString (IntPtr ptr)
{
throw new NotImplementedException ();
}
public static void RemoveAllEventHandlers(Action<EventRegistrationToken> removeMethod)
{
throw new NotImplementedException ();
}
public static void RemoveEventHandler<T> (Action<EventRegistrationToken> removeMethod, T handler)
{
throw new NotImplementedException ();
}
public static IntPtr StringToHString (string s)
{
throw new NotImplementedException ();
}
}
}
#endif
@@ -0,0 +1,53 @@
#if NET_4_5
//
// WindowsRuntimeMetadata.cs
//
// Author:
// Martin Baulig <[email protected]>
//
// 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.
using System;
using System.Collections.Generic;
using System.Runtime.CompilerServices;
namespace System.Runtime.InteropServices.WindowsRuntime
{
[MonoTODO]
public static class WindowsRuntimeMetadata
{
public static IEnumerable<string> ResolveNamespace (string namespaceName, IEnumerable<string> packageGraphFilePaths)
{
throw new NotImplementedException ();
}
public static IEnumerable<string> ResolveNamespace (string namespaceName, string windowsSdkFilePath, IEnumerable<string> packageGraphFilePaths)
{
throw new NotImplementedException ();
}
#pragma warning disable 0067
public static event EventHandler<DesignerNamespaceResolveEventArgs> DesignerNamespaceResolve;
public static event EventHandler<NamespaceResolveEventArgs> ReflectionOnlyNamespaceResolve;
#pragma warning restore 0067
}
}
#endif
@@ -0,0 +1,37 @@
#if NET_4_5
//
// WriteOnlyArrayAttribute.cs
//
// Author:
// Martin Baulig <[email protected]>
//
// 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.
using System;
using System.Runtime.CompilerServices;
namespace System.Runtime.InteropServices.WindowsRuntime
{
[AttributeUsageAttribute(AttributeTargets.Parameter, Inherited = false, AllowMultiple = false)]
public sealed class WriteOnlyArrayAttribute : Attribute
{
}
}
#endif
@@ -182,6 +182,9 @@ namespace System.Threading.Tasks
if (IsContinuation)
throw new InvalidOperationException ("Start may not be called on a continuation task");
if (IsPromise)
throw new InvalidOperationException ("Start may not be called on a promise-style task");
SetupScheduler (scheduler);
Schedule ();
}
@@ -208,6 +211,9 @@ namespace System.Threading.Tasks
if (IsContinuation)
throw new InvalidOperationException ("RunSynchronously may not be called on a continuation task");
if (IsPromise)
throw new InvalidOperationException ("RunSynchronously may not be called on a promise-style task");
RunSynchronouslyCore (scheduler);
}
@@ -220,7 +226,9 @@ namespace System.Threading.Tasks
if (scheduler.RunInline (this, false))
return;
} catch (Exception inner) {
throw new TaskSchedulerException (inner);
var ex = new TaskSchedulerException (inner);
TrySetException (new AggregateException (ex), false, true);
throw ex;
}
Schedule ();
@@ -343,8 +351,7 @@ namespace System.Threading.Tasks
continuations.Add (continuation);
// Retry in case completion was achieved but event adding was too late
if (IsCompleted) {
continuations.Remove (continuation);
if (IsCompleted && continuations.Remove (continuation)) {
if (!canExecuteInline)
return false;
@@ -448,7 +455,7 @@ namespace System.Threading.Tasks
return true;
}
internal bool TrySetException (AggregateException aggregate, bool cancellation)
internal bool TrySetException (AggregateException aggregate, bool cancellation, bool observed)
{
if (IsCompleted)
return false;
@@ -470,6 +477,9 @@ namespace System.Threading.Tasks
HandleGenericException (aggregate);
}
if (observed)
exSlot.Observed = true;
return true;
}
@@ -1349,6 +1359,12 @@ namespace System.Threading.Tasks
}
}
bool IsPromise {
get {
return invoker == TaskActionInvoker.Promise;
}
}
internal Task ContinuationAncestor {
get {
return contAncestor;
@@ -35,6 +35,7 @@ namespace System.Threading.Tasks
abstract class TaskActionInvoker
{
public static readonly TaskActionInvoker Empty = new EmptyTaskActionInvoker ();
public static readonly TaskActionInvoker Promise = new EmptyTaskActionInvoker ();
public static readonly TaskActionInvoker Delay = new DelayTaskInvoker ();
sealed class EmptyTaskActionInvoker : TaskActionInvoker
@@ -113,7 +113,7 @@ namespace System.Threading.Tasks
if (aggregate.InnerExceptions.Count == 0)
throw new ArgumentNullException ("exceptions");
return source.TrySetException (aggregate, false);
return source.TrySetException (aggregate, false, false);
}
public bool TrySetResult (TResult result)
@@ -110,18 +110,26 @@ namespace System.Threading.Tasks
}
}
class ActionContinuation : IContinuation
class AwaiterActionContinuation : IContinuation
{
readonly Action action;
public ActionContinuation (Action action)
public AwaiterActionContinuation (Action action)
{
this.action = action;
}
public void Execute ()
{
action ();
//
// Continuation can be inlined only when the current context allows it. This is different to awaiter setup
// because the context where the awaiter task is set to completed can be anywhere (due to TaskCompletionSource)
//
if ((SynchronizationContext.Current == null || SynchronizationContext.Current.GetType () == typeof (SynchronizationContext)) && TaskScheduler.IsDefault) {
action ();
} else {
ThreadPool.UnsafeQueueUserWorkItem (l => ((Action) l) (), action);
}
}
}
@@ -194,7 +202,7 @@ namespace System.Threading.Tasks
}
if (exceptions != null) {
owner.TrySetException (new AggregateException (exceptions), false);
owner.TrySetException (new AggregateException (exceptions), false, false);
return;
}
@@ -254,7 +262,7 @@ namespace System.Threading.Tasks
}
if (exceptions != null) {
owner.TrySetException (new AggregateException (exceptions), false);
owner.TrySetException (new AggregateException (exceptions), false, false);
return;
}
@@ -331,6 +339,7 @@ namespace System.Threading.Tasks
sealed class CountdownContinuation : IContinuation, IDisposable
{
readonly CountdownEvent evt;
bool disposed;
public CountdownContinuation (int initialCount)
{
@@ -345,12 +354,18 @@ namespace System.Threading.Tasks
public void Dispose ()
{
disposed = true;
Thread.MemoryBarrier ();
evt.Dispose ();
}
public void Execute ()
{
evt.Signal ();
// Guard against possible race when continuation is disposed and some tasks may still
// execute it (removal was late and the execution is slower than the Dispose thread)
if (!disposed)
evt.Signal ();
}
}
@@ -100,6 +100,12 @@ namespace System.Threading.Tasks
return id;
}
}
internal static bool IsDefault {
get {
return currentScheduler == null || currentScheduler == defaultScheduler;
}
}
public virtual int MaximumConcurrencyLevel {
get {
@@ -180,7 +180,9 @@ namespace MonoTests.System.Runtime.CompilerServices
});
mres.Set ();
Assert.IsTrue (mres2.WaitOne (2000), "#2");;
// this will only terminate correctly if the test was not executed from the main thread
// e.g. Touch.Unit defaults to run tests on the main thread and this will return false
Assert.AreEqual (Thread.CurrentThread.IsBackground, mres2.WaitOne (2000), "#2");;
}
}
}
@@ -837,6 +837,23 @@ namespace MonoTests.System.Threading.Tasks
}
}
[Test]
public void RunSynchronously_SchedulerException ()
{
var scheduler = new MockScheduler ();
scheduler.TryExecuteTaskInlineHandler += (task, b) => {
throw new ApplicationException ();
};
Task t = new Task (() => { });
try {
t.RunSynchronously (scheduler);
Assert.Fail ();
} catch (Exception e) {
Assert.AreEqual (t.Exception.InnerException, e);
}
}
[Test]
public void RunSynchronouslyWithAttachedChildren ()
{
@@ -152,6 +152,7 @@ namespace MonoTests.System.Threading {
}
[Test]
[Category("MobileNotWorking")]
public void Capture ()
{
ExecutionContext ec = ExecutionContext.Capture ();
@@ -169,6 +170,7 @@ namespace MonoTests.System.Threading {
}
[Test]
[Category("MobileNotWorking")]
public void Copy ()
{
ExecutionContext ec = ExecutionContext.Capture ();
@@ -198,6 +200,7 @@ namespace MonoTests.System.Threading {
}
[Test]
[Category("MobileNotWorking")]
public void IsFlowSuppressed ()
{
Assert.IsFalse (ExecutionContext.IsFlowSuppressed (), "IsFlowSuppressed-1");
@@ -211,12 +214,14 @@ namespace MonoTests.System.Threading {
[Test]
[ExpectedException (typeof (InvalidOperationException))]
[Category("MobileNotWorking")]
public void RestoreFlow_None ()
{
ExecutionContext.RestoreFlow ();
}
[Test]
[Category("MobileNotWorking")]
public void RestoreFlow_SuppressFlow ()
{
Assert.IsFalse (ExecutionContext.IsFlowSuppressed (), "IsFlowSuppressed-1");
@@ -237,6 +242,7 @@ namespace MonoTests.System.Threading {
[Test]
[ExpectedException (typeof (InvalidOperationException))]
[Category("MobileNotWorking")]
public void Run_SuppressFlow ()
{
Assert.IsFalse (ExecutionContext.IsFlowSuppressed ());
@@ -251,6 +257,7 @@ namespace MonoTests.System.Threading {
}
[Test]
[Category("MobileNotWorking")]
public void SuppressFlow ()
{
Assert.IsFalse (ExecutionContext.IsFlowSuppressed (), "IsFlowSuppressed-1");
@@ -264,6 +271,7 @@ namespace MonoTests.System.Threading {
[Test]
[ExpectedException (typeof (InvalidOperationException))]
[Category("MobileNotWorking")]
public void SuppressFlow_Two_Undo ()
{
Assert.IsFalse (ExecutionContext.IsFlowSuppressed (), "IsFlowSuppressed-1");
+12
View File
@@ -925,6 +925,18 @@ System.Runtime.InteropServices.ComTypes/VARDESC.cs
System.Runtime.InteropServices.ComTypes/VARFLAGS.cs
System.Runtime.InteropServices.ComTypes/VARKIND.cs
System.Runtime.InteropServices.Expando/IExpando.cs
System.Runtime.InteropServices.WindowsRuntime/DefaultInterfaceAttribute.cs
System.Runtime.InteropServices.WindowsRuntime/DesignerNamespaceResolveEventArgs.cs
System.Runtime.InteropServices.WindowsRuntime/EventRegistrationToken.cs
System.Runtime.InteropServices.WindowsRuntime/EventRegistrationTokenTable.cs
System.Runtime.InteropServices.WindowsRuntime/IActivationFactory.cs
System.Runtime.InteropServices.WindowsRuntime/InterfaceImplementedInVersionAttribute.cs
System.Runtime.InteropServices.WindowsRuntime/NamespaceResolveEventArgs.cs
System.Runtime.InteropServices.WindowsRuntime/ReadOnlyArrayAttribute.cs
System.Runtime.InteropServices.WindowsRuntime/ReturnValueNameAttribute.cs
System.Runtime.InteropServices.WindowsRuntime/WindowsRuntimeMarshal.cs
System.Runtime.InteropServices.WindowsRuntime/WindowsRuntimeMetadata.cs
System.Runtime.InteropServices.WindowsRuntime/WriteOnlyArrayAttribute.cs
System.Runtime.Remoting/ActivatedClientTypeEntry.cs
System.Runtime.Remoting/ActivatedServiceTypeEntry.cs
System.Runtime.Remoting/CustomErrorsModes.cs
+71
View File
@@ -0,0 +1,71 @@
using System;
using System.Threading;
using System.Threading.Tasks;
class MyContext : SynchronizationContext
{
public override void Post (SendOrPostCallback d, object state)
{
base.Post (d, state);
}
public override void Send (SendOrPostCallback d, object state)
{
base.Send (d, state);
}
}
class X
{
static TaskCompletionSource<bool> tcs;
static ManualResetEvent mre, mre2;
static int main_thread_id;
public static int Main ()
{
main_thread_id = Thread.CurrentThread.ManagedThreadId;
Console.WriteLine ("{0}:Main start", main_thread_id);
mre = new ManualResetEvent (false);
mre2 = new ManualResetEvent (false);
tcs = new TaskCompletionSource<bool> ();
Task.Factory.StartNew (new Func<Task> (ExecuteAsync), new CancellationToken (), TaskCreationOptions.LongRunning, TaskScheduler.Default);
if (!mre.WaitOne (1000))
return 1;
// Have to wait little bit longer for await not to take quick path
Thread.Sleep (10);
Console.WriteLine ("{0}:Main Set Result", Thread.CurrentThread.ManagedThreadId);
SynchronizationContext.SetSynchronizationContext (new MyContext ());
tcs.SetResult (true);
if (!mre2.WaitOne (1000))
return 2;
Console.WriteLine ("ok");
return 0;
}
static async Task ExecuteAsync ()
{
var t = Thread.CurrentThread;
Console.WriteLine ("{0} - started ", t.ManagedThreadId);
mre.Set ();
await tcs.Task;
t = Thread.CurrentThread;
Console.WriteLine ("{0} - resumed ", t.ManagedThreadId);
//
// Continuation cannot resume on main thread because it has synchronization context set
//
if (main_thread_id != Thread.CurrentThread.ManagedThreadId)
mre2.Set ();
}
}
+32
View File
@@ -0,0 +1,32 @@
using System;
using System.Threading;
using System.Threading.Tasks;
class Test
{
public static int Main ()
{
Task<int> t = TestMethod ();
try {
t.Start ();
return 1;
} catch (InvalidOperationException) {
}
try {
t.RunSynchronously ();
return 2;
} catch (InvalidOperationException) {
}
Console.WriteLine ("ok");
return 0;
}
async static Task<int> TestMethod ()
{
await Task.Delay (100000);
return 1;
}
}
+46
View File
@@ -0,0 +1,46 @@
using System;
using System.Threading;
using System.Threading.Tasks;
class X
{
static bool unobserved;
public static int Main ()
{
TaskScheduler.UnobservedTaskException += TaskScheduler_UnobservedTaskException;
try {
Test ().Wait ();
GC.Collect ();
GC.WaitForPendingFinalizers ();
if (unobserved)
return 1;
return 0;
} finally {
TaskScheduler.UnobservedTaskException -= TaskScheduler_UnobservedTaskException;
}
}
static void TaskScheduler_UnobservedTaskException (object sender, UnobservedTaskExceptionEventArgs e)
{
unobserved = true;
Console.WriteLine ("unobserved");
}
static async Task Test ()
{
try {
await ThrowAsync ();
} catch {
}
}
static async Task ThrowAsync()
{
await Task.Delay (5);
throw new Exception ("boom");
}
}
+138
View File
@@ -60604,6 +60604,144 @@
</method>
</type>
</test>
<test name="test-async-55.cs">
<type name="MyContext">
<method name="Void Post(System.Threading.SendOrPostCallback, System.Object)" attrs="198">
<size>10</size>
</method>
<method name="Void Send(System.Threading.SendOrPostCallback, System.Object)" attrs="198">
<size>10</size>
</method>
<method name="Void .ctor()" attrs="6278">
<size>7</size>
</method>
</type>
<type name="X">
<method name="Int32 Main()" attrs="150">
<size>232</size>
</method>
<method name="System.Threading.Tasks.Task ExecuteAsync()" attrs="145">
<size>33</size>
</method>
<method name="Void .ctor()" attrs="6278">
<size>7</size>
</method>
</type>
<type name="X+&lt;ExecuteAsync&gt;c__async0">
<method name="Void MoveNext()" attrs="486">
<size>278</size>
</method>
<method name="Void SetStateMachine(IAsyncStateMachine)" attrs="486">
<size>13</size>
</method>
</type>
</test>
<test name="test-async-56.cs">
<type name="Test">
<method name="Int32 Main()" attrs="150">
<size>70</size>
</method>
<method name="System.Threading.Tasks.Task`1[System.Int32] TestMethod()" attrs="145">
<size>33</size>
</method>
<method name="Void .ctor()" attrs="6278">
<size>7</size>
</method>
</type>
<type name="Test+&lt;TestMethod&gt;c__async0">
<method name="Void MoveNext()" attrs="486">
<size>169</size>
</method>
<method name="Void SetStateMachine(IAsyncStateMachine)" attrs="486">
<size>13</size>
</method>
</type>
</test>
<test name="test-async-57.cs">
<type name="X">
<method name="Void Main()" attrs="150">
<size>2</size>
</method>
<method name="System.Threading.Tasks.Task TestAsync()" attrs="132">
<size>41</size>
</method>
<method name="Void .ctor()" attrs="6278">
<size>14</size>
</method>
</type>
<type name="X+&lt;TestAsync&gt;c__async0">
<method name="Void MoveNext()" attrs="486">
<size>172</size>
</method>
<method name="Void SetStateMachine(IAsyncStateMachine)" attrs="486">
<size>13</size>
</method>
</type>
</test>
<test name="test-async-58.cs">
<type name="A">
<method name="Int32 Get()" attrs="134">
<size>10</size>
</method>
<method name="Void .ctor()" attrs="6278">
<size>7</size>
</method>
</type>
<type name="B">
<method name="System.Threading.Tasks.Task`1[System.Int32] GetAsync()" attrs="134">
<size>41</size>
</method>
<method name="Void Main()" attrs="145">
<size>17</size>
</method>
<method name="Void .ctor()" attrs="6278">
<size>7</size>
</method>
</type>
<type name="B+&lt;GetAsync&gt;c__async0">
<method name="Void MoveNext()" attrs="486">
<size>49</size>
</method>
<method name="Void SetStateMachine(IAsyncStateMachine)" attrs="486">
<size>13</size>
</method>
</type>
</test>
<test name="test-async-59.cs">
<type name="X">
<method name="Int32 Main()" attrs="150">
<size>119</size>
</method>
<method name="Void TaskScheduler_UnobservedTaskException(System.Object, System.Threading.Tasks.UnobservedTaskExceptionEventArgs)" attrs="145">
<size>18</size>
</method>
<method name="System.Threading.Tasks.Task Test()" attrs="145">
<size>33</size>
</method>
<method name="System.Threading.Tasks.Task ThrowAsync()" attrs="145">
<size>33</size>
</method>
<method name="Void .ctor()" attrs="6278">
<size>7</size>
</method>
</type>
<type name="X+&lt;Test&gt;c__async0">
<method name="Void MoveNext()" attrs="486">
<size>190</size>
</method>
<method name="Void SetStateMachine(IAsyncStateMachine)" attrs="486">
<size>13</size>
</method>
</type>
<type name="X+&lt;ThrowAsync&gt;c__async1">
<method name="Void MoveNext()" attrs="486">
<size>163</size>
</method>
<method name="Void SetStateMachine(IAsyncStateMachine)" attrs="486">
<size>13</size>
</method>
</type>
</test>
<test name="test-cls-00.cs">
<type name="CLSCLass_6">
<method name="Void add_Disposed(Delegate)" attrs="2182">
+4 -2
View File
@@ -8870,8 +8870,10 @@ mono_compile_assembly (MonoAssembly *ass, guint32 opts, const char *aot_options)
if (acfg->aot_opts.dwarf_debug && acfg->aot_opts.asm_only && acfg->aot_opts.gnu_asm) {
/*
* CLANG supports GAS .file/.loc directives, so emit line number information this way
* FIXME: CLANG only emits line number info for .loc directives followed by assembly, not
* .byte directives.
*/
acfg->gas_line_numbers = TRUE;
//acfg->gas_line_numbers = TRUE;
}
if (!acfg->aot_opts.nodebug || acfg->aot_opts.dwarf_debug) {
@@ -8885,7 +8887,7 @@ mono_compile_assembly (MonoAssembly *ass, guint32 opts, const char *aot_options)
img_writer_emit_start (acfg->w);
if (acfg->dwarf)
mono_dwarf_writer_emit_base_info (acfg->dwarf, mono_unwind_get_cie_program ());
mono_dwarf_writer_emit_base_info (acfg->dwarf, g_path_get_basename (acfg->image->name), mono_unwind_get_cie_program ());
if (acfg->thumb_mixed) {
char symbol [256];
+7 -4
View File
@@ -916,7 +916,7 @@ emit_debug_info_end (MonoDwarfWriter *w)
}
void
mono_dwarf_writer_emit_base_info (MonoDwarfWriter *w, GSList *base_unwind_program)
mono_dwarf_writer_emit_base_info (MonoDwarfWriter *w, const char *cu_name, GSList *base_unwind_program)
{
char *s, *build_info;
int i;
@@ -985,7 +985,7 @@ mono_dwarf_writer_emit_base_info (MonoDwarfWriter *w, GSList *base_unwind_progra
emit_string (w, s);
g_free (build_info);
g_free (s);
emit_string (w, "JITted code");
emit_string (w, cu_name);
emit_string (w, "");
emit_byte (w, DW_LANG_C);
emit_pointer_value (w, 0);
@@ -1678,6 +1678,7 @@ emit_line_number_info (MonoDwarfWriter *w, MonoMethod *method,
prev_line = 1;
prev_il_offset = -1;
w->cur_file_index = -1;
for (i = 0; i < code_size; ++i) {
int line_diff, addr_diff;
@@ -1731,8 +1732,6 @@ emit_line_number_info (MonoDwarfWriter *w, MonoMethod *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);
prev_line = loc->row;
prev_native_offset = i;
first = FALSE;
}
@@ -1754,6 +1753,9 @@ emit_line_number_info (MonoDwarfWriter *w, MonoMethod *method,
w->cur_file_index = file_index;
}
}
}
if (loc->row != prev_line && !first) {
//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);
@@ -1762,6 +1764,7 @@ emit_line_number_info (MonoDwarfWriter *w, MonoMethod *method,
}
mono_debug_symfile_free_location (loc);
first = FALSE;
}
g_free (native_to_il_offset);
+1 -1
View File
@@ -24,7 +24,7 @@ MonoDwarfWriter* mono_dwarf_writer_create (MonoImageWriter *writer, FILE *il_fil
void mono_dwarf_writer_destroy (MonoDwarfWriter *w) MONO_INTERNAL;
void mono_dwarf_writer_emit_base_info (MonoDwarfWriter *w, GSList *base_unwind_program) MONO_INTERNAL;
void mono_dwarf_writer_emit_base_info (MonoDwarfWriter *w, const char *cu_name, GSList *base_unwind_program) MONO_INTERNAL;
void mono_dwarf_writer_close (MonoDwarfWriter *w) MONO_INTERNAL;
+1 -1
View File
@@ -8152,7 +8152,7 @@ mono_method_to_ir (MonoCompile *cfg, MonoMethod *method, MonoBasicBlock *start_b
/*
* Making generic calls out of gsharedvt methods.
*/
if (cmethod && cfg->gsharedvt && mini_is_gsharedvt_variable_signature (fsig)) {
if (cmethod && cfg->gsharedvt && mini_is_gsharedvt_signature (cfg, fsig)) {
MonoRgctxInfoType info_type;
if (virtual) {
+5
View File
@@ -120,8 +120,13 @@ static gboolean iphone_abi = FALSE;
*/
static MonoArmFPU arm_fpu;
#if defined(ARM_FPU_VFP_HARD)
static int vfp_scratch1 = ARM_VFP_F28;
static int vfp_scratch2 = ARM_VFP_F30;
#else
static int vfp_scratch1 = ARM_VFP_D0;
static int vfp_scratch2 = ARM_VFP_D1;
#endif
static int i8_align;
+7 -4
View File
@@ -52,7 +52,6 @@
#endif
#define MONO_MAX_IREGS 16
#define MONO_MAX_FREGS 32
#define MONO_SAVED_GREGS 10 /* r4-r11, ip, lr */
@@ -77,6 +76,8 @@
#if defined(ARM_FPU_VFP_HARD)
#define MONO_SAVED_FREGS 16
#define MONO_MAX_FREGS 32
/*
* d8-d15 must be preserved across function calls. We use d14-d15 as
* scratch registers in the JIT. The rest have no meaning tied to them.
@@ -84,12 +85,14 @@
#define MONO_ARCH_CALLEE_FREGS 0x00005555
#define MONO_ARCH_CALLEE_SAVED_FREGS 0x55550000
#else
#define MONO_SAVED_FREGS 0
#define MONO_SAVED_FREGS 8
#define MONO_MAX_FREGS 16
/*
* No registers need to be preserved across function calls. We use d14-d15
* No registers need to be preserved across function calls. We use d0-d1
* as scratch registers in the JIT. The rest have no meaning tied to them.
*/
#define MONO_ARCH_CALLEE_FREGS 0x05555555
#define MONO_ARCH_CALLEE_FREGS 0x55555550
#define MONO_ARCH_CALLEE_SAVED_FREGS 0x00000000
#endif
+2 -2
View File
@@ -173,7 +173,7 @@ mono_xdebug_init (const char *options)
img_writer_emit_section_change (w, ".text", 0);
img_writer_emit_string (w, "");
mono_dwarf_writer_emit_base_info (xdebug_writer, mono_unwind_get_cie_program ());
mono_dwarf_writer_emit_base_info (xdebug_writer, "JITted code", mono_unwind_get_cie_program ());
}
static void
@@ -192,7 +192,7 @@ xdebug_begin_emit (MonoImageWriter **out_w, MonoDwarfWriter **out_dw)
dw = mono_dwarf_writer_create (w, il_file, il_file_line_index, FALSE, TRUE);
mono_dwarf_writer_emit_base_info (dw, mono_unwind_get_cie_program ());
mono_dwarf_writer_emit_base_info (dw, "JITted code", mono_unwind_get_cie_program ());
*out_w = w;
*out_dw = dw;