Skip to content

Fix misleading "not found" error when workflow/activity activation fails due to missing DI dependency#1781

Merged
WhitWaldo merged 4 commits intomasterfrom
copilot/fix-activity-activation-error-reporting
Apr 14, 2026
Merged

Fix misleading "not found" error when workflow/activity activation fails due to missing DI dependency#1781
WhitWaldo merged 4 commits intomasterfrom
copilot/fix-activity-activation-error-reporting

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 13, 2026

When a registered workflow or activity fails to activate (e.g., a constructor dependency isn't registered in DI), the runtime was swallowing the real exception and reporting WorkflowNotFound/ActivityNotFoundException — pointing developers in completely the wrong direction.

Changes

  • IWorkflowsFactory — Added out Exception? activationException to TryCreateWorkflow and TryCreateActivity, enabling callers to distinguish "not registered" (null) from "registered but failed to activate" (exception set)
  • WorkflowsFactory — Populates activationException when the factory delegate throws; leaves it null when the name isn't in the registry
  • WorkflowWorker — Checks activationException on failure; routes to a distinct error type/message (e.g. System.InvalidOperationException) instead of the generic "not found" path
  • Logging.cs — Added LogWorkerWorkflowHandleOrchestratorRequestActivationFailed and LogWorkerWorkflowHandleActivityRequestActivationFailed
  • Tests — Updated all callers of TryCreate* for new signature; enhanced existing "factory throws" tests to assert activationException is populated; added new worker-level tests for both workflow and activity activation failure paths

Before: Activity 'SendEmailActivity' not found

After: Activity 'SendEmailActivity' failed to activate: No service for type 'IEmailSender' has been registered.

Issue reference

We strive to have all PR being opened based on an issue, where the problem or feature have been discussed prior to implementation.

Please reference the issue this PR will close: #1775

Checklist

Please make sure you've completed the relevant tasks for this PR, out of the following list:

  • Code compiles correctly
  • Created/updated tests
  • Extended the documentation

… not-found errors

Agent-Logs-Url: https://github.com/dapr/dotnet-sdk/sessions/c8f56699-b71e-42a4-9539-3de6638c6577

Co-authored-by: WhitWaldo <2238529+WhitWaldo@users.noreply.github.com>
@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 13, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 61.20%. Comparing base (b3eaad0) to head (9ee7f66).
⚠️ Report is 1 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1781      +/-   ##
==========================================
+ Coverage   61.18%   61.20%   +0.01%     
==========================================
  Files         285      285              
  Lines        8405     8405              
  Branches      974      974              
==========================================
+ Hits         5143     5144       +1     
  Misses       3026     3026              
+ Partials      236      235       -1     
Flag Coverage Δ
net10.0 61.20% <ø> (+0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Workflow/Activity activation failures are reported as WorkflowNotFound / ActivityNotFound

2 participants