Skip to content

Commit e828a01

Browse files
Delete dead WinRT code in Activator (#55721)
1 parent 62fa1f8 commit e828a01

File tree

1 file changed

+3
-19
lines changed

1 file changed

+3
-19
lines changed

src/libraries/System.Private.CoreLib/src/System/Activator.RuntimeType.cs

Lines changed: 3 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -102,8 +102,6 @@ public static partial class Activator
102102

103103
[UnconditionalSuppressMessage("ReflectionAnalysis", "IL2026:RequiresUnreferencedCode",
104104
Justification = "Implementation detail of Activator that linker intrinsically recognizes")]
105-
[UnconditionalSuppressMessage("ReflectionAnalysis", "IL2057:UnrecognizedReflectionPattern",
106-
Justification = "Implementation detail of Activator that linker intrinsically recognizes")]
107105
[UnconditionalSuppressMessage("ReflectionAnalysis", "IL2072:UnrecognizedReflectionPattern",
108106
Justification = "Implementation detail of Activator that linker intrinsically recognizes")]
109107
[UnconditionalSuppressMessage("ReflectionAnalysis", "IL2096:UnrecognizedReflectionPattern",
@@ -118,32 +116,18 @@ public static partial class Activator
118116
object?[]? activationAttributes,
119117
ref StackCrawlMark stackMark)
120118
{
121-
Type? type = null;
122-
Assembly? assembly = null;
119+
Assembly assembly;
123120
if (assemblyString == null)
124121
{
125122
assembly = Assembly.GetExecutingAssembly(ref stackMark);
126123
}
127124
else
128125
{
129126
AssemblyName assemblyName = new AssemblyName(assemblyString);
130-
131-
if (assemblyName.ContentType == AssemblyContentType.WindowsRuntime)
132-
{
133-
// WinRT type - we have to use Type.GetType
134-
type = Type.GetType(typeName + ", " + assemblyString, throwOnError: true, ignoreCase);
135-
}
136-
else
137-
{
138-
// Classic managed type
139-
assembly = RuntimeAssembly.InternalLoad(assemblyName, ref stackMark, AssemblyLoadContext.CurrentContextualReflectionContext);
140-
}
127+
assembly = RuntimeAssembly.InternalLoad(assemblyName, ref stackMark, AssemblyLoadContext.CurrentContextualReflectionContext);
141128
}
142129

143-
if (type == null)
144-
{
145-
type = assembly!.GetType(typeName, throwOnError: true, ignoreCase);
146-
}
130+
Type? type = assembly.GetType(typeName, throwOnError: true, ignoreCase);
147131

148132
object? o = CreateInstance(type!, bindingAttr, binder, args, culture, activationAttributes);
149133

0 commit comments

Comments
 (0)