Skip to content

Commit d5dc991

Browse files
fix(hosting): use OfType<Type>() in FindXamlMetadataProviderInAssembly
Addresses #144 review feedback. `ex.Types` is `Type?[]`, so the previous `.Where(t => t is not null).ToArray()!` pattern relied on a nullable suppression and left a redundant `t is null` check inside the scan loop. `OfType<Type>().ToArray()` produces a true `Type[]`, eliminating both. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 8d296c9 commit d5dc991

1 file changed

Lines changed: 1 addition & 2 deletions

File tree

src/Reactor/Hosting/ReactorApp.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,11 +111,10 @@ public static void RegisterControlAssembly(global::System.Reflection.Assembly as
111111
{
112112
global::System.Type[] types;
113113
try { types = assembly.GetTypes(); }
114-
catch (global::System.Reflection.ReflectionTypeLoadException ex) { types = ex.Types.Where(t => t is not null).ToArray()!; }
114+
catch (global::System.Reflection.ReflectionTypeLoadException ex) { types = ex.Types.OfType<global::System.Type>().ToArray(); }
115115

116116
foreach (var t in types)
117117
{
118-
if (t is null) continue;
119118
if (!typeof(IXamlMetadataProvider).IsAssignableFrom(t)) continue;
120119
if (t.IsAbstract || t.IsInterface) continue;
121120
if (t.GetConstructor(global::System.Type.EmptyTypes) is null) continue;

0 commit comments

Comments
 (0)