472,951 Members | 2,561 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,951 software developers and data experts.

Threads debugging

Hi,

I have the folloving code:

Public class MyForm : Form
{
……
void SomeMethod()
{
a = new Obj1(this);
Thread t = new Thread( new ThreadStart( a.CallMethod ) );
t.Start();
}
}
Class Obj1
{
Public Obj1(Form myForm)
{
parent = myForm;
}
Public void CallMethod()
{

if (parent != null) //// so far debugging is OK
{
Do something
}

Process.Start(...) //Run a process (external exe file)
....
if (parent != null) //// =Debugger will hang
{
Do something
}
}

The debugger will either hang out on the second occurence of "if (parent !=
null)" or sometimes it seems like it goes through but doesn't stop on any
futher break point. When I run it wthout a debugger, everything is OK.

I am debugging form a Vista 64 bit machine, and application (32 bits) is
running on virtual machine VMWare, Vista 32. I am attaching debugger to the
process while debugging.

Why I can not debugging it?

Thanks,
Lubomir
Jun 27 '08 #1
3 1318
On Apr 24, 12:59 pm, Lubomir <Lubo...@discussions.microsoft.com>
wrote:
Hi,

I have the folloving code:

Public class MyForm : Form
{

void SomeMethod()
{
a = new Obj1(this);
Thread t = new Thread( new ThreadStart( a.CallMethod ) );
t.Start();
}

}

Class Obj1
{
Public Obj1(Form myForm)
{
parent = myForm;
}

Public void CallMethod()
{

if (parent != null) //// so far debugging is OK
{
Do something
}

Process.Start(...) //Run a process (external exe file)
....
if (parent != null) //// =Debugger will hang
{
Do something
}

}

The debugger will either hang out on the second occurence of "if (parent !=
null)" or sometimes it seems like it goes through but doesn't stop on any
futher break point. When I run it wthout a debugger, everything is OK.

I am debugging form a Vista 64 bit machine, and application (32 bits) is
running on virtual machine VMWare, Vista 32. I am attaching debugger to the
process while debugging.

Why I can not debugging it?

Thanks,
Lubomir

I think when you try to access the form from a different thread , it
does not like it...

try this
MyForm .CheckForIllegalCrossThreadCalls=false;

to see if that is the probelm..
Jun 27 '08 #2
"parez" wrote:
On Apr 24, 12:59 pm, Lubomir <Lubo...@discussions.microsoft.com>
wrote:
Hi,

I have the folloving code:

Public class MyForm : Form
{
……
void SomeMethod()
{
a = new Obj1(this);
Thread t = new Thread( new ThreadStart( a.CallMethod ) );
t.Start();
}

}

Class Obj1
{
Public Obj1(Form myForm)
{
parent = myForm;
}

Public void CallMethod()
{

if (parent != null) //// so far debugging is OK
{
Do something
}

Process.Start(...) //Run a process (external exe file)
....
if (parent != null) //// =Debugger will hang
{
Do something
}

}

The debugger will either hang out on the second occurence of "if (parent !=
null)" or sometimes it seems like it goes through but doesn't stop on any
futher break point. When I run it wthout a debugger, everything is OK.

I am debugging form a Vista 64 bit machine, and application (32 bits) is
running on virtual machine VMWare, Vista 32. I am attaching debugger to the
process while debugging.

Why I can not debugging it?

Thanks,
Lubomir


I think when you try to access the form from a different thread , it
does not like it...

try this
MyForm .CheckForIllegalCrossThreadCalls=false;

to see if that is the probelm..
It is the same even when I pass null instead of "this".

