dapr - v1.13.0


Dapr 1.13

We're happy to announce the release of Dapr 1.13!

We would like to extend our thanks to all the new and existing contributors who helped make this release happen.

If you're new to Dapr, visit the getting started page and familiarize yourself with Dapr.

Docs have been updated with all the new features and changes of this release.
To get started with new capabilities introduced in this release, go to the Concepts and the Developing applications.

Note: This release contains a few breaking changes.

See this section on upgrading Dapr to version 1.13.

Highlights

These are the v1.13 release highlights:

Component hot reloading (preview)

Component "Hot Reloading" is a new preview feature that, when enabled, allows component updates to be picked up automatically, without the need for restarting the Dapr process.
The component spec is reconciled and takes effect when running in both Kubernetes and Self-Hosted modes.

Go and JavaScript/TypeScript SDK support for workflow

You can now use Go and JavaScript/TypeScript to write fault-tolerant, workflow-based apps with durable execution.
See the Go SDK for more details and try the Quickstart or the examples.
See the Javascript SDK for more details and try the Quickstart or the examples

Actor reminders performance improvement

You can now opt-in to make actor reminders data use protobuf serialization instead of JSON, which increases throughput, reduces latency, and improves stability when multiple Dapr instances are operating on the same reminders.
With this feature enabled, we have observed improvements as high as 40% in Actor Reminders and Workflow benchmarks.
This serialization method will become default in v1.14.

Important: Once you enable this feature, you should not downgrade the Dapr control plane to an earlier version, as your reminders data may become unreadable.

To enable protobuf serialization for actor reminders, set the following Helm argument on Kubernetes: dapr_placement.maxActorApiLevel=20.
On self-hosted mode, run daprd with the flag: --max-api-level=20

Low metrics cardinality for HTTP server

Dapr now includes an optional setting to enable low cardinality for metrics emitted by the HTTP server, which will be enabled by default in Dapr 1.14.

Currently, the Dapr HTTP server emits metrics for each request path, which has been observed to cause significant memory usage and have other negative performance impact.
When low-cardinality metrics are enabled, the HTTP Dapr server behaves more like the gRPC server and groups requests for each Dapr API together, possibly reducing memory consumption significantly.
See additional info here.

Graceful shutdown

Dapr now accepts a dapr.io/block-shutdown-duration annotation or --dapr-block-shutdown-duration CLI flag which delays the full shutdown procedure for this duration or until the app reports as unhealthy- whichever is sooner.
During this period, all Subscriptions and input bindings will be closed.
This is useful for applications that need to use the Dapr APIs as part of their own shutdown procedure.
See additional info here.

Standardized error codes

The Dapr PubSub and State APIs now have the appropriate and standardized error codes returned to applications including enriched error details based on gRPC's richer error model.
The remaining APIs are a work in progress, and community contributions towards this effort are greatly appreciated and very impactful.
See additional info on the error codes here.
Check the docs for each SDK for per-SDK error code parsing and handling.
See an example of the Go SDK error parsing and handling here.

Rust SDK support for actors (alpha)

You can now use Rust to run Dapr Actors, a programming model for highly scalable stateful applications.
See the Rust SDK for more details

Components

Local name resolver based on SQLite

You can now use a SQLite based name resolver for service invocation in self-hosted mode.
This is useful for dealing with corporate firewalls and VPNs that filter mDNS.
See additional info here.

PostgreSQL state store v2

PostgreSQL has a new v2 implementation which contains improvements to performance and reliability.
New applications are encouraged to use v2.
The v1 implementation remains supported and is not deprecated.
There is no migration path from v1 to v2.
See additional info here.

Azure Blob Storage state store v2

Azure Blob Storage has a new v2 implementation, which is recommended for all new projects as it fixes a backwards-incompatible bug with key prefixes.
The v1 implementation remains supported and is not deprecated.
There is no migration path from v1 to v2.
See additional info here.

Acknowledgements

Thanks to everyone who made this release possible!

