question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Support for .NET 7 Dapr Actors on Apple Silicon (ARM)

See original GitHub issue

Expected Behavior

When building from scratch or upgrading from .NET 6 to .NET 7 packages for dapr (1.9 at the time of writing), I had hoped that the Dapr SDK would continue working. I have a training/demo repository that I have created to learn and play with Dapr components in order to make educated decisions for an upcoming project for work. In this past week, one question that came past my desk was whether to use .NET 7 or .NET 6 for this new project. We understand the risks of not using an LTS version of .NET but we do feel the performance benefits and theoretical simple upgrade path to .NET 8 would be worth it. As such, I played with .NET 7 this week and found issues with our intended use case, specifically around Dapr Actors.

Actual Behavior

However, when I tried updating my ASP.NET 6 Web APIs to .NET 7 with C# 11 and started running into issues. My training repository leverages the following Dapr components:

  • Service-to-service invocation
  • Secrets management
  • State management
  • Pub/Sub
  • Actors

Of the above, it appeared that only Actors were impacted during the upgrade. Specifically, the issue lay when innovating an Actor’s method through the Actor proxy. Example code of the error I expected can be seen below (link):

public async Task CreateOrderAsync(Order order)
{
  _logger.LogDebug("CreateOrderAsync start. OrderId: {orderId}", order.OrderId);
  var actorId = new ActorId(order.OrderId.ToString());
  var orderActor = ActorProxy.Create<IOrderActor>(actorId, OrderActor.ActorType);
  await orderActor.CreateOrderAsync(order);
  _logger.LogDebug("CreateOrderAsync end. OrderId: {orderId}", order.OrderId);
}

Below is the stack trace of the error:

Dapr.Actors.ActorMethodInvocationException: Remote Actor Method Exception,  DETAILS: Exception: SerializationException, Method Name: ReadObjectHandleExceptions, Line Number: 0, Exception uuid: b26c0996-78f0-4d38-82da-7de0452f1cc8
---> Dapr.Actors.ActorInvokeException: There was an error deserializing the object of type WrappedMessageBody. The input source is not correctly formatted.
   --- End of inner exception stack trace ---
   at Dapr.Actors.DaprHttpInteractor.InvokeActorMethodWithRemotingAsync(ActorMessageSerializersManager serializersManager, IActorRequestMessage remotingRequestRequestMessage, CancellationToken cancellationToken)
   at Dapr.Actors.Communication.Client.ActorRemotingClient.InvokeAsync(IActorRequestMessage remotingRequestMessage, CancellationToken cancellationToken)
   at Dapr.Actors.Client.ActorProxy.InvokeMethodAsync(Int32 interfaceId, Int32 methodId, String methodName, IActorRequestMessageBody requestMsgBodyValue, CancellationToken cancellationToken)
   at OrderApi.Managers.OrderManager.CreateOrderAsync(Order order) in /Users/krylixza/git/dapr-demo/src/OrderApi/Managers/OrderManager.cs:line 31
   at OrderApi.Controllers.OrdersController.CreateOrderAsync(Order order) in /Users/krylixza/git/dapr-demo/src/OrderApi/Controllers/OrdersController.cs:line 42
   at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.TaskOfIActionResultExecutor.Execute(ActionContext actionContext, IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeActionMethodAsync>g__Awaited|12_0(ControllerActionInvoker invoker, ValueTask`1 actionResultValueTask)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeNextActionFilterAsync>g__Awaited|10_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Rethrow(ActionExecutedContextSealed context)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeInnerFilterAsync>g__Awaited|13_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeFilterPipelineAsync>g__Awaited|20_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeAsync>g__Awaited|17_0(ResourceInvoker invoker, Task task, IDisposable scope)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeAsync>g__Awaited|17_0(ResourceInvoker invoker, Task task, IDisposable scope)
   at Microsoft.AspNetCore.Routing.EndpointMiddleware.<Invoke>g__AwaitRequestTask|6_0(Endpoint endpoint, Task requestTask, ILogger logger)
   at Swashbuckle.AspNetCore.SwaggerUI.SwaggerUIMiddleware.Invoke(HttpContext httpContext)
   at Swashbuckle.AspNetCore.Swagger.SwaggerMiddleware.Invoke(HttpContext httpContext, ISwaggerProvider swaggerProvider)
   at Microsoft.AspNetCore.Authorization.AuthorizationMiddleware.Invoke(HttpContext context)
   at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context)
   at Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddlewareImpl.Invoke(HttpContext context)

 

HEADERS
=======
Accept: */*
Connection: keep-alive
Host: localhost:8000
User-Agent: PostmanRuntime/7.30.0
Accept-Encoding: gzip, deflate, br
Content-Type: application/json
Content-Length: 530
Postman-Token: a0fb12e8-33ca-460f-bce6-0d5d6632db2a

Steps to Reproduce the Problem

The simplest way to reproduce this error would be

  1. Fork my dapr-demo repository
  2. Upgrade all projects from .NET 6 to .NET 7
  3. Upgrade all projects to use C# 11 instead of C# 10
  4. Update all relevant Microsoft NuGet packages from 6.0.x to 7.0.x
  5. You can launch the project through the docker-compose.yml and docker-compose.override.yml or just simply setting it as the default launch project in Visual Studio
  6. Create an order using the CreateOrderAsync endpoint either through the Swagger UI which is opened upon launch (http://localhost:8000/swagger/index.html) or through the provided Postman collection and environment

Release Note

RELEASE NOTE:

Issue Analytics

  • State:open
  • Created 9 months ago
  • Comments:14 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
halspangcommented, Feb 28, 2023

@KrylixZA - Thanks for the detailed info. I’ll see if I can find someone with an M1 Mac to help me reproduce this.

1reaction
CormacLennoncommented, Jan 12, 2023

Encountering this issue as well after upgrading to .Net 7

“An unhandled exception has occurred while executing the request.”,“@i”:“48a46595”,“@l”:“Error”,“@x”:“Dapr.Actors.ActorMethodInvocationException: Remote Actor Method Exception, DETAILS: Exception: SerializationException, Method Name: ReadObjectHandleExceptions, Line Number: 0, Exception uuid: f9599da6-2797-4e68-adf7-940827e88421\r\n —> Dapr.Actors.ActorInvokeException: There was an error deserializing the object of type WrappedMessageBody. The input source is not correctly formatted”

Did you find a solution @KrylixZA ?

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to: Run and use virtual actors in the .NET SDK
The Dapr actor package allows you to interact with Dapr virtual actors from a .NET application. In this guide, you learn how to:...
Read more >
Dapr actors .NET SDK
With the Dapr actor package, you can interact with Dapr virtual actors from a .NET application. To get started, walk through the Dapr...
Read more >
.NET development on Apple Silicon
NET development tools for Windows don't play nicely with an ARM architecture. Currently, the best option is to use Visual Studio 2022 Preview...
Read more >
The first preview of .NET 6 is now live: Here's what you ...
Microsoft has released .NET 6 Preview 1. It comes with a bunch of features including support for Apple Silicon, Blazor, Mult-platform App UI ......
Read more >
Problem installing with dotnet on M1 MacOS architecture
Hello. I have installed : dotnet-sdk-3.1.417-osx-x64.pkg on a MAC mini M1 arm64 and I have the following issue when I run dotnet :...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found