.NET: Fix source generator bug that silently drops base class handler registrations for protocol-only partial executors#4751
Open
.NET: Fix source generator bug that silently drops base class handler registrations for protocol-only partial executors#4751
Conversation
…trations for protocol-only partial executors
Contributor
There was a problem hiding this comment.
Pull request overview
Fixes a .NET workflows source-generator bug where protocol-only partial executors could silently lose inherited ConfigureProtocol handler registrations (breaking the CustomAgentExecutors sample), by correctly carrying and propagating base-class protocol override information through generator analysis.
Changes:
- Extended
ClassProtocolInfoto includeBaseHasConfigureProtocol. - Populated and propagated
BaseHasConfigureProtocolthrough semantic analysis and protocol-only result combination. - Updated the
CustomAgentExecutorssample to be generator-compatible (partial + IO attributes) and added basic runtime error printing.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| dotnet/src/Microsoft.Agents.AI.Workflows.Generators/Models/ClassProtocolInfo.cs | Adds BaseHasConfigureProtocol to the protocol-only analysis model so the generator can preserve base protocol configuration. |
| dotnet/src/Microsoft.Agents.AI.Workflows.Generators/Analysis/SemanticAnalyzer.cs | Computes BaseHasConfigureProtocol during attribute analysis and uses it when combining protocol-only results (fixing the inheritance regression). |
| dotnet/samples/03-workflows/Agents/CustomAgentExecutors/Program.cs | Adjusts the sample executor to use generator-driven protocol declarations and prints workflow errors to aid diagnosis. |
dotnet/src/Microsoft.Agents.AI.Workflows.Generators/Analysis/SemanticAnalyzer.cs
Show resolved
Hide resolved
dotnet/src/Microsoft.Agents.AI.Workflows.Generators/Analysis/SemanticAnalyzer.cs
Show resolved
Hide resolved
dotnet/src/Microsoft.Agents.AI.Workflows.Generators/Models/ClassProtocolInfo.cs
Outdated
Show resolved
Hide resolved
westey-m
approved these changes
Mar 18, 2026
alliscode
approved these changes
Mar 18, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation and Context
ClassProtocolInfodidn't carryBaseHasConfigureProtocol, soCombineOutputOnlyResultscouldn't know whether the base class already overridesConfigureProtocoland this led to silent drop of base class handler registrations for protocol-only partial executors. This broke theCustomAgentExecutorssample.Fixes #4202
Description
• Added
BaseHasConfigureProtocoltoClassProtocolInfo• Populated it via
BaseHasConfigureProtocolinAnalyzeClassProtocolAttribute• Used
BaseHasConfigureProtocolinCombineOutputOnlyResultsinstead of hardcoded false value.Contribution Checklist