Skip to content

.NET: Log a warning when an unsupported declarative action is skipped - #8056

Open
tirdesh wants to merge 1 commit into
microsoft:mainfrom
tirdesh:issue-8040
Open

.NET: Log a warning when an unsupported declarative action is skipped#8056
tirdesh wants to merge 1 commit into
microsoft:mainfrom
tirdesh:issue-8040

Conversation

@tirdesh

@tirdesh tirdesh commented Sep 4, 2026

Copy link
Copy Markdown

Motivation & Context

WorkflowActionVisitor routes 32 declarative action kinds to NotSupported, which records
the skip in two ways and neither reaches the caller. Debug.WriteLine is
System.Diagnostics.Debug, annotated [Conditional("DEBUG")], so the compiler removes the
call in Release. HasUnsupportedActions is declared on WorkflowActionVisitor, which is
internal sealed, and across the repository it is read in exactly one place, a unit test in
DeclarativeWorkflowTest.

The result is that a workflow containing SearchKnowledgeSources, InvokeFlowAction,
OAuthInput or any of the other 29 kinds builds, runs to completion and reports success
while never performing that step. In a Release build nothing is written anywhere.

The Python implementation already reports this. _declarative_builder.py in
_create_executor_for_action logs "Unknown action kind ... action will be skipped" and
returns None at the same point in the build, so the two languages currently disagree.

Description & Review Guide

  • What are the major changes? NotSupported now logs a warning through the
    ILoggerFactory that DeclarativeWorkflowOptions already supplies to the visitor, naming
    the action type and id. The visitor creates one logger in its constructor. A regression
    test, UnsupportedActionLogsWarning, builds an AdaptiveDialog containing a
    SearchKnowledgeSources action and asserts a single warning carrying both values. Local
    checks: dotnet build -c Release (0 warnings, 0 errors),
    dotnet test -f net10.0 in Debug and in Release (878 passed, 0 failed), and
    dotnet format --verify-no-changes clean on both projects. Reverting only the source
    change and rerunning leaves 877 passing with UnsupportedActionLogsWarning failing.
  • What is the impact of these changes? Control flow is unchanged and every action that
    was skipped before is still skipped. No public API is added, so the public API baselines
    and package validation are untouched. LoggerFactory defaults to
    NullLoggerFactory.Instance, so callers that configure no logging see no behavior change.
  • What do you want reviewers to focus on? Debug.WriteLine is
    [Conditional("DEBUG")], so item.GetId() did not execute in Release before this change
    and now does. It is a plain property read that cannot throw for a DialogAction, and it
    renders as (null) for an action that carries no id.

If you would rather surface this as a WorkflowWarningEvent raised on first run instead of a
log, I am happy to change it.

Related Issue

Fixes #8040

No other open pull request for #8040 was found during the duplicate check.

Contribution Checklist

  • The code builds clean without any errors or warnings
  • All unit tests pass, and I have added new tests where possible
  • The PR follows the Contribution Guidelines
  • This PR is linked to an issue and there is no other open PR for this issue (see Related Issue above).
  • This is not a breaking change.

WorkflowActionVisitor routes 32 action kinds to NotSupported, which recorded
the skip only through Debug.WriteLine and the HasUnsupportedActions flag.
Debug.WriteLine is [Conditional("DEBUG")] and so is removed in Release, and
the flag sits on an internal sealed type that a caller cannot reach, so a
workflow containing one of those actions completed successfully with no
indication that part of it had not run.

Log a warning through the ILoggerFactory the visitor already receives in its
options, naming the action type and id. Control flow is unchanged and no
public API is added.

Fixes microsoft#8040
Copilot AI balanced review requested due to automatic review settings September 4, 2026 10:30
@tirdesh
tirdesh deployed to github-app-auth September 4, 2026 10:30 — with GitHub Actions Active
@tirdesh
tirdesh deployed to github-app-auth September 4, 2026 10:30 — with GitHub Actions Active
@agent-framework-automation agent-framework-automation Bot added .NET Usage: [Issues, PRs], Target: .Net workflows Usage: [Issues, PRs], Target: Workflows labels Sep 4, 2026
@tirdesh
tirdesh deployed to github-app-auth September 4, 2026 10:30 — with GitHub Actions Active

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

The focused implementation resolves the silent-skip issue with appropriate regression coverage and no identified defects.

Pull request overview

Adds visible warning logs when .NET declarative workflows skip unsupported actions, addressing issue #8040.

Changes:

  • Creates a visitor-scoped logger and emits action type and ID warnings.
  • Adds regression coverage verifying the warning.
File summaries
File Description
WorkflowActionVisitor.cs Logs unsupported skipped actions.
DeclarativeWorkflowTest.cs Tests warning level and content.
Review details
  • Files reviewed: 2/2 changed files
  • Comments generated: 0
  • Review effort level: Balanced

💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.

@tirdesh

tirdesh commented Sep 4, 2026

Copy link
Copy Markdown
Author

@microsoft-github-policy-service agree

@baywet Vincent Biret (baywet) left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the contribution!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

.NET Usage: [Issues, PRs], Target: .Net workflows Usage: [Issues, PRs], Target: Workflows

Projects

None yet

Development

Successfully merging this pull request may close these issues.

.NET: [Bug]: Declarative workflows silently skip unsupported actions

4 participants