Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check iscompilergenerated last in canberegistered for perf reasons #1289

Merged
merged 2 commits into from
Oct 8, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,11 @@ private static IEnumerable<Type> CanBeRegistered<TActivatorData, TStyle>(this IE
// non-public types here. Folks use assembly scanning on their
// own stuff, so encapsulation is a tricky thing to manage.
// If people want only public types, a LINQ Where clause can be used.
return types.Where(t => t.IsClass && !t.IsAbstract && !t.IsDelegate() && !t.IsCompilerGenerated() && activatorData.Filters.All(p => p(t)));
return types.Where(t => t.IsClass &&
!t.IsAbstract &&
!t.IsDelegate() &&
activatorData.Filters.All(p => p(t)) &&
!t.IsCompilerGenerated()); // run iscompilergenerated check last due to perf. See AssemblyScanningPerformanceTests.MeasurePerformance.
}

private static void ConfigureFrom<TActivatorData, TScanStyle, TRegistrationBuilderStyle>(
Expand Down