473,320 Members | 1,856 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

occasional bug

Try getting this bug to occur!

Run the following code in debug mode (i.e. hit F5). Then literally
just keep moving the mouse around in the main window form area (the big
gray box).

IT TAKES OVER A MINUTE, even! But *eventually*, a window pops up with
the error message:

"An unhandled exception of type 'System.NullReferenceException'
occurred in Unknown Module.

Additional information: Object reference not set to an instance of an
object."
Here's the code:
<<
using System;
using System.Drawing;
using System.Windows.Forms;

class MainForm : Form
{
public static void Main() { Application.Run(new MainForm()); }
public MainForm()
{
OpenFileDialog dlg = new OpenFileDialog();
}
}


Note: if you can even get this bug to happen, please post that you did
so. I need confirmation that it's not just my system. ;P I'm running
Win XP Pro SP2 and VS.NET 2003.

Thanks!

--Nick

Nov 16 '05 #1
5 1121
Yes it happens on my machine also

"ni***********@yahoo.com" wrote:
Try getting this bug to occur!

Run the following code in debug mode (i.e. hit F5). Then literally
just keep moving the mouse around in the main window form area (the big
gray box).

IT TAKES OVER A MINUTE, even! But *eventually*, a window pops up with
the error message:

"An unhandled exception of type 'System.NullReferenceException'
occurred in Unknown Module.

Additional information: Object reference not set to an instance of an
object."
Here's the code:
<<
using System;
using System.Drawing;
using System.Windows.Forms;

class MainForm : Form
{
public static void Main() { Application.Run(new MainForm()); }
public MainForm()
{
OpenFileDialog dlg = new OpenFileDialog();
}
}


Note: if you can even get this bug to happen, please post that you did
so. I need confirmation that it's not just my system. ;P I'm running
Win XP Pro SP2 and VS.NET 2003.

Thanks!

--Nick

Nov 16 '05 #2
And I also get it.

My configuration is Win XP Pro SP2 and VS.NET 2003.

Michael
Nov 16 '05 #3
Nick,
You may need to mark Main as [STAThread] to get a message pump running
for the dialog otherwise the default would be a MTA threading model and you
wouldn't have a message pump.
The following will show a blank form on the screen. I haven't checked
to see if it leaks any memory as the dialog isn't disposed of using this
code.
------------------------------snip--------------------------------------------------
using System;
using System.Drawing;
using System.Windows.Forms;

namespace Test
{
public class Form1 : System.Windows.Forms.Form
{

public Form1()
{

OpenFileDialog dlg = new OpenFileDialog();

}

[STAThread]
static void Main()
{
Application.Run(new Form1());
}
}
}

------------------------------snip--------------------------------------------------

Ron Allen
<ni***********@yahoo.com> wrote in message
news:11**********************@z14g2000cwz.googlegr oups.com...
Try getting this bug to occur!

Run the following code in debug mode (i.e. hit F5). Then literally
just keep moving the mouse around in the main window form area (the big
gray box).

IT TAKES OVER A MINUTE, even! But *eventually*, a window pops up with
the error message:

"An unhandled exception of type 'System.NullReferenceException'
occurred in Unknown Module.

Additional information: Object reference not set to an instance of an
object."
Here's the code:
<<
using System;
using System.Drawing;
using System.Windows.Forms;

class MainForm : Form
{
public static void Main() { Application.Run(new MainForm()); }
public MainForm()
{
OpenFileDialog dlg = new OpenFileDialog();
}
}


Note: if you can even get this bug to happen, please post that you did
so. I need confirmation that it's not just my system. ;P I'm running
Win XP Pro SP2 and VS.NET 2003.

Thanks!

--Nick

Nov 16 '05 #4
Curious,but the following code does not result in this error:

using System;
using System.Drawing;
using System.Windows.Forms;

class MainForm : Form
{
public static void Main() { Application.Run(new MainForm()); }
public MainForm()
{

this.AutoScaleBaseSize=new Size(5,20);
OpenFileDialog dlg = new OpenFileDialog();
}
}

