You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
However, if something is blocking the UI thread, NuGet/PMC can't get the UI thread to do the cast. If the code blocking the UI thread called a NuGet API and is waiting for the result, this causes a deadlock.
A few lines earlier in RunspaceManager.cs, PMC gets the DTE object via NuGet's ServiceLocator, which correctly uses JTF to switch to the UI thread. Hence, by getting the service locator to cast to DTE2, rather than doing it from a background thread, this should eliminate the risk of deadlock.
Verbose Logs
No response
The text was updated successfully, but these errors were encountered:
NuGet Product Used
Visual Studio Package Manager Console
Product Version
all?
Worked before?
No response
Impact
It's more difficult to complete my work
Repro Steps & Context
There's a timing bug, which means that it can't be reproduced on demand, it just depends if everything lines up in the wrong way.
Huge thanks to @sharwell and @CyrusNajmabadi for finding and telling us about the problem (and how to fix
Low level details are:
During PMC initialization,
RunspaceManager.CreateRunspace
casts aDTE
object toDTE2
, but at this time it's running on a background thread. Since DTE(2) is a COM object, it needs the UI thread to do the cast.However, if something is blocking the UI thread, NuGet/PMC can't get the UI thread to do the cast. If the code blocking the UI thread called a NuGet API and is waiting for the result, this causes a deadlock.
A few lines earlier in
RunspaceManager.cs
, PMC gets the DTE object via NuGet'sServiceLocator
, which correctly uses JTF to switch to the UI thread. Hence, by getting the service locator to cast to DTE2, rather than doing it from a background thread, this should eliminate the risk of deadlock.Verbose Logs
No response
The text was updated successfully, but these errors were encountered: