man-group / dapr-sidekick-dotnet

Dapr Sidekick for .NET - a lightweight lifetime management component for Dapr
Apache License 2.0
175 stars 21 forks source link

Support Visual Studio 2022 Preview #27

Closed tmech closed 2 years ago

tmech commented 2 years ago

Describe the feature

First things first: I love the intent and the design of this integration. Well done!

I spent a few hours trying to get an existing Dapr based actor system to debug in Visual Studio 2022 after playing with the DaprSidekick samples. It didn't occur to me that VS could be the problem because the logs looked identical up to the point where I tried to call one of my actor methods. It failed with an address not found error "ERR_ACTOR_INVOKE_METHOD error invoke actor method: error finding address for actor type MarketActor with id US". The health checks were also not firing which may indicate something is not getting hooked up in the same way as in VS2019.

The services.AddActor calls were executed, apparently successfully. When I tried the same solution in VS2019, I got a number of DI errors during F5 that I did not get in VS2022. Fixing the DI error did not change the behavior in VS2022. This issue reproduces with the Actor sample in your repo, so I didn't provide a link to my own repo.

Release Note

RELEASE NOTE: DaprSideKick-Actors-VS22-Error.log

badgeratu commented 2 years ago

Before we take a look at this, could you please see if the problem occurs without using Sidekick i.e. launching your application in the "classic" way using "dapr run" and with Sidekick disabled or removed. Just to determine if the issue is with the official Dapr SDK rather than Sidekick.

badgeratu commented 2 years ago

Just to let you know I tried this today with the VS2022 Preview 5 and default dapr init setup with Dapr 1.4.2, and our ActorSample worked out of the box with no errors. Here's the output:

19:01:22.055 [DBG] [Man.Dapr.Sidekick.DaprSidecarHost]  placement order received: lock
19:01:22.059 [DBG] [Man.Dapr.Sidekick.DaprSidecarHost]  placement order received: update
19:01:22.061 [INF] [Man.Dapr.Sidekick.DaprSidecarHost]  placement tables updated, version: 1
19:01:22.063 [DBG] [Man.Dapr.Sidekick.DaprSidecarHost]  placement order received: unlock
19:01:41.329 [INF] [DaprDemoActor.DemoActor] ["ActorType: DemoActor, ActorId: abc, MethodName: SaveData"] This is Actor id abc with data PropertyA: ValueA, PropertyB: ValueB.
19:01:41.612 [INF] [DaprDemoActor.DemoActor]  This is Actor id abc with data PropertyA: ValueA, PropertyB: ValueB.
19:01:44.722 [DBG] [Man.Dapr.Sidekick.DaprSidecarHost]  executing timer TestTimer for actor type DemoActor with id abc
19:01:44.747 [INF] [DaprDemoActor.DemoActor] ["ActorType: DemoActor, ActorId: abc, TimerName: TestTimer"] Timer parameter1: 100
19:01:44.814 [INF] [DaprDemoActor.DemoActor] ["ActorType: DemoActor, ActorId: abc, TimerName: TestTimer"] Timer parameter2: timer test
19:01:46.017 [DBG] [Man.Dapr.Sidekick.DaprSidecarHost]  executing reminder TestReminder for actor type DemoActor with id abc
19:01:47.724 [DBG] [Man.Dapr.Sidekick.DaprSidecarHost]  executing timer TestTimer for actor type DemoActor with id abc
19:01:47.724 [INF] [DaprDemoActor.DemoActor] ["ActorType: DemoActor, ActorId: abc, TimerName: TestTimer"] Timer parameter1: 100
19:01:47.776 [INF] [DaprDemoActor.DemoActor] ["ActorType: DemoActor, ActorId: abc, TimerName: TestTimer"] Timer parameter2: timer test
19:01:47.874 [INF] [Man.Dapr.Sidekick.DaprSidecarHost]  timer DemoActor||abc||TestTimer with parameters: dueTime: 0h0m3s0ms, period: 0h0m3s0ms, TTL: , data: eyJJbnRQYXJhbSI6MTAwLCJTdHJpbmdQYXJhbSI6InRpbWVyIHRlc3QifQ== has been deleted.
19:01:47.891 [INF] [Man.Dapr.Sidekick.DaprSidecarHost]  Found reminder with key: DemoActor||abc||TestReminder. Deleting reminder
19:01:47.902 [INF] [Man.Dapr.Sidekick.DaprSidecarHost]  reminder TestReminder with parameters: dueTime: 2021-10-14T19:01:46+01:00, period: 0h0m5s0ms, data:  has been deleted.
19:01:49.505 [DBG] [Man.Dapr.Sidekick.DaprSidecarHost]  Refreshing all mDNS addresses.
19:01:49.508 [DBG] [Man.Dapr.Sidekick.DaprSidecarHost]  no mDNS apps to refresh.

Are you still getting the same problem?

badgeratu commented 2 years ago

Closing as tested successfully with VS2022 Preview 5