Let me suggest a completely different option: make a destructor that works while the GC is running by managing the resources manually in both construction and destruction. Remember, it isn't *all* reference types that are problematic to access, it is just GC managed references. So anything from a C function is cool.

Otherwise, accessing the runtime variable seems ok to me like the link said, hacky sure, but it'd work.... nothing else comes to mind, other than using a separate dispose() method when you delete it manually and leave the dtor for only the GC.

Reply via email to