--
Mick Doherty
http://dotnetrix.co.uk/nothing.html
Nov 16 '05 #5
Ron,

This is not true, message pumps are 'initiated' by the Application.Run call,
STAThread or MTAThread has nothing to do with message pumps, they are meant
to put the thread running Main() in a STA or MTA which is a COM imposed
requirement.

Willy.

"Ron Allen" <rallen@_nospam_src-us.com> wrote in message
news:ex**************@TK2MSFTNGP14.phx.gbl...
Nick,
You may need to mark Main as [STAThread] to get a message pump running
for the dialog otherwise the default would be a MTA threading model and
you wouldn't have a message pump.
The following will show a blank form on the screen. I haven't checked
to see if it leaks any memory as the dialog isn't disposed of using this
code.
------------------------------snip--------------------------------------------------
using System;
using System.Drawing;
using System.Windows.Forms;

namespace Test
{
public class Form1 : System.Windows.Forms.Form
{

public Form1()
{

OpenFileDialog dlg = new OpenFileDialog();

}

[STAThread]
static void Main()
{
Application.Run(new Form1());
}
}
}

------------------------------snip--------------------------------------------------

Ron Allen
<ni***********@yahoo.com> wrote in message
news:11**********************@z14g2000cwz.googlegr oups.com...
Try getting this bug to occur!

Run the following code in debug mode (i.e. hit F5). Then literally
just keep moving the mouse around in the main window form area (the big
gray box).

IT TAKES OVER A MINUTE, even! But *eventually*, a window pops up with
the error message:

"An unhandled exception of type 'System.NullReferenceException'
occurred in Unknown Module.

Additional information: Object reference not set to an instance of an
object."
Here's the code:
<<
using System;
using System.Drawing;
using System.Windows.Forms;

class MainForm : Form
{
public static void Main() { Application.Run(new MainForm()); }
public MainForm()
{
OpenFileDialog dlg = new OpenFileDialog();
}
}


Note: if you can even get this bug to happen, please post that you did
so. I need confirmation that it's not just my system. ;P I'm running
Win XP Pro SP2 and VS.NET 2003.

Thanks!

--Nick


Nov 16 '05 #6

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

Similar topics

3
by: Thomas Lindgaard | last post by:
Hello I'm almost done with my webcrawler with a nice curses interface. But every once in a while an exception is thrown and not caught, and because of the use of curses I can't figure out which...
3
by: VK | last post by:
On Windows platforms path separator "\" collides with the script escape sign "\" Obvious and old way to prevent it is to double backslashes: "\\" But I'm curious if there is a reliable way to...
1
by: Sven Schimmel | last post by:
Hello all, I face the problem that occasional in one WebApplication the following error occures: System.Data.SqlClient.SqlException: A severe error occurred on the current command. The...
0
by: Mike Labosh | last post by:
We have an in-house ASP.NET application that uses a .net "dataaccess.dll" library we wrote to wrap the data tier. Every once in a while, apparently only after a rebuild (not this dll, but the...
0
by: ttomic | last post by:
I have asp.net application written in jscript. On POST request, during Page_Load, I receive string which I evaluate using jscript eval method. String looks like: my_fun("arg") where my_fun is...
0
by: Jan Ove Halvorsen | last post by:
Hi! I have a web service that is used by a smart client (windows forms). It normally works ok, but occasionally I get the following error-message: System.Web.Services.Protocols.SoapException:...
11
by: Alec Wysoker | last post by:
Using Python 2.3.5 on Windows XP, I occasionally get OSError: Permission denied when calling os.remove(). This can occur with a file that is not used by any other process on the machine, and is...
1
by: (PeteCresswell) | last post by:
Every so often Agent looks like it's locked up. No mouse or keyboard response and the window's drag bar turns white. Seems to last 10-15 seconds on an average. No message on the status bar. ...
1
by: Ransom | last post by:
Hey folks... Newbie here. I'm working with win32com launching, closing and re-launching Excel grabbing output and doing stuff. Well, on some occasions, I get the following error: ...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
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 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.