Skip to content

.NET: fix: Expose WorkflowErrorEvent as ErrorContent#2762

Merged
lokitoth merged 2 commits intomainfrom
dev/dotnet_workflow/errorcontent
Jan 8, 2026
Merged

.NET: fix: Expose WorkflowErrorEvent as ErrorContent#2762
lokitoth merged 2 commits intomainfrom
dev/dotnet_workflow/errorcontent

Conversation

@lokitoth
Copy link
Member

@lokitoth lokitoth commented Dec 10, 2025

Motivation and Context

When hosted using AsAgent(), Workflows were not exposing inner errors coming as Exceptions (through raised WorkflowErrorEvent)

Description

The fix is to convert the Message property to an ErrorContent on the way out, rather than rely on the default "empty update" to collect the raw event.

Contribution Checklist

  • The code builds clean without any errors or warnings
  • The PR follows the Contribution Guidelines
  • All unit tests pass, and I have added new tests where possible
  • Is this a breaking change? If yes, add "[BREAKING]" prefix to the title of the PR.

Copilot AI review requested due to automatic review settings December 10, 2025 20:36
@markwallace-microsoft markwallace-microsoft added .NET workflows Related to Workflows in agent-framework labels Dec 10, 2025
@github-actions github-actions bot changed the title fix: Expose WorkflowErrorEvent as ErrorContent .NET: fix: Expose WorkflowErrorEvent as ErrorContent Dec 10, 2025
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes a bug where workflows hosted using .AsAgent() were not exposing inner errors coming from exceptions through the WorkflowErrorEvent. The fix converts error events to ErrorContent objects so they can be properly surfaced to consumers.

Key Changes:

  • Added an Exception property to WorkflowErrorEvent for direct access to the underlying exception
  • Modified WorkflowThread.CreateUpdate to accept a raw representation parameter
  • Added handling for WorkflowErrorEvent in workflow execution to convert exceptions to ErrorContent

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.

File Description
WorkflowErrorEvent.cs Adds public Exception property to expose the underlying exception data
WorkflowThread.cs Updates CreateUpdate signature to include raw representation and adds error event handling to convert exceptions to ErrorContent
WorkflowHostSmokeTests.cs Adds comprehensive smoke tests validating both direct error content streaming and exception-to-error-content conversion

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

Labels

.NET workflows Related to Workflows in agent-framework

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

4 participants