Add ComVisible(true) back to several special types (dotnet/coreclr#9403)
authorJan Kotas <jkotas@microsoft.com>
Wed, 8 Feb 2017 03:30:40 +0000 (19:30 -0800)
committerGitHub <noreply@github.com>
Wed, 8 Feb 2017 03:30:40 +0000 (19:30 -0800)
It is required by WinRT/COM interop. Fixes dotnet/coreclr#9401.

Commit migrated from https://github.com/dotnet/coreclr/commit/272cc4e755e6ef4570d70b815a03c15c7a9ccc1b

src/coreclr/src/mscorlib/src/System/Delegate.cs
src/coreclr/src/mscorlib/src/System/MulticastDelegate.cs
src/coreclr/src/mscorlib/src/System/Object.cs
src/coreclr/src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/ManagedActivationFactory.cs
src/coreclr/src/mscorlib/src/System/Threading/Tasks/IAsyncCausalityTracerStatics.cs

index 8cb8d11..fb9dc4b 100644 (file)
@@ -16,6 +16,8 @@ namespace System {
     using System.Diagnostics.Contracts;
 
     [Serializable]
+    [ClassInterface(ClassInterfaceType.AutoDual)]
+    [System.Runtime.InteropServices.ComVisible(true)]
     public abstract class Delegate : ICloneable, ISerializable 
     {
         // _target is the object we will invoke on
index eb4d08b..aa3271c 100644 (file)
@@ -14,6 +14,7 @@ namespace System
     using System.Reflection.Emit;
 
     [Serializable]
+    [System.Runtime.InteropServices.ComVisible(true)]
     public abstract class MulticastDelegate : Delegate
     {
         // This is set under 3 circumstances
index 421ef14..d8d9a0e 100644 (file)
@@ -33,6 +33,7 @@ namespace System
  //This class contains no data and does not need to be serializable 
 [Serializable]
 [ClassInterface(ClassInterfaceType.AutoDual)]
+[System.Runtime.InteropServices.ComVisible(true)]
 public class Object
 {
     // Creates a new instance of an Object.
@@ -202,6 +203,7 @@ public class Object
 
 [Serializable]
 [ClassInterface(ClassInterfaceType.AutoDual)]
+[System.Runtime.InteropServices.ComVisible(true)]
 internal class __Canon
 {
 }
index 2fefa3f..2d08cab 100644 (file)
@@ -27,6 +27,7 @@ namespace System.Runtime.InteropServices.WindowsRuntime
     //
     // In order to be activatable via the ManagedActivationFactory type, the type must be decorated with either
     // ActivatableAttribute, or StaticAttribute.
+    [ComVisible(true)]
     [ClassInterface(ClassInterfaceType.None)]
     internal sealed class ManagedActivationFactory : IActivationFactory, IManagedActivationFactory
     {
index ef699ce..32efd77 100644 (file)
@@ -19,15 +19,16 @@ namespace Windows.Foundation.Diagnostics
     [Guid("50850B26-267E-451B-A890-AB6A370245EE")]
     [WindowsRuntimeImport]
     internal interface IAsyncCausalityTracerStatics
-       {
-               void TraceOperationCreation(CausalityTraceLevel traceLevel, CausalitySource source, Guid platformId, ulong operationId, string operationName, ulong relatedContext);
-               void TraceOperationCompletion(CausalityTraceLevel traceLevel, CausalitySource source, Guid platformId, ulong operationId, AsyncCausalityStatus status);
-               void TraceOperationRelation(CausalityTraceLevel traceLevel, CausalitySource source, Guid platformId, ulong operationId, CausalityRelation relation);
-               void TraceSynchronousWorkStart(CausalityTraceLevel traceLevel, CausalitySource source, Guid platformId, ulong operationId, CausalitySynchronousWork work);
-               void TraceSynchronousWorkCompletion(CausalityTraceLevel traceLevel, CausalitySource source, CausalitySynchronousWork work);
+    {
+        void TraceOperationCreation(CausalityTraceLevel traceLevel, CausalitySource source, Guid platformId, ulong operationId, string operationName, ulong relatedContext);
+        void TraceOperationCompletion(CausalityTraceLevel traceLevel, CausalitySource source, Guid platformId, ulong operationId, AsyncCausalityStatus status);
+        void TraceOperationRelation(CausalityTraceLevel traceLevel, CausalitySource source, Guid platformId, ulong operationId, CausalityRelation relation);
+        void TraceSynchronousWorkStart(CausalityTraceLevel traceLevel, CausalitySource source, Guid platformId, ulong operationId, CausalitySynchronousWork work);
+        void TraceSynchronousWorkCompletion(CausalityTraceLevel traceLevel, CausalitySource source, CausalitySynchronousWork work);
         //These next 2 functions could've been represented as an event except that the EventRegistrationToken wasn't being propagated to WinRT
         EventRegistrationToken add_TracingStatusChanged(System.EventHandler<TracingStatusChangedEventArgs> eventHandler);
-       }
+        void remove_TracingStatusChanged(EventRegistrationToken token);
+    }
 
     [ComImport]
     [Guid("410B7711-FF3B-477F-9C9A-D2EFDA302DC3")]