The
Resolver
class initializes on load and runs an asynchronous thread that makes Unity method calls, some of which are unsupported outside of the main Unity thread, including showing the window itself.
The
ShowWindow
call is wrapped within try/catch with the comment
// Unity says we can't open windows from this function so it throws an exception but also works fine.
This is bad practice and also just broken, using
OK
in the dialog popup causes Unity to hang indefinitely, and the window itself, while it renders, never actually manages to refresh packages.
The static constructor should instead be used to subscribe to the
EditorApplication.update
event, the handler should immediately return when
EditorApplication.isCompiling || EditorApplication.isUpdating
evaluates to
true
and otherwise should unsubscribe itself, set the session bool and check if a package resolve is needed.