Skip to content

DuplicateAgentNameAnalyzer

NexusLabs.Foundry.MicrosoftAgentFramework.Analyzers

DuplicateAgentNameAnalyzer Class

Analyzer that detects two declared agents publishing the same name.

public sealed class DuplicateAgentNameAnalyzer

Inheritance Microsoft.CodeAnalysis.Diagnostics.DiagnosticAnalyzer 🡒 DuplicateAgentNameAnalyzer

Remarks

FDRYMAF031 (Error): Two or more classes decorated with [FoundryAgent] resolve to the same published name — [FoundryAgent(Name = "…")] when declared, the class name otherwise.

Building the agent factory already rejects this, but only once the composition root runs. The declarations that collide are visible at compile time, so the collision is reported there instead, next to the code that has to change.