I've finally found the cause of the problem.
I host a chromium embedded browser (CefSharp) inside my application to integrate the debugger inside the application.
When a UI event which is bound to a script function is triggered and if there is a breakpoint in that function, the UI of the application freezes until the execution is resumed in the debugger.
Since the debugger interface is IN MY APPLICATON, I do not have the chance to resume the script because my UI is frozen and this gives me a frozen application.
When I run the debugger interface in an external Chrome instance, the Winforms application is frozen again when the breakpoint is hit but since I can click the resume button in the external interface I can unfreeze the app.
Can you imagine of a coding trick to overcome this problem?
As I wrote before I have the following "calling a delegate function in a new thread" option but this makes the code complicated and hard to maintain.
I host a chromium embedded browser (CefSharp) inside my application to integrate the debugger inside the application.
When a UI event which is bound to a script function is triggered and if there is a breakpoint in that function, the UI of the application freezes until the execution is resumed in the debugger.
Since the debugger interface is IN MY APPLICATON, I do not have the chance to resume the script because my UI is frozen and this gives me a frozen application.
When I run the debugger interface in an external Chrome instance, the Winforms application is frozen again when the breakpoint is hit but since I can click the resume button in the external interface I can unfreeze the app.
Can you imagine of a coding trick to overcome this problem?
As I wrote before I have the following "calling a delegate function in a new thread" option but this makes the code complicated and hard to maintain.
public delegate void FormEvent(string eventName, object sender, EventArgs e);
private FormEvent callbacks;
public void RegisterToFormEvents(FormEvent eventHandler)
{
callbacks += eventHandler;
}
private void MainForm_Resize(object sender, EventArgs e)
{
new Thread(() =>
{
if (callbacks != null)
callbacks("Resize", sender, e);
}).Start();
}