<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Best Practices for the Dapr .NET SDK on Dapr Docs</title><link>https://v1-18.docs.dapr.io/developing-applications/sdks/dotnet/dotnet-guidance/</link><description>Recent content in Best Practices for the Dapr .NET SDK on Dapr Docs</description><generator>Hugo</generator><language>en</language><atom:link href="https://v1-18.docs.dapr.io/developing-applications/sdks/dotnet/dotnet-guidance/index.xml" rel="self" type="application/rss+xml"/><item><title>Error Model in the Dapr .NET SDK</title><link>https://v1-18.docs.dapr.io/developing-applications/sdks/dotnet/dotnet-guidance/dotnet-guidance-error-model/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://v1-18.docs.dapr.io/developing-applications/sdks/dotnet/dotnet-guidance/dotnet-guidance-error-model/</guid><description>&lt;p>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,
allowing consumers of the application to better understand the issue and resolve it faster. You can read more about the richer error model &lt;a href="https://google.aip.dev/193">here&lt;/a>, and you
can find the Dapr proto file implementing these errors &lt;a href="https://github.com/googleapis/googleapis/blob/master/google/rpc/error_details.proto%22">here&lt;/a>.&lt;/p>
&lt;p>The Dapr .NET SDK implements all details supported by the Dapr runtime, implemented in the &lt;code>Dapr.Common.Exceptions&lt;/code> namespace, and is accessible through
the &lt;code>DaprException&lt;/code> extension method &lt;code>TryGetExtendedErrorInfo&lt;/code>. Currently, this detail extraction is only supported for
&lt;code>RpcException&lt;/code>s where the details are present.&lt;/p></description></item><item><title>Experimental Attributes</title><link>https://v1-18.docs.dapr.io/developing-applications/sdks/dotnet/dotnet-guidance/dotnet-guidance-experimental-attributes/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://v1-18.docs.dapr.io/developing-applications/sdks/dotnet/dotnet-guidance/dotnet-guidance-experimental-attributes/</guid><description>&lt;h2 id="experimental-attributes">Experimental Attributes&lt;/h2>
&lt;h3 id="introduction-to-experimental-attributes">Introduction to Experimental Attributes&lt;/h3>
&lt;p>With the release of .NET 8, C# 12 introduced the &lt;code>[Experimental]&lt;/code> attribute, which provides a standardized way to mark
APIs that are still in development or experimental. This attribute is defined in the &lt;code>System.Diagnostics.CodeAnalysis&lt;/code>
namespace and requires a diagnostic ID parameter used to generate compiler warnings when the experimental API
is used.&lt;/p>
&lt;p>In the Dapr .NET SDK, we now use the &lt;code>[Experimental]&lt;/code> attribute instead of &lt;code>[Obsolete]&lt;/code> to mark building blocks and
components that have not yet passed the stable lifecycle certification. This approach provides a clearer distinction
between:&lt;/p></description></item><item><title>Integration testing with Dapr.Testcontainers</title><link>https://v1-18.docs.dapr.io/developing-applications/sdks/dotnet/dotnet-guidance/dotnet-guidance-testcontainers/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://v1-18.docs.dapr.io/developing-applications/sdks/dotnet/dotnet-guidance/dotnet-guidance-testcontainers/</guid><description>&lt;h2 id="overview">Overview&lt;/h2>
&lt;p>&lt;code>Dapr.Testcontainers&lt;/code> is a helper package for writing integration tests against real Dapr runtime components using
containers. It wraps the &lt;code>Testcontainers&lt;/code> library to spin up Dapr sidecars, control plane services (placement and
scheduler), and the infrastructure needed by specific Dapr building blocks.&lt;/p>


&lt;div class="alert alert-warning" role="alert">
&lt;h4 class="alert-heading">Important&lt;/h4>

 &lt;code>Dapr.Testcontainers&lt;/code> is an initial release. The API is still evolving and may change in future versions. We aim to
keep changes minimal, but you should expect potential breaking changes while the package matures.

&lt;/div>

&lt;h2 id="packages">Packages&lt;/h2>
&lt;ul>
&lt;li>&lt;code>Dapr.Testcontainers&lt;/code> (core harnesses and infrastructure)&lt;/li>
&lt;li>&lt;code>Dapr.Testcontainers.Xunit&lt;/code> (optional xUnit helpers)&lt;/li>
&lt;/ul>
&lt;h2 id="prerequisites">Prerequisites&lt;/h2>
&lt;ul>
&lt;li>A container runtime (Docker Desktop, Podman, or equivalent).&lt;/li>
&lt;li>Network access to pull Dapr and dependency images.&lt;/li>
&lt;/ul>
&lt;h2 id="core-concepts">Core concepts&lt;/h2>
&lt;p>&lt;code>Dapr.Testcontainers&lt;/code> models tests around &lt;strong>environments&lt;/strong> and &lt;strong>harnesses&lt;/strong>:&lt;/p></description></item><item><title>Dapr source code analyzers and generators</title><link>https://v1-18.docs.dapr.io/developing-applications/sdks/dotnet/dotnet-guidance/dotnet-guidance-source-generators/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://v1-18.docs.dapr.io/developing-applications/sdks/dotnet/dotnet-guidance/dotnet-guidance-source-generators/</guid><description>&lt;p>Dapr supports a growing collection of optional Roslyn analyzers and code fix providers that inspect your code for
code quality issues. Starting with the release of v1.16, developers have the opportunity to install additional projects
from NuGet alongside each of the standard capability packages to enable these analyzers in their solutions.&lt;/p>


&lt;div class="alert alert-primary" role="alert">
&lt;h4 class="alert-heading">Note&lt;/h4>

 A future release of the Dapr .NET SDK will include these analyzers by default without requiring a separate package
install.

&lt;/div>

&lt;p>Rule violations will typically be marked as &lt;code>Info&lt;/code> or &lt;code>Warning&lt;/code> so that if the analyzer identifies an issue, it won&amp;rsquo;t
necessarily break builds. All code analysis violations appear with the prefix &amp;ldquo;DAPR&amp;rdquo; and are uniquely distinguished
by a number following this prefix.&lt;/p></description></item></channel></rss>