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
Best practice and local dev documentation updates (#1608)
* Refactored error model documentation into developer guidance section
* Minor changes to developer index page
* Fixed header on experimental attributes doc
* Grammar tweak
* Migrated into development section, fixed table to add missing version added numbers
* Added missing space
* Changed dev integrations title to more general dev guidance
* Rearranged guidance/development docs, added new landing page for "best practices" section
* Added best practices to main page
---------
Signed-off-by: Whit Waldo <[email protected]>
The Dapr .NET SDK offers a rich set of capabilities for building distributed applications. This section provides
12
+
practical guidance for using the SDK effectively in production scenarios—focusing on reliability, maintainability, and
13
+
developer experience.
14
+
15
+
Topics covered include:
16
+
17
+
- Error handling strategies across Dapr building blocks
18
+
- Managing experimental features and suppressing related warnings
19
+
- Leveraging source analyzers and generators to reduce boilerplate and catch issues early
20
+
- General .NET development practices in Dapr-based applications
21
+
22
+
## Error model guidance
23
+
24
+
Dapr operations can fail for many reasons—network issues, misconfigured components, or transient faults. The SDK
25
+
provides structured error types to help you distinguish between retryable and fatal errors.
26
+
27
+
Learn how to use `DaprException` and its derived types effectively [here]({{% ref dotnet-guidance-error-model.md %}}).
28
+
29
+
## Experimental attributes
30
+
31
+
Some SDK features are marked as experimental and may change in future releases. These are annotated with
32
+
`[Experimental]` and generate build-time warnings by default. You can:
33
+
34
+
- Suppress warnings selectively using `#pragma warning disable`
35
+
- Use `SuppressMessage` attributes for finer control
36
+
- Track experimental usage across your codebase
37
+
38
+
Learn more about our use of the `[Experimenta]` attribute [here]({{% ref dotnet-guidance-experimental-attributes.md %}}).
39
+
40
+
## Source tooling
41
+
42
+
The SDK includes Roslyn-based analyzers and source generators to help you write better code with less effort. These tools:
43
+
44
+
- Warn about common misuses of the SDK
45
+
- Generate boilerplate for actor registration and invocation
46
+
- Support IDE integration for faster feedback
47
+
48
+
Read more about how to install and use these analyzers [here]({{% ref dotnet-guidance-source-generators.md %}}).
49
+
50
+
## Additional guidance
51
+
52
+
This section is designed to support a wide range of development scenarios. As your applications grow in complexity, you'll find increasingly relevant practices and patterns for working with Dapr in .NET—from actor lifecycle management to configuration strategies and performance tuning.
Copy file name to clipboardExpand all lines: daprdocs/content/en/dotnet-sdk-docs/dotnet-guidance/dotnet-guidance-error-model.md
+17-16Lines changed: 17 additions & 16 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,18 +1,18 @@
1
1
---
2
2
type: docs
3
-
title: "Richer Error Model in the Dapr .NET SDK"
4
-
linkTitle: "Richer error model"
5
-
weight: 59000
3
+
title: "Error Model in the Dapr .NET SDK"
4
+
linkTitle: "Error Model"
5
+
weight: 85100
6
6
description: Learn how to use the richer error model in the .NET SDK.
7
7
---
8
8
9
9
The Dapr .NET SDK supports the richer error model, implemented by the Dapr runtime. This model provides a way for applications to enrich their errors with added context,
10
-
allowing consumers of the application to better understand the issue and resolve faster. You can read more about the richer error model [here](https://google.aip.dev/193), and you
10
+
allowing consumers of the application to better understand the issue and resolve it faster. You can read more about the richer error model [here](https://google.aip.dev/193), and you
11
11
can find the Dapr proto file implementing these errors [here](https://github.com/googleapis/googleapis/blob/master/google/rpc/error_details.proto").
12
12
13
13
The Dapr .NET SDK implements all details supported by the Dapr runtime, implemented in the `Dapr.Common.Exceptions` namespace, and is accessible through
14
-
the `DaprException` extension method `TryGetExtendedErrorInfo`. Currently this detail extraction is only supported for
15
-
`RpcException`'s where the details are present.
14
+
the `DaprException` extension method `TryGetExtendedErrorInfo`. Currently, this detail extraction is only supported for
15
+
`RpcException`s where the details are present.
16
16
17
17
```csharp
18
18
// Example usage of ExtendedErrorInfo
@@ -75,7 +75,7 @@ All details implement the abstract `DaprExtendedErrorDetail` and have an associa
`DaprPreconditionFailureViolation`, whicheachhas `Subject` (subjectwherethepreconditionfailureoccurede.g. "Azure"), `Type` (representationofthepreconditiontypee.g. "TermsOfService"), and `Description` (furtherdescriptione.g. "ToS must be accepted.").
94
+
`DaprPreconditionFailureViolation`, whicheachhas `Subject` (subjectwherethepreconditionfailureoccured, e.g. "Azure"),
95
+
`Type` (representationofthepreconditiontype, e.g. "TermsOfService"), and `Description` (furtherdescriptione.g. "ToS must be accepted.").
| DAPR1301 | Dapr.Workflow | Usage | Warning | 1.16 | The workflow type is not registered with the dependency injection provider | Yes |
63
-
| DAPR1302 | Dapr.Workflow | Usage | Warning | 1.16 | The workflow activity type is not registered with the dependency injection provider | Yes |
64
-
| DAPR1401 | Dapr.Actors | Usage | Warning | 1.16 | Actor timer method invocations require the named callback method to exist on type | No |
65
-
| DAPR1402 | Dapr.Actors | Usage | Warning | The actor type is not registered with dependency injection | Yes |
66
-
| DAPR1403 | Dapr.Actors | Interoperability | Info | Set options.UseJsonSerialization to true to support interoperability with non-.NET actors | Yes |
67
-
| DAPR1404 | Dapr.Actors | Usage | Warning | Call app.MapActorsHandlers to map endpoints for Dapr actors | Yes |
68
-
| DAPR1501 | Dapr.Jobs | Usage | Warning | Job invocations require the MapDaprScheduledJobHandler to be set and configured for each anticipated job on IEndpointRouteBuilder | No |
60
+
| Diagnostic ID | Dapr Package | Category | Severity | Version Added | Description| Code Fix Available |
| DAPR1301 | Dapr.Workflow | Usage | Warning | 1.16 | The workflow type is not registered with the dependency injection provider| Yes |
63
+
| DAPR1302 | Dapr.Workflow | Usage | Warning | 1.16 | The workflow activity type is not registered with the dependency injection provider| Yes |
64
+
| DAPR1401 | Dapr.Actors | Usage | Warning | 1.16 | Actor timer method invocations require the named callback method to exist on type| No |
65
+
| DAPR1402 | Dapr.Actors | Usage | Warning |1.16 |The actor type is not registered with dependency injection| Yes |
66
+
| DAPR1403 | Dapr.Actors | Interoperability | Info |1.16 |Set options.UseJsonSerialization to true to support interoperability with non-.NET actors| Yes |
67
+
| DAPR1404 | Dapr.Actors | Usage | Warning |1.16 |Call app.MapActorsHandlers to map endpoints for Dapr actors | Yes|
68
+
| DAPR1501 | Dapr.Jobs | Usage | Warning |1.16 |Job invocations require the MapDaprScheduledJobHandler to be set and configured for each anticipated job on IEndpointRouteBuilder | No|
69
69
70
70
## Analyzer Categories
71
71
The following are each of the eligible categories that an analyzer can be assigned to and are modeled after the
0 commit comments