Breakpoints not hit when C# application called from external program RRS feed

  • Question

  • I am able to call C# methods successfully from Robot Framework using IronPython however I am facing few runtime errors on the C# side which I want to debug using Visual Studio. Is there a way to debug C# application using Visual Studio when its method invoked through external program/script?

    I have configured my C# project in Visual Studio using Start External Program (provided the robot executable path and arguments as required by external program). When I started debugging then my external program executes as expected with C# methods also executed successfully. However breakpoints which I have set in the Visual Studio doesn't get hit. 

    Is there any specifics I am missing while using Start External Program? My python script (external program) is importing DLL from same location where it’s getting generated while building C# project. PDB files also available in the same folder as DLL.
    Wednesday, July 24, 2019 11:17 AM

All replies

  • In general setting the external program is the correct solution. However this is relying on the external program not doing something odd like copying your binary and putting it elsewhere to run it. If it does that then the debugger wouldn't be able to track it.

    Are you sure your DLL is actually being loaded and that the breakpoint would actually get hit? Maybe the runtime error is because it isn't.

    An alternative approach to starting the program for VS is adding a Debug.Assert line into the called code. When the Assert gets hit it pops up a dialog that allows you to attach to the running code with a debugger. You can attach this way.

    Yet another alternative is to start the external program and then use VS to Attach to Process on it. Then you can debug code as well.

    Michael Taylor

    Wednesday, July 24, 2019 2:10 PM
  • Thanks for your response. I am able to find out the reason for my case. Reason is I am not attaching the correct process. Let me explain in brief.

    As I mentioned in my post that I am calling C# methods from Robot Framework using IronPython. I have used robot.exe (Robot Framework executable) as my external program (in the Visual Studio) and I expect my breakpoints to be hit under C# project. However the issue is that C# method is executed by ipy.exe (Iron Python). It looks like Robot Framework starts ipy.exe process internally during execution and through ipy process C# methods get invoked. That means I have to attach ipy.exe process to my C# project so that control will come to Visual Studio whenever breakpoints hit.

    I have inserted Debug.Assert in my C# code to halt the execution. Then I have started my external program (Robot Framework Test Case) and during execution message box appears due to Debug.Assert statement in the C# project. At this moment I attached ipy.exe(Iron Python) process to my C# project using Visual Studio. Afterwards when I went ahead with code execution by ignoring the message box then control comes to Visual Studio.

    Thursday, July 25, 2019 4:26 AM
  • Hi mailtogagan,

    I am glad to hear that you got it working.

    Thank you for sharing the solutions here. It will be beneficial for other community members who have similar questions.

    Best Regards,


    MSDN Community Support Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact

    Friday, July 26, 2019 3:18 AM