@a-elsheikh, @addjuarez, @AishwaryaBalyaya01, @alfred-mikhael, @amimimor, @andreas-eriksson, @andrew-hillier, @arthbalete, @artursouza, @ASHIQUEMD, @avo-sepp, @baransonmez, @berndverst, @bkc, @bmelbourne, @bruth, @burhan, @cgillum, @chaitanyab2311, @cicoyle, @ckcd, @cscetbon, @danielgerlag, @dasanind, @DeepanshuA, @ejba, @elena-kolevska, @emctl, @eunicecompra, @famarting, @farshaddavoudi, @fazledyn-or, @filintod, @frankbuckley, @frodera, @fvandillen, @fyzact, @georgestevens99, @Gonzoe79, @greenie-msft, @gspadotto, @hauju, @henrikkarstrom, @heunghingwan, @hhunter-ms, @ItalyPaleAle, @jamesmcroft, @jancespivo, @jellis18, @jerinthomas1404, @jhberge, @jigargandhi, @jjcollinge, @jorimvanhove, @JoshVanL, @kaibocai, @KarstenWintermann, @KrylixZA, @litan1106, @lrascao, @lucus-sun, @luigirende, @macel94, @marcduiker, @martbln, @mathieu-benoit, @mikeee, @MregXN, @msfussell, @mukundansundar, @nitroin, @olitomlinson, @paianish62, @passuied, @paulyuk, @philliphoff, @pngan, @prashantrewar, @prateek041, @pravinpushkar, @qustavo, @rabollin, @robertojrojas, @RyanLettieri, @sadath-12, @salaboy, @shivamkm07, @shubham1172, @sicoyle, @siebenluke, @skyao, @srilasya02, @srparupu, @stuartleeks, @Taction, @thapasusheel, @tlund101, @tmacam, @toneill818, @TWEESTY, @twinguy, @vermillionsword, @Viktorsubota, @willvelida, @WhitWaldo, @XavierGeerinck, @xiangpingjiang, @yaron2, @yash-nisar, @ytimocin

New in this release

