473,786 Members | 2,426 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

wierd exception

Hello,
I have a C# project with windows forms.
I sometimes get unprdictable .NET exceptions. I don't always get them, so I
can't reproduce where exactly it happens. I can generally say it happens when
closing the application (maybe in the dispose method?).
Here are 2 examples:

System.Threadin g.ThreadAbortEx ception: Thread was being aborted.
at System.Windows. Forms.UnsafeNat iveMethods.Call WindowProc(IntP tr
wndProc, IntPtr hWnd, Int32 msg, IntPtr wParam, IntPtr lParam)
at System.Windows. Forms.NativeWin dow.DefWndProc( Message& m)
at System.Windows. Forms.Form.DefW ndProc(Message& m)
at System.Windows. Forms.Control.W ndProc(Message& m)
at System.Windows. Forms.Scrollabl eControl.WndPro c(Message& m)
at System.Windows. Forms.Container Control.WndProc (Message& m)
at System.Windows. Forms.Form.WndP roc(Message& m)
at System.Windows. Forms.Control.C ontrolNativeWin dow.OnMessage(M essage& m)
at System.Windows. Forms.Control.C ontrolNativeWin dow.WndProc(Mes sage& m)
at System.Windows. Forms.NativeWin dow.Callback(In tPtr hWnd, Int32 msg,
IntPtr wparam, IntPtr lparam)
System.Threadin g.ThreadAbortEx ception: Thread was being aborted.
at System.Windows. Forms.UnsafeNat iveMethods.SetF ocus(HandleRef hWnd)
at System.Windows. Forms.Container Control.FocusAc tiveControlInte rnal()
at System.Windows. Forms.Form.set_ Active(Boolean value)
at System.Windows. Forms.Form.WmAc tivate(Message& m)
at System.Windows. Forms.Form.WndP roc(Message& m)
at System.Windows. Forms.Control.C ontrolNativeWin dow.OnMessage(M essage& m)
at System.Windows. Forms.Control.C ontrolNativeWin dow.WndProc(Mes sage& m)
at System.Windows. Forms.NativeWin dow.Callback(In tPtr hWnd, Int32 msg,
IntPtr wparam, IntPtr lparam)

Any ideas?

thanks,
--
dshemesh
May 28 '07
10 2827
When checking the code more thoroughly It looks something like this:

void Main {
int retval = foo();
if (retval == FAILED) {
System.Environm ent.Exit(-1); }
else {
System.Windows. Forms.Applicati on.Run(new psScheduleTasks ()); }
}

void foo {
Thread a;
a = new Thread(new ThreadStart(Sho wWaitScreen));
a.Start();
more code...

a.abort();
return retval;
}

The exception is thrown when foo returns FAILED.
I tried using System.Windows. Forms.Applicati on.Exit() instead of
System.Environm ent.Exit(-1), but the exception is still begin thrown.
--
dshemesh
"Jorge" wrote:
On May 28, 10:22 am, dshemesh <dshem...@discu ssions.microsof t.com>
wrote:
Hello,
I have a C# project with windows forms.
I sometimes get unprdictable .NET exceptions. I don't always get them, so I
can't reproduce where exactly it happens. I can generally say it happens when
closing the application (maybe in the dispose method?).
Here are 2 examples:

System.Threadin g.ThreadAbortEx ception: Thread was being aborted.
at System.Windows. Forms.UnsafeNat iveMethods.Call WindowProc(IntP tr
wndProc, IntPtr hWnd, Int32 msg, IntPtr wParam, IntPtr lParam)
at System.Windows. Forms.NativeWin dow.DefWndProc( Message& m)
at System.Windows. Forms.Form.DefW ndProc(Message& m)
at System.Windows. Forms.Control.W ndProc(Message& m)
at System.Windows. Forms.Scrollabl eControl.WndPro c(Message& m)
at System.Windows. Forms.Container Control.WndProc (Message& m)
at System.Windows. Forms.Form.WndP roc(Message& m)
at System.Windows. Forms.Control.C ontrolNativeWin dow.OnMessage(M essage& m)
at System.Windows. Forms.Control.C ontrolNativeWin dow.WndProc(Mes sage& m)
at System.Windows. Forms.NativeWin dow.Callback(In tPtr hWnd, Int32 msg,
IntPtr wparam, IntPtr lparam)

