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

Performance Improvement for AssemblyLoading #13

Open
enisn opened this issue Dec 4, 2021 · 0 comments
Open

Performance Improvement for AssemblyLoading #13

enisn opened this issue Dec 4, 2021 · 0 comments
Assignees
Milestone

Comments

@enisn
Copy link
Owner

enisn commented Dec 4, 2021

Currently, assemblies are loaded and cached. It's good for calling twice or more. Because it'll return the same assembly collection after the first call. But that collection has never been released or cleared.

The main required action is, clearing that collection after ServiceCollection is built.

Source code of that section:

private static IList<Assembly> AssembliesToSearchFor
{
get
{
if (assemblies == null)
{
lock (lockingObj)
{
var _assemblies = Assembly
.GetEntryAssembly()
.GetReferencedAssemblies()
.Select(s => Assembly.Load(s.ToString()))
.Concat(new[] { Assembly.GetEntryAssembly() });
if (AppDomain.CurrentDomain.FriendlyName == "testhost") // Test host is not referenced directly .dll
{
_assemblies = _assemblies
.Concat(AppDomain.CurrentDomain.GetAssemblies());
}
assemblies = _assemblies.Distinct().ToList();
}
}
return assemblies;

@enisn enisn added this to the Backlog milestone Dec 4, 2021
@enisn enisn self-assigned this Dec 4, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant