Did you quit playing?
No, I've been busy building a new system for Android and iOS development with Mono For Android (
http://xamarin.com/monoforandroid) and haven't been playing with much else
Regarding this, I was just trying to save you the embarrassment resulting from finding out that trying to show messages using an API that is inherently not thread-safe (MessageBox.Show) doesn't always work when it is run on a high-priority, background thread with no message pump (the GC's thread), and there will be no exception or any other indication that it failed (other than AutoCAD crashing
). For that matter, we're not supposed to do any kind of blocking UI calls in the GC's thread.
Just guessing here, but I think the reason why MessagBox.Show(), ShowAlertDialog(), etc, may not work or even may crash AutoCAD, has to do with the hooks AutoCAD uses to disable/enable floating windows whenever a modal dialog is shown/dismissed. If I'm not mistaken, that involves accessing state and APIs that cannot be accessed asynchronously, from a non-AutoCAD thread.
Did you not see my comment regarding the fact that even acutPrintF() fails in that context?
I lost count of how many classes I've made that are based on DisposableWrapper, and every one of their implementations of DeleteUnmanagedObject() is called on the next GC (in the thread of the GC) after they become unreachable when Dispose() was not called on them. I know that, because from my overrides of their Dispose(bool) methods, I usually throw an exception in debug builds, to tell me that I failed to deterministically dispose the instance.
So, you might be mistaking the failure of MessageBox.Show() when run on the GC thread, with the presumption that the finalizer is not running, or is not calling DeleteUnmanagedObject(). It certainly is and does, and you can confirm that by using a thread-safe way of showing the message (even the debugger may not hit a breakbpoint in that context, BTW).
I use a homegrown trace utility that outputs trace messages synchronously to another process via SendMessage(WM_COPYDATA,...) that doesn't return until the message has actually been shown in the other process (the trace listener, which I wrote in Delphi about 10 years ago and can't find the source code for now
).
As Jeff's experiment shows,when you tell the runtime to not do garbage collection asynchronously, everything is fine, except that it will most-likely result in severe 'lag' in the UI, due to the fact that AutoCAD must stop and wait for a GC to complete.