hello,
I encounter a problem using threads. I have a simple code to use a thread :
cSurveillanceBorne = New clsThreadSurveillance
_SurveillanceThread = New Thread(AddressOf cSurveillanceBorne.SurveilleBorne)
_SurveillanceThread.Start()
This code work perfectly on my workstation. I use Visual Studio 2003, and
the CLR version is 1.1.4322.573
But when, i copy this assembly on another workstation that have only the
redistribuable CLR, the thread doesn't start !!! The only difference i have
noted is :
- CLR version is 1.1.4322.2032 on the other workstation
- Visual Studio is not installed
I'm a bit disappointed, and have tried some different way to lauch my
thread, but without success. I will be great if someone coul help...
kind regards,
--
Thanks,
Cedric 6 1997
what does your thread do? does it rely on external resources. i'm pretty
sure the thread starts, it probably dies with an exception. put another way,
i've never seen a thread not start when it wasn't due to program logic error
--
Regards,
Alvin Bruney
[Shameless Author Plug]
The Microsoft Office Web Components Black Book with .NET
available at www.lulu.com/owc
_________________________
"cedric" <ch****@online.nospam> wrote in message
news:A7**********************************@microsof t.com... hello,
I encounter a problem using threads. I have a simple code to use a thread :
cSurveillanceBorne = New clsThreadSurveillance _SurveillanceThread = New Thread(AddressOf cSurveillanceBorne.SurveilleBorne) _SurveillanceThread.Start()
This code work perfectly on my workstation. I use Visual Studio 2003, and the CLR version is 1.1.4322.573
But when, i copy this assembly on another workstation that have only the redistribuable CLR, the thread doesn't start !!! The only difference i have noted is : - CLR version is 1.1.4322.2032 on the other workstation - Visual Studio is not installed
I'm a bit disappointed, and have tried some different way to lauch my thread, but without success. I will be great if someone coul help...
kind regards, -- Thanks,
Cedric
Hello Alvin,
Thanks for your help. The thread is a loop, it just ping an IP address at a
fixed interval. I have put a messagebox as first instruction of the thread ,
and it doesn't display. I've tried a Try..Catch block for the
_SurveillanceThread.Start(), but there is'nt error !
I will try to delete all the code of the thread, just let the messagebox,
and will post back the results.
"Alvin Bruney [ASP.NET MVP]" wrote: what does your thread do? does it rely on external resources. i'm pretty sure the thread starts, it probably dies with an exception. put another way, i've never seen a thread not start when it wasn't due to program logic error
-- Regards, Alvin Bruney [Shameless Author Plug] The Microsoft Office Web Components Black Book with .NET available at www.lulu.com/owc _________________________
"cedric" <ch****@online.nospam> wrote in message news:A7**********************************@microsof t.com... hello,
I encounter a problem using threads. I have a simple code to use a thread :
cSurveillanceBorne = New clsThreadSurveillance _SurveillanceThread = New Thread(AddressOf cSurveillanceBorne.SurveilleBorne) _SurveillanceThread.Start()
This code work perfectly on my workstation. I use Visual Studio 2003, and the CLR version is 1.1.4322.573
But when, i copy this assembly on another workstation that have only the redistribuable CLR, the thread doesn't start !!! The only difference i have noted is : - CLR version is 1.1.4322.2032 on the other workstation - Visual Studio is not installed
I'm a bit disappointed, and have tried some different way to lauch my thread, but without success. I will be great if someone coul help...
kind regards, -- Thanks,
Cedric
Hello Again,
I found why the thread wasn't starting. In fact, you put me on the way
alvin. With a simple messagebox the thread was starting. What is very
confusing, is that when an error produce in a thread, the thread doesn't fire
any error, so it's very difficult to debug.
I have put the faulty code in a simple method, and what was my surprise when
an error displayed me that it can't found Microsoft.VB6 compatibility library
! My thread was using VB6.GetPath, and it work perfectly on my workstation,
but just doesn't work on the other because the version of this library is not
the same.
So i'm a bit disappointed, i thought that DLL hell was finished with the
framework DotNet, but not ! Should i have to include all the framework DLL
that i import in my project when i install it on another PC, or there is an
easier way by configuring a config file ?
Thanks,
Cedric
"cedric" wrote: Hello Alvin,
Thanks for your help. The thread is a loop, it just ping an IP address at a fixed interval. I have put a messagebox as first instruction of the thread , and it doesn't display. I've tried a Try..Catch block for the _SurveillanceThread.Start(), but there is'nt error !
I will try to delete all the code of the thread, just let the messagebox, and will post back the results.
"Alvin Bruney [ASP.NET MVP]" wrote:
what does your thread do? does it rely on external resources. i'm pretty sure the thread starts, it probably dies with an exception. put another way, i've never seen a thread not start when it wasn't due to program logic error
-- Regards, Alvin Bruney [Shameless Author Plug] The Microsoft Office Web Components Black Book with .NET available at www.lulu.com/owc _________________________
"cedric" <ch****@online.nospam> wrote in message news:A7**********************************@microsof t.com... hello,
I encounter a problem using threads. I have a simple code to use a thread :
cSurveillanceBorne = New clsThreadSurveillance _SurveillanceThread = New Thread(AddressOf cSurveillanceBorne.SurveilleBorne) _SurveillanceThread.Start()
This code work perfectly on my workstation. I use Visual Studio 2003, and the CLR version is 1.1.4322.573
But when, i copy this assembly on another workstation that have only the redistribuable CLR, the thread doesn't start !!! The only difference i have noted is : - CLR version is 1.1.4322.2032 on the other workstation - Visual Studio is not installed
I'm a bit disappointed, and have tried some different way to lauch my thread, but without success. I will be great if someone coul help...
kind regards, -- Thanks,
Cedric
Hi Cedric,
First of all, I would like to confirm my understanding of your issue. From
your description, I understand that one of your thread is terminated with
an exception. If there is any misunderstanding, please feel free to let me
know.
As Alvin mentioned, when an exception is thrown by the sub thread, the main
thread will not be aware of it and the sub thread is terminated. We can
only get known of it in the appdomain. Try to add the following code:
static void Main()
{
AppDomain.CurrentDomain.UnhandledException +=new
UnhandledExceptionEventHandler(CurrentDomain_Unhan dledException);
Application.Run(new Form1());
}
private static void CurrentDomain_UnhandledException(object sender,
UnhandledExceptionEventArgs e)
{
MessageBox.Show("Exception thrown");
}
I see that you are using the VB6 code in you VB.NET project. It might be
the cause of the exception, because these methods doesn't exist in .NET
framework and need to interop with unmanaged DLLs. So you might need to
redistribute these DLLs with your app.
Could you let me know what you're trying to do with the VB6 code, so that I
can find an equivalent way using .NET class library to achieve that. Could
you please provide me with the thread code? Thanks!
Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."
Hello Kevin,
Thanks for your help. Sorry for the multi-posting, the first time, my
browser return me that there were a problem with my request, so i clicked
twice... You're right, my thread was terminated with an exception. Thanks for
your snippet, i will add this to my code in order to handle sub Thread errors
now.
I was using "VB6.GetPath" from Microsoft.VisualBasic.Compatibility.dll, in
order to get the path where the app is installed. I have replaced it by
"Application.StartupPath". I'm not sure it's the same (because startup path
may not be the same as the application path), but it seems to work.
The problem was, that Microsoft.VisualBasic.Compatibility.dll is present in
the CLR of my workstation, but not on the other one. So without the DLL, no
way to work :) What i don't understand is why this dll is not present in the
other framework. I use Visual Studio, and maybe it adds some dll, that the
redistribuable framework don't include...
Thanks,
Cedric
"Kevin Yu [MSFT]" wrote: Hi Cedric,
First of all, I would like to confirm my understanding of your issue. From your description, I understand that one of your thread is terminated with an exception. If there is any misunderstanding, please feel free to let me know.
As Alvin mentioned, when an exception is thrown by the sub thread, the main thread will not be aware of it and the sub thread is terminated. We can only get known of it in the appdomain. Try to add the following code:
static void Main() { AppDomain.CurrentDomain.UnhandledException +=new UnhandledExceptionEventHandler(CurrentDomain_Unhan dledException); Application.Run(new Form1()); }
private static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e) { MessageBox.Show("Exception thrown"); }
I see that you are using the VB6 code in you VB.NET project. It might be the cause of the exception, because these methods doesn't exist in .NET framework and need to interop with unmanaged DLLs. So you might need to redistribute these DLLs with your app.
Could you let me know what you're trying to do with the VB6 code, so that I can find an equivalent way using .NET class library to achieve that. Could you please provide me with the thread code? Thanks!
Kevin Yu ======= "This posting is provided "AS IS" with no warranties, and confers no rights."
Hi Cedric,
Yes, you can use Application.StartupPath for an equivalence. As I
know,Microsoft.VisualBasic.Compatibility.dll is installed with Visual
Studio .NET. It is used by VB6 upgrade wizard, and is not a part of .NET
framework. So it's better to use a .NET framework method to achieve this.
HTH.
Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights." This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Bruce Bon |
last post by:
The class below is intended to play a Sun audio file (.au) in the
background while the main thread, which is servicing a GUI, continues
without impact. It doesn't work. For a sound file that...
|
by: phil |
last post by:
And sorry I got ticked, frustrating week
>And I could help more, being fairly experienced with
>threading issues and race conditions and such, but
>as I tried to indicate in the first place,...
|
by: Charles Law |
last post by:
Hi guys. I'm back on the threading gig again.
It's the age-old question about waiting for something to happen without
wasting time doing it.
Take two threads: the main thread and a worker...
|
by: cedric |
last post by:
hello,
I encounter a problem using threads. I have a simple code to use a thread :
cSurveillanceBorne = New clsThreadSurveillance
_SurveillanceThread = New Thread(AddressOf...
|
by: Tony Proctor |
last post by:
Hi everyone
We're experiencing some serious anomalies with the scheduling of ASP
threads. I'd be interested to hear if anyone knows what algorithm is used
(e.g. simple round-robin, or something...
|
by: Ivan |
last post by:
Hi
I have following problem: I'm creating two threads who are performing some
tasks. When one thread finished I would like to restart her again (e.g. new
job). Following example demonstrates...
|
by: JS |
last post by:
I am monitoring/controlling some realtime activities in a manufacturing
process.
When a part comes into my station, I have a bunch of processing to do.
There are 30-40 data acquisition and data...
|
by: NaeiKinDus |
last post by:
Hello, i'm trying to program a thread that would be locked (by a
mutex) and that would only be unlocked once that a function
(generating data) is done. The purpose is to generate data, and unlock...
|
by: suga.masanobu |
last post by:
Hello group.
I have thread in which I perform specific task in loop. I can specify,
by check box, in what periods of time that task should be done, ex.
instantly, with 5min break, with 15min...
|
by: Hendrik van Rooyen |
last post by:
I thought I would share this nasty little gotcha with the group.
Consider the following code fragment:
<start>
print 'starting kbd thread'
keyboard_thread = thread.start_new_thread(kbd_driver...
|
by: CloudSolutions |
last post by:
Introduction:
For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
|
by: Faith0G |
last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
| |