Imported Upstream version 4.2.0.179

Former-commit-id: 4610231f55806d2a05ed69e5ff3faa7336cc1479
This commit is contained in:
Xamarin Public Jenkins
2015-08-26 07:17:56 -04:00
committed by Jo Shields
parent aa7da660d6
commit c042cd0c52
7507 changed files with 90259 additions and 657307 deletions

View File

@@ -825,28 +825,16 @@ namespace System.Runtime.CompilerServices
// so that they won't "leak" out of the first await.
Thread currentThread = Thread.CurrentThread;
#if MONO
ExecutionContext.Switcher ecs = default (ExecutionContext.Switcher);
#else
ExecutionContextSwitcher ecs = default(ExecutionContextSwitcher);
#endif
RuntimeHelpers.PrepareConstrainedRegions();
try
{
#if MONO
currentThread.BranchExecutionContext (out ecs);
#else
ExecutionContext.EstablishCopyOnWriteScope(currentThread, false, ref ecs);
#endif
stateMachine.MoveNext();
}
finally
{
#if MONO
currentThread.RestoreExecutionContext (ref ecs);
#else
ecs.Undo(currentThread);
#endif
}
}

View File

@@ -42,6 +42,15 @@ namespace System.Runtime.ExceptionServices {
{
// Copy over the details we need to save.
m_Exception = exception;
#if MONO
var count = exception.captured_traces == null ? 0 : exception.captured_traces.Length;
var stack_traces = new System.Diagnostics.StackTrace [count + 1];
if (count != 0)
Array.Copy (exception.captured_traces, 0, stack_traces, 0, count);
stack_traces [count] = new System.Diagnostics.StackTrace (exception, 0, true, true);
m_stackTrace = stack_traces;
#else
m_remoteStackTrace = exception.RemoteStackTrace;
// NOTE: don't be tempted to pass the fields for the out params; the containing object
@@ -54,6 +63,7 @@ namespace System.Runtime.ExceptionServices {
m_IPForWatsonBuckets = exception.IPForWatsonBuckets;
m_WatsonBuckets = exception.WatsonBuckets;
#endif
}
internal UIntPtr IPForWatsonBuckets

View File

@@ -16,6 +16,7 @@
**
**
==========================================================================*/
#if !MOBILE
namespace System.Runtime.InteropServices.ComTypes
{
using System;
@@ -27,3 +28,4 @@ namespace System.Runtime.InteropServices.ComTypes
System.Collections.IEnumerator GetEnumerator();
}
}
#endif

View File

@@ -16,6 +16,7 @@
**
**
==========================================================================*/
#if !MOBILE
namespace System.Runtime.InteropServices.ComTypes
{
using System;
@@ -33,3 +34,4 @@ namespace System.Runtime.InteropServices.ComTypes
void Reset();
}
}
#endif

View File

@@ -16,6 +16,8 @@
**
**
==========================================================================*/
#if !MOBILE
namespace System.Runtime.InteropServices.ComTypes
{
using System;
@@ -30,3 +32,4 @@ namespace System.Runtime.InteropServices.ComTypes
void RemoveMember(MemberInfo m);
}
}
#endif

View File

@@ -16,6 +16,7 @@
**
**
==========================================================================*/
#if !MOBILE
namespace System.Runtime.InteropServices.ComTypes
{
using System;
@@ -78,3 +79,4 @@ namespace System.Runtime.InteropServices.ComTypes
}
}
}
#endif

View File