Dapr Runtime

  • ADDED New name-resolver based on SQLite for local development (alternative to mDNS) 3256 7038
  • ADDED Option to emit metrics from HTTP server with lower cardinality for reduced memory consumption (disabled by default), and include more information in API logs 6723 6919 7429
  • ADDED Metrics for Dapr Workflow 7109 7152 7370
  • ADDED Improve Actor Reminders performance by serializing as protobuf (opt-in) 7129 7548 7196
  • UPDATED Switched default Docker registry to ghcr.io in Helm chart 6413 7176
  • UPDATED Enforce Component names to be unique 7195
  • ADDED Helm chart option to deploy Placement with zero replicas 7253
  • ADDED Support for priorityClass in Helm charts 7103 7395
  • ADDED Helm option dapr_sidecar_injector.enableK8sDownwardAPIs to improve detection of pod IP in certain Kubernetes environments 7511
  • ADDED Hot Reloading for components 7239 7260 7286 7433 7441
  • ADDED Add Helm chart options to configure the Service resources created 7153
  • ADDED Option --dapr-block-shutdown-duration to daprd 7268 4313
  • ADDED Enhanced logging for Workflow 7065 7460 7222
  • ADDED Allow specifying control plane service for actors and/or reminders 7318 7203
  • UPDATED Multiple performance improvements for Actor invocations 7231
  • UPDATED Tune actor app health check to recover more quickly from failure 7022
  • ADDED Metadata API: report actor runtime status 7040
  • ADDED Sentry JWKS validator: add support for passing root CA certs 7366
  • ADDED Cascading terminate and purge of child workflows 6393 7498 7340
  • ADDED Option to add extra env vars to control plane pods in Helm charts 7183 7182
  • ADDED Tracing info to outbox requests 7198 7047
  • ADDED Register Reflection service on gRPC server 7215
  • ADDED Support for application/json serialization to outbox 7230
  • FIXED Dapr Operator should not patch the Subscription CRDs if the conversion webhooks are disabled 7154 7432
  • FIXED Error immediately when metrics export server fails 7021
  • FIXED Duplicate HTTP headers on non-successful responses 7403 7371
  • FIXED Fixed multiple bugs in connection with Placement service 7119
  • FIXED Removed unused CLI flags for control plane services 6925
  • FIXED grpc_server_status label missing for gRPC server latency metric 7045 7255
  • FIXED Using deploymentAnnotations produces invalid Helm chart 7194
  • FIXED Send dropped PubSub message to dead-letter if configured 7097 6282
  • FIXED Concurrency issue when halting all actors 7381 7380
  • FIXED Change Operator default port to 443 7083
  • FIXED Do not write SVID to local file 7214 5756
  • FIXED Metadata API contains invalid value for PubSub subscription rule when undefined 7049 7067
  • FIXED Prevent null traceparent from being returned to the caller 7406 7372
  • FIXED Make Injector resilient to Sentry unavailability 7479 7507 7508
  • FIXED Missing namespace property in Sentry CA bundle ConfigMap Helm resource 7420
  • FIXED Grafana dashboards not working 7120 7121
  • UPDATED Build Dapr using Go 1.21 7228 7262
  • REMOVED Remove deprecated RenameReminder methods 6711 6945
  • REMOVED Remove AppChannelAllowInsecureTLS feature flag, and require TLS-enabled app channel to use TLS 1.2+ 7292 7149
  • FIXED Workflow events of the same name are not buffered 6799
  • UPDATED Injector: Change daprd projected token audience to sentry SPIFFE ID 7041 5756
  • ADDED Make workflow engine configurable 7090 7089
  • ADDED Workflow creation policy options. 7101 7308
  • ADDED Authorization to the APIs of Operator and Placement 7111 7112
  • ADDED Support for alternate backends for Dapr Workflow (currently limited to Dapr Actors only) 7127 7283
  • ADDED Richer error codes model 7257 6068
  • ADDED Standardize error messages for PubSub 7322 6068
  • FIXED Fix timeouts in HTTP service invocation when resiliency policies with timeouts are applied 7270 7173 7145
  • ADDED Block Graceful Shutdown: stop input bindings and subscriptions 7474
  • FIXED dapr-api-token header population for proxied calls 7344 7404
  • ADDED Calculate vnodes on daprd instead of the placement service 7382 7415 7428 7462
  • FIXED Workflow Sub-Orchestration creation not working 7384
  • FIXED conflict with content-length metadata in pubsub subscription. 7413 7421
  • ADDED Disable placement timeout with no peers 7418
  • FIXED Dapr workflow fails while purging retryable child workflows 7422
  • FIXED Workflow gRPC start API should generate instanceID if not present 7503
  • FIXED Subscriptions: Fix panic when match rule is empty 7539
  • ADDED gRPC metadata and HTTP headers added to binding response even in case of error 7572

Components

Dapr 1.13 introduces 3 new components:

  • State Store: PostgreSQL v2 2956 3250
    This new version of the PostgreSQL state store can offer up to 10% improved performance in some scenarios.
    This version supports all stable capabilities, including Actor State Store; support for the Alpha Query API.
    Note that the v1 of the component continues to be supported and there are currently no plans to deprecate it.
  • State Store: Azure Blob Storage v2 3203 3032
    This version addresses a fundamental breaking change in the handling of the state key prefix.
    Note that the v1 of the component continues to be supported and there are currently no plans to deprecate it.
  • Name Resolver: SQLite 3178
    This component is particularly useful in local development or in single-node deployments, as an alternative to the default mDNS name resolver.

Additionally, one component has been removed:

  • The NATS Streaming component (which was deprecated in Dapr 1.11) has been removed, since the NATS Streaming Server project is deprecated. Users are encouraged to migrate to NATS JetStream. 3150

