Support for .NET 7 Dapr Actors on Apple Silicon (ARM)
See original GitHub issueExpected 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
- Fork my dapr-demo repository
- Upgrade all projects from .NET 6 to .NET 7
- Upgrade all projects to use C# 11 instead of C# 10
- Update all relevant Microsoft NuGet packages from 6.0.x to 7.0.x
- You can launch the project through the
docker-compose.yml
anddocker-compose.override.yml
or just simply setting it as the default launch project in Visual Studio - 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:
- Created 9 months ago
- Comments:14 (5 by maintainers)
Top GitHub Comments
@KrylixZA - Thanks for the detailed info. I’ll see if I can find someone with an M1 Mac to help me reproduce this.
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 ?