Skip to content
Merged
Show file tree
Hide file tree
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 @@ -33,5 +33,6 @@ public abstract class AssemblyBinder
public abstract bool Bind(RuntimeAssemblyName refName, bool cacheMissedLookups, out AssemblyBindResult result, out Exception exception);

public abstract IList<AssemblyBindResult> GetLoadedAssemblies();
public abstract int GetLoadedAssembliesCount();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,9 @@ public static Assembly Load(string assemblyString)
}

// Performance metric to count the number of assemblies
// Caching since in NativeAOT, the number will be the same
private static uint s_assemblyCount;
internal static uint GetAssemblyCount()
{
if (s_assemblyCount == 0)
s_assemblyCount = (uint)Internal.Reflection.Core.Execution.ReflectionCoreExecution.ExecutionEnvironment.AssemblyBinder.GetLoadedAssemblies().Count;
return s_assemblyCount;
return (uint)Internal.Reflection.Core.Execution.ReflectionCoreExecution.ExecutionEnvironment.AssemblyBinder.GetLoadedAssembliesCount();
}

[Obsolete("Assembly.LoadWithPartialName has been deprecated. Use Assembly.Load() instead.")]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,11 @@ public sealed override IList<AssemblyBindResult> GetLoadedAssemblies()
return loadedAssemblies;
}

public sealed override int GetLoadedAssembliesCount()
{
return ScopeGroups.Length;
}

//
// Encapsulates the assembly ref->def matching policy.
//
Expand Down
Loading