For dockable panes and modeless windows (WPFMixin_ subclasses), the output window persists across command executions. When the user closes it, re-creating a functional ScriptConsole mid-session crashes Revit regardless of approach.
Attempted fixes (all crash):
new ScriptConsole() + swap into EXEC_PARAMS.window_handle + rewire ScriptIO/sys.stdout — mirrors sessionmgr._setup_output() but crashes mid-session
ScriptConsoleManager.CreateDetached() with explicit Show() on Dispatcher — crashes on show
- Both with and without pre-registration in
AppendToOutputWindowList
Suspected causes:
SetupDefaultPage() runs a DoEvents() busy-wait in the constructor, causing message loop re-entrancy when called outside the normal startup context
ScriptConsole may have implicit dependencies on the startup execution environment that aren't met when constructed on-demand
Expected behaviour: For persistent panels, closing the output window and re-running any panel method should produce a fresh, functional output window — the same behaviour regular commands get on each run.
Workaround: None currently.
For dockable panes and modeless windows (
WPFMixin_subclasses), the output window persists across command executions. When the user closes it, re-creating a functionalScriptConsolemid-session crashes Revit regardless of approach.Attempted fixes (all crash):
new ScriptConsole()+ swap intoEXEC_PARAMS.window_handle+ rewireScriptIO/sys.stdout— mirrorssessionmgr._setup_output()but crashes mid-sessionScriptConsoleManager.CreateDetached()with explicitShow()onDispatcher— crashes on showAppendToOutputWindowListSuspected causes:
SetupDefaultPage()runs aDoEvents()busy-wait in the constructor, causing message loop re-entrancy when called outside the normal startup contextScriptConsolemay have implicit dependencies on the startup execution environment that aren't met when constructed on-demandExpected behaviour: For persistent panels, closing the output window and re-running any panel method should produce a fresh, functional output window — the same behaviour regular commands get on each run.
Workaround: None currently.