Skip to content

Commit 3f2025e

Browse files
committed
fix: Changed return type from array to list for the GetAssembliesTypeHasAccessTo method
The recent refactoring of the method made it impossible to add additional assemblies after collecting the main ones, so I returned this ability.
1 parent c517743 commit 3f2025e

File tree

2 files changed

+15
-3
lines changed

2 files changed

+15
-3
lines changed

Editor/Drawers/TypeDropdownDrawer.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ private SortedSet<TypeItem> GetFilteredTypes()
9595
return sortedTypes;
9696
}
9797

98-
private void IncludeAdditionalAssemblies(ICollection<Assembly> typeRelatedAssemblies)
98+
private void IncludeAdditionalAssemblies(List<Assembly> typeRelatedAssemblies)
9999
{
100100
foreach (string assemblyName in _attribute.IncludeAdditionalAssemblies)
101101
{

Editor/Util/TypeCollector.cs

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,19 @@
1313
/// </summary>
1414
internal static class TypeCollector
1515
{
16-
public static Assembly[] GetAssembliesTypeHasAccessTo(Type type)
16+
/// <summary>
17+
/// Collects assemblies the type has access to: the type's native assembly and all its referenced assemblies.
18+
/// </summary>
19+
/// <param name="type">Type to collect the assemblies for.</param>
20+
/// <returns>Collection of assemblies the type has access to.</returns>
21+
/// <exception cref="FileNotFoundException">
22+
/// If the method tried to load the Assembly-Csharp assembly but it does not exist.
23+
/// </exception>
24+
/// <remarks>
25+
/// Additional assemblies may be added using <see cref="TypeOptionsAttribute.IncludeAdditionalAssemblies"/>,
26+
/// hence the List return type.
27+
/// </remarks>
28+
public static List<Assembly> GetAssembliesTypeHasAccessTo(Type type)
1729
{
1830
Assembly typeAssembly;
1931

@@ -30,7 +42,7 @@ public static Assembly[] GetAssembliesTypeHasAccessTo(Type type)
3042
return typeAssembly.GetReferencedAssemblies()
3143
.Select(Assembly.Load)
3244
.Append(typeAssembly)
33-
.ToArray();
45+
.ToList();
3446
}
3547

3648
public static List<Type> GetFilteredTypesFromAssemblies(

0 commit comments

Comments
 (0)