1
1
using System ;
2
2
using System . Collections . Generic ;
3
+ using System . Diagnostics . CodeAnalysis ;
3
4
using System . Reflection ;
4
5
using System . Runtime . InteropServices ;
5
6
using System . Text ;
@@ -67,13 +68,17 @@ private static unsafe int Do_Abi_ActivateInstance_0(IntPtr thisPtr, out IntPtr i
67
68
return 0 ;
68
69
}
69
70
}
70
- internal static ObjectReference < Vftbl > FromAbi ( IntPtr thisPtr ) => ObjectReference < Vftbl > . FromAbi ( thisPtr ) ;
71
+ internal static ObjectReference < Vftbl > FromAbi ( IntPtr thisPtr ) => ObjectReference < Vftbl > . FromAbi ( thisPtr , global :: WinRT . Interop . IID . IID_IActivationFactory ) ;
71
72
72
73
public static implicit operator IActivationFactory ( IObjectReference obj ) => ( obj != null ) ? new IActivationFactory ( obj ) : null ;
73
74
protected readonly ObjectReference < Vftbl > _obj ;
74
75
public IObjectReference ObjRef { get => _obj ; }
75
76
public IntPtr ThisPtr => _obj . ThisPtr ;
76
- public ObjectReference < I > AsInterface < I > ( ) => _obj . As < I > ( ) ;
77
+ public ObjectReference < I > AsInterface <
78
+ #if NET
79
+ [ DynamicallyAccessedMembers ( DynamicallyAccessedMemberTypes . PublicFields ) ]
80
+ #endif
81
+ I > ( ) => _obj . As < I > ( ) ;
77
82
public A As < A > ( ) => _obj . AsType < A > ( ) ;
78
83
public IActivationFactory ( IObjectReference obj ) : this ( obj . As < Vftbl > ( ) ) { }
79
84
internal IActivationFactory ( ObjectReference < Vftbl > obj )
@@ -114,8 +119,13 @@ internal class ActivationFactory : IActivationFactory
114
119
namespace WinRT
115
120
{
116
121
public static class Module
117
- {
118
- public static unsafe IntPtr GetActivationFactory ( String runtimeClassId )
122
+ {
123
+ #if NET
124
+ [ DynamicDependency ( DynamicallyAccessedMemberTypes . PublicParameterlessConstructor , typeof ( TestHost . ProbeByClass ) ) ]
125
+ [ UnconditionalSuppressMessage ( "Trimming" , "IL2057" , Justification = "We're manually keeping the target type around." ) ]
126
+
127
+ #endif
128
+ public static unsafe IntPtr GetActivationFactory ( string runtimeClassId )
119
129
{
120
130
if ( string . CompareOrdinal ( runtimeClassId , "TestHost.ProbeByClass" ) == 0 )
121
131
{
@@ -138,7 +148,10 @@ public static unsafe IntPtr GetActivationFactory(String runtimeClassId)
138
148
namespace TestHost
139
149
{
140
150
public class ProbeByClass : IStringable
141
- {
151
+ {
152
+ #if NET
153
+ [ UnconditionalSuppressMessage ( "SingleFile" , "IL3000" , Justification = "We're not publishing this test as single file." ) ]
154
+ #endif
142
155
public override string ToString ( )
143
156
{
144
157
return new System . IO . FileInfo ( Assembly . GetExecutingAssembly ( ) . Location ) . Name ;
0 commit comments