diff options
author | Luqun Lou <luqunl@microsoft.com> | 2017-08-15 23:09:36 +0300 |
---|---|---|
committer | Luqun Lou <luqunl@microsoft.com> | 2017-08-15 23:09:36 +0300 |
commit | 256dfb1c896848ac0209f1836ec831577b7bf831 (patch) | |
tree | 433526e8eb040a76cd7530a6ba3b16f38f244cba /src/System.Private.Interop | |
parent | d477247f499160c94f6ab1b97079255dacc508da (diff) |
Remove Unnecessary Debug Assert in ObjectToComInterface
The Debug.Assert(obj == null || obj is __ComObject) is Unnecessary and incorrect:
Unnecessary: There is another Debug.Assert(!typeHnd.IsNull()) later, which will do similar(or better) check. since Debug.Assert(!typeHnd.IsNull()) also handle managed winmdobject case.
Incorrect: it miss a case such as obj itself is a managed winmd object case.
so it should be Debug.Assert(obj == null || obj is __ComObject || obj is managed winmd object);
[tfs-changeset: 1670398]
Diffstat (limited to 'src/System.Private.Interop')
-rw-r--r-- | src/System.Private.Interop/src/Shared/McgMarshal.cs | 5 |
1 files changed, 1 insertions, 4 deletions
diff --git a/src/System.Private.Interop/src/Shared/McgMarshal.cs b/src/System.Private.Interop/src/Shared/McgMarshal.cs index 7cb17ca0d..2c3b9e5a4 100644 --- a/src/System.Private.Interop/src/Shared/McgMarshal.cs +++ b/src/System.Private.Interop/src/Shared/McgMarshal.cs @@ -692,10 +692,7 @@ namespace System.Runtime.InteropServices if (typeHnd.IsComClass()) { - Debug.Assert(obj == null || obj is __ComObject); - /// - /// This code path should be executed only for WinRT classes - /// + // This code path should be executed only for WinRT classes typeHnd = typeHnd.GetDefaultInterface(); Debug.Assert(!typeHnd.IsNull()); } |