Other improvements and fixes to components:

  • Bindings:
    • Invocation metadata property ttl is now an alias for ttlInSeconds and accepts a Go duration format in addition to seconds as whole numbers 3122
    • AWS S3:
      • Added support for Content-Type in the metadata request 3216
      • Handle object not found error 2526 3223
    • Azure Blob Storage:
      • Handle object not found error 2526 3223
    • GCP Bucket:
      • Handle object not found error 2526 3223
    • Huawei OBS:
      • Handle object not found error 2526 3223
    • Kafka:
      • Added support for AWS IAM with AWS Kafka clusters 3239 3305
  • PubSub:
    • Invocation metadata property ttl is now an alias for ttlInSeconds and accepts a Go duration format in addition to seconds as whole numbers 3122
    • AWS SQS:
      • Fixed errors during Dapr shutdown and with message polling behavior 3156 3174
    • GCP PubSub:
      • Fixed: reduce unnecessary administrator calls on publish to a GCP PubSub Topic 2539 3241
    • Kafka:
      • Added support for AWS IAM with AWS Kafka clusters 3239 3305
      • Added Avro schema registry support 31443292
      • Added message key and other metadata as metadata in consumer 3289
      • Added more configuration options to control prefetching and concurrency 3275
    • Redis:
      • Added support for message metadata 3320
  • Secret stores:
    • AWS Secret Manager and AWS Parameter Store:
      • Added connection validation 3301
  • State stores:
    • AWS DynamoDB:
      • Fixed: validate AWS connection 3285
    • Azure Blob Storage (v1):
      • Added disableEntityManagement metadata option to work with minimal Microsoft Entra ID permissions 3213
    • Azure CosmosDB:
      • Added ability to pass explicit partition key in Query method 3227
    • Cassandra:
      • Added TLS verification support via metadata option EnableHostVerification 3230
    • Microsoft SQL Server:
      • Improve performance of Multi invocations with 1 operation only 3300
    • MySQL:
      • Improved performance of Set operations with first-write-wins 3159
      • Improved performance of Multi invocations with 1 operation only 3300
    • PostgreSQL (v1):
      • Improved performance of Multi invocations with 1 operation only 3300
    • Redis:
      • Fixed: numeric operators do not work correctly on large numbers when querying 3334
    • SQLite:
      • Fixed: when connecting to an in-memory database, limit to 1 concurrent connection 3255
      • Improved performance of Set operations with first-write-wins 3159
      • Improved performance of Multi invocations with 1 operation only 3300
    • All components that support the alpha Query APIs now offer new filter types 3218
  • Name resolvers:
    • Consul:
      • Added local in-memory caching of Consul responses 934 3121
  • Azure components:
    • Allow Azure Auth order to be specified via azureAuthMethods component metadata 3183 3217

Dapr CLI

  • FIXED Unix: Directories in ~/.dapr given 777 permisions. 1317
  • UPDATE Upgrade go to 1.21 1331
  • ADDED Add --run-file support for stdin 1364

.NET SDK

  • UPDATED Can't use C# 9.0 Record for actor method return type 679
  • UPDATED Error Suppression and Vault Name Mapping 887
  • FIXED HttpClient created by DaprClient.CreateInvokeHttpClient can't find the target service to invoke 937
  • ADDED [Crypto] Implement support for EncryptAlpha1/DecryptAlpha1 APIs 1072
  • ADDED FEATURE PREVIEW: Add Actor State TTL support 1078
  • ADDED Proposal: Strongly-typed non-remoted Actor clients 1158
  • FIXED bug: Dapr not handling enums as string in pub/sub with JsonSerializerOptions 1160
  • UPDATED Increase Logging Metrics for Workflow 1170
  • UPDATED GetBulkStateAsync should have typed overload that performs bulk deserialization 1172
  • FIXED Exception running Actor example: Type 'Dapr.Actors.Runtime.ActorReminder' cannot be serialized. 1177
  • UPDATED [Proposal] Move to C# 10 for SDK development 1181
  • ADDED Support .NET 8 1187
  • FIXED [Bug] Console will be stuck in workflow sample 1191
  • ADDED add some descriptions to README in workflow example 1192
  • ADDED Proposal: Support cancellation tokens for non-remoted actor interfaces 1201
  • UPDATED use daprWorkflowClient instead of daprClient in workflow sample 1212
  • UPDATED Weakly-typed actors should support polymorphic response and null response 1213
  • ADDED Cascade Terminate/Purge for workflow 1226
  • FIXED AddDaprClient incompatible with keyed services 1235
  • UPDATED Update protos and related use for Dapr 1.13. 1236