Jun 27 '08 #3
Could you provide details of the process start call. Are you redirecting
output or anthing that will stop the process finishing. Maybe that is the
cause of the hang
--
Ciaran O''Donnell
http://wannabedeveloper.spaces.live.com
"Lubomir" wrote:
"parez" wrote:
On Apr 24, 12:59 pm, Lubomir <Lubo...@discussions.microsoft.com>
wrote:
Hi,
>
I have the folloving code:
>
Public class MyForm : Form
{
……
void SomeMethod()
{
a = new Obj1(this);
Thread t = new Thread( new ThreadStart( a.CallMethod ) );
t.Start();
}
>
}
>
Class Obj1
{
Public Obj1(Form myForm)
{
parent = myForm;
}
>
Public void CallMethod()
{

if (parent != null) //// so far debugging is OK
{
Do something
}
>
Process.Start(...) //Run a process (external exe file)
....
if (parent != null) //// =Debugger will hang
{
Do something
}
>
}
>
The debugger will either hang out on the second occurence of "if (parent !=
null)" or sometimes it seems like it goes through but doesn't stop on any
futher break point. When I run it wthout a debugger, everything is OK.
>
I am debugging form a Vista 64 bit machine, and application (32 bits) is
running on virtual machine VMWare, Vista 32. I am attaching debugger to the
process while debugging.
>
Why I can not debugging it?
>
Thanks,
Lubomir

I think when you try to access the form from a different thread , it
does not like it...

try this
MyForm .CheckForIllegalCrossThreadCalls=false;

to see if that is the probelm..

It is the same even when I pass null instead of "this".
Jun 27 '08 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: John Wood | last post by:
Does anyone know how to enumerate the managed threads in the current process? Process.Threads gives you a list of ProcessThreads, but I want to somehow get a list of the managed threads... --...
2
by: Brett | last post by:
Let's say some one makes the argument that instead of multi threading an application, they say it's better just to make multiple applications. The app does the same thing for different modules. ...
1
by: rwaddell | last post by:
I'm using Visual Studio 2005 Pro final, and I've noticed some bizarre behaviour when I'm debugging programs with multiple threads. Specifically, if I set a breakpoint in one of my non-UI threads,...
6
by: BogusException | last post by:
I'll ask a simple question: How can someone generate any number of threads from within a simple "for" ot Timer loop/sub (including indefinitely)? Dim i As Integer For i = 1 To 10 Dim t As...
35
by: Carl J. Van Arsdall | last post by:
Alright, based a on discussion on this mailing list, I've started to wonder, why use threads vs processes. So, If I have a system that has a large area of shared memory, which would be better? ...
2
by: sunil | last post by:
Hi All, I am tring to debug the following program.I written this program in HP-Unix and I am using the GDB as a debugger. #include <stdio.h> #include<unistd.h> int main() { int pid; pid =...
4
by: Al Norman | last post by:
We have two separate DLLs that do not interact (directly, at least). One is an MFC extension DLL that was built back in VC++ 6 days (but has been recompiled with VS2005). The other is a DLL that...
5
by: tshad | last post by:
I am writing a Service that will start up some threads and I am trying to find a way to tell if the threads are still running or not? Is there a good program that will show that threads a service...
3
by: =?Utf-8?B?cm9iaW50dw==?= | last post by:
Hi, While debugging my application I have noticed that occasionally a message saying "Win32 Thread xxxx exited with code 0 (0x0)" appearing in the debug window. I investigated this some more and...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Sept 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
2
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 4 Oct 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
tracyyun
by: tracyyun | last post by:
Hello everyone, I have a question and would like some advice on network connectivity. I have one computer connected to my router via WiFi, but I have two other computers that I want to be able to...
2
by: giovanniandrean | last post by:
The energy model is structured as follows and uses excel sheets to give input data: 1-Utility.py contains all the functions needed to calculate the variables and other minor things (mentions...
4
NeoPa
by: NeoPa | last post by:
Hello everyone. I find myself stuck trying to find the VBA way to get Access to create a PDF of the currently-selected (and open) object (Form or Report). I know it can be done by selecting :...
3
by: nia12 | last post by:
Hi there, I am very new to Access so apologies if any of this is obvious/not clear. I am creating a data collection tool for health care employees to complete. It consists of a number of...
0
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be focusing on the Report (clsReport) class. This simply handles making the calling Form invisible until all of the Reports opened by it have been closed, when it...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.