diff options
author | Jan Kotas <jkotas@microsoft.com> | 2017-10-03 03:35:30 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-10-03 03:35:30 +0300 |
commit | 0e24120b6ae36d17909370a9c15a53249af7f49c (patch) | |
tree | d7bb9531e6daf10d68aed3877be9d4ee56113621 | |
parent | c34c182ff644cde2295712aefcf76d40fa983e1d (diff) | |
parent | 8ed72529dab3862ff3da37f0b08842fcfb9338a3 (diff) |
Merge pull request #4647 from dotnet-bot/from-tfs
Merge changes from TFS
20 files changed, 1175 insertions, 91 deletions
diff --git a/src/System.Private.Interop/src/InteropExtensions/DependencyReductionConditionallyDependentAttribute.cs b/src/System.Private.Interop/src/InteropExtensions/DependencyReductionConditionallyDependentAttribute.cs new file mode 100644 index 000000000..b75e4a770 --- /dev/null +++ b/src/System.Private.Interop/src/InteropExtensions/DependencyReductionConditionallyDependentAttribute.cs @@ -0,0 +1,16 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace System.Runtime.CompilerServices +{ + // When applied to a type this custom attribute will cause the type to be necessary + // if dependencyType is necessary + [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct, Inherited = false, AllowMultiple = true)] + public class DependencyReductionConditionallyDependentAttribute : Attribute + { + public DependencyReductionConditionallyDependentAttribute(System.Type dependencyType) + { + } + } +} diff --git a/src/System.Private.Interop/src/InteropExtensions/DependencyReductionRootAttribute.cs b/src/System.Private.Interop/src/InteropExtensions/DependencyReductionRootAttribute.cs new file mode 100644 index 000000000..bb697727c --- /dev/null +++ b/src/System.Private.Interop/src/InteropExtensions/DependencyReductionRootAttribute.cs @@ -0,0 +1,13 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace System.Runtime.CompilerServices +{ + // When applied to a type this custom attribute will cause the type to become a new dependency + // reduction root. + [AttributeUsage(AttributeTargets.Class | AttributeTargets.Method | AttributeTargets.Constructor, Inherited = false, AllowMultiple = false)] + public class DependencyReductionRootAttribute : Attribute + { + } +} diff --git a/src/System.Private.Interop/src/InteropExtensions/DependencyReductionTypeRemoved.cs b/src/System.Private.Interop/src/InteropExtensions/DependencyReductionTypeRemoved.cs new file mode 100644 index 000000000..5af94f119 --- /dev/null +++ b/src/System.Private.Interop/src/InteropExtensions/DependencyReductionTypeRemoved.cs @@ -0,0 +1,23 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.Diagnostics; + +namespace System.Runtime.CompilerServices +{ + // This type should never be directly used. Dependency reduction + // can replace TypeHandles that should not be used with the TypeHandle + // for this type. + + // Rooted so we don't replace types with a different missing type + [DependencyReductionRoot] + public class DependencyReductionTypeRemoved + { + public DependencyReductionTypeRemoved() + { + Debug.Assert(false, "A type that was removed by dependency reduction has been instantiated."); + throw new Exception("A type that was removed by dependency reduction has been instantiated."); + } + } +} diff --git a/src/System.Private.Interop/src/InteropExtensions/EagerStaticClassConstructionAttribute.cs b/src/System.Private.Interop/src/InteropExtensions/EagerStaticClassConstructionAttribute.cs new file mode 100644 index 000000000..26e6484ee --- /dev/null +++ b/src/System.Private.Interop/src/InteropExtensions/EagerStaticClassConstructionAttribute.cs @@ -0,0 +1,15 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; +using System.Runtime; +namespace System.Runtime.CompilerServices +{ + // When applied to a type this custom attribute will cause any static class constructor to be run eagerly + // at module load time rather than deferred till just before the class is used. + [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct, Inherited = false, AllowMultiple = false)] + public class EagerStaticClassConstructionAttribute : Attribute + { + } +} diff --git a/src/System.Private.Interop/src/InteropExtensions/ExplicitScopeAttribute.cs b/src/System.Private.Interop/src/InteropExtensions/ExplicitScopeAttribute.cs new file mode 100644 index 000000000..fc309169b --- /dev/null +++ b/src/System.Private.Interop/src/InteropExtensions/ExplicitScopeAttribute.cs @@ -0,0 +1,28 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; + +namespace Internal.Reflection +{ + // + // This attribute is used to affect the generation of Project N metadata. When applied to a class, + // it will cause the metadata generator to emit the type into a user-specified scope (creating it if necessary.) + // + // For Fx, One use of this is to allow us to generate metadata for non-public types for private use by other FX components. + // By throwing it into a private scope that Reflection knows about, we can prevent Reflection's own consumers + // from seeing the internal type. + // For FX, it doesn't use(or reference) this attribute in this contact. Each FX assembly via a transform will inject a definition of this attribute and reference that one + + // For Interop, We use it to pass native winmd winrt type's winmd infomation to CreateMetadata Transform, so it knows where this + // native winmd winrt type originally comes from. + // For Interop, it will use this attribute in this contract during Mcg Transform. + [AttributeUsage(AttributeTargets.Interface | AttributeTargets.Class | AttributeTargets.Enum | AttributeTargets.Struct | AttributeTargets.Delegate, Inherited = false)] + public sealed class ExplicitScopeAttribute : Attribute + { + public ExplicitScopeAttribute(String assemblyIdentity) + { + } + } +} diff --git a/src/System.Private.Interop/src/InteropExtensions/FixupRuntimeTypeHandle.cs b/src/System.Private.Interop/src/InteropExtensions/FixupRuntimeTypeHandle.cs new file mode 100644 index 000000000..9fa6a3361 --- /dev/null +++ b/src/System.Private.Interop/src/InteropExtensions/FixupRuntimeTypeHandle.cs @@ -0,0 +1,30 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; +using System.Runtime.InteropServices; + +namespace Internal.Runtime.CompilerServices +{ + /// <summary> + /// FixupRuntimeTypeHandle is a do nothing class for consistency with ProjectN + /// </summary> + public unsafe struct FixupRuntimeTypeHandle + { + private RuntimeTypeHandle _handle; + + public FixupRuntimeTypeHandle(RuntimeTypeHandle runtimeTypeHandle) + { + this._handle = runtimeTypeHandle; + } + + public RuntimeTypeHandle RuntimeTypeHandle + { + get + { + return _handle; + } + } + } +} diff --git a/src/System.Private.Interop/src/InteropExtensions/IActivationFactory.cs b/src/System.Private.Interop/src/InteropExtensions/IActivationFactory.cs new file mode 100644 index 000000000..955e991ed --- /dev/null +++ b/src/System.Private.Interop/src/InteropExtensions/IActivationFactory.cs @@ -0,0 +1,23 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; +using System.Runtime.InteropServices; + +namespace System.Runtime.InteropServices.WindowsRuntime +{ + + /// <summary> + /// This one is used by MCG as anchor type for the real IActivationFactory interface + /// </summary> + [Guid("00000035-0000-0000-C000-000000000046")] + public interface IActivationFactoryInternal + { + /// <summary> + /// Creates an new instance + /// </summary> + /// <returns>The IInspectable of the created object</returns> + object ActivateInstance(); + } +} diff --git a/src/System.Private.Interop/src/InteropExtensions/InternalExtensions.cs b/src/System.Private.Interop/src/InteropExtensions/InternalExtensions.cs new file mode 100644 index 000000000..d5fe16588 --- /dev/null +++ b/src/System.Private.Interop/src/InteropExtensions/InternalExtensions.cs @@ -0,0 +1,26 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; + +namespace System.Runtime.InteropServices +{ + /// <summary> + /// Internal APIs available on ProjectN but not in ProjectK + /// </summary> + static class InternalExtensions + { + // Converts the DateTime instance into an OLE Automation compatible + // double date. + internal static double ToOADate(this DateTime dateTime) + { + throw new NotSupportedException("ToOADate"); + } + + internal static long DoubleDateToTicks(this double value) + { + throw new NotSupportedException("DoubleDateToTicks"); + } + } +} diff --git a/src/System.Private.Interop/src/InteropExtensions/InteropExtensions.cs b/src/System.Private.Interop/src/InteropExtensions/InteropExtensions.cs new file mode 100644 index 000000000..5341a4554 --- /dev/null +++ b/src/System.Private.Interop/src/InteropExtensions/InteropExtensions.cs @@ -0,0 +1,457 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; +using System.Collections.Generic; +using System.Runtime; +using System.Reflection; + +namespace System.Runtime.InteropServices +{ + /// <summary> + /// Hooks for System.Private.Interop.dll code to access internal functionality in System.Private.CoreLib.dll. + /// Methods added to InteropExtensions should also be added to the System.Private.CoreLib.InteropServices contract + /// in order to be accessible from System.Private.Interop.dll. + /// </summary> + [CLSCompliant(false)] + public static class InteropExtensions + { + // Converts a managed DateTime to native OLE datetime + // Used by MCG marshalling code + public static double ToNativeOleDate(DateTime dateTime) + { + return dateTime.ToOADate(); + } + + // Converts native OLE datetime to managed DateTime + // Used by MCG marshalling code + public static DateTime FromNativeOleDate(double nativeOleDate) + { + return new DateTime(nativeOleDate.DoubleDateToTicks()); + } + + // Used by MCG's SafeHandle marshalling code to initialize a handle + public static void InitializeHandle(SafeHandle safeHandle, IntPtr win32Handle) + { + // We need private reflection here to access the handle field. + FieldInfo fieldInfo = safeHandle.GetType().GetField("handle", BindingFlags.NonPublic | BindingFlags.Instance); + fieldInfo.SetValue(safeHandle, win32Handle); + } + + // Used for methods in System.Private.Interop.dll that need to work from offsets on boxed structs + public unsafe static void PinObjectAndCall(Object obj, Action<IntPtr> del) + { + throw new NotSupportedException("PinObjectAndCall"); + } + + public static void CopyToManaged(IntPtr source, Array destination, int startIndex, int length) + { + throw new NotSupportedException("CopyToManaged"); + } + + public static void CopyToNative(Array array, int startIndex, IntPtr destination, int length) + { + throw new NotSupportedException("CopyToNative"); + } + + public static int GetElementSize(this Array array) + { + throw new NotSupportedException("GetElementSize"); + } + + public static bool IsBlittable(this RuntimeTypeHandle handle) + { + throw new NotSupportedException("IsBlittable"); + } + + public static bool IsElementTypeBlittable(this Array array) + { + throw new NotSupportedException("IsElementTypeBlittable"); + } + + public static bool IsGenericType(this RuntimeTypeHandle handle) + { + throw new NotSupportedException("IsGenericType"); + } + + + public static bool IsClass(RuntimeTypeHandle handle) + { + return Type.GetTypeFromHandle(handle).GetTypeInfo().IsClass; + } + + public static IntPtr GetNativeFunctionPointer(this Delegate del) + { + throw new PlatformNotSupportedException("GetNativeFunctionPointer"); + } + public static IntPtr GetFunctionPointer(this Delegate del, out RuntimeTypeHandle typeOfFirstParameterIfInstanceDelegate) + { + // Note this work only for non-static methods , for static methods + // _methodPtr points to a stub that remove the this pointer and + // _methodPtrAux points actual pointer. + typeOfFirstParameterIfInstanceDelegate = default(RuntimeTypeHandle); + BindingFlags bindFlags = BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static; + FieldInfo field = del.GetType().GetField("_methodPtr", bindFlags); + return (IntPtr)field.GetValue(del); + } + + public static IntPtr GetRawFunctionPointerForOpenStaticDelegate(this Delegate del) + { + throw new NotSupportedException("GetRawFunctionPointerForOpenStaticDelegate"); + } + + public static IntPtr GetRawValue(this RuntimeTypeHandle handle) + { + throw new NotSupportedException("GetRawValue"); + } + + public static bool IsOfType(this Object obj, RuntimeTypeHandle handle) + { + return obj.GetType() == Type.GetTypeFromHandle(handle); + } + + public static bool IsNull(this RuntimeTypeHandle handle) + { + return handle.Equals(default(RuntimeTypeHandle)); + } + + public static Type GetTypeFromHandle(IntPtr typeHandle) + { + throw new NotSupportedException("GetTypeFromHandle(IntPtr)"); + } + + public static Type GetTypeFromHandle(RuntimeTypeHandle typeHandle) + { + return Type.GetTypeFromHandle(typeHandle); + } + + public static int GetValueTypeSize(this RuntimeTypeHandle handle) + { + throw new NotSupportedException("GetValueTypeSize"); + } + + public static bool IsValueType(this RuntimeTypeHandle handle) + { + return Type.GetTypeFromHandle(handle).GetTypeInfo().IsValueType; + } + + public static bool IsEnum(this RuntimeTypeHandle handle) + { + return Type.GetTypeFromHandle(handle).GetTypeInfo().IsEnum; + } + + public static bool AreTypesAssignable(RuntimeTypeHandle sourceHandle, RuntimeTypeHandle targetHandle) + { + Type srcType = Type.GetTypeFromHandle(sourceHandle); + Type targetType = Type.GetTypeFromHandle(targetHandle); + return targetType.IsAssignableFrom(srcType); + } + + public static unsafe void Memcpy(IntPtr destination, IntPtr source, int bytesToCopy) + { + throw new NotSupportedException("Memcpy"); + } + + public static bool RuntimeRegisterGcCalloutForGCStart(IntPtr pCalloutMethod) + { + //Nop + return true; + } + + public static bool RuntimeRegisterGcCalloutForGCEnd(IntPtr pCalloutMethod) + { + //Nop + return true; + } + + public static bool RuntimeRegisterGcCalloutForAfterMarkPhase(IntPtr pCalloutMethod) + { + //Nop + return true; + } + + public static bool RuntimeRegisterRefCountedHandleCallback(IntPtr pCalloutMethod, RuntimeTypeHandle pTypeFilter) + { + // Nop + return true; + } + + public static void RuntimeUnregisterRefCountedHandleCallback(IntPtr pCalloutMethod, RuntimeTypeHandle pTypeFilter) + { + //Nop + } + public static IntPtr RuntimeHandleAllocRefCounted(Object value) + { + return GCHandle.ToIntPtr( GCHandle.Alloc(value, GCHandleType.Normal)); + } + + public static void RuntimeHandleSet(IntPtr handle, Object value) + { + GCHandle gcHandle = GCHandle.FromIntPtr(handle); + gcHandle.Target = value; + } + + public static void RuntimeHandleFree(IntPtr handlePtr) + { + GCHandle handle = GCHandle.FromIntPtr(handlePtr); + handle.Free(); + } + + public static IntPtr RuntimeHandleAllocDependent(object primary, object secondary) + { + throw new NotSupportedException("RuntimeHandleAllocDependent"); + } + + public static bool RuntimeIsPromoted(object obj) + { + throw new NotSupportedException("RuntimeIsPromoted"); + } + + public static void RuntimeHandleSetDependentSecondary(IntPtr handle, Object secondary) + { + throw new NotSupportedException("RuntimeHandleSetDependentSecondary"); + } + + public static T UncheckedCast<T>(object obj) where T : class + { + return obj as T; + } + + public static bool IsArray(RuntimeTypeHandle type) + { + throw new NotSupportedException("IsArray"); + } + + public static RuntimeTypeHandle GetArrayElementType(RuntimeTypeHandle arrayType) + { + throw new NotSupportedException("GetArrayElementType"); + } + + public static RuntimeTypeHandle GetTypeHandle(this object target) + { + Type type = target.GetType(); + return type.TypeHandle; + } + + public static bool IsInstanceOf(object obj, RuntimeTypeHandle typeHandle) + { + Type type = Type.GetTypeFromHandle(typeHandle); + return type.IsInstanceOfType(obj); + } + + public static bool IsInstanceOfClass(object obj, RuntimeTypeHandle classTypeHandle) + { + return obj.GetType() == Type.GetTypeFromHandle(classTypeHandle); + } + + public static bool IsInstanceOfInterface(object obj, RuntimeTypeHandle interfaceTypeHandle) + { + Type interfaceType = Type.GetTypeFromHandle(interfaceTypeHandle); + return TypeExtensions.IsInstanceOfType(interfaceType, obj); + } + + public static bool GuidEquals(ref Guid left, ref Guid right) + { + return left.Equals(right); + } + + public static bool ComparerEquals<T>(T left, T right) + { + throw new NotSupportedException("ComparerEquals"); + } + + public static object RuntimeNewObject(RuntimeTypeHandle typeHnd) + { + Func<Type, object> getUninitializedObjectDelegate = + (Func<Type, object>) + typeof(string) + .GetTypeInfo() + .Assembly + .GetType("System.Runtime.Serialization.FormatterServices") + ?.GetMethod("GetUninitializedObject", BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Static) + ?.CreateDelegate(typeof(Func<Type, object>)); + + return getUninitializedObjectDelegate.Invoke(Type.GetTypeFromHandle(typeHnd)); + } + + internal static unsafe int wcslen(char* ptr) + { + char* end = ptr; + + // The following code is (somewhat surprisingly!) significantly faster than a naive loop, + // at least on x86 and the current jit. + + // First make sure our pointer is aligned on a dword boundary + while (((uint)end & 3) != 0 && *end != 0) + end++; + if (*end != 0) + { + // The loop condition below works because if "end[0] & end[1]" is non-zero, that means + // neither operand can have been zero. If is zero, we have to look at the operands individually, + // but we hope this going to fairly rare. + + // In general, it would be incorrect to access end[1] if we haven't made sure + // end[0] is non-zero. However, we know the ptr has been aligned by the loop above + // so end[0] and end[1] must be in the same page, so they're either both accessible, or both not. + + while ((end[0] & end[1]) != 0 || (end[0] != 0 && end[1] != 0)) + { + end += 2; + } + } + // finish up with the naive loop + for (; *end != 0; end++) + ; + + int count = (int)(end - ptr); + + return count; + } + + /// <summary> + /// Copy StringBuilder's contents to the char*, and appending a '\0' + /// The destination buffer must be big enough, and include space for '\0' + /// NOTE: There is no guarantee the destination pointer has enough size, but we have no choice + /// because the pointer might come from native code. + /// </summary> + /// <param name="stringBuilder"></param> + /// <param name="destination"></param> + public static unsafe void UnsafeCopyTo(this System.Text.StringBuilder stringBuilder, char* destination) + { + for (int i = 0; i < stringBuilder.Length; i++) + { + destination[i] = stringBuilder[i]; + } + destination[stringBuilder.Length] = '\0'; + } + + public static unsafe void ReplaceBuffer(this System.Text.StringBuilder stringBuilder, char* newBuffer) + { + // Mimic N stringbuilder replacebuffer behaviour.wcslen assume newBuffer to be '\0' terminated. + int len = wcslen(newBuffer); + stringBuilder.Clear(); + // the '+1' is for back-compat with desktop CLR in terms of length calculation because desktop + // CLR had '\0' + stringBuilder.EnsureCapacity(len + 1); + stringBuilder.Append(newBuffer, len); + } + + public static void ReplaceBuffer(this System.Text.StringBuilder stringBuilder, char[] newBuffer) + { + // mimic N stringbuilder replacebuffer behaviour. this's safe to do since we know the + // length of newBuffer. + stringBuilder.Clear(); + // the '+1' is for back-compat with desktop CLR in terms of length calculation because desktop + // CLR had '\0' + stringBuilder.EnsureCapacity(newBuffer.Length + 1); + stringBuilder.Append(newBuffer); + } + + public static char[] GetBuffer(this System.Text.StringBuilder stringBuilder, out int len) + { + return stringBuilder.GetBuffer(out len); + } + + public static IntPtr RuntimeHandleAllocVariable(Object value, uint type) + { + throw new NotSupportedException("RuntimeHandleAllocVariable"); + } + + public static uint RuntimeHandleGetVariableType(IntPtr handle) + { + throw new NotSupportedException("RuntimeHandleGetVariableType"); + } + + public static void RuntimeHandleSetVariableType(IntPtr handle, uint type) + { + throw new NotSupportedException("RuntimeHandleSetVariableType"); + } + + public static uint RuntimeHandleCompareExchangeVariableType(IntPtr handle, uint oldType, uint newType) + { + throw new NotSupportedException("RuntimeHandleCompareExchangeVariableType"); + } + + public static void SetExceptionErrorCode(Exception exception, int hr) + { + throw new NotSupportedException("SetExceptionErrorCode"); + } + + public static Exception CreateDataMisalignedException(string message) + { + return new DataMisalignedException(message); + } + + public static Delegate CreateDelegate(RuntimeTypeHandle typeHandleForDelegate, IntPtr ldftnResult, Object thisObject, bool isStatic, bool isVirtual, bool isOpen) + { + throw new NotSupportedException("CreateDelegate"); + } + + public enum VariableHandleType + { + WeakShort = 0x00000100, + WeakLong = 0x00000200, + Strong = 0x00000400, + Pinned = 0x00000800, + } + + public static void AddExceptionDataForRestrictedErrorInfo(Exception ex, string restrictedError, string restrictedErrorReference, string restrictedCapabilitySid, object restrictedErrorObject) + { + throw new NotSupportedException("AddExceptionDataForRestrictedErrorInfo"); + } + + public static bool TryGetRestrictedErrorObject(Exception ex, out object restrictedErrorObject) + { + throw new NotSupportedException("TryGetRestrictedErrorObject"); + } + + public static bool TryGetRestrictedErrorDetails(Exception ex, out string restrictedError, out string restrictedErrorReference, out string restrictedCapabilitySid) + { + throw new NotSupportedException("TryGetRestrictedErrorDetails"); + } + + public static TypeInitializationException CreateTypeInitializationException(string message) + { + return new TypeInitializationException(message,null); + } + + public unsafe static IntPtr GetObjectID(object obj) + { + throw new NotSupportedException("GetObjectID"); + } + + public static bool RhpETWShouldWalkCom() + { + throw new NotSupportedException("RhpETWShouldWalkCom"); + } + + public static void RhpETWLogLiveCom(int eventType, IntPtr CCWHandle, IntPtr objectID, IntPtr typeRawValue, IntPtr IUnknown, IntPtr VTable, Int32 comRefCount, Int32 jupiterRefCount, Int32 flags) + { + throw new NotSupportedException("RhpETWLogLiveCom"); + } + + public static bool SupportsReflection(this Type type) + { + return true; + } + + public static void SuppressReentrantWaits() + { + // Nop + } + + public static void RestoreReentrantWaits() + { + //Nop + } + } + + public class GCHelpers + { + public static void RhpSetThreadDoNotTriggerGC() { } + public static void RhpClearThreadDoNotTriggerGC() { } + } +} diff --git a/src/System.Private.Interop/src/InteropExtensions/Lock.cs b/src/System.Private.Interop/src/InteropExtensions/Lock.cs new file mode 100644 index 000000000..d86c28f12 --- /dev/null +++ b/src/System.Private.Interop/src/InteropExtensions/Lock.cs @@ -0,0 +1,25 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; + +namespace System.Threading +{ + /// <summary> + /// Simple wrapper around Monitor.Enter and Exit exposing interface as expected by + /// System.Private.InteropServices.__ComObject + /// </summary> + public class Lock + { + private object _lock = new object(); + public void Acquire() + { + Monitor.Enter(_lock); + } + public void Release() + { + Monitor.Exit(_lock); + } + } +} diff --git a/src/System.Private.Interop/src/InteropExtensions/MetadataTransformedAttribute.cs b/src/System.Private.Interop/src/InteropExtensions/MetadataTransformedAttribute.cs new file mode 100644 index 000000000..b2e49840d --- /dev/null +++ b/src/System.Private.Interop/src/InteropExtensions/MetadataTransformedAttribute.cs @@ -0,0 +1,43 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; + +namespace Internal.Reflection +{ + // This enumeration is a contract with Dependency Reducer ReducerEngine.cs, MdTransform\Metadata.cs, and MCG + [Flags] + public enum MetadataTransformation + { + None = 0x0, + OriginallyNotSealed = 0x1, // A method was originally unsealed, but a transform sealed it + OriginallyVirtual = 0x2, // A method was originally virtual, but a transform devirtualized it + OriginallySealed = 0x4, // A method was originally sealed, but a transform unsealed it + OriginallyNewSlot = 0x8, // A method was originally NewSlot + OriginallyAccessCheckedOnOverride = 0x10, // A method was originally AccessCheckedOnOverride (strict) + + OriginallyForeignObject = 0x20, // A class was originally marked as WindowsRuntime + OriginallyComObject = 0x40 + } + + /// <summary> + /// Indicates that a transform has changed metadata and has a flag for the state + /// reflection should show + /// </summary> + [System.Runtime.CompilerServices.DependencyReductionRoot] + [AttributeUsage( + AttributeTargets.Method | + AttributeTargets.Class | + AttributeTargets.Enum | + AttributeTargets.Interface | + AttributeTargets.Struct | + AttributeTargets.Delegate, + Inherited = false)] + public sealed class MetadataTransformedAttribute : Attribute + { + public MetadataTransformedAttribute(MetadataTransformation transformation) + { + } + } +} diff --git a/src/System.Private.Interop/src/InteropExtensions/MissingInteropDataException.cs b/src/System.Private.Interop/src/InteropExtensions/MissingInteropDataException.cs new file mode 100644 index 000000000..fea2591a8 --- /dev/null +++ b/src/System.Private.Interop/src/InteropExtensions/MissingInteropDataException.cs @@ -0,0 +1,23 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.Reflection; + +namespace System.Runtime.CompilerServices +{ + /// <summary> + /// Thrown when a manual marshalling method is called, but the type was not found + /// by static analysis or in the rd.xml file. + /// </summary> + public class MissingInteropDataException : Exception + { + public Type MissingType { get; private set; } + + public MissingInteropDataException(string resourceFormat, Type pertainantType) + : base() + { + MissingType = pertainantType; + } + } +} diff --git a/src/System.Private.Interop/src/InteropExtensions/MissingMetadataException.cs b/src/System.Private.Interop/src/InteropExtensions/MissingMetadataException.cs new file mode 100644 index 000000000..8d7d8cfe9 --- /dev/null +++ b/src/System.Private.Interop/src/InteropExtensions/MissingMetadataException.cs @@ -0,0 +1,27 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + + +/*============================================================ +** + Type: MissingMetadataException +** +==============================================================*/ + +using global::System; + +namespace System.Reflection +{ + public sealed class MissingMetadataException : TypeAccessException + { + public MissingMetadataException() + { + } + + public MissingMetadataException(String message) + : base(message) + { + } + } +} diff --git a/src/System.Private.Interop/src/InteropExtensions/NativeCallableAttribute.cs b/src/System.Private.Interop/src/InteropExtensions/NativeCallableAttribute.cs new file mode 100644 index 000000000..54b0c4f8d --- /dev/null +++ b/src/System.Private.Interop/src/InteropExtensions/NativeCallableAttribute.cs @@ -0,0 +1,20 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; +namespace System.Runtime.InteropServices +{ + //BARTOK expects + [AttributeUsage(AttributeTargets.Method)] + public sealed class NativeCallableAttribute : Attribute + { + // Optional. If omitted, then the method is native callable, but no EAT is emitted. + public string EntryPoint; + // Optional. If omitted a default will be chosen by the compiler. + public CallingConvention CallingConvention; + public NativeCallableAttribute() + { + } + } +} diff --git a/src/System.Private.Interop/src/InteropExtensions/PInvokeMarshal.cs b/src/System.Private.Interop/src/InteropExtensions/PInvokeMarshal.cs new file mode 100644 index 000000000..0a88205f3 --- /dev/null +++ b/src/System.Private.Interop/src/InteropExtensions/PInvokeMarshal.cs @@ -0,0 +1,203 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.Runtime.CompilerServices; + +namespace System.Runtime.InteropServices +{ + /// <summary> + /// This PInvokeMarshal class should provide full public Marshal + /// implementation for all things related to P/Invoke marshalling + /// </summary> + [CLSCompliant(false)] + public sealed class PInvokeMarshal + { + public static void SaveLastWin32Error() + { + // nop + } + + public static void ClearLastWin32Error() + { + // nop + } + + public static int GetLastWin32Error() + { + return 0; + } + + public static void SetLastWin32Error(int errorCode) + { + // nop + } + + public static IntPtr GetStubForPInvokeDelegate(Delegate del) + { + return IntPtr.Zero; + } + + public static Delegate GetPInvokeDelegateForStub(IntPtr pStub, RuntimeTypeHandle delegateType) + { + return default(Delegate); + } + + public static IntPtr GetCurrentCalleeOpenStaticDelegateFunctionPointer() + { + return IntPtr.Zero; + } + + public static unsafe IntPtr MemAlloc(IntPtr cb) + { + return Marshal.AllocHGlobal(cb); + } + + public static void MemFree(IntPtr hglobal) + { + Marshal.FreeHGlobal(hglobal); + } + + public static unsafe IntPtr MemReAlloc(IntPtr pv, IntPtr cb) + { + return Marshal.ReAllocHGlobal(pv, cb); + } + + public static IntPtr CoTaskMemAlloc(UIntPtr bytes) + { + return Marshal.AllocCoTaskMem((int)bytes); + } + + public static void CoTaskMemFree(IntPtr allocatedMemory) + { + Marshal.FreeCoTaskMem(allocatedMemory); + } + + public static IntPtr CoTaskMemReAlloc(IntPtr pv, IntPtr cb) + { + return Marshal.ReAllocCoTaskMem(pv, (int)cb); + } + + public static T GetCurrentCalleeDelegate<T>() where T : class // constraint can't be System.Delegate + { + return default(T); + } + + public static unsafe void StringBuilderToUnicodeString(System.Text.StringBuilder stringBuilder, ushort* destination) + { + // nop + } + + public static unsafe void UnicodeStringToStringBuilder(ushort* newBuffer, System.Text.StringBuilder stringBuilder) + { + // nop + } + + public static unsafe void StringBuilderToAnsiString(System.Text.StringBuilder stringBuilder, byte* pNative, + bool bestFit, bool throwOnUnmappableChar) + { + // nop + } + + public static unsafe void AnsiStringToStringBuilder(byte* newBuffer, System.Text.StringBuilder stringBuilder) + { + // nop + } + + public static unsafe string AnsiStringToString(byte* pchBuffer) + { + return default(string); + } + + public static unsafe byte* StringToAnsiString(string str, bool bestFit, bool throwOnUnmappableChar) + { + return default(byte*); + } + + public static unsafe void ByValWideCharArrayToAnsiCharArray(char[] managedArray, byte* pNative, int expectedCharCount, + bool bestFit, bool throwOnUnmappableChar) + { + // nop + } + + public static unsafe void ByValAnsiCharArrayToWideCharArray(byte* pNative, char[] managedArray) + { + // nop + } + + public static unsafe void WideCharArrayToAnsiCharArray(char[] managedArray, byte* pNative, bool bestFit, bool throwOnUnmappableChar) + { + // nop + } + + public static unsafe void AnsiCharArrayToWideCharArray(byte* pNative, char[] managedArray) + { + // nop + } + + public static unsafe byte WideCharToAnsiChar(char managedValue, bool bestFit, bool throwOnUnmappableChar) + { + return default(byte); + } + + public static unsafe char AnsiCharToWideChar(byte nativeValue) + { + return default(char); + } + + public static unsafe void StringToByValAnsiString(string str, byte* pNative, int charCount, bool bestFit, bool throwOnUnmappableChar, bool truncate = true) + { + // nop + } + + public static unsafe string ByValAnsiStringToString(byte* pchBuffer, int charCount) + { + return default(string); + } + + public static unsafe int ConvertMultiByteToWideChar(byte* buffer, int ansiLength, char* pWChar, int uniLength) + { + return default(int); + } + + public static unsafe int ConvertWideCharToMultiByte(char* wideCharStr, int wideCharLen, byte* multiByteStr, int multiByteLen) + { + return default(int); + } + + public static unsafe int ConvertWideCharToMultiByte(char* wideCharStr, + int wideCharLen, + byte* multiByteStr, + int multiByteLen, + uint flags, + IntPtr usedDefaultChar) + { + return default(int); + } + + public static unsafe int GetByteCount(char* wStr, int wideStrLen) + { + return default(int); + } + + unsafe public static int GetCharCount(byte* multiByteStr, int multiByteLen) + { + return default(int); + } + + public static unsafe int GetSystemMaxDBCSCharSize() + { + return default(int); + } + + public static unsafe String PtrToStringUni(IntPtr ptr, int len) + { + return default(String); + } + + public static unsafe String PtrToStringUni(IntPtr ptr) + { + return default(String); + } + } +} diff --git a/src/System.Private.Interop/src/InteropExtensions/PreInitializedAttribute.cs b/src/System.Private.Interop/src/InteropExtensions/PreInitializedAttribute.cs new file mode 100644 index 000000000..96c83a0e8 --- /dev/null +++ b/src/System.Private.Interop/src/InteropExtensions/PreInitializedAttribute.cs @@ -0,0 +1,17 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; +using System.Threading; + +namespace System.Runtime.CompilerServices +{ + // This attribute should be placed on a static field by the code author to indicate that it is expected to + // be completely pre-initialized by the tool chain. The tool chain will produce an error if the field + // cannot be completely pre-initialized. + [AttributeUsage(AttributeTargets.Field)] + public sealed class PreInitializedAttribute : Attribute + { + } +} diff --git a/src/System.Private.Interop/src/Readme.md b/src/System.Private.Interop/src/Readme.md new file mode 100644 index 000000000..62c2c0145 --- /dev/null +++ b/src/System.Private.Interop/src/Readme.md @@ -0,0 +1,8 @@ +# System.Private.Interop.CoreCLR.csproj + +Builds the CoreCLR specific version of System.Private.Interop which along with MCG for CoreCLR provide WinRT marshalling support for CoreCLR/Mono. + + +# System.Private.Interop.Shared.projitems + +This includes all the compilation units required for building System.Private.Interop for .NET Native, CoreCLR, and CoreRT runtimes. diff --git a/src/System.Private.Interop/src/System.Private.Interop.CoreCLR.csproj b/src/System.Private.Interop/src/System.Private.Interop.CoreCLR.csproj new file mode 100644 index 000000000..00dd7abc5 --- /dev/null +++ b/src/System.Private.Interop/src/System.Private.Interop.CoreCLR.csproj @@ -0,0 +1,72 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" DefaultTargets="Build"> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" /> + <PropertyGroup> + <AssemblyName>System.Private.Interop</AssemblyName> + <TargetName>$(AssemblyName)</TargetName> + <OutputType>Library</OutputType> + <ProjectGuid>{A85709C9-22D5-4704-8B7A-73751BB4386A}</ProjectGuid> + <AllowUnsafeBlocks>true</AllowUnsafeBlocks> + <DefineConstants>TARGET_CORE_API_SET;CORECLR</DefineConstants> + <!-- Disable warning about CLSCompliant attributes on members not being needed. --> + <NoWarn>$(NoWarn);3021</NoWarn> + <!-- Use MSFT assembly key for compatibility with uapaot targeting pack --> + <AssemblyKey>MSFT</AssemblyKey> + <OnlyBuildProjectNLibraries>false</OnlyBuildProjectNLibraries> + <TargetsWindows Condition="$(TargetsWindows) ==''">true</TargetsWindows> + <TargetNetCoreForCoreCLRFramework>true</TargetNetCoreForCoreCLRFramework> + <OutputPath>$(OutputPath)\coreclr</OutputPath> + <TargetFramework>netstandard1.3</TargetFramework> + </PropertyGroup> + + <ItemGroup> + <PackageReference Include="System.Diagnostics.Contracts"> + <Version>4.3.0</Version> + </PackageReference> + <PackageReference Include="System.Reflection.TypeExtensions"> + <Version>4.3.0</Version> + </PackageReference> + <PackageReference Include="System.Private.CompilerServices.ICastable"> + <Version>1.0.0</Version> + </PackageReference> + </ItemGroup> + + <ItemGroup> + <Compile Include="InteropExtensions\DependencyReductionConditionallyDependentAttribute.cs" /> + <Compile Include="InteropExtensions\DependencyReductionRootAttribute.cs" /> + <Compile Include="InteropExtensions\DependencyReductionTypeRemoved.cs" /> + <Compile Include="InteropExtensions\EagerStaticClassConstructionAttribute.cs" /> + <Compile Include="InteropExtensions\ExplicitScopeAttribute.cs" /> + <Compile Include="InteropExtensions\FixupRuntimeTypeHandle.cs" /> + <Compile Include="InteropExtensions\IActivationFactory.cs" /> + <Compile Include="InteropExtensions\InternalExtensions.cs" /> + <Compile Include="InteropExtensions\InteropExtensions.cs" /> + <Compile Include="InteropExtensions\Lock.cs" /> + <Compile Include="InteropExtensions\MetadataTransformedAttribute.cs" /> + <Compile Include="InteropExtensions\MissingInteropDataException.cs" /> + <Compile Include="InteropExtensions\MissingMetadataException.cs" /> + <Compile Include="InteropExtensions\NativeCallableAttribute.cs" /> + <Compile Include="InteropExtensions\PreInitializedAttribute.cs" /> + <Compile Include="InteropExtensions\PInvokeMarshal.cs" /> + <Compile Include="Interop\Interop.PlatformNotSupported.cs" /> + <Compile Include="Interop\Interop.WinRT.cs" /> + <Compile Include="Interop\Interop.WinRT.Basic.cs" /> + <Compile Condition="'$(TargetsWindows)' == 'true'" Include="System\Runtime\InteropServices\Variant.cs" /> + <Compile Include="..\..\Common\src\System\Runtime\InteropServices\McgPInvokeData.cs"> + <Link>System\Runtime\InteropServices\McgPInvokeData.cs</Link> + </Compile> + <Compile Include="..\..\Common\src\System\Runtime\InteropServices\McgGeneratedNativeCallCodeAttribute.cs"> + <Link>System\Runtime\InteropServices\McgGeneratedNativeCallCodeAttribute.cs</Link> + </Compile> + </ItemGroup> + + <ItemGroup> + <Compile Include="System\Reflection\DispatchProxy.cs" /> + <Compile Include="System\Reflection\DispatchProxyEntry.cs" /> + <Compile Include="System\Reflection\DispatchProxyHelpers.cs" /> + <Compile Include="System\Reflection\DispatchProxyInstanceNotFoundException.cs" /> + </ItemGroup> + + <Import Project="System.Private.Interop.shared.projitems" /> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" /> +</Project> diff --git a/src/System.Private.Interop/src/System.Private.Interop.Shared.projitems b/src/System.Private.Interop/src/System.Private.Interop.Shared.projitems new file mode 100644 index 000000000..041fbc43f --- /dev/null +++ b/src/System.Private.Interop/src/System.Private.Interop.Shared.projitems @@ -0,0 +1,75 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup> + <Compile Include="System\__HResults.cs" /> + + <!-- TODO We should not include anything from CompilerServices directly --> + <Compile Include="System\Runtime\CompilerServices\McgResource.cs" /> + <Compile Include="System\Runtime\CompilerServices\ModuleConstructorAttribute.cs" /> + <Compile Include="System\Runtime\CompilerServices\IgnoresAccessChecksToAttribute.cs" /> + <Compile Include="System\Runtime\CompilerServices\UnmanagedValueTypeConstraintAttribute.cs" /> + + <Compile Include="System\Runtime\InteropServices\ComWeakReferenceHelpers.cs" /> + <Compile Include="System\Runtime\InteropServices\InteropEventProvider.cs" /> + <Compile Include="System\Runtime\InteropServices\MarshalAdapter.cs" /> + <Compile Include="System\Runtime\InteropServices\MarshalImpl.cs" /> + + <Compile Include="Shared\ComCallableObject.cs" /> + <Compile Include="Shared\ComInterop.cs" /> + <Compile Include="Shared\Dictionary.cs" /> + <Compile Include="Shared\DictionaryBase.cs" /> + <Compile Include="Shared\FixedHashTable.cs" /> + <Compile Include="Shared\GCEventProvider.cs" /> + <Compile Include="Shared\HashSet.cs" /> + <Compile Include="Shared\InternalModule.cs" /> + <Compile Include="Shared\Interop.Manual.cs" /> + <Compile Include="Shared\List.cs" /> + <Compile Include="Shared\McgAccessorAttribute.cs" /> + <Compile Include="Shared\McgComCallableAttribute.cs" /> + <Compile Include="Shared\McgComHelpers.cs" /> + <Compile Include="Shared\McgData.cs" /> + <Compile Include="Shared\McgGeneratedAssemblyAttribute.cs" /> + <Compile Include="Shared\McgGeneratedMarshallingCodeAttribute.cs" /> + <Compile Include="Shared\McgHelpers.cs" /> + <Compile Include="Shared\McgIntrinsics.cs" /> + <Compile Include="Shared\McgMarshal.cs" /> + <Compile Include="Shared\McgMethodNameAttribute.cs" /> + <Compile Include="Shared\McgModule.cs" /> + <Compile Include="Shared\McgModuleManager.cs" /> + <Compile Include="Shared\McgPInvokeMarshalStubAttribute.cs" /> + <Compile Include="Shared\McgredirectedMethodAttribute.cs" /> + <Compile Include="Shared\McgRedirectedTypeAttribute.cs" /> + <Compile Include="Shared\McgRemovedType.cs" /> + <Compile Include="Shared\McgRootsTypeAttribute.cs" /> + <Compile Include="Shared\McgTypeHelpers.cs" /> + <Compile Include="Shared\McgWindowsRuntimeVersionAttribute.cs" /> + <Compile Include="Shared\RCWWalker.cs" /> + <Compile Include="Shared\StandardInterfaces.cs" /> + <Compile Include="Shared\StringPool.cs" /> + <Compile Include="Shared\__ComObject.cs" /> + + <Compile Include="..\..\Common\src\Internal\NativeFormat\NativeFormatReader.cs"> + <Link>Internal\NativeFormat\NativeFormatReader.cs</Link> + </Compile> + <Compile Include="..\..\Common\src\Internal\NativeFormat\NativeFormatReader.Primitives.cs"> + <Link>Internal\NativeFormat\NativeFormatReader.Primitives.cs</Link> + </Compile> + <Compile Include="..\..\Common\src\Internal\NativeFormat\NativeFormatReader.String.cs"> + <Link>Internal\NativeFormat\NativeFormatReader.String.cs</Link> + </Compile> + <Compile Include="Interop\Interop.Memory.cs" /> + + </ItemGroup> + + <ItemGroup Condition="'$(TargetsWindows)' == 'true'"> + <Compile Include="Interop\Interop.COM.Windows.cs" /> + <Compile Include="Interop\Interop.Common.Windows.cs" /> + <Compile Include="Interop\Interop.Localization.Windows.cs" /> + <Compile Include="Interop\Interop.String.Windows.cs" /> + </ItemGroup> + + <ItemGroup Condition="'$(TargetsWindows)' != 'true'"> + <Compile Include="Interop\Interop.Common.Unix.cs" /> + <Compile Include="Interop\Interop.String.Unix.cs" /> + </ItemGroup> +</Project>
\ No newline at end of file diff --git a/src/System.Private.Interop/src/System.Private.Interop.csproj b/src/System.Private.Interop/src/System.Private.Interop.csproj index 69e64aac3..ce0931c6b 100644 --- a/src/System.Private.Interop/src/System.Private.Interop.csproj +++ b/src/System.Private.Interop/src/System.Private.Interop.csproj @@ -21,67 +21,27 @@ <ProjectReference Include="..\..\System.Private.CoreLib\src\System.Private.CoreLib.csproj" /> <ProjectReference Include="..\..\System.Private.TypeLoader\src\System.Private.TypeLoader.csproj" /> </ItemGroup> - <!-- TODO We should not include anything from CompilerServices directly --> + + <Import Project="System.Private.Interop.shared.projitems" /> + + <ItemGroup Condition="'$(IsProjectNLibrary)' == 'true'"> + <Compile Include="System\Reflection\DispatchProxy.cs" /> + <Compile Include="System\Reflection\DispatchProxyEntry.cs" /> + <Compile Include="System\Reflection\DispatchProxyHelpers.cs" /> + <Compile Include="System\Reflection\DispatchProxyInstanceNotFoundException.cs" /> + </ItemGroup> + <ItemGroup> <Compile Include="TypeForwarders.cs" /> - <Compile Include="System\Runtime\CompilerServices\UnmanagedValueTypeConstraintAttribute.cs" /> - <Compile Include="System\Runtime\CompilerServices\McgResource.cs" /> - <Compile Include="System\Runtime\CompilerServices\ModuleConstructorAttribute.cs" /> - <Compile Include="System\Runtime\CompilerServices\IgnoresAccessChecksToAttribute.cs" /> + <!-- TODO We should not include anything from CompilerServices directly --> <Compile Include="System\Runtime\CompilerServices\FunctionPointerHelpers.cs" /> - </ItemGroup> - <ItemGroup> - <Compile Include="..\..\Common\src\Internal\NativeFormat\NativeFormatReader.cs"> - <Link>Internal\NativeFormat\NativeFormatReader.cs</Link> - </Compile> - <Compile Include="..\..\Common\src\Internal\NativeFormat\NativeFormatReader.Primitives.cs"> - <Link>Internal\NativeFormat\NativeFormatReader.Primitives.cs</Link> - </Compile> - <Compile Include="..\..\Common\src\Internal\NativeFormat\NativeFormatReader.String.cs"> - <Link>Internal\NativeFormat\NativeFormatReader.String.cs</Link> - </Compile> <Compile Include="..\..\Common\src\Internal\Runtime\LowLevelStringConverter.cs"> <Link>Internal\Runtime\LowLevelStringConverter.cs</Link> </Compile> - <Compile Include="Shared\__ComObject.cs" /> - <Compile Include="Shared\ComCallableObject.cs" /> <Compile Include="Shared\ComException.cs" /> - <Compile Include="Shared\ComInterop.cs" /> - <Compile Include="Shared\Dictionary.cs" /> - <Compile Include="Shared\DictionaryBase.cs" /> - <Compile Include="Shared\FixedHashTable.cs" /> - <Compile Include="Shared\GCEventProvider.cs" /> - <Compile Include="Shared\HashSet.cs" /> - <Compile Include="Shared\InternalModule.cs" /> - <Compile Include="Shared\Interop.Manual.cs" /> - <Compile Include="Shared\List.cs" /> <Compile Include="Shared\Marshal.cs" /> - <Compile Include="Shared\McgAccessorAttribute.cs" /> - <Compile Include="Shared\McgComCallableAttribute.cs" /> - <Compile Include="Shared\McgComHelpers.cs" /> - <Compile Include="Shared\McgData.cs" /> - <Compile Include="Shared\McgGeneratedAssemblyAttribute.cs" /> - <Compile Include="Shared\McgGeneratedMarshallingCodeAttribute.cs" /> - <Compile Include="Shared\McgHelpers.cs" /> <Compile Include="Shared\McgInternalTypeAttribute.cs" /> - <Compile Include="Shared\McgIntrinsics.cs" /> - <Compile Include="Shared\McgMarshal.cs" /> - <Compile Include="Shared\McgMethodNameAttribute.cs" /> - <Compile Include="Shared\McgModule.cs" /> - <Compile Include="Shared\McgModuleManager.cs" /> - <Compile Include="Shared\McgPInvokeMarshalStubAttribute.cs" /> - <Compile Include="Shared\McgredirectedMethodAttribute.cs" /> - <Compile Include="Shared\McgRedirectedTypeAttribute.cs" /> - <Compile Include="Shared\McgRemovedType.cs" /> - <Compile Include="Shared\McgRootsTypeAttribute.cs" /> - <Compile Include="Shared\McgTypeHelpers.cs" /> - <Compile Include="Shared\RCWWalker.cs" /> - <Compile Include="Shared\StandardInterfaces.cs" /> - <Compile Include="Shared\StringPool.cs" /> - <Compile Include="Shared\McgWindowsRuntimeVersionAttribute.cs" /> <Compile Condition="'$(EnableWinRT)'=='true'" Include="Shared\WindowsRuntimeMarshal.cs" /> - </ItemGroup> - <ItemGroup> <Compile Include="System\Runtime\InteropServices\AllowReversePInvokeCallsAttribute.cs" /> <Compile Include="System\Runtime\InteropServices\ArrayWithOffset.cs" /> <Compile Include="System\Runtime\InteropServices\BStrWrapper.cs" /> @@ -102,7 +62,6 @@ <Compile Include="System\Runtime\InteropServices\DispIdAttribute.cs" /> <Compile Include="System\Runtime\InteropServices\ErrorWrapper.cs" /> <Compile Include="System\Runtime\InteropServices\HandleRef.cs" /> - <Compile Include="System\Runtime\InteropServices\InteropEventProvider.cs" /> <Compile Include="System\Runtime\InteropServices\GuidAttribute.cs" /> <Compile Include="System\Runtime\InteropServices\ICustomAdapter.cs" /> <Compile Include="System\Runtime\InteropServices\ICustomFactory.cs" /> @@ -113,8 +72,6 @@ <Compile Include="System\Runtime\InteropServices\InvalidOleVariantTypeException.cs" /> <Compile Include="System\Runtime\InteropServices\LCIDConversionAttribute.cs" /> <Compile Include="System\Runtime\InteropServices\Marshal.cs" /> - <Compile Include="System\Runtime\InteropServices\MarshalAdapter.cs" /> - <Compile Include="System\Runtime\InteropServices\MarshalImpl.cs" /> <Compile Include="System\Runtime\InteropServices\MissingInteropDataException.cs" /> <Compile Include="System\Runtime\InteropServices\ProgIdAttribute.cs" /> <Compile Include="System\Runtime\InteropServices\SafeArrayRankMismatchException.cs" /> @@ -124,26 +81,11 @@ <Compile Include="System\Runtime\InteropServices\UnknownWrapper.cs" /> <Compile Include="System\Runtime\InteropServices\Variant.cs" /> <Compile Include="System\Runtime\InteropServices\VariantWrapper.cs" /> - <Compile Include="System\Runtime\InteropServices\ComWeakReferenceHelpers.cs" /> <Compile Include="System\Runtime\InteropServices\HandleCollector.cs" /> <Compile Include="System\Runtime\InteropServices\DefaultParameterValueAttribute.cs" /> <Compile Include="System\Runtime\InteropServices\ComAwareEventInfo.cs" /> <Compile Include="System\Runtime\InteropServices\WindowsRuntime\EventRegistrationToken.cs" /> - <Compile Include="Internal\Runtime\CompilerHelpers\LibraryInitializer.cs" /> - <Compile Include="Interop\Interop.Memory.cs" /> - <Compile Include="Internal\Runtime\CompilerHelpers\RuntimeInteropData.cs"/> - <Compile Condition="'$(IsProjectNLibrary)' == 'true'" Include="Internal\Runtime\CompilerHelpers\RuntimeInteropData.ProjectN.cs"/> - <Compile Condition="'$(IsProjectNLibrary)' != 'true'" Include="Internal\Runtime\CompilerHelpers\RuntimeInteropData.CoreRT.cs"/> - </ItemGroup> - <ItemGroup Condition="'$(IsProjectNLibrary)' != 'true'"> - <Compile Include="..\..\Common\src\Internal\Runtime\MetadataBlob.cs"> - <Link>MetadataBlob.cs</Link> - </Compile> - <Compile Include="..\..\Common\src\System\Runtime\CompilerServices\__BlockReflectionAttribute.cs"> - <Link>System\Runtime\CompilerServices\__BlockReflectionAttribute.cs</Link> - </Compile> - </ItemGroup> - <ItemGroup> + <Compile Include="System\Runtime\InteropServices\ComTypes\advf.cs" /> <Compile Include="System\Runtime\InteropServices\ComTypes\bindopts.cs" /> <Compile Include="System\Runtime\InteropServices\ComTypes\bindptr.cs" /> @@ -199,23 +141,21 @@ <Compile Include="System\Runtime\InteropServices\ComTypes\vardesc.cs" /> <Compile Include="System\Runtime\InteropServices\ComTypes\varflags.cs" /> <Compile Include="System\Runtime\InteropServices\ComTypes\varkind.cs" /> - <Compile Include="System\__HResults.cs" /> - </ItemGroup> - <ItemGroup Condition=" '$(TargetsWindows)' == 'true' "> - <Compile Include="Interop\Interop.String.Windows.cs" /> - <Compile Include="Interop\Interop.WinRT.cs" /> - <Compile Include="Interop\Interop.WinRT.Basic.cs" /> - <Compile Include="Interop\Interop.Localization.Windows.cs" /> - <Compile Include="Interop\Interop.Sync.Windows.cs" /> - <Compile Include="Interop\Interop.COM.Windows.cs" /> - <Compile Include="Interop\Interop.Common.Windows.cs" /> + <Compile Include="Internal\Runtime\CompilerHelpers\RuntimeInteropData.cs"/> + <Compile Include="Internal\Runtime\CompilerHelpers\LibraryInitializer.cs" /> + <Compile Condition="'$(IsProjectNLibrary)' == 'true'" Include="Internal\Runtime\CompilerHelpers\RuntimeInteropData.ProjectN.cs"/> + <Compile Condition="'$(IsProjectNLibrary)' != 'true'" Include="Internal\Runtime\CompilerHelpers\RuntimeInteropData.CoreRT.cs"/> </ItemGroup> - <ItemGroup Condition="'$(IsProjectNLibrary)' == 'true'"> - <Compile Include="System\Reflection\DispatchProxy.cs" /> - <Compile Include="System\Reflection\DispatchProxyEntry.cs" /> - <Compile Include="System\Reflection\DispatchProxyHelpers.cs" /> - <Compile Include="System\Reflection\DispatchProxyInstanceNotFoundException.cs" /> + + <ItemGroup Condition="'$(IsProjectNLibrary)' != 'true'"> + <Compile Include="..\..\Common\src\Internal\Runtime\MetadataBlob.cs"> + <Link>MetadataBlob.cs</Link> + </Compile> + <Compile Include="..\..\Common\src\System\Runtime\CompilerServices\__BlockReflectionAttribute.cs"> + <Link>System\Runtime\CompilerServices\__BlockReflectionAttribute.cs</Link> + </Compile> </ItemGroup> + <ItemGroup Condition="'$(EnableWinRT)'=='true'"> <Compile Include="InteropCallbacks.cs" /> <Compile Include="..\..\Common\src\System\NotImplemented.cs"> @@ -232,7 +172,11 @@ <Compile Include="System\Runtime\InteropServices\WindowsRuntime\WindowsRuntimeImportAttribute.cs" /> <Compile Include="System\Runtime\InteropServices\WindowsRuntime\WriteOnlyArrayAttribute.cs" /> </ItemGroup> - <ItemGroup Condition="'$(TargetsWindows)' == 'true' and '$(IsProjectKLibrary)' != 'true'"> + <ItemGroup Condition="'$(TargetsWindows)' == 'true'"> + <Compile Include="Interop\Interop.Sync.Windows.cs" /> + <Compile Include="Interop\Interop.WinRT.cs" /> + <Compile Include="Interop\Interop.WinRT.Basic.cs" /> + <Compile Include="..\..\Common\src\Interop\Windows\mincore\Interop.MemAllocFree.cs"> <Link>Interop\Windows\mincore\Interop.MemAllocFree.cs</Link> </Compile> @@ -243,11 +187,7 @@ <Link>Interop\Windows\mincore\Interop.MemAllocWithZeroInitializeNoThrow.cs</Link> </Compile> </ItemGroup> - <ItemGroup Condition=" '$(TargetsWindows)' != 'true' "> - <Compile Include="Interop\Interop.String.Unix.cs" /> - <Compile Include="Interop\Interop.Common.Unix.cs" /> - </ItemGroup> - <ItemGroup Condition="'$(TargetsUnix)'=='true' and '$(IsProjectKLibrary)' != 'true'"> + <ItemGroup Condition="'$(TargetsUnix)'=='true'"> <Compile Include="..\..\Common\src\Interop\Unix\Interop.Libraries.cs"> <Link>Interop\Unix\Interop.Libraries.cs</Link> </Compile> |