System.Threadin g.ThreadAbortEx ception: Thread was being aborted.
at System.Windows. Forms.UnsafeNat iveMethods.SetF ocus(HandleRef hWnd)
at System.Windows. Forms.Container Control.FocusAc tiveControlInte rnal()
at System.Windows. Forms.Form.set_ Active(Boolean value)
at System.Windows. Forms.Form.WmAc tivate(Message& m)
at System.Windows. Forms.Form.WndP roc(Message& m)
at System.Windows. Forms.Control.C ontrolNativeWin dow.OnMessage(M essage& m)
at System.Windows. Forms.Control.C ontrolNativeWin dow.WndProc(Mes sage& m)
at System.Windows. Forms.NativeWin dow.Callback(In tPtr hWnd, Int32 msg,
IntPtr wparam, IntPtr lparam)

Any ideas?

thanks,
--
dshemesh

Are you spawning threads in your app?
Sometimes it happens when you close an application and some threads
are still running.

May 29 '07 #11

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

Similar topics

3
2873
by: Markus Fischer | last post by:
Hi, I'm experiencing a wierd problem with IE 6 in Windows with two _slightly_ different Version. Give the following HTMl-Code, ideally the output of offsetTop should be "105"; a few pixel plus minus would still be ok, whyever. I've tested this successfully on 6.0.2800.1106 on a german W2KPro machine, also with 6.0.2800.1106 on a german XPPro machine.
3
1412
by: Sathyaish | last post by:
A practice excercise from K&R. Kindly read the comments within the program. I'd be very grateful to people who helped. Why is it that I get the wierd face-like characters on the screen instead of the boolean output 0s or 1s? #include <stdio.h> /*This program is made to check that leaving the brackets around the epxression (c=getchar()) in the statement while ((c=getchar()) !=EOF) produces a boolean output in
112
4071
by: Tom | last post by:
This is very strange: I have a Windows Form with a Panel on it. In that panel I dynamically (at run time) create some labels, as so: for i=1 to x dim ctlNew as New Label() with ctlNew .Name="Whatever" & trim(cstr(i)) .Text=.Name .Visible=True ... etc etc etc ...
1
1451
by: Sašo Zagoranski | last post by:
Hi... This is driving me crazy and I really hope I can get an answer... Take a look at the piece of code below (I'm using .net 2.0): try { double pointTime = XDate.DateTimeToXLDate(point.time); double pointValue = Convert.ToDouble(point.value); list.Add(pointTime, pointValue);
8
3287
by: John Nagle | last post by:
Here's a wierd problem: I have a little test case for M2Crypto, which just opens up SSL connections to web servers and reads their certificates. This works fine. But if I execute socket.setdefaulttimeout(5.0) so that the sockets don't wait too long if there's no SSL server, I get
5
1721
by: desktop | last post by:
I am confused about the use of the template parameter "E" in the below class. Since when is it allowed to use these parameters like "E(1)" and what does it mean (where can I read more about this kind of use)? template <typename E> class Mytest { public: Mytest(int n) { s = E(0);
1
1468
by: Bobby Edward | last post by:
Here's my code... Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load If Not Request.Cookies("UserSettings")("IsAdmin") Is Nothing Then ' THIS IS LINE 11 If Request.Cookies("UserSettings")("IsAdmin") = "True" Then Me.panAdmin.Visible = True Else Me.panAdmin.Visible = False
4
2515
by: Cirene | last post by:
In my web.config I added <pages enableSessionState="true">. In each of my pages I also added EnableSessionState="True" to the Page declaration. (I didn't think this was necessary, but...) Any reason why even though I did this I keep getting this error.... Server Error in '/abc' Application.
4
4883
by: alex21 | last post by:
Ok im getting this exception from a DataGridView control in my program. System.ArgumentOutOfRangeException was unhandled Message="Value of '132' is not valid for 'Value'. 'Value' should be between 'minimum' and 'maximum'.\r\nParameter name: Value" Source="System.Windows.Forms" ParamName="Value" StackTrace: at System.Windows.Forms.ScrollBar.set_Value(Int32 value) at System.Windows.Forms.DataGridView.ScrollRows(Int32...
0
9496
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
10164
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9961
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7512
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5397
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
5534
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4066
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
3669
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2894
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.