debug problem (UI) ...

F

Frank Uray

Hi all

I have a little problem with debugging ...
I have build a application (MDI Container) with plugins,
and now, for some reason, after about 1h the applications
hangs, without error message ...

I have tried to debug in visual studio (attach process)
and I have seen the application is still running,
it seams just the GUI is blocked ...
But also when debugging, there is no exception rised ... ???

How can I find out what is happening ??
Any ideas?

Thanks for any comments

Frank Uray
 
I

Ignacio Machin ( .NET/ C# MVP )

Hi all

I have a little problem with debugging ...
I have build a application (MDI Container) with plugins,
and now, for some reason, after about 1h the applications
hangs, without error message ...

Define "hangs", also check what is the app doing when it happens
 
J

jp2msft

What do the plug-ins do? Are they COM objects? Maybe they are the cause.
Does your app have issues if the plug-in section of the code is commented
out?
 
F

Frank Uray

Hi

No, the PlugIns do not use COM,
but some of them are using Form.Invoke .

I am guessing there is a problem in one of the PlugIns,
but the question is, how can I find such errors ???

Best regards
Frank Uray
 
J

jp2msft

My best advice would be to start dropping try...catch routines all through
your code:

try {
// code
} catch (Exception err) {
MessageBox.Show(err.ToString(), "Error at Line X"); // fill in the X
}

The ToString() method should tell you the line number (if you are in debug
mode) where the error occurred.

Start by making your try...catch routines encompass large sections of your
code, then narrow them down to smaller and smaller sections as you get your
bugs eliminated.

Personally, I even keep a try...catch block covering my main function:

[STAThread]
static void Main() {
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
try {
Application.Run(new Form1());
} catch (Exception err) {
MessageBox.Show(err.ToString(), "Main() Error");
}
}
 
F

Frank Uray

Hello

Thanks again for your answer.

I have tried this try-catch within the main,
but it does not help, still the same problem ... :-((

The GUI is blocked, but I am able to debug (attach to process)
the application ... ??

Best regards
Frank Uray


jp2msft said:
My best advice would be to start dropping try...catch routines all through
your code:

try {
// code
} catch (Exception err) {
MessageBox.Show(err.ToString(), "Error at Line X"); // fill in the X
}

The ToString() method should tell you the line number (if you are in debug
mode) where the error occurred.

Start by making your try...catch routines encompass large sections of your
code, then narrow them down to smaller and smaller sections as you get your
bugs eliminated.

Personally, I even keep a try...catch block covering my main function:

[STAThread]
static void Main() {
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
try {
Application.Run(new Form1());
} catch (Exception err) {
MessageBox.Show(err.ToString(), "Main() Error");
}
}


Frank Uray said:
Hi

No, the PlugIns do not use COM,
but some of them are using Form.Invoke .

I am guessing there is a problem in one of the PlugIns,
but the question is, how can I find such errors ???

Best regards
Frank Uray
 
A

Adam Benson

Not too sure what your app does so this may or may not be useful, but given
the symptoms you describe check for threads other than the UI thread trying
to perform UI operations.

If you can get a stack trace of all your threads and you see threads other
than the UI thread stuck in a UI call that's a dead give away. This can be
caused, for example, by an event handler enabling \ disabling a button or
control on the front end. If the handler is called, let's say, in response
to a network event then it will be raised on a non-UI thread. If it doesn't
marshall itself to the UI thread your app's going to hang.

HTH,

Adam.
 
J

jp2msft

Hi Frank,

How exactly are you debugging? When I see "the GUI is blocked, but I am able
to debug" ...I get lost.

Are you stepping through your code in Visual Studio or are you using some
other programming tool?

Frank Uray said:
Hello

Thanks again for your answer.

I have tried this try-catch within the main,
but it does not help, still the same problem ... :-((

The GUI is blocked, but I am able to debug (attach to process)
the application ... ??

Best regards
Frank Uray


jp2msft said:
My best advice would be to start dropping try...catch routines all through
your code:

try {
// code
} catch (Exception err) {
MessageBox.Show(err.ToString(), "Error at Line X"); // fill in the X
}

The ToString() method should tell you the line number (if you are in debug
mode) where the error occurred.

Start by making your try...catch routines encompass large sections of your
code, then narrow them down to smaller and smaller sections as you get your
bugs eliminated.

Personally, I even keep a try...catch block covering my main function:

[STAThread]
static void Main() {
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
try {
Application.Run(new Form1());
} catch (Exception err) {
MessageBox.Show(err.ToString(), "Main() Error");
}
}


Frank Uray said:
Hi

No, the PlugIns do not use COM,
but some of them are using Form.Invoke .

I am guessing there is a problem in one of the PlugIns,
but the question is, how can I find such errors ???

Best regards
Frank Uray

:

What do the plug-ins do? Are they COM objects? Maybe they are the cause.
Does your app have issues if the plug-in section of the code is commented
out?

Hi all

I have a little problem with debugging ...
I have build a application (MDI Container) with plugins,
and now, for some reason, after about 1h the applications
hangs, without error message ...

I have tried to debug in visual studio (attach process)
and I have seen the application is still running,
it seams just the GUI is blocked ...
But also when debugging, there is no exception rised ... ???

How can I find out what is happening ??
Any ideas?

Thanks for any comments

Frank Uray
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top