Go SDK

  • ADDED Workflow implementation in SDK 379
  • RESOLVED Allow overriding the default logger 496

Java SDK

  • FIXED Unable to get the HTTP response details by Dapr HttpBinding if the state code is not 200 783
  • UPDATED reactore-core to v3.5.0. 815
  • UPDATED Update project-reactor dependency & fix deprecated calls 816
  • ADDED Additional CloudEvent fields (pubsubname, topic, time, etc) 866
  • FIXED HTTP HEAD calls must not have a request body 891
  • ADDED Provide getGuid() method in Java workflow SDK 931
  • FIXED Cannot schedule a workflow at a specific date/time 943
  • ADDED Workflow Log Enhancements 946 953
  • ADDED Support JDK17 and springboot3 in Dapr Java SDK 971
  • ADDED Error details and payload to the DaprException 998 1009
  • ADDED Use health check to wait for sidecar 981
  • ADDED Saga Pattern support 956

Python SDK

  • ADDED Check outbound healthz endpoint on sidecar wait 611
  • ADDED Support Cascade Terminate/Purge feature for Dapr Workflow 661
  • CHANGED Improved developer experience for error handling 648
  • DEPRECATED The wait method is now deprecated and will be removed in a future release. The automatic outbound health check covers this use case.
Python Workflow Alpha SDK (dapr-ext-workflow)
  • ADDED Python decorators for workflow 635
  • ADDED Add support for retry policies 576
  • FIXED Child Workflow doesn't work if input or instance_id is not passed 660
  • CHANGED Logs enhancements - Structured logging and right log levels 626
  • ADDED Allow optional explicit naming of workflow and activity names 623
  • FIXED try/except not working correctly in workflow functions 627

JavaScript SDK

  • FIXED Actor reminder and timer to accept empty period parameter 535
  • UPDATED Accept the API token through the DAPR_API_TOKEN environment variable 547
  • FIXED ActorId accepts invalid IDs, causing issues when making Actor HTTP calls 537
  • FIXED PubSub Example 557
  • UPDATED gRPC endpoint parsing 542
  • FIXED File Header Styling 559
  • ADDED Workflow Authoring Support 463
  • FIXED Configuration gRPC calls not sending metadata 570

Rust SDK

  • UPDATED Update dependencies (axum, prost, tonic) 121
  • UPDATED Protos updated to Dapr v1.13 120
  • CHANGED Handle metadata for Configuration API 118
  • ADDED Configuration client API implemented 110
  • ADDED Initial actor runtime implementation 99

Quickstarts

Dapr 1.13 Quickstarts include these major updates:

