Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BI Developer Extensions hanging Visual Studio while walking installed extensions on UI thread #130

Open
davkean opened this issue Nov 11, 2021 · 0 comments

Comments

@davkean
Copy link

davkean commented Nov 11, 2021

Describe the bug
I'm from the Visual Studio performance team and our telemetry is showing us that BI Developer Extensions extension is causing Visual Studio responsiveness issues by walking all installed extensions while on the UI thread. This has caused Visual Studio to freeze the following amounts over the past 21 days:

Blame Expressed Hits Total Hits Duration (75th Percentile) Delayed Mouse Clicks Delayed Key Strokes
bidshelper2019.dll!BIDSHelper.BIDSHelperPackage.OriginalInitialize 132 892 5.10 sec 126 7

Expressed delays are situations where the UI hung while within this method and it interrupted/prevented users mouse or keyboard input. Total hits are all the times the UI hung while within this method, regardless of whether input was interrupted.

The lines of code in question are these:

https://github.com/BIDeveloperExtensions/bideveloperextensions/blob/master/BidsHelperPackage.cs#L165-L208

Version/To Reproduce
This data comes our telemetry system, so we do not have any information on the versions of BI Developer Extensions or any dlls involved in this problem. We also have no understanding of the steps involved to reproduce the above situation other than the fact this data was just captured from real world usage.

Expected behavior
This code should avoid performing this operation on the UI thread. IVsExtensionManager is free-threaded and can be accessed on a background thread, move the SwitchToMainThreadAsync to after it, or introduce a new method that does something like this:

private async Task WalkExtensionsAsync()
{
    await TaskScheduler.Default;

    var em = await  GetServiceAsync<SVsExtensionManager, IVsExtensionManager>(); // NOTE the use of GetServiceAsync, not GetService

    foreach (Microsoft.VisualStudio.ExtensionManager.IInstalledExtension i in em.GetInstalledExtensions())
    { 
      ...
    }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant