Skip to content

Commit 14f973e

Browse files
committed
Revert "Simplify type lookup"
This reverts commit d118f30.
1 parent 47e383d commit 14f973e

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/DefaultBuilder/test/Microsoft.AspNetCore.TrimmingTests/X509Utilities.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,10 @@ public static class X509Utilities
1414
public static bool HasCertificateType =>
1515
GetType("System.Security.Cryptography", "System.Security.Cryptography.X509Certificates.X509Certificate") is not null;
1616

17-
[UnconditionalSuppressMessage("ReflectionAnalysis", "IL2057:UnrecognizedReflectionPattern",
17+
[UnconditionalSuppressMessage("ReflectionAnalysis", "IL2026:RequiresUnreferencedCode",
1818
Justification = "Returning null when the type is unreferenced is desirable")]
1919
private static Type? GetType(string assemblyName, string typeName) {
20-
return Type.GetType($"{typeName}, {assemblyName}");
20+
var assembly = AppDomain.CurrentDomain.GetAssemblies().SingleOrDefault(a => a.GetName().Name == assemblyName);
21+
return assembly?.GetType(typeName);
2122
}
2223
}

0 commit comments

Comments
 (0)