AGS Development > Editor Development

Asynchronous thread abort on Editor close

(1/1)

Crimson Wizard:
I have no idea if that's important, just thought I'll post this here.
If run under MSVS with "Managed Debugging Assistants" enabled (Debug -> Exceptions) the Editor invokes following warning every time it closes:


--- Quote ---Managed Debugging Assistant 'AsynchronousThreadAbort' has detected a problem in '<...>\Editor\AGS.Editor\bin\Debug\AGSEditor.vshost.exe'.
Additional Information: User code running on thread XXXX has attempted to abort thread YYYY. This may result in a corrupt state or resource leaks if the thread being aborted was in the middle of an operation that modifies global state or uses native resources. Aborting threads other than the currently running thread is strongly discouraged.
--- End quote ---

Thread id are always different, ofc.
This happens with all versions of AGS I've tried (3.2.1, 3.2.2, github).

Callstack:

--- Quote ---    mscorlib.dll!System.Threading.Thread.Abort() + 0x20 bytes   
   AGSEditor.exe!AGS.Editor.NamedPipesServer.Stop() Line 121 + 0xd bytes   C#
    AGSEditor.exe!AGS.Editor.NamedPipesEngineCommunicatio n.Dispose() Line 123 + 0xd bytes   C#
    AGSEditor.exe!AGS.Editor.DebugController.EditorShutdo wn() Line 204 + 0xc bytes   C#
    AGSEditor.exe!AGS.Editor.AGSEditor.Dispose() Line 210 + 0xd bytes   C#
    AGSEditor.exe!AGS.Editor.GUIController._mainForm_OnEd itorShutdown() Line 1508 + 0xd bytes   C#
    AGSEditor.exe!AGS.Editor.frmMain.frmMain_FormClosing(object sender = {AGS.Editor.frmMain}, System.Windows.Forms.FormClosingEventAr gs e = {System.Windows.Forms.FormClosingEventArgs}) Line 408 + 0x17 bytes   C#
    System.Windows.Forms.dll!System.Windows.Forms.Form.OnFormClosing(System.Windows.Forms.FormClosingEventAr gs e) + 0x77 bytes   
    System.Windows.Forms.dll!System.Windows.Forms.Form.RaiseFormClos ingOnAppExit() + 0xf4 bytes   
    System.Windows.Forms.dll!System.Windows.Forms.Application.ExitIn ternal() + 0xe7 bytes   
    System.Windows.Forms.dll!System.Windows.Forms.Application.Exit(System.ComponentModel.CancelEventArgs e = null) + 0x4e bytes   
    System.Windows.Forms.dll!System.Windows.Forms.Application.Exit() + 0x7 bytes   
    AGSEditor.exe!AGS.Editor.GUIController.ShowWelcomeScr een() Line 856 + 0x5 bytes   C#
    AGSEditor.exe!AGS.Editor.frmMain.frmMain_Shown(object sender = {AGS.Editor.frmMain}, System.EventArgs e = {System.EventArgs}) Line 435 + 0x12 bytes   C#
    System.Windows.Forms.dll!System.Windows.Forms.Form.OnShown(System.EventArgs e) + 0x7a bytes   
    System.Windows.Forms.dll!System.Windows.Forms.Form.CallShownEven t() + 0x20 bytes   
    System.Windows.Forms.dll!System.Windows.Forms.Control.InvokeMars haledCallbackDo(System.Windows.Forms.Control.ThreadMeth odEntry tme) + 0x76 bytes   
    System.Windows.Forms.dll!System.Windows.Forms.Control.InvokeMars haledCallbackHelper(object obj) + 0x69 bytes   
    mscorlib.dll!System.Threading.ExecutionContext.runTr yCode(object userData) + 0x51 bytes   
    [Native to Managed Transition]   
    [Managed to Native Transition]   
    mscorlib.dll!System.Threading.ExecutionContext.RunIn ternal(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state) + 0x67 bytes   
    mscorlib.dll!System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state) + 0x45 bytes   
    System.Windows.Forms.dll!System.Windows.Forms.Control.InvokeMars haledCallback(System.Windows.Forms.Control.ThreadMeth odEntry tme) + 0x69 bytes   
    System.Windows.Forms.dll!System.Windows.Forms.Control.InvokeMars haledCallbacks() + 0xc3 bytes   
    System.Windows.Forms.dll!System.Windows.Forms.Control.WndProc(ref System.Windows.Forms.Message m) + 0x12f bytes   
    System.Windows.Forms.dll!System.Windows.Forms.ScrollableControl. WndProc(ref System.Windows.Forms.Message m) + 0x2a bytes   
    System.Windows.Forms.dll!System.Windows.Forms.ContainerControl.W ndProc(ref System.Windows.Forms.Message m) + 0x10 bytes   
    System.Windows.Forms.dll!System.Windows.Forms.Form.WndProc(ref System.Windows.Forms.Message m) + 0x40 bytes   
    System.Windows.Forms.dll!System.Windows.Forms.Control.ControlNat iveWindow.OnMessage(ref System.Windows.Forms.Message m) + 0x10 bytes   
    System.Windows.Forms.dll!System.Windows.Forms.Control.ControlNat iveWindow.WndProc(ref System.Windows.Forms.Message m) + 0x31 bytes   
    System.Windows.Forms.dll!System.Windows.Forms.NativeWindow.Callb ack(System.IntPtr hWnd, int msg = 0x0000c23f, System.IntPtr wparam, System.IntPtr lparam) + 0x5a bytes   
    [Native to Managed Transition]   
    [Managed to Native Transition]   
    System.Windows.Forms.dll!System.Windows.Forms.Application.Compon entManager.System.Windows.Forms.UnsafeN ativeMethods.IMsoComponentManager.FPush MessageLoop(int dwComponentID, int reason = 0xffffffff, int pvLoopData = 0x00000000) + 0x24e bytes   
    System.Windows.Forms.dll!System.Windows.Forms.Application.Thread Context.RunMessageLoopInner(int reason = 0xffffffff, System.Windows.Forms.ApplicationContext context = {System.Windows.Forms.ApplicationContext}) + 0x177 bytes   
    System.Windows.Forms.dll!System.Windows.Forms.Application.Thread Context.RunMessageLoop(int reason, System.Windows.Forms.ApplicationContext context) + 0x61 bytes   
    System.Windows.Forms.dll!System.Windows.Forms.Application.Run(System.Windows.Forms.Form mainForm) + 0x31 bytes   
    AGSEditor.exe!AGS.Editor.GUIController.StartGUI(string[] commandLineArguments = {string[0x00000000]}) Line 1369 + 0xb bytes   C#
    AGSEditor.exe!AGS.Editor.ApplicationController.StartG UI(string[] commandLineArguments = {string[0x00000000]}) Line 123 + 0x10 bytes   C#
    AGSEditor.exe!AGS.Editor.Program.RunApplication(string[] args = {string[0x00000000]}) Line 55 + 0x10 bytes   C#
    AGSEditor.exe!AGS.Editor.Program.Main(string[] args = {string[0x00000000]}) Line 23 + 0x8 bytes   C#
    [Native to Managed Transition]   
    [Managed to Native Transition]   
    mscorlib.dll!System.AppDomain.ExecuteAssembly(string assemblyFile, System.Security.Policy.Evidence assemblySecurity, string[] args) + 0x3a bytes   
    Microsoft.VisualStudio.HostingProcess.U tilities.dll!Microsoft.VisualStudio.HostingProcess.H ostProc.RunUsersAssembly() + 0x2b bytes   
    mscorlib.dll!System.Threading.ThreadHelper.ThreadSta rt_Context(object state) + 0x66 bytes   
    mscorlib.dll!System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state) + 0x6f bytes   
    mscorlib.dll!System.Threading.ThreadHelper.ThreadSta rt() + 0x44 bytes   

--- End quote ---

Calin Leafshade:
I would imagine thats the GUI thread stopping the debugger thread that waits for input from the engine.

Named pipes shouldn't be an issue resource wise so I don't think this is a problem. Arguably the thread should stop itself though just for cleaness.

I think we should probably get rid of the named pipes altogether though and replace them with a TCP debugging interface. Name pipes are a windows-only solution.

Navigation

[0] Message Index

Go to full version