Don't fail configuration setup if there's an exception during initialization.
Make exception message more accurate.
Don't double-free foreign threads.
Don't crash when checking whether a method should be shared.
Update build scripts.