Custom window performance regression from 2020 -> 2021, help?

My team has recently upgraded Unity from 2020.3.35f1 to 2021.3.10f1.

We’ve got a custom window with a lot of things in it.

In 2021 (but not 2020), a loading bar stating “Waiting for user code in mscorlib.dll to finish executing” (see attached) is sitting for more than 1 minute, the first time I open the custom window. The second time, everything is fine. The loading bar consistently is longer than 1 minute any time you close and re-open Unity and try to open this custom window.

In 2020, the window took about 15 seconds to load for the first time.

Any tips on where to start investigating first-time custom window performance in 2021?

8461208--1123391--image (10).png

This started to happen to me after recent Windows 11 update, I would think this is the reason at least. As well as this message can sit for several minutes when opening Package Manager9677084--1379360--upload_2024-3-3_9-12-35.png

What can I do to fix it? Unity 2022.3.7f1