1
1
using System ;
2
2
using System . Diagnostics ;
3
3
using System . Linq ;
4
- using System . Reflection ;
5
4
using System . Runtime . CompilerServices ;
6
5
using System . Runtime . InteropServices ;
7
6
using System . Runtime . InteropServices . ComTypes ;
@@ -256,7 +255,6 @@ internal static int QueryInterface(IntPtr pUnk, ref Guid iid, out IntPtr ppv)
256
255
Debug . Assert ( iid_local != Guid . Empty , "Empty IID passed in" ) ;
257
256
} ) ;
258
257
259
- Debug . Print ( $ "Entering { nameof ( QueryInterface ) } ; { nameof ( pUnk ) } : { FormatPtr ( pUnk ) } , { nameof ( iid ) } : { iid . ToString ( ) } ") ;
260
258
Trace ( TraceAction . Entering , pUnk , args : ( nameof ( iid ) , iid . ToString ( ) ) ) ;
261
259
var result = Marshal . QueryInterface ( pUnk , ref iid , out ppv ) ;
262
260
Trace ( TraceAction . Leaving , pUnk , args : new ( string Name , object Value ) [ ]
@@ -312,7 +310,6 @@ internal static int ReleaseComObject(object o)
312
310
Assert ( ( ) =>
313
311
{
314
312
var ptr = Marshal . GetIUnknownForObject ( o ) ;
315
- Debug . Print ( $ "Entering { nameof ( ReleaseComObject ) } ; { nameof ( o ) } : { FormatPtr ( ptr ) } , { o . GetType ( ) . Name } ") ;
316
313
var debugResult = Marshal . Release ( ptr ) ;
317
314
Debug . Assert ( debugResult > 0 ,
318
315
$ "The ref count is at zero or is invalid before calling the { nameof ( Marshal . ReleaseComObject ) } .") ;
@@ -403,8 +400,6 @@ private enum TraceAction
403
400
Executing
404
401
}
405
402
406
-
407
- [ Conditional ( "DEBUG" ) ]
408
403
[ Conditional ( "TRACE_MARSHAL" ) ]
409
404
private static void Trace ( TraceAction action , IntPtr pUnk , [ CallerMemberName ] string MethodName = null , params ( string Name , object Value ) [ ] args )
410
405
{
@@ -418,7 +413,6 @@ private static void Trace(TraceAction action, IntPtr pUnk, [CallerMemberName]str
418
413
Debug . Print ( $ "{ Enum . GetName ( typeof ( TraceAction ) , action ) } { MethodName } ; { nameof ( pUnk ) } : { FormatPtr ( pUnk ) } { argPrint } ") ;
419
414
}
420
415
421
- [ Conditional ( "DEBUG" ) ]
422
416
[ Conditional ( "TRACE_MARSHAL" ) ]
423
417
private static void Trace ( TraceAction action , [ CallerMemberName ] string MethodName = null , params ( string Name , object Value ) [ ] args )
424
418
{
@@ -431,21 +425,18 @@ private static void Trace(TraceAction action, [CallerMemberName]string MethodNam
431
425
Debug . Print ( $ "{ Enum . GetName ( typeof ( TraceAction ) , action ) } { MethodName } ; { argPrint } ") ;
432
426
}
433
427
434
- [ Conditional ( "DEBUG" ) ]
435
428
[ Conditional ( "TRACE_MARSHAL" ) ]
436
429
private static void Assert ( Action assert )
437
430
{
438
431
assert . Invoke ( ) ;
439
432
}
440
433
441
- [ Conditional ( "DEBUG" ) ]
442
434
[ Conditional ( "REF_COUNT" ) ]
443
435
private static void PrintRefCount ( object o , int result )
444
436
{
445
437
Debug . Print ( $ "{ nameof ( ReleaseComObject ) } :: COM Object: { o . GetType ( ) . Name } ref count { result } ") ;
446
438
}
447
439
448
- [ Conditional ( "DEBUG" ) ]
449
440
[ Conditional ( "REF_COUNT" ) ]
450
441
private static void PrintRefCount ( IntPtr pUnk , [ CallerMemberName ] string methodName = null , int refCount = 0 )
451
442
{
@@ -468,14 +459,12 @@ private static void PrintRefCount(IntPtr pUnk, [CallerMemberName] string methodN
468
459
}
469
460
}
470
461
471
- [ Conditional ( "DEBUG" ) ]
472
462
[ Conditional ( "REF_COUNT" ) ]
473
463
private static void PrintAlloc ( IntPtr pUnmanaged , [ CallerMemberName ] string methodName = null )
474
464
{
475
465
Debug . Print ( $ "{ methodName } :: Unmanaged pointer allocated: { FormatPtr ( pUnmanaged ) } ") ;
476
466
}
477
467
478
- [ Conditional ( "DEBUG" ) ]
479
468
[ Conditional ( "REF_COUNT" ) ]
480
469
private static void PrintFree ( IntPtr pUnmanaged , [ CallerMemberName ] string methodName = null )
481
470
{
0 commit comments