SharpDevelop Community

Get your problems solved!
Welcome to SharpDevelop Community Sign in | Join | Help
in Search

Debugger.DebuggerException: Debugee state already created

Last post 07-04-2008 5:21 PM by DanielGrunwald. 4 replies.
Page 1 of 1 (5 items)
Sort Posts: Previous Next
  • 07-04-2008 1:38 PM

    Debugger.DebuggerException: Debugee state already created

    Hi everyone,

    I have a bit of fun stuff for you to figure out.

     SharpDevelop Version : 3.0.0.2970
    .NET Version         : 2.0.50727.1433
    OS Version           : Microsoft Windows NT 6.0.6000.0
    Current culture      : English (United States) (en-US)
    Running under WOW6432, processor architecture: AMD64
    Working Set Memory   : 233552kb
    GC Heap Memory       : 89837kb

    Error while requesting tooltip for location (Line 186, Col 22)
    Exception thrown:
    Debugger.DebuggerException: Debugee state already created
       at Debugger.Process.CreateDebuggeeState()
       at Debugger.ManagedCallback.Pause()
       at Debugger.ManagedCallback.ExitCallback()
       at Debugger.ManagedCallback.Exception2(ICorDebugAppDomain pAppDomain, ICorDebugThread pThread, ICorDebugFrame pFrame, UInt32 nOffset, CorDebugExceptionCallbackType exceptionType, UInt32 dwFlags)
       at Debugger.ManagedCallbackProxy.<>c__DisplayClass58.<Exception>b__57()
       at Debugger.Interop.MTA2STA.<>c__DisplayClass3.<EnqueueCall>b__0()
       at Debugger.Interop.MTA2STA.PerformCall()
       at Debugger.Process.WaitForPause(TimeSpan timeout)
       at Debugger.Eval.WaitForResult()
       at Debugger.Eval.InvokeMethod(MethodInfo method, Value thisValue, Value[ args)
       at Debugger.Eval.InvokeMethod(Process process, Nullable`1 domainID, Type type, String name, Value thisValue, Value[ args)
       at Debugger.Value.InvokeToString()
       at Debugger.AddIn.TreeModel.ValueNode..ctor(Value val)
       at Debugger.AddIn.TreeModel.ValueNode.Create(Expression expression)
       at ICSharpCode.SharpDevelop.Services.WindowsDebugger.GetTooltipControl(String variableName)
       at ICSharpCode.SharpDevelop.Debugging.DebuggerService.GetToolTipInfo(TextArea textArea, ToolTipRequestEventArgs e)
       at ICSharpCode.SharpDevelop.Debugging.DebuggerTextAreaToolTipProvider.GetToolTipInfo(TextArea textArea, ToolTipRequestEventArgs e)
       at ICSharpCode.SharpDevelop.Debugging.DebuggerService.TextAreaToolTipRequest(Object sender, ToolTipRequestEventArgs e)

     

    I suspect that it has something to do with threading, as the debugger crashes with one of my heavily threaded applications.

    Environment:

    • .NET 3.5 (all updates)
    • Vista 64 (no SP1, but all updates)
    • System.Windows.Forms on one thread, 3 other modules on other threads, and I tried to debug one of those other modules.
    • Axiom with Win32/DirectX (rendering an empty scene, however it keeps throwing exceptions during debugging that it doesn't throw during normal execution, see below)


    Axiom exception during debugging (does not occur without the debugger - and I know cross-thread-access is messy, but I'd rather trick winforms than be annoyed by it's shortcomings):

    13:06:39.515 [ Graphics.Axiom]: Dependencies () ready, initializing...
    13:06:39.516 [ Graphics.Axiom]: Initializing...
    13:06:39.974 [ Graphics.Axiom]: Selected renderer: Axiom DirectX9 (Managed DX) Renderer
    13:06:40.072 [ Graphics.Axiom]: [ERROR] System.InvalidOperationException: Cross-thread operation not valid: Control 'sageView' accessed from a thread other than the thread it was created on.
       at System.Windows.Forms.Control.get_Handle()
       at Microsoft.DirectX.Direct3D.PresentParameters.set_DeviceWindow(Control value)
       at Axiom.RenderSystems.DirectX9.D3DWindow.Create(String name, Int32 width, Int32 height, Int32 colorDepth, Boolean isFullScreen, Int32 left, Int32 top, Boolean depthBuffer, Object[ miscParams)
       at Axiom.RenderSystems.DirectX9.D3D9RenderSystem.CreateRenderWindow(String name, Int32 width, Int32 height, Int32 colorDepth, Boolean isFullscreen, Int32 left, Int32 top, Boolean depthBuffer, Boolean vsync, Object target)
       at Axiom.Core.Root.CreateRenderWindow(String name, Int32 width, Int32 height, Int32 colorDepth, Boolean isFullscreen, Int32 left, Int32 top, Boolean depthBuffer, Boolean vsync, Object targetHandle) in c:\dev\projects\sage\Graphics\Axiom\Axiom\Projects\Axiom\Source\Engine\Core\Root.cs:line 476
       at Sage.Graphics.Axiom.Module.Configure() in c:\dev\projects\sage\Graphics\Axiom\Module.cs:line 228
       at Sage.Graphics.Axiom.Module.InitializeGraphics() in c:\dev\projects\sage\Graphics\Axiom\Module.cs:line 161
       at Sage.Graphics.Axiom.Module.DoInitialize() in c:\dev\projects\sage\Graphics\Axiom\Module.cs:line 372
    13:06:40.078 [ Graphics.Axiom]: [ERROR] System.InvalidOperationException: Cross-thread operation not valid: Control 'sageView' accessed from a thread other than the thread it was created on.
       at System.Windows.Forms.Control.get_Handle()
       at Microsoft.DirectX.Direct3D.PresentParameters.set_DeviceWindow(Control value)
       at Axiom.RenderSystems.DirectX9.D3DWindow.Create(String name, Int32 width, Int32 height, Int32 colorDepth, Boolean isFullScreen, Int32 left, Int32 top, Boolean depthBuffer, Object[ miscParams)
       at Axiom.RenderSystems.DirectX9.D3D9RenderSystem.CreateRenderWindow(String name, Int32 width, Int32 height, Int32 colorDepth, Boolean isFullscreen, Int32 left, Int32 top, Boolean depthBuffer, Boolean vsync, Object target)
       at Axiom.Core.Root.CreateRenderWindow(String name, Int32 width, Int32 height, Int32 colorDepth, Boolean isFullscreen, Int32 left, Int32 top, Boolean depthBuffer, Boolean vsync, Object targetHandle) in c:\dev\projects\sage\Graphics\Axiom\Axiom\Projects\Axiom\Source\Engine\Core\Root.cs:line 476
       at Sage.Graphics.Axiom.Module.Configure() in c:\dev\projects\sage\Graphics\Axiom\Module.cs:line 228
       at Sage.Graphics.Axiom.Module.InitializeGraphics() in c:\dev\projects\sage\Graphics\Axiom\Module.cs:line 161
       at Sage.Graphics.Axiom.Module.DoInitialize() in c:\dev\projects\sage\Graphics\Axiom\Module.cs:line 379
       at Sage.Modules.Module.Initialize() in c:\dev\projects\sage\Modules\Module.cs:line 203
       at Sage.Modules.Scheduler.Update(Int64 timeSinceLastUpdate) in c:\dev\projects\sage\Modules\Scheduler.cs:line 183

     

     Hope this helps,

     regards.

  • 07-04-2008 1:54 PM In reply to

    • DavidSrbecky
    • Top 10 Contributor
    • Joined on 08-22-2005
    • Usti nad Labem, Czech Republic
    • Posts 440
    • Team Members

    Re: Debugger.DebuggerException: Debugee state already created

    Relating to "Debugee state already created": I have not figured this one out so I have rewritten all the related code.  The new design should be more robust.  Update at http://build.sharpdevelop.net/BuildArtefacts/

    Relating to "Cross-thread operation not valid": You are not supposed to do that and it does happen even without debugger.  However without the debugger attached, it is silently ignored.  Control.BeginInvoke could help you

  • 07-04-2008 4:09 PM In reply to

    Re: Debugger.DebuggerException: Debugee state already created

    DavidSrbecky:

    Relating to "Cross-thread operation not valid": You are not supposed to do that and it does happen even without debugger.  However without the debugger attached, it is silently ignored.  Control.BeginInvoke could help you

     

     I'm fairly certain that it does indeed work without the debugger.

    You are not allowed to call any of the .NET methods on the control, true. However, it seems the WinAPI is less restricting and you can render to the device-handle from a different thread. I haven't even experienced any tearing or other issues with it - yet.


    regards.

     

    PS: here's a screenshot of the application running without the debugger:

    Sage.Editor running Winforms and Renderer on separate threads.

  • 07-04-2008 5:00 PM In reply to

    • DavidSrbecky
    • Top 10 Contributor
    • Joined on 08-22-2005
    • Usti nad Labem, Czech Republic
    • Posts 440
    • Team Members

    Re: Debugger.DebuggerException: Debugee state already created

    Yes, it does work without the debugger.  I suppose it is kind of additional sanytity check that the windows froms do while running under debugger.  If not running under the deubbger the check is not made - and the application may or may not work.

    (In any case, it is not issue with the debbuger.  Visual Studio should behave in the same way)

  • 07-04-2008 5:21 PM In reply to

    Re: Debugger.DebuggerException: Debugee state already created

    You should Invoke for any cross-thread calls on the control, even for getting the handle. Once you have the handle, you may use it on another thread if you're sure what you're doing.

    Daniel Grunwald
Page 1 of 1 (5 items)
Powered by Community Server (Commercial Edition), by Telligent Systems
Don't contact us via this (fleischfalle@alphasierrapapa.com) email address.