@@ -1,3 +1,6 @@
#if MONO_COM
#define FEATURE_COMINTEROP
#endif
// ==++==
//
// Copyright (c) Microsoft Corporation. All rights reserved.
@@ -162,7 +165,7 @@ namespace System.Runtime.InteropServices{
public String Value { get { return _importClassName; } }
}
#if FEATURE_COMINTEROP
#if FEATURE_COMINTEROP || MOBILE_LEGACY
[AttributeUsage(AttributeTargets.Method, Inherited = false)]
[System.Runtime.InteropServices.ComVisible(true)]
public sealed class LCIDConversionAttribute : Attribute
@@ -243,6 +246,7 @@ namespace System.Runtime.InteropServices{
}
public IDispatchImplType Value { get {return _val;} }
}
#endif
[AttributeUsage(AttributeTargets.Class, Inherited = true)]
[System.Runtime.InteropServices.ComVisible(true)]
@@ -272,6 +276,7 @@ namespace System.Runtime.InteropServices{
public String Value { get {return _val;} }
}
#if FEATURE_COMINTEROP || MOBILE_LEGACY
[AttributeUsage(AttributeTargets.All, Inherited = false)]
[System.Runtime.InteropServices.ComVisible(true)]
public sealed class ComConversionLossAttribute : Attribute
@@ -280,7 +285,8 @@ namespace System.Runtime.InteropServices{
{
}
}
#endif
#if FEATURE_COMINTEROP
[Serializable]
[Flags()]
[System.Runtime.InteropServices.ComVisible(true)]
@@ -472,7 +478,7 @@ namespace System.Runtime.InteropServices{
Currency = 0xf, // A currency
#if FEATURE_COMINTEROP || FEATURE_LEGACYNETCF
#if FEATURE_COMINTEROP || FEATURE_LEGACYNETCF || MONO
BStr = 0x13, // OLE Unicode BSTR
#endif //FEATURE_COMINTEROP || FEATURE_LEGACYNETCF
@@ -486,13 +492,13 @@ namespace System.Runtime.InteropServices{
IUnknown = 0x19, // COM IUnknown pointer.
#if FEATURE_COMINTEROP || FEATURE_LEGACYNETCF
#if FEATURE_COMINTEROP || FEATURE_LEGACYNETCF || MONO
IDispatch = 0x1a, // COM IDispatch pointer
#endif //FEATURE_COMINTEROP || FEATURE_LEGACYNETCF
Struct = 0x1b, // Structure
#if FEATURE_COMINTEROP || FEATURE_LEGACYNETCF
#if FEATURE_COMINTEROP || FEATURE_LEGACYNETCF || MONO
Interface = 0x1c, // COM interface
SafeArray = 0x1d, // OLE SafeArray
@@ -504,7 +510,7 @@ namespace System.Runtime.InteropServices{
SysUInt = 0x20,
#if FEATURE_COMINTEROP || FEATURE_LEGACYNETCF
#if FEATURE_COMINTEROP || FEATURE_LEGACYNETCF || MONO
VBByRefStr = 0x22,
AnsiBStr = 0x23, // OLE BSTR containing SBCS characters
@@ -522,7 +528,7 @@ namespace System.Runtime.InteropServices{
LPStruct = 0x2b, // Pointer to a structure
#if FEATURE_COMINTEROP || FEATURE_LEGACYNETCF
#if FEATURE_COMINTEROP || FEATURE_LEGACYNETCF || MONO
CustomMarshaler = 0x2c,
#endif //FEATURE_COMINTEROP || FEATURE_LEGACYNETCF
@@ -538,10 +544,17 @@ namespace System.Runtime.InteropServices{
#endif //FEATURE_COMINTEROP
}
#if !MONO
[AttributeUsage(AttributeTargets.Parameter | AttributeTargets.Field | AttributeTargets.ReturnValue, Inherited = false)]
[System.Runtime.InteropServices.ComVisible(true)]
public unsafe sealed class MarshalAsAttribute : Attribute
{
#if MONO
internal MarshalAsAttribute Copy ()
{
return (MarshalAsAttribute)this.MemberwiseClone ();
}
#else
[System.Security.SecurityCritical] // auto-generated
internal static Attribute GetCustomAttribute(RuntimeParameterInfo parameter)
{
@@ -619,7 +632,7 @@ namespace System.Runtime.InteropServices{
MarshalTypeRef = marshalTypeRef;
MarshalCookie = marshalCookie;
}
#endif
internal UnmanagedType _val;
public MarshalAsAttribute(UnmanagedType unmanagedType)
{
@@ -653,10 +666,13 @@ namespace System.Runtime.InteropServices{
public Type MarshalTypeRef; // Type of marshaler class
public String MarshalCookie; // cookie to pass to marshaler
}
#endif
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Interface, Inherited = false)]
[System.Runtime.InteropServices.ComVisible(true)]
public sealed class ComImportAttribute : Attribute
#if !MONOTOUCH
public
#endif
sealed class ComImportAttribute : Attribute
{
internal static Attribute GetCustomAttribute(RuntimeType type)
{
@@ -799,12 +815,18 @@ namespace System.Runtime.InteropServices{
if ((method.Attributes & MethodAttributes.PinvokeImpl) == 0)
return null;
#if !MONO
MetadataImport scope = ModuleHandle.GetMetadataImport(method.Module.ModuleHandle.GetRuntimeModule());
#endif
string entryPoint, dllName = null;
int token = method.MetadataToken;
PInvokeAttributes flags = 0;
#if MONO
((MonoMethod)method).GetPInvoke(out flags, out entryPoint, out dllName);
#else
scope.GetPInvokeMap(token, out flags, out entryPoint, out dllName);
#endif
CharSet charSet = CharSet.None;
@@ -891,7 +913,7 @@ namespace System.Runtime.InteropServices{
private const int DEFAULT_PACKING_SIZE = 8;
[System.Security.SecurityCritical] // auto-generated
internal static Attribute GetCustomAttribute(RuntimeType type)
internal static StructLayoutAttribute GetCustomAttribute(RuntimeType type)
{
if (!IsDefined(type))
return null;
@@ -914,7 +936,12 @@ namespace System.Runtime.InteropServices{
case TypeAttributes.UnicodeClass: charSet = CharSet.Unicode; break;
default: Contract.Assume(false); break;
}
#if MONO
type.GetPacking (out pack, out size);
#else
type.GetRuntimeModule().MetadataImport.GetClassLayout(type.MetadataToken, out pack, out size);
#endif
// Metadata parameter checking should not have allowed 0 for packing size.
// The runtime later converts a packing size of 0 to 8 so do the same here
@@ -967,7 +994,11 @@ namespace System.Runtime.InteropServices{
int fieldOffset;
if (field.DeclaringType != null &&
#if MONO
(fieldOffset = field.GetFieldOffset ()) >= 0)
#else
field.GetRuntimeModule().MetadataImport.GetFieldOffset(field.DeclaringType.MetadataToken, field.MetadataToken, out fieldOffset))
#endif
return new FieldOffsetAttribute(fieldOffset);
return null;
@@ -987,7 +1018,7 @@ namespace System.Runtime.InteropServices{
public int Value { get { return _val; } }
}
#if FEATURE_COMINTEROP
#if FEATURE_COMINTEROP || MOBILE_LEGACY
[AttributeUsage(AttributeTargets.Parameter | AttributeTargets.Field | AttributeTargets.Property | AttributeTargets.ReturnValue, Inherited = false)]
[System.Runtime.InteropServices.ComVisible(true)]
public sealed class ComAliasNameAttribute : Attribute
@@ -1044,7 +1075,7 @@ namespace System.Runtime.InteropServices{
public Type CoClass { get { return _CoClass; } }
}
#if FEATURE_COMINTEROP
#if FEATURE_COMINTEROP || MONO
[AttributeUsage(AttributeTargets.Interface, Inherited = false)]
[System.Runtime.InteropServices.ComVisible(true)]
@@ -1062,7 +1093,8 @@ namespace System.Runtime.InteropServices{
public Type SourceInterface { get {return _SourceInterface;} }
public Type EventProvider { get {return _EventProvider;} }
}
#endif
#if FEATURE_COMINTEROP || MOBILE_LEGACY
[AttributeUsage(AttributeTargets.Assembly, Inherited = false)]
[System.Runtime.InteropServices.ComVisible(true)]
public sealed class TypeLibVersionAttribute : Attribute

View File

@@ -140,7 +140,7 @@ using System.Runtime.Versioning;
#if !FEATURE_CORECLR
[SecurityPermission(SecurityAction.InheritanceDemand, UnmanagedCode=true)]
#endif
public abstract class SafeHandle : CriticalFinalizerObject, IDisposable
public abstract partial class SafeHandle : CriticalFinalizerObject, IDisposable
{
// ! Do not add or rearrange fields as the EE depends on this layout.
//------------------------------------------------------------------
@@ -173,7 +173,7 @@ public abstract class SafeHandle : CriticalFinalizerObject, IDisposable
if (!ownsHandle)
GC.SuppressFinalize(this);
#if DEBUG
#if !MONO && DEBUG
if (BCLDebug.SafeHandleStackTracesEnabled)
_stackTrace = Environment.GetStackTrace(null, false);
else
@@ -187,7 +187,7 @@ public abstract class SafeHandle : CriticalFinalizerObject, IDisposable
_fullyInitialized = true;
}
#if FEATURE_CORECLR
#if FEATURE_CORECLR || MOBILE
// Migrating InheritanceDemands requires this default ctor, so we can mark it critical
protected SafeHandle()
{
@@ -201,12 +201,12 @@ public abstract class SafeHandle : CriticalFinalizerObject, IDisposable
{
Dispose(false);
}
#if !MONO
[ResourceExposure(ResourceScope.None)]
[ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
[MethodImplAttribute(MethodImplOptions.InternalCall)]
extern void InternalFinalize();
#endif
[ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
#if !FEATURE_CORECLR
[TargetedPatchingOptOut("Performance critical to inline across NGen image boundaries")]
@@ -273,7 +273,7 @@ public abstract class SafeHandle : CriticalFinalizerObject, IDisposable
else
InternalFinalize();
}
#if !MONO
[ResourceExposure(ResourceScope.None)]
[ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
[MethodImplAttribute(MethodImplOptions.InternalCall)]
@@ -333,5 +333,6 @@ public abstract class SafeHandle : CriticalFinalizerObject, IDisposable
[ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
[MethodImplAttribute(MethodImplOptions.InternalCall)]
public extern void DangerousRelease();
#endif
}
}

View File

@@ -26,7 +26,7 @@ namespace System.Runtime.InteropServices
public Object pUnk;
public int dwCookie;
}
#if !FULL_AOT_RUNTIME
[Obsolete("Use System.Runtime.InteropServices.ComTypes.IEnumConnections instead. http://go.microsoft.com/fwlink/?linkid=14202", false)]
[Guid("B196B287-BAB4-101A-B69C-00AA00341D07")]
[InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIUnknown)]
@@ -41,4 +41,5 @@ namespace System.Runtime.InteropServices
void Reset();
void Clone(out UCOMIEnumConnections ppenum);
}
#endif
}

View File

@@ -36,6 +36,13 @@ namespace System.Runtime.Remoting.Messaging{
{
}
#if MONO
internal static object SetCurrentCallContext (LogicalCallContext ctx)
{
return null;
}
#endif
// Sets the given logical call context object on the thread.
// Returns the previous one.
internal static LogicalCallContext SetLogicalCallContext(

View File

@@ -149,7 +149,7 @@ namespace System.Runtime.Serialization.Formatters.Binary {
return Deserialize(serializationStream, handler, true);
}
#if FEATURE_REMOTING
#if FEATURE_REMOTING || MOBILE_LEGACY
[System.Security.SecuritySafeCritical] // auto-generated
public Object DeserializeMethodResponse(Stream serializationStream, HeaderHandler handler, IMethodCallMessage methodCallMessage) {
return Deserialize(serializationStream, handler, true, methodCallMessage);
@@ -161,7 +161,7 @@ namespace System.Runtime.Serialization.Formatters.Binary {
return Deserialize(serializationStream, handler, false);
}
#if FEATURE_REMOTING
#if FEATURE_REMOTING || MOBILE_LEGACY
[System.Security.SecurityCritical] // auto-generated_required
[System.Runtime.InteropServices.ComVisible(false)]
public Object UnsafeDeserializeMethodResponse(Stream serializationStream, HeaderHandler handler, IMethodCallMessage methodCallMessage) {

View File

@@ -71,9 +71,9 @@ namespace System.Runtime.Serialization.Formatters.Binary {
private BinaryMethodReturn binaryMethodReturn;
private bool bIsCrossAppDomain;
#endif
#if !DISABLE_CAS_USE
private static FileIOPermission sfileIOPermission = new FileIOPermission(PermissionState.Unrestricted);
#endif
private SerStack ValueFixupStack
{
get {
@@ -139,7 +139,7 @@ namespace System.Runtime.Serialization.Formatters.Binary {
}
#if FEATURE_REMOTING
#if FEATURE_REMOTING || MOBILE_LEGACY
[System.Security.SecurityCritical] // auto-generated
internal Object Deserialize(HeaderHandler handler, __BinaryParser serParser, bool fCheck, bool isCrossAppDomain, IMethodCallMessage methodCallMessage) {
if (serParser == null)
@@ -1362,7 +1362,9 @@ namespace System.Runtime.Serialization.Formatters.Binary {
if (bSimpleAssembly)
{
try {
#if !DISABLE_CAS_USE
sfileIOPermission.Assert();
#endif
try {
#if FEATURE_FUSION
assm = ObjectReader.ResolveSimpleAssemblyName(new AssemblyName(assemblyName));
@@ -1371,7 +1373,9 @@ namespace System.Runtime.Serialization.Formatters.Binary {
#endif // FEATURE_FUSION
}
finally {
#if !DISABLE_CAS_USE
CodeAccessPermission.RevertAssert();
#endif
}
}
catch(Exception e){
@@ -1386,12 +1390,16 @@ namespace System.Runtime.Serialization.Formatters.Binary {
else {
try
{
#if !DISABLE_CAS_USE
sfileIOPermission.Assert();
#endif
try {
assm = Assembly.Load(assemblyName);
}
finally {
#if !DISABLE_CAS_USE
CodeAccessPermission.RevertAssert();
#endif
}
}
catch (Exception e)

View File

@@ -12,7 +12,7 @@
**
**
===========================================================*/
#if FEATURE_REMOTING
#if FEATURE_REMOTING || MOBILE_LEGACY
namespace System.Runtime.Serialization.Formatters {
using System.Runtime.Remoting;

View File

@@ -14,7 +14,7 @@
** Date: June 27, 2000
**
===========================================================*/
#if FEATURE_REMOTING
#if FEATURE_REMOTING || MOBILE_LEGACY
namespace System.Runtime.Serialization.Formatters
{
using System;

View File

@@ -12,7 +12,7 @@
**
**
===========================================================*/
#if FEATURE_REMOTING
#if FEATURE_REMOTING || MOBILE_LEGACY
namespace System.Runtime.Serialization.Formatters {
using System.Runtime.Remoting;
using System.Runtime.Remoting.Messaging;

View File

@@ -108,6 +108,11 @@ namespace System.Runtime.Versioning
return MakeVersionSafeName(name, from, to, null);
}
#if MONO
[MethodImplAttribute(MethodImplOptions.InternalCall)]
extern static uint GetCurrentProcessId ();
#endif
[System.Security.SecuritySafeCritical] // auto-generated
[ResourceExposure(ResourceScope.None)]
[ResourceConsumption(ResourceScope.Process, ResourceScope.Process)]
@@ -131,7 +136,11 @@ namespace System.Runtime.Versioning
if ((requires & SxSRequirements.ProcessID) != 0) {
safeName.Append(separator);
safeName.Append('p');
#if MONO
safeName.Append (GetCurrentProcessId ());
#else
safeName.Append(Win32Native.GetCurrentProcessId());
#endif
}
if ((requires & SxSRequirements.CLRInstanceID) != 0) {
String clrID = GetCLRInstanceString();