Other improvements include:

  • UPDATED dapr.yml updates 955
  • UPDATED Update app.js - process.env.STATE_STORE_NAME 958
  • UPDATED use daprWorkflowClient instead of daprClient in workflow sample 959
  • UPDATED Change dotnet TargetFramework from v7.0 to v8.0 960
  • UPDATED Clarified actor state persistence description 961
  • UPDATED Updating CI/CD actions to use release-1.13 of dapr/dapr runtime [976]
  • UPDATED Update README.md 963
  • FIXED dapr-bot (assign) is broken 966
  • FIXED correct readme 975
    (https://github.com/dapr/quickstarts/pull/976)
  • FIXED Quickstart tests are failing as CRON Binding is not getting loaded 978
  • FIXED Proposal: Upgrade C# quickstarts to .NET 8 LTS 980
  • FIXED Its Not clear which is the most up-to-date-dotnet Workflow Sample 981
  • FIXED Fix the DAPR bot script addressing this issue #966 985

Upgrading to Dapr 1.13

To upgrade to this release of Dapr, follow the steps here to ensure a smooth upgrade.
You know, the one where you don't get red errors on the terminal.. we all hate that, right?

Local Machine / Self-hosted

Uninstall Dapr using the CLI you currently have installed.
Note that this will remove the default $HOME/.dapr directory, binaries and all containers dapr_redis, dapr_placement and dapr_zipkin.
Linux users need to run sudo if docker command needs sudo:

dapr uninstall --all

For RC releases like this, download the latest and greatest release from here and put the dapr binary in your PATH.

Once you have installed the CLI, run:

dapr init --runtime-version=1.13

Wait for the update to finish, ensure you are using the latest version of Dapr(1.13) with:

$ dapr --version

CLI version: 1.13
Runtime version: 1.13

Kubernetes

Upgrading from previous version

You can perform zero-downtime upgrades using both Helm 3 and the Dapr CLI.

Upgrade using the CLI

Download the latest RC release from here and put the dapr binary in your PATH.

To upgrade Dapr, run:

dapr upgrade --runtime-version 1.13 -k

To upgrade with high availability mode:

dapr upgrade --runtime-version 1.13 --enable-ha=true -k

Wait until the operation is finished and check your status with dapr status -k.

All done!

Note: Make sure your deployments are restarted to pick the latest version of the Dapr sidecar

Upgrade using Helm

To upgrade Dapr using Helm, run:

helm repo add dapr https://dapr.github.io/helm-charts/
helm repo update

helm upgrade dapr dapr/dapr --version 1.13 --namespace=dapr-system --wait

Wait until the operation is finished and check your status with dapr status -k.

All done!

Note: Make sure your deployments are restarted to pick the latest version of the Dapr sidecar

Starting a fresh install on a cluster

Please see how to deploy Dapr on a Kubernetes cluster for a complete guide to installing Dapr on Kubernetes

You can use Helm 3 to install Dapr:

helm repo add dapr https://dapr.github.io/helm-charts/
helm repo update

kubectl create namespace dapr-system

helm install dapr dapr/dapr --version 1.13 --namespace dapr-system --wait

Alternatively, you can use the latest version of CLI:

dapr init --runtime-version=1.13 -k
Post installation

Verify the control plane pods are running and are healthy:

$ dapr status -k
  NAME                   NAMESPACE    HEALTHY  STATUS   REPLICAS  VERSION  AGE  CREATED
  dapr-sidecar-injector  dapr-system  True     Running  1         1.13   15s  2024-02-26 13:07.39
  dapr-sentry            dapr-system  True     Running  1         1.13   15s  2024-02-26 13:07.39
  dapr-operator          dapr-system  True     Running  1         1.13   15s  2024-02-26 13:07.39
  dapr-placement         dapr-system  True     Running  1         1.13   15s  2024-02-26 13:07.39

After Dapr 1.13 has been installed, perform a rolling restart for your deployments to pick up the new version of the sidecar.
This can be done with:

kubectl rollout restart deploy/<deployment-name>

Breaking Changes

  • The NATS Streaming PubSub component, which was deprecated in Dapr 1.11, has been removed. The NATS Streaming Server project has been deprecated since June 2023, and users are encouraged to switch to NATS JetStream and the corresponding Dapr PubSub component. components-contrib#3150
  • The deprecated RenameReminder methods have been removed from the Dapr Actor APIs and SDKs dapr#6711
  • The preview flag AppChannelAllowInsecureTLS feature flag has been removed. The Dapr app channel now requires TLS 1.2 or higher when TLS is enabled, and this behavior cannot be disabled dapr#7149
  • When terminating or stopping a Workflow, the default behavior has changed to cascade the action to child Workflows. Non-cascading termination/purge can be requested in the API call. dapr#7340 dotnet-sdk#1226
  • Components must now have a unique name across all component types dapr#7195
  • As part of the Richer Error Codes model change (dapr#7257, dapr#7322), a subset of the State and PubSub API errors has been updated to use an appropriate status code (ex. INVALID_ARGUMENT, FAILED_PRECONDITION) instead of the generic UNKNOWN

.NET SDK

Additional breaking changes for the Dapr .NET SDK:

  • Polymorphic Responses in Weakly-typed Actors in Dapr .NET SDK:
    • Description: The .NET 6 and .NET 8 targets of the Dapr .NET SDK have different serialization behavior of properties of a derived response object on an operation of a weakly-typed actor client.
    • Impact: Impacts users upgrading a consumer application to .NET 8 running Dapr 1.13 or later.
    • Root cause: In the .NET 6 target of the SDK, the actor runtime serializes the response object on an operation of a weakly-typed actor client using the runtime type of the response object. In the .NET 8 target of the SDK, the actor runtime serializes the response object using the base response type as declared on the operation on the actor interface.
    • Solution:
      For .NET 8, the developer must decorate the base response class that is declared on the operation on the actor interface with a JsonDerivedType attribute specifying the derived response class.
      Alternatively, a custom IJsonTypeInfoResolver implementation can be set on the JsonSerializerOptions.TypeInfoResolver property adding a JsonDerivedType instance to the JsonPolymorphismOptions.DerivedTypes property on the JsonTypeInfo.PolymorphismOptions property.
    • Notes:
      • While .NET 7 introduced polymorphic (de)serialization using JsonDerivedType attribute or JsonPolymorphismOptions on a custom IJsonTypeInfoResolver implementation, Dapr does not ship a .NET 7 target of the SDK. Hence, a .NET 7 consumer application uses the .NET 6 target of the Dapr SDK. Therefore, this breaking change only applies when upgrading a consumer application to .NET 8.
      • The new serialization behavior in the .NET 8 version of the SDK allows for polymorphic deserialization of the response by a weakly-typed actor client. This requires that the programmer specifies a typeDiscriminator on the JsonDerivedType attribute.

Polymorphic Responses in Weakly-typed Actors in Dapr .NET SDK

The .NET 6 and .NET 8 targets of the Dapr .NET SDK have different serialization behavior of properties of a derived response object on an operation of a weakly-typed actor client.

Impacts users upgrading a consumer application to .NET 8 running Dapr 1.13 or later.

Root Cause

In the .NET 6 target of the SDK, the actor runtime serializes the response object on an operation of a weakly-typed actor client using the runtime type of the response object.
In the .NET 8 target of the SDK, the actor runtime serializes the response object using the base response type as declared on the operation on the actor interface.

Solution

For .NET 8, the programmer must decorate the base response class that is declared on the operation on the actor interface with a JsonDerivedType attribute specifying the derived response class.

Alternatively, a custom IJsonTypeInfoResolver implementation can be set on the JsonSerializerOptions.TypeInfoResolver property adding a JsonDerivedType instance to the JsonPolymorphismOptions.DerivedTypes property on the JsonTypeInfo.PolymorphismOptions property.

Note that while .NET 7 introduced polymorphic (de)serialization using JsonDerivedType attribute or JsonPolymorphismOptions on a custom IJsonTypeInfoResolver implementation, Dapr does not ship a .NET 7 target of the SDK.
Hence, a .NET 7 consumer application uses the .NET 6 target of the Dapr SDK.
Therefore, this breaking change only applies when upgrading a consumer application to .NET 8.

Note that the new serialization behavior in the .NET 8 version of the SDK allows for polymorphic deserialization of the response by a weakly-typed actor client.
This requires that the programmer specifies a typeDiscriminator on the JsonDerivedType attribute.

Java SDK

  • UPDATED Project Reactor dependency & fix deprecated calls 816

Details

date
March 6, 2024, 2:28 a.m.
name
Dapr Runtime v1.13.0
type
Minor
👇
Register or login to:
  • 🔍View and search all dapr releases.
  • 🛠️Create and share lists to track your tools.
  • 🚨Setup notifications for major, security, feature or patch updates.
  • 🚀Much more coming soon!
Continue with GitHub
Continue with Google
or