Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Jan 31st, 2008, 8:35 AM   #1
tattis
Newbie
 
Join Date: Jan 2008
Posts: 2
Rep Power: 0 tattis is on a distinguished road
Runtime error - Dispose

Hi there folks,
my problem is a very hard one to solve and a very frustrating to get. It is a runtime error and it appears at random, sometimes instantlly when i start my app.. sometimes after a few hours.


The error message are in swedish but I'll try to translate it for you. It goes something like this "The Object is in use somewhere else."
-    e    {"Objektet används för närvarande någon annan stans." }    System.Exception 
+    [System.InvalidOperationException]    {System.InvalidOperationException}    System.InvalidOperationException 
    System.Object    {System.InvalidOperationException}    System.Object 
    _className    null    string 
    _COMPlusExceptionCode    -532459699    int 
    _exceptionMethod    <undefined value>    System.Reflection.MethodBase 
    _exceptionMethodString    null    string 
    _helpURL    null    string 
    _HResult    -2146233079    int 
    _innerException    { }    System.Exception 
    _message    "Objektet används för närvarande någon annan stans."    string 
    _remoteStackIndex    0    int 
    _remoteStackTraceString    null    string 
    _source    null    string 
+    _stackTrace    {System.Array}    System.Object 
    _stackTraceString    null    string 
    _xcode    -532459699    int 
    _xptrs    0    int 
    HelpLink    null    string 
    HResult    -2146233079    int 
    InnerException    { }    System.Exception 
    Message    "Objektet används för närvarande någon annan stans."    string 
    Source    "System.Drawing"    string 
    StackTrace    "   at System.Drawing.Graphics.Dispose(Boolean disposing)\r\n   at System.Drawing.Graphics.Dispose()\r\n   at System.Windows.Forms.PaintEventArgs.Dispose(Boolean disposing)\r\n   at System.Windows.Forms.PaintEventArgs.Dispose()\r\n   at System.Windows.Forms.Control.WmPaint(Message& m)\r\n   at System.Windows.Forms.Control.WndProc(Message& m)\r\n   at System.Windows.Forms.GroupBox.WndProc(Message& m)\r\n   at System.Windows.Forms.ControlNativeWindow.OnMessage(Message& m)\r\n   at System.Windows.Forms.ControlNativeWindow.WndProc(Message& m)\r\n   at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)\r\n   at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)\r\n   at System.Windows.Forms.ComponentManager.System.Windows.Forms.UnsafeNativeMethods+IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData)\r\n   at System.Windows.Forms.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)\r\n   at System.Windows.Forms.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)\r\n   at System.Windows.Forms.Application.Run(Form mainForm)\r\n   at OrderManager.MainForm.Main() in c:\dev\source\ordermanager\source\appform.cs:line 6381"    string 
+    TargetSite    {System.Reflection.RuntimeMethodInfo}    System.Reflection.MethodBase


and my control(random control) get this white background and red X in it.




I have had this error for a long time now and it seems i cant solve it without some help

PS this is my first thread here so be kind to me
tattis is offline   Reply With Quote
Old Feb 26th, 2008, 6:06 AM   #2
bambi
Newbie
 
Join Date: Feb 2008
Posts: 3
Rep Power: 0 bambi is on a distinguished road
Re: Runtime error - Dispose

Did you managed to solve the problem ?
I have exactly the same problem using VsualBasic in .NET 2003
bambi is offline   Reply With Quote
Old Feb 26th, 2008, 8:54 AM   #3
Ooble
I eat cake for breakfast.
 
Ooble's Avatar
 
Join Date: Jul 2004
Location: In my box.
Posts: 4,434
Rep Power: 9 Ooble is on a distinguished road
Re: Runtime error - Dispose

Have you tried tracing it through? Can we see the code near where the error gets triggered?
__________________
Me :: You :: Them
Ooble is offline   Reply With Quote
Old Feb 26th, 2008, 9:03 AM   #4
bambi
Newbie
 
Join Date: Feb 2008
Posts: 3
Rep Power: 0 bambi is on a distinguished road
Re: Runtime error - Dispose

The code is as followed, there was much more in the try block, but even with this little it crash. this is the first button I press on after launcing the application.

Any hint to where and how to trace this will be very appreciated

Dim ofd As New OpenFileDialog
Dim FileName As String

ofd.InitialDirectory = rstParams.BaseDir()
ofd.Filter = "Image Files(*.BMP;*.PNG;*.JPG;*.TIF;*.TIFF)|*.BMP;*.PNG;*.JPG;*.TIF;*.TIFF|All files (*.*)|*.*"
ofd.FilterIndex = 1
ofd.RestoreDirectory = True
ofd.Title = "Select Image File"

Try
If ofd.ShowDialog() = System.Windows.Forms.DialogResult.OK Then
FileName = ofd.FileName()
ofd.Dispose()
End If
Catch ex As Exception
MsgBox("Message: " + ex.Message + vbCr + "Source: " + ex.Source + vbCr + "StackTrace: " + ex.StackTrace + vbCr + _
"TargetSite: " + ex.TargetSite.ToString())
Exit Sub
End Try

