File tree 2 files changed +4
-21
lines changed
src/DefaultBuilder/test/Microsoft.AspNetCore.TrimmingTests
2 files changed +4
-21
lines changed Original file line number Diff line number Diff line change 2
2
3
3
<ItemGroup >
4
4
<TestConsoleAppSourceFiles Include =" SlimBuilderDoesNotDependOnX509Test.cs" >
5
- <DisabledFeatureSwitches >System.Text.Json.JsonSerializer.IsReflectionEnabledByDefault</DisabledFeatureSwitches >
5
+ <DisabledFeatureSwitches >System.Text.Json.JsonSerializer.IsReflectionEnabledByDefault;System.Diagnostics.Debugger.IsSupported </DisabledFeatureSwitches >
6
6
<AdditionalSourceFiles >X509Utilities.cs</AdditionalSourceFiles >
7
7
</TestConsoleAppSourceFiles >
8
8
<TestConsoleAppSourceFiles Include =" UseHttpsDoesDependOnX509Test.cs" >
9
- <DisabledFeatureSwitches >System.Text.Json.JsonSerializer.IsReflectionEnabledByDefault</DisabledFeatureSwitches >
9
+ <DisabledFeatureSwitches >System.Text.Json.JsonSerializer.IsReflectionEnabledByDefault;System.Diagnostics.Debugger.IsSupported </DisabledFeatureSwitches >
10
10
<AdditionalSourceFiles >X509Utilities.cs</AdditionalSourceFiles >
11
11
</TestConsoleAppSourceFiles >
12
12
</ItemGroup >
Original file line number Diff line number Diff line change 11
11
12
12
public static class X509Utilities
13
13
{
14
- public static bool HasCertificateType
15
- {
16
- get
17
- {
18
- var certificateType = GetType ( "System.Security.Cryptography" , "System.Security.Cryptography.X509Certificates.X509Certificate" ) ;
19
-
20
- // We're checking for members, rather than just the presence of the type,
21
- // because Debugger Display types may reference it without actually
22
- // causing a meaningful binary size increase.
23
- return certificateType is not null && GetMembers ( certificateType ) . Any ( ) ;
24
- }
25
- }
14
+ public static bool HasCertificateType =>
15
+ GetType ( "System.Security.Cryptography" , "System.Security.Cryptography.X509Certificates.X509Certificate" ) is not null ;
26
16
27
17
[ UnconditionalSuppressMessage ( "ReflectionAnalysis" , "IL2057:UnrecognizedReflectionPattern" ,
28
18
Justification = "Returning null when the type is unreferenced is desirable" ) ]
29
19
private static Type ? GetType ( string assemblyName , string typeName )
30
20
{
31
21
return Type . GetType ( $ "{ typeName } , { assemblyName } ") ;
32
22
}
33
-
34
- [ UnconditionalSuppressMessage ( "ReflectionAnalysis" , "IL2070:UnrecognizedReflectionPattern" ,
35
- Justification = "Returning null when the type is unreferenced is desirable" ) ]
36
- private static MemberInfo [ ] GetMembers ( Type type )
37
- {
38
- return type . GetMembers ( BindingFlags . Public | BindingFlags . NonPublic | BindingFlags . Static | BindingFlags . Instance | BindingFlags . DeclaredOnly ) ;
39
- }
40
23
}
You can’t perform that action at this time.
0 commit comments