c# – Python debugging in visual studio 2022 with automatic managed proccess connection
I am creating application where python scripts use C# libraries via pythonnet (pythonnet) and I need to be able debug theese c# libraries which are called via pythonnet. When I start python project in visual studio I can see that following processes are started.
Processes in Visual studio debugger processes
Problem is that I am unable hit breakpoint in C# code when pythonet executes it automatically. But if I start the python project using command line I am than able to attach visual studio debugger to the red (Managed) python process manually using Debug -> AttachToProcess as it is shown in the picture above. When python process is started 2 python processes are created Managed and Native and debugger is by default attached to the Native one, but I need to somehow automatically connect to the Managed and I dont want to use Wrapper which will find current instance of Visual Studio and than start python process and connects to it automatically. I want to everything is done automatically when press F5.
Steps I need to automate and somehow connect to start debugging (F5) are described here in the mixed mode debugging ad. 4 point a-d.
Please, is there any way how to achieve this?
Read more here: Source link
