You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: references/core/determinism.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -88,7 +88,7 @@ Each Temporal SDK language provides a different level of protection against non-
88
88
- TypeScript: The TypeScript SDK runs workflows in an isolated V8 sandbox, intercepting many common sources of non-determinism and replacing them automatically with deterministic variants.
89
89
- Java: The Java SDK has no sandbox. Determinism is enforced by developer conventions — the SDK provides `Workflow.*` APIs as safe alternatives (e.g., `Workflow.sleep()` instead of `Thread.sleep()`), and non-determinism is only detected at replay time via `NonDeterministicException`. A static analysis tool (`temporal-workflowcheck`, beta) can catch violations at build time. Cooperative threading under a global lock eliminates the need for synchronization.
90
90
- Go: The Go SDK has no runtime sandbox. Therefore, non-determinism bugs will never be immediately appararent, and are usually only observable during replay. The optional `workflowcheck` static analysis tool can be used to check for many sources of non-determinism at compile time.
91
-
- .NET: The .NET SDK has no sandbox. It uses a custom TaskScheduler and a runtime EventListener to detect invalid task scheduling. Developers must use Workflow.* safe alternatives (e.g., Workflow.DelayAsync instead of Task.Delay) and avoid non-deterministic .NET Task APIs.
91
+
- .NET: The .NET SDK has no sandbox. It uses a custom TaskScheduler and a runtime EventListener to detect invalid task scheduling. Developers must use `Workflow.*` safe alternatives (e.g., Workflow.DelayAsync instead of Task.Delay) and avoid non-deterministic .NET Task APIs.
92
92
93
93
Regardless of which SDK you are using, it is your responsibility to ensure that workflow code does not contain sources of non-determinism. Use SDK-specific tools as well as replay tests for doing so.
- Put any state initialization logic in the constructor of your workflow class to guarantee that it happens before signals/updates arrive. If your state initialization logic requires the workflow parameters, then add the `[WorkflowInit]` attribute and parameters to your constructor.
91
97
- Use `[WorkflowRun]` on the async entry point method
92
98
- Must return `Task` or `Task<T>`
93
99
- Use `[WorkflowSignal]`, `[WorkflowQuery]`, `[WorkflowUpdate]` for handlers
94
100
95
101
### Activity Definition
102
+
96
103
- Use `[Activity]` attribute on methods
97
104
- Can be sync or async
98
105
- Instance methods support dependency injection
99
106
- Static methods are also supported
100
107
101
108
### Worker Setup
109
+
102
110
- Connect client, create `TemporalWorker` with workflows and activities
103
111
- Use `AddWorkflow<T>()` and `AddAllActivities(instance)` or `AddActivity(method)`
104
112
@@ -181,6 +189,7 @@ See `references/dotnet/testing.md` for info on writing tests.
181
189
## Additional Resources
182
190
183
191
### Reference Files
192
+
184
193
-**`references/dotnet/patterns.md`** — Signals, queries, child workflows, saga pattern, etc.
185
194
-**`references/dotnet/determinism.md`** — Essentials of determinism in .NET
186
195
-**`references/dotnet/gotchas.md`** — .NET-specific mistakes and anti-patterns
0 commit comments