473,788 Members | 2,855 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 1342
On Apr 24, 12:59 pm, Lubomir <Lubo...@discus sions.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 .CheckForIllega lCrossThreadCal ls=false;

to see if that is the probelm..
Jun 27 '08 #2
"parez" wrote:
On Apr 24, 12:59 pm, Lubomir <Lubo...@discus sions.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 .CheckForIllega lCrossThreadCal ls=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...@discus sions.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 .CheckForIllega lCrossThreadCal ls=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
5519
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... -- John Wood Blog: http://spaces.msn.com/members/johnwood/
2
1223
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. The modules are conceptually the same. They contain mostly data but some processing to get data. The app knows nothing about how they get the data. Just that they return data in a starndard format. The argument is based on 12 apps vs. 1 multi...
1
2859
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, and try to step-over a line of code, my thread aborts and pretty much breaks my application. I tried a similar test in a console application and it seems to work fine. Here is a sample to show what I mean. Create a new Windows application...
6
2278
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 New Thread(AddressOf DoSomethingSub) t.IsBackground = True t.Start()
35
4044
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? I've been leaning towards threads, I'm going to say why. Processes seem fairly expensive from my research so far. Each fork copies the entire contents of memory into the new process. There's also a more expensive context switch between...
2
1988
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 = fork();
4
5806
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 contains .Net functions wrapped in C++ (as described by Paul DiLascia -- see http://msdn.microsoft.com/msdnmag/issues/06/06/CAtWork/default.aspx). Both DLLs specify 'Use MFC in a shared DLL'. Since we have an old VC 6 application (large) that we...
5
966
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 or program has running? Part of my code is: ***************************************************************************** Protected Overrides Sub OnStart(ByVal args() As String) Dim oCredit1 As New CreditProcessor
3
1726
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 found that, according to the threads window, there were four Win32 threads in my program! I had no idea where these had come from, and was rather worried about what they were doing. I found that the threads were only there in programs that used...
0
9498
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10370
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10113
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
6750
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5402
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5538
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4074
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3677
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2896
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.