Last edited by bambi; Feb 26th, 2008 at 9:13 AM. Reason: adding the error message
bambi is offline   Reply With Quote
Old Feb 26th, 2008, 9:14 AM   #5
bambi
Newbie
 
Join Date: Feb 2008
Posts: 3
Rep Power: 0 bambi is on a distinguished road
Re: Runtime error - Dispose

The code is as followed, there was much more in the try block, but even with this little it crash. this is the first button I press on after launcing the application.

Any hint to where and how to trace this will be very appreciated

Dim ofd As New OpenFileDialog
Dim FileName As String

ofd.InitialDirectory = rstParams.BaseDir()
ofd.Filter = "Image Files(*.BMP;*.PNG;*.JPG;*.TIF;*.TIFF)|*.BMP;*.PNG;*.JPG;*.TIF;*.TIFF|All files (*.*)|*.*"
ofd.FilterIndex = 1
ofd.RestoreDirectory = True
ofd.Title = "Select Image File"

Try
If ofd.ShowDialog() = System.Windows.Forms.DialogResult.OK Then
FileName = ofd.FileName()
ofd.Dispose()
End If
Catch ex As Exception
MsgBox("Message: " + ex.Message + vbCr + "Source: " + ex.Source + vbCr + "StackTrace: " + ex.StackTrace + vbCr + _
"TargetSite: " + ex.TargetSite.ToString())
Exit Sub
End Try

The error message that I get is:

Message: The object is currently in use elsewhere.
Source: System.Drawing
StackTrace: at System.Drawing.Graphics.Dispose(Boolean disposing)
at System.Drawing.Graphics.Dispose()
at System.Windows.Forms.PaintEventArgs.Dispose(Boolean disposing)
at System.Windows.Forms.PaintEventArgs.Dispose()
at System.Windows.Forms.Control.WmPaint(Message& m)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.GroupBox.WndProc(Message& m)
at System.Windows.Forms.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
at System.Windows.Forms.UnsafeNativeMethods.GetOpenFileName(OPENFILENAME_I ofn)
at System.Windows.Forms.OpenFileDialog.RunFileDialog(OPENFILENAME_I ofn)
at System.Windows.Forms.FileDialog.RunDialog(IntPtr hWndOwner)
at System.Windows.Forms.CommonDialog.ShowDialog()
at DevGUI.FormMain.btnNewImage_Click(Object sender, EventArgs e) in D:\Ofra_Data\MyProjects\NeuroMath\DevGUI\Form_Main.vb:line 1011
TargetSite: Void Dispose(Boolean)" String
bambi is offline   Reply With Quote
Old Feb 26th, 2008, 9:22 AM   #6
milot
Programmer
 
milot's Avatar
 
Join Date: Nov 2006
Location: Kosovë/Prishtinë
Posts: 47
Rep Power: 0 milot is on a distinguished road
Re: Runtime error - Dispose

Well, we cannot help here without pasting some piece of code, but as I read the runtime unhandled exception I saw that the problem comes from line 6381. Look at these lines on your generated exception:

System.Windows.Forms.Application.Run(Form mainForm)\r\n   at OrderManager.MainForm.Main() in c:\dev\source\ordermanager\source\appform.cs:line 6381"    string

And IMO I think that you can fix this by looking at your code at line 6381 and keep tracing. Or run with debugger and add some breakpoints on your IDE and trace it.
milot is offline   Reply With Quote
Old Sep 12th, 2008, 3:56 AM   #7
tattis
Newbie
 
Join Date: Jan 2008
Posts: 2
Rep Power: 0 tattis is on a distinguished road
Re: Runtime error - Dispose

I haven't solved my problem, and the strange thing is that it appears "randomly" (even when you just let the application run and don't touch it). This is why I have a hard time to pick some of the code to show you guys..

But I have managed to evoke the crash when I change(click) the value for two radiobuttons back and forth..

The ERROR ( stacktrace ):
"The object is in use somewhere else right now"
http://www.flyttpoolen.se/newerror.png

The Code ( Application.Run(mainForm); = line6289 ):

[STAThread]
static void Main()
{
try
{
MainForm mainForm = new MainForm();

if (mainForm.shutDown == true)
{
return;
}

Application.Run(mainForm);
}
catch (Exception e)
{
MessageBox.Show(e.HelpLink /*e.Message*/,
"Fel",
MessageBoxButtons.OK,
MessageBoxIcon.Error);

MessageBox.Show("Target: " + e.TargetSite);
MessageBox.Show("HelpLink: " + e.HelpLink);

MessageBox.Show(e.ToString());

MessageBox.Show("StackTrace:" + e.StackTrace + "\r\n" + "Inner exception:" + e.InnerException);
}
}
tattis is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Java without runtime? DESERVE Java 8 Nov 21st, 2007 10:05 PM
Creating forms at runtime kruptof Visual Basic 6 Jun 14th, 2006 7:01 PM
runtime error when int incremented Kilo C# 2 Dec 4th, 2005 8:36 PM
Runtime error R6034 Polyphemus_ C++ 4 Nov 27th, 2005 6:14 AM
Mono Runtime error. pr0gm3r C# 8 Oct 12th, 2005 4:10 PM




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 4:31 PM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC