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

Commit 95fad1c

Browse files
committed
Don't throw when extension Path is not found
1 parent 321b02b commit 95fad1c

File tree

1 file changed

+19
-21
lines changed

1 file changed

+19
-21
lines changed

src/testcentric.extensibility/ExtensionManager.cs

Lines changed: 19 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -488,20 +488,22 @@ internal void FindExtensionsInAssembly(ExtensionAssembly extensionAssembly)
488488

489489
ExtensionNode extensionNode = BuildExtensionNode(extensionAttr, extensionType, extensionAssembly);
490490
ExtensionPoint? extensionPoint = BuildExtensionPoint(extensionNode, extensionType, extensionAssembly.FromWildCard);
491+
if (extensionPoint is null)
492+
log.Warning($"Extension ignored - Unable to deduce ExtensionPoint.");
491493

492494
// TODO: Ignoring version requirement for now. Decide whether or how to implement
493495
// it for varying hosts. Replace with ExtensibilityVersion?
494496
//string? versionArg = extensionAttr.GetNamedArgument("EngineVersion") as string;
495497
//if (versionArg is not null && !CheckRequiredVersion(versionArg, extensionPoint))
496498
// log.Warning($" Ignoring {extensionType.Name}. It requires version {versionArg}.");
497-
//else
498-
//{
499-
AddExtensionPropertiesToNode(extensionType, extensionNode);
500-
501-
_extensions.Add(extensionNode);
502-
extensionPoint.Install(extensionNode);
503-
log.Info($" Installed at path {extensionNode.Path}");
504-
//}
499+
else
500+
{
501+
AddExtensionPropertiesToNode(extensionType, extensionNode);
502+
503+
_extensions.Add(extensionNode);
504+
extensionPoint.Install(extensionNode);
505+
log.Info($" Installed at path {extensionNode.Path}");
506+
}
505507
}
506508
}
507509
}
@@ -519,24 +521,20 @@ private ExtensionNode BuildExtensionNode(CustomAttribute attr, TypeDefinition ty
519521
return node;
520522
}
521523

522-
private ExtensionPoint BuildExtensionPoint(ExtensionNode node, TypeDefinition type, bool fromWildCard)
524+
private ExtensionPoint? BuildExtensionPoint(ExtensionNode node, TypeDefinition type, bool fromWildCard)
523525
{
524526
ExtensionPoint? ep;
525527

526-
if (node.Path is null)
527-
{
528-
ep = DeduceExtensionPointFromType(type);
529-
if (ep is null)
530-
throw new ExtensibilityException($"Unable to deduce ExtensionPoint for Type {type.FullName}. Specify Path on ExtensionAttribute to resolve.");
531-
532-
log.Debug($" Deduced Path {ep.Path}");
533-
node.Path = ep.Path;
534-
}
528+
if (node.Path is not null)
529+
ep = GetExtensionPoint(node.Path);
535530
else
536531
{
537-
ep = GetExtensionPoint(node.Path);
538-
if (ep is null)
539-
throw new ExtensibilityException($"Unable to locate ExtensionPoint for Type {type.FullName}. The Path {node.Path} cannot be found.");
532+
ep = DeduceExtensionPointFromType(type);
533+
if (ep is not null)
534+
{
535+
log.Debug($" Deduced Path {ep.Path}");
536+
node.Path = ep.Path;
537+
}
540538
}
541539

542540
return ep;

0 commit comments

Comments
 (0)