Skip to content
This repository was archived by the owner on Dec 10, 2025. It is now read-only.

Commit abb5215

Browse files
committed
Fix Duplicate Path error
1 parent bd7c3ae commit abb5215

File tree

1 file changed

+14
-12
lines changed

1 file changed

+14
-12
lines changed

src/testcentric.extensibility/ExtensionManager.cs

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -96,27 +96,29 @@ public void FindExtensionPoints(params Assembly[] targetAssemblies)
9696

9797
log.Info($"Assembly: {assemblyName.Name}");
9898

99-
foreach (Type type in assembly.GetExportedTypes())
99+
try
100100
{
101-
try
101+
// First check for ExtensionPoint attributes on the assembly.
102+
foreach (ExtensionPointAttribute attr in assembly.GetCustomAttributes(typeof(ExtensionPointAttribute), false))
103+
AddExtensionPoint(attr.Path, attr.Type, assemblyName, attr.Description);
104+
105+
foreach (NUNIT.ExtensionPointAttribute attr in assembly.GetCustomAttributes(typeof(NUNIT.ExtensionPointAttribute), false))
106+
AddExtensionPoint(attr.Path, attr.Type, assemblyName, attr.Description);
107+
108+
// Check each exported type for TypeExtensionPoint attributes
109+
foreach (Type type in assembly.GetExportedTypes())
102110
{
103111
foreach (TypeExtensionPointAttribute attr in type.GetCustomAttributes(typeof(TypeExtensionPointAttribute), false))
104112
AddExtensionPoint(attr.Path ?? TypeExtensionPath + type.Name, type, assemblyName, attr.Description);
105113

106-
foreach (ExtensionPointAttribute attr in assembly.GetCustomAttributes(typeof(ExtensionPointAttribute), false))
107-
AddExtensionPoint(attr.Path, attr.Type, assemblyName, attr.Description);
108-
109114
foreach (NUNIT.TypeExtensionPointAttribute attr in type.GetCustomAttributes(typeof(NUNIT.TypeExtensionPointAttribute), false))
110115
AddExtensionPoint(attr.Path ?? NUNIT_TYPE_EXTENSIONS_PATH + type.Name, type, assemblyName, attr.Description);
111-
112-
foreach (NUNIT.ExtensionPointAttribute attr in assembly.GetCustomAttributes(typeof(NUNIT.ExtensionPointAttribute), false))
113-
AddExtensionPoint(attr.Path, attr.Type, assemblyName, attr.Description);
114-
}
115-
catch (Exception ex)
116-
{
117-
Console.WriteLine(ex.ToString());
118116
}
119117
}
118+
catch (Exception ex)
119+
{
120+
Console.WriteLine(ex.ToString());
121+
}
120122
}
121123

122124
void AddExtensionPoint(string path, Type type, AssemblyName assemblyName, string? description = null)

0 commit comments

Comments
 (0)