Open jsaelmackers opened 2 years ago
Hello, we encounter the same problem here. Is there any workaround or something that we can do to debug our actor?
someone to fix it?
I am just now trying actors for the first time and thought that debugging was not possible by the way it behaved. Its good to know it did work before and this is an actual issue that might be fixed in the future. It was going to be a major sticking point and barrier to adoption if this was not the case. Has there been any news on this?
@jsaelmackers - I did try this and found that I also couldn't attach to a process to debug it. However, I've also never tried that really, so I can't speak to regressions.
However, I was able to start dapr separately and start the app with the debugger. That allowed me to step through the code, even for actors. Does that work for you? Or do you need the attach flow?
Unfortunately no since we use Tye to run all the components of our app and launches dapr as well. Tye has a debug option where it waits for debugger to attach before proceeding with startup, which is our usual avenue for debugging. I am holding out hope that a fix is found for this, otherwise I will have to resort to something like what you suggest to test actors.
@halspang - It would be great if you could explain a litlte bit more the attach flow.
Hi, in our case, we have service fabric actors, which we are unable to debug in Visual Studio when the actor project uses .NET 6. The error is very similar to that of yours when attached to the process:
"Failed to load metadata for ServiceFabric.Interfaces.IIntegrationActor_.actorV2.disp', possibly because the process is corrupt."
When targeting .NET 5, it is possible to debug.. Additionally, when targeting .NET 6 and attaching to the process and observing the output log, after all symbols have been loaded, there are several exceptions thrown of type: Exception thrown: 'System.ObjectDisposedException' in System.Net.Sockets.dll Exception thrown: 'System.IO.IOException' in System.Net.Sockets.dll
These are not thrown when targeting .NET 5. I have yet to figure out how or if these are connected to .NET 6 specifically.
Does .NET 6 debugging not work with actors in general?
From the linked Service Fabric issue, It appears to have been an issue with the .NET runtime itself, fixed in 6.0.12. With the latest .NET 6.0.22 (SDK 6.0.317), I'm able to debug actor implementations (e.g. using the Dapr Actors Quickstart) in Visual Studio 2022 (17.7.4).
@jsaelmackers Please let us know if you're continuing to see debugging issues.
What version of Dapr? Dapr Actors 1.5.0
Expected Behavior To be able to debug step by step when attaching the code to a process.
Actual Behavior Since we are targeting the net6.0 framework, it is no more possible to debug the code in Visual Studio 2022. Some error messages appears in the output console 'DaprActorService.exe' (CoreCLR: clrhost): Failed to load metadata for 'DaprActorContract.ICustomActor.actorV1.disp', possibly because the process is corrupt. 'DaprActorService.exe' (CoreCLR: clrhost): Failed to load metadata for 'DaprActorContract.ICustomActor.actorV1.mt', possibly because the process is corrupt. We get this when a breakpoint is hitting.
When clicking "Continue execution" the Actor doesn't crash, it is just not possible to debug step by step. It is working when targeting the net5.0 framework.
Steps to Reproduce the Problem In self-hosted mode,
launch Actor with the following command : pwsh.exe -Command "cd ..\src\DaprActorService; dapr run --app-id actor1 --app-port 5001 --dapr-http-port 55001 dotnet run" attach to process in visualstudio 2022 add a breakpoint invoke the actor through the actor proxy