Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

Possible error in usage of cancellationToken parameter to context.CreateTimer in AzureStorageScenarioTests.cs?

未关闭
#1,178 2 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 2 天内回复

还没有人认领这个 Issue。

评估

难度
3/5
预计耗时
1-2 天
新手友好度
35/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
停滞
技术栈
csharp

调研方向

从 test/DurableTask.AzureStorage.Tests/AzureStorageScenarioTests.cs 的 3151 行附近开始,检查 context.CreateTimer 的重载和取消流程。将那里使用的参数与方法签名进行比较,然后运行 Azure Storage 场景测试,以验证审批任务完成时计时器是否会被取消,以及编排是否会完成。

由索引模型根据 Issue 内容生成。

描述

Referring to

https://github.com/Azure/durabletask/blob/main/test/DurableTask.AzureStorage.Tests/AzureStorageScenarioTests.cs#L3151, which is:

 Task timeoutTask = context.CreateTimer(deadline, cts.Token);

The second parameter of context.CreateTimer, that should be the state, not the cancellationToken, am I right? I'm trying to understand how to use this in my own projects, and looking at the source code to understand.

In this particular scenario, the state returned from the CreateTimer is not used, so it might not be easy to spot, but shouldn't the line be:

 object dummyState = new object() // whatever, the result is not used in this example
 Task timeoutTask = context.CreateTimer(deadline, dummyState, cts.Token);

where dummyState is the state? If not, the timer will never be cancelled, even when the approval task completes, and the orchestration instance will never finish?

Or have I misunderstood how this works?

主要语言
C#
星标
1.7k
派生
338
平均合并
3 天 19 小时
30 天内合并 PR
12

环境准备

这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

Azure/durabletask 的其他 Issue

查看 Azure/durabletask 的全部 Issue

相似的 Issue

更多 C# Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。