Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Dec 2, 2025

  • Analyze the issue: TaskEntity support is missing from the DurableTaskSourceGenerator
  • Update DurableTaskSourceGenerator.cs to recognize TaskEntity<T> base classes in addition to TaskOrchestrator and TaskActivity
  • Update DurableTaskSourceGenerator.cs to categorize entities separately (like activities and orchestrators)
  • Update AddRegistrationMethodForAllTasks to include builder.AddEntity<T>() calls for entities
  • Update DurableFunction.cs to include Entity enum value for DurableFunctionKind
  • Update DurableTaskAttribute.cs documentation to mention entities
  • Add unit tests to validate the new entity source generation (non-Azure Functions)
  • Add Azure Functions entity source generation tests
  • Run tests to verify changes work correctly (18 passing, 8 skipped)
  • Verify full solution builds successfully
Original prompt

This section details on the original issue you should resolve

<issue_title>Bug: TaskEntity source generator missing in DurableTaskSourceGenerator.cs</issue_title>
<issue_description>https://github.com/microsoft/durabletask-dotnet/blob/main/src/Generators/DurableTaskSourceGenerator.cs#L105

https://github.com/microsoft/durabletask-dotnet/blob/main/src/Generators/AzureFunctions/DurableFunction.cs#L9

https://github.com/microsoft/durabletask-dotnet/blob/main/src/Generators/DurableTaskSourceGenerator.cs#L378

only contains references for TaskOrchestrator and TaskActivity
whereas another type of task exists, TaskEntity

as listed in factory

https://github.com/microsoft/durabletask-dotnet/blob/main/src/Worker/Core/IDurableTaskFactory.cs#L43

consequently when calling AddAllGeneratedTasks
task entities are missing</issue_description>

<agent_instructions>analyze, inspect, address if this is a bug or miss and add tests to validate changes work as expected</agent_instructions>

Comments on the Issue (you are @copilot in this section)


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI changed the title [WIP] Fix TaskEntity source generator in DurableTaskSourceGenerator Add TaskEntity support to DurableTaskSourceGenerator Dec 2, 2025
Copilot AI requested a review from YunchuWang December 2, 2025 21:27
@YunchuWang YunchuWang marked this pull request as ready for review December 2, 2025 21:56
Copilot AI review requested due to automatic review settings December 2, 2025 21:56
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 adds TaskEntity<TState> support to the DurableTask source generator, fixing a bug where entities were excluded from the AddAllGeneratedTasks() registration method. The implementation properly handles entities' single type parameter (TState) versus the two type parameters (TInput, TOutput) used by orchestrators and activities.

Key changes:

  • Added TaskEntity detection logic to the source generator with a DurableTaskKind enum to distinguish between orchestrators, activities, and entities
  • Updated source generation to emit builder.AddEntity<T>() calls in the registration method
  • Added comprehensive test coverage for entity scenarios including primitive types, custom types, explicit naming, inheritance, and mixed task types

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
src/Generators/DurableTaskSourceGenerator.cs Core implementation: Added TaskEntity detection in type hierarchy traversal, introduced DurableTaskKind enum to replace boolean flag, updated type parameter validation logic for entities (1 param) vs orchestrators/activities (2 params), and added entity registration generation
src/Generators/AzureFunctions/DurableFunction.cs Added Entity enum value to DurableFunctionKind for future Azure Functions entity support
src/Abstractions/DurableTaskAttribute.cs Updated XML documentation to mention TaskEntity support and entity registration
test/Generators.Tests/ClassBasedSyntaxTests.cs Added comprehensive test coverage with 5 new test methods covering primitive types, custom types, explicit naming, inheritance, and mixed orchestrator/activity/entity scenarios

@YunchuWang
Copy link
Member

@copilot add tests to validate azure function entity source generation

Copy link
Contributor Author

Copilot AI commented Dec 3, 2025

@copilot add tests to validate azure function entity source generation

Added Azure Functions entity source generation tests in commit 09a7cf1. The tests include:

  • Entities_ClassBasedSyntax - validates entity class-based syntax generates appropriate code in Azure Functions mode
  • Mixed_OrchestratorActivityEntity_ClassBasedSyntax - validates a mix of orchestrators, activities, and entities in Azure Functions mode

The tests are skipped with the same reason as existing Azure Functions tests ("Durable Functions Extension out of date") since the Azure Functions extension needs to be updated to run these tests.

@YunchuWang YunchuWang force-pushed the copilot/fix-taskentity-source-generator branch from 09a7cf1 to 5abe338 Compare December 3, 2025 07:48
@YunchuWang
Copy link
Member

the function source genereator tests are all skipped currently, out of scope for this pr that fixes customer concern on non function entity source generation missing issue. we can address in separate pr.

@YunchuWang YunchuWang requested a review from torosent December 3, 2025 19:24
@torosent torosent merged commit 2e79ebc into main Dec 5, 2025
7 checks passed
@torosent torosent deleted the copilot/fix-taskentity-source-generator branch December 5, 2025 01:43
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.

Bug: TaskEntity source generator missing in DurableTaskSourceGenerator.cs

4 participants