@@ -35,7 +35,6 @@ internal struct LICINFO
3535 [ InterfaceType ( ComInterfaceType . InterfaceIsIUnknown ) ]
3636 internal interface IClassFactory
3737 {
38- [ RequiresUnreferencedCode ( "Built-in COM support is not trim compatible" , Url = "https://aka.ms/dotnet-illink/com" ) ]
3938 void CreateInstance (
4039 [ MarshalAs ( UnmanagedType . Interface ) ] object ? pUnkOuter ,
4140 ref Guid riid ,
@@ -50,7 +49,6 @@ void CreateInstance(
5049 [ InterfaceType ( ComInterfaceType . InterfaceIsIUnknown ) ]
5150 internal interface IClassFactory2 : IClassFactory
5251 {
53- [ RequiresUnreferencedCode ( "Built-in COM support is not trim compatible" , Url = "https://aka.ms/dotnet-illink/com" ) ]
5452 new void CreateInstance (
5553 [ MarshalAs ( UnmanagedType . Interface ) ] object ? pUnkOuter ,
5654 ref Guid riid ,
@@ -280,19 +278,6 @@ private static unsafe int GetClassFactoryForTypeInContext(ComActivationContextIn
280278 private static unsafe int GetClassFactoryForTypeImpl ( ComActivationContextInternal * pCxtInt , bool isolatedContext )
281279 {
282280 ref ComActivationContextInternal cxtInt = ref * pCxtInt ;
283-
284- if ( IsLoggingEnabled ( ) )
285- {
286- Log (
287- $@ "{ nameof ( GetClassFactoryForTypeInternal ) } arguments:
288- { cxtInt . ClassId }
289- { cxtInt . InterfaceId }
290- 0x{ ( ulong ) cxtInt . AssemblyPathBuffer : x}
291- 0x{ ( ulong ) cxtInt . AssemblyNameBuffer : x}
292- 0x{ ( ulong ) cxtInt . TypeNameBuffer : x}
293- 0x{ cxtInt . ClassFactoryDest . ToInt64 ( ) : x} " ) ;
294- }
295-
296281 try
297282 {
298283 var cxt = ComActivationContext . Create ( ref cxtInt , isolatedContext ) ;
@@ -341,19 +326,6 @@ private static unsafe int RegisterClassForTypeInContext(ComActivationContextInte
341326 private static unsafe int RegisterClassForTypeImpl ( ComActivationContextInternal * pCxtInt , bool isolatedContext )
342327 {
343328 ref ComActivationContextInternal cxtInt = ref * pCxtInt ;
344-
345- if ( IsLoggingEnabled ( ) )
346- {
347- Log (
348- $@ "{ nameof ( RegisterClassForTypeInternal ) } arguments:
349- { cxtInt . ClassId }
350- { cxtInt . InterfaceId }
351- 0x{ ( ulong ) cxtInt . AssemblyPathBuffer : x}
352- 0x{ ( ulong ) cxtInt . AssemblyNameBuffer : x}
353- 0x{ ( ulong ) cxtInt . TypeNameBuffer : x}
354- 0x{ cxtInt . ClassFactoryDest . ToInt64 ( ) : x} " ) ;
355- }
356-
357329 if ( cxtInt . InterfaceId != Guid . Empty
358330 || cxtInt . ClassFactoryDest != IntPtr . Zero )
359331 {
@@ -410,19 +382,6 @@ private static unsafe int UnregisterClassForTypeInContext(ComActivationContextIn
410382 private static unsafe int UnregisterClassForTypeImpl ( ComActivationContextInternal * pCxtInt , bool isolatedContext )
411383 {
412384 ref ComActivationContextInternal cxtInt = ref * pCxtInt ;
413-
414- if ( IsLoggingEnabled ( ) )
415- {
416- Log (
417- $@ "{ nameof ( UnregisterClassForTypeInternal ) } arguments:
418- { cxtInt . ClassId }
419- { cxtInt . InterfaceId }
420- 0x{ ( ulong ) cxtInt . AssemblyPathBuffer : x}
421- 0x{ ( ulong ) cxtInt . AssemblyNameBuffer : x}
422- 0x{ ( ulong ) cxtInt . TypeNameBuffer : x}
423- 0x{ cxtInt . ClassFactoryDest . ToInt64 ( ) : x} " ) ;
424- }
425-
426385 if ( cxtInt . InterfaceId != Guid . Empty
427386 || cxtInt . ClassFactoryDest != IntPtr . Zero )
428387 {
@@ -447,21 +406,6 @@ private static unsafe int UnregisterClassForTypeImpl(ComActivationContextInterna
447406 static void ClassRegistrationScenarioForTypeLocal ( ComActivationContext cxt , bool register ) => ClassRegistrationScenarioForType ( cxt , register ) ;
448407 }
449408
450- private static bool IsLoggingEnabled ( )
451- {
452- #if COM_ACTIVATOR_DEBUG
453- return true ;
454- #else
455- return false ;
456- #endif
457- }
458-
459- private static void Log ( string fmt , params object [ ] args )
460- {
461- // [TODO] Use FrameworkEventSource in release builds
462- Debug . WriteLine ( fmt , args ) ;
463- }
464-
465409 [ RequiresUnreferencedCode ( "Built-in COM support is not trim compatible" , Url = "https://aka.ms/dotnet-illink/com" ) ]
466410 private static Type FindClassType ( ComActivationContext cxt )
467411 {
@@ -478,10 +422,7 @@ private static Type FindClassType(ComActivationContext cxt)
478422 }
479423 catch ( Exception e )
480424 {
481- if ( IsLoggingEnabled ( ) )
482- {
483- Log ( $ "COM Activation of { cxt . ClassId } failed. { e } ") ;
484- }
425+ Debug . WriteLine ( $ "COM Activation of { cxt . ClassId } failed. { e } ") ;
485426 }
486427
487428 const int CLASS_E_CLASSNOTAVAILABLE = unchecked ( ( int ) 0x80040111 ) ;
@@ -529,6 +470,7 @@ private static AssemblyLoadContext GetALC(string assemblyPath, bool isolatedCont
529470 }
530471
531472 [ ComVisible ( true ) ]
473+ [ RequiresUnreferencedCode ( "Built-in COM support is not trim compatible" , Url = "https://aka.ms/dotnet-illink/com" ) ]
532474 private sealed class BasicClassFactory : IClassFactory
533475 {
534476 private readonly Guid _classId ;
@@ -648,7 +590,6 @@ public static object CreateAggregatedObject(object pUnkOuter, object comObject)
648590 }
649591 }
650592
651- [ RequiresUnreferencedCode ( "Built-in COM support is not trim compatible" , Url = "https://aka.ms/dotnet-illink/com" ) ]
652593 public void CreateInstance (
653594 [ MarshalAs ( UnmanagedType . Interface ) ] object ? pUnkOuter ,
654595 ref Guid riid ,
@@ -672,6 +613,7 @@ public void LockServer([MarshalAs(UnmanagedType.Bool)] bool fLock)
672613 }
673614
674615 [ ComVisible ( true ) ]
616+ [ RequiresUnreferencedCode ( "Built-in COM support is not trim compatible" , Url = "https://aka.ms/dotnet-illink/com" ) ]
675617 private sealed class LicenseClassFactory : IClassFactory2
676618 {
677619 private readonly LicenseInteropProxy _licenseProxy = new LicenseInteropProxy ( ) ;
@@ -686,7 +628,6 @@ public LicenseClassFactory(Guid clsid, [DynamicallyAccessedMembers(DynamicallyAc
686628 _classType = classType ;
687629 }
688630
689- [ RequiresUnreferencedCode ( "Built-in COM support is not trim compatible" , Url = "https://aka.ms/dotnet-illink/com" ) ]
690631 public void CreateInstance (
691632 [ MarshalAs ( UnmanagedType . Interface ) ] object ? pUnkOuter ,
692633 ref Guid riid ,
0 commit comments