diff options
author | Luqun Lou <luqunl@microsoft.com> | 2017-10-18 01:36:18 +0300 |
---|---|---|
committer | Luqun Lou <luqunl@microsoft.com> | 2017-10-18 01:36:18 +0300 |
commit | b1f2d21fd0cfb9b779ecd715b64d62063f79b0cd (patch) | |
tree | e8f25339b6ea0b5f845136e0c2c90e1ebb18b0fa /src/System.Private.Interop | |
parent | c2ea60d0f17abac47dc207db25cc752fcec12c62 (diff) |
Delegate shouldn't treat as ComClass
From interop point, Delegate isn't ComClass.
In WinRT, we treat delegate as interface instead of Class.
[tfs-changeset: 1678339]
Diffstat (limited to 'src/System.Private.Interop')
-rw-r--r-- | src/System.Private.Interop/src/Shared/McgTypeHelpers.cs | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/System.Private.Interop/src/Shared/McgTypeHelpers.cs b/src/System.Private.Interop/src/Shared/McgTypeHelpers.cs index e965835b0..97c4b72e3 100644 --- a/src/System.Private.Interop/src/Shared/McgTypeHelpers.cs +++ b/src/System.Private.Interop/src/Shared/McgTypeHelpers.cs @@ -836,10 +836,12 @@ namespace System.Runtime.InteropServices internal static bool IsComClass(this RuntimeTypeHandle handle) { + //From Interop point, Delegates aren't treated as Class #if CORECLR - return InteropExtensions.IsClass(handle); + return InteropExtensions.IsClass(handle) && + !InteropExtensions.AreTypesAssignable(handle, typeof(Delegate).TypeHandle); #else - return !InteropExtensions.IsInterface(handle) && + return !InteropExtensions.IsInterface(handle) && !handle.IsValueType() && !InteropExtensions.AreTypesAssignable(handle, typeof(Delegate).TypeHandle); #endif |