F
fperfect13
Hi,
I have the folowing exception
Exception : System.NullReferenceException: Object reference not set to
an instance of an object.
00000019 3:30:48 PM [260] at
System.Windows.Forms.UnsafeNativeMethods.GetOpenFileName(OPENFILENAME_I
ofn)
00000020 3:30:48 PM [260] at
System.Windows.Forms.OpenFileDialog.RunFileDialog(OPENFILENAME_I ofn)
00000021 3:30:48 PM [260] at
System.Windows.Forms.FileDialog.RunDialog(IntPtr hWndOwner)
00000022 3:30:48 PM [260] at
System.Windows.Forms.CommonDialog.ShowDialog()
00000023 3:30:48 PM [260] at
UI.Commands.File.OpenPackage(Object sender, EventArgs e) in
........\StartUp\Commands\File.cs:line 155
00000024 3:30:48 PM [260] at
Crownwood.Magic.Menus.MenuCommand.OnClick(EventArgs e)
00000025 3:30:48 PM [260] at
Crownwood.Magic.Menus.MenuControl.GenerateShortcut(Shortcut sc,
MenuCommandCollection mcc)
00000026 3:30:48 PM [260] at
Crownwood.Magic.Menus.MenuControl.GenerateShortcut(Shortcut sc,
MenuCommandCollection mcc)
00000027 3:30:48 PM [260] at
Crownwood.Magic.Menus.MenuControl.PreFilterMessage(Message& msg)
00000028 3:30:48 PM [260] at
System.Windows.Forms.ThreadContext.System.Windows.Forms.UnsafeNativeMethods+IMsoComponent.FPreTranslateMessage(MSG&
msg)
00000029 3:30:48 PM [260] at
System.Windows.Forms.ComponentManager.System.Windows.Forms.UnsafeNativeMethods+IMsoComponentManager.FPushMessageLoop(Int32
dwComponentID, Int32 reason, Int32 pvLoopData)
00000030 3:30:48 PM [260] at
System.Windows.Forms.ThreadContext.RunMessageLoopInner(Int32 reason,
ApplicationContext context)
00000031 3:30:48 PM [260] at
System.Windows.Forms.ThreadContext.RunMessageLoop(Int32 reason,
ApplicationContext context)
00000032 3:30:48 PM [260] at
System.Windows.Forms.Application.Run(Form mainForm)
the exception is thrown in the following code in try section
OpenFileDialog openFileDialog = new OpenFileDialog();
openFileDialog.DefaultExt = "xxxx";
openFileDialog.Title = "xxxxxxx";
openFileDialog.InitialDirectory = Environment.CurrentDirectory;
openFileDialog.FileName = "";
try
{
dialogResult = openFileDialog.ShowDialog();
}
catch (NullReferenceException ex)
{
//log exception
}
The code is called on an open selection from a menu.
It throws the exception randomly, meaning that I can pres open 100
times and get no exception or only 3 times an get it. The try catch
doesn't solve the problem because all the program freezes.
I found on google that this exception appears in other programs but no
solution to solve the problem
(http://aquaxp.com/news/index.php?p=22 or
http://www.evilgeniuschat.com/viewtopic.php?t=2514&start=15&sid=4c9845877c2bab4ae7b36fe56cf6ae60)
I have the folowing exception
Exception : System.NullReferenceException: Object reference not set to
an instance of an object.
00000019 3:30:48 PM [260] at
System.Windows.Forms.UnsafeNativeMethods.GetOpenFileName(OPENFILENAME_I
ofn)
00000020 3:30:48 PM [260] at
System.Windows.Forms.OpenFileDialog.RunFileDialog(OPENFILENAME_I ofn)
00000021 3:30:48 PM [260] at
System.Windows.Forms.FileDialog.RunDialog(IntPtr hWndOwner)
00000022 3:30:48 PM [260] at
System.Windows.Forms.CommonDialog.ShowDialog()
00000023 3:30:48 PM [260] at
UI.Commands.File.OpenPackage(Object sender, EventArgs e) in
........\StartUp\Commands\File.cs:line 155
00000024 3:30:48 PM [260] at
Crownwood.Magic.Menus.MenuCommand.OnClick(EventArgs e)
00000025 3:30:48 PM [260] at
Crownwood.Magic.Menus.MenuControl.GenerateShortcut(Shortcut sc,
MenuCommandCollection mcc)
00000026 3:30:48 PM [260] at
Crownwood.Magic.Menus.MenuControl.GenerateShortcut(Shortcut sc,
MenuCommandCollection mcc)
00000027 3:30:48 PM [260] at
Crownwood.Magic.Menus.MenuControl.PreFilterMessage(Message& msg)
00000028 3:30:48 PM [260] at
System.Windows.Forms.ThreadContext.System.Windows.Forms.UnsafeNativeMethods+IMsoComponent.FPreTranslateMessage(MSG&
msg)
00000029 3:30:48 PM [260] at
System.Windows.Forms.ComponentManager.System.Windows.Forms.UnsafeNativeMethods+IMsoComponentManager.FPushMessageLoop(Int32
dwComponentID, Int32 reason, Int32 pvLoopData)
00000030 3:30:48 PM [260] at
System.Windows.Forms.ThreadContext.RunMessageLoopInner(Int32 reason,
ApplicationContext context)
00000031 3:30:48 PM [260] at
System.Windows.Forms.ThreadContext.RunMessageLoop(Int32 reason,
ApplicationContext context)
00000032 3:30:48 PM [260] at
System.Windows.Forms.Application.Run(Form mainForm)
the exception is thrown in the following code in try section
OpenFileDialog openFileDialog = new OpenFileDialog();
openFileDialog.DefaultExt = "xxxx";
openFileDialog.Title = "xxxxxxx";
openFileDialog.InitialDirectory = Environment.CurrentDirectory;
openFileDialog.FileName = "";
try
{
dialogResult = openFileDialog.ShowDialog();
}
catch (NullReferenceException ex)
{
//log exception
}
The code is called on an open selection from a menu.
It throws the exception randomly, meaning that I can pres open 100
times and get no exception or only 3 times an get it. The try catch
doesn't solve the problem because all the program freezes.
I found on google that this exception appears in other programs but no
solution to solve the problem
(http://aquaxp.com/news/index.php?p=22 or
http://www.evilgeniuschat.com/viewtopic.php?t=2514&start=15&sid=4c9845877c2bab4ae7b36fe56cf6ae60)