There are two approaches, one I have used for years with dotnet when I want to debug something that is challenging to get a debugger attached – think apps which spawn other processes and they fail in the startup routine. You can add a
Debugger.Launch()to your program then when spark executes it, a prompt will be displayed and you can attach Visual Studio to your program. (as an aside I used to do this manually a lot by writing an
__asm int 3into an app to get it to break at an appropriate point, great memories but we don’t need to do that anymore luckily :).
The second approach is to start the spark-dotnet driver in debug mode which instead of launching your app, it starts and listens for incoming requests – you can then run your program as normal (f5), set a breakpoint and your breakpoint will be hit.
Read on to see how it’s done, as well as a possibly-accidental benefit to this.