May 20th, 2019

Updates to synchronous autoload of extensions in Visual Studio 2019

Mads Kristensen
Principal Product Manager

Since announcing that Visual Studio 2019 v16.1 will block any extension from synchronously autoloading, we’ve seen a tremendous effort of both 1st and 3rd-party extensions to implement async background load. It’s been truly amazing to see the community of extension authors stepping up to the task. Many even did it long before we announced Visual Studio 2019.

The result is faster startup and solution load times for Visual Studio, as well as fewer UI delays cause by blocking operations on the main thread. So, a big THANK YOU to all extension authors for all the hard work to make this happen.

Control the behavior

By default, Visual Studio 2019 v16.1 blocks any synchronously autoloaded package from any extension and shows a notification to alert the user about it.

Yellow bar notification

What’s new is that the individual user can now control how they would like the extension to load. The reason for this change is two-fold.

First, most extensions now support async background loading, which improves startup and solution load performance across the board. Second, there exist a class of extensions developed and used internally in companies around the world that for various reasons cannot support async background load. It’s usually because they no longer have the source code or the person who originally built the extension is no longer working at the company.

To stop blocking synchronously autoloaded extensions, you can either click the Allow synchronous autoload on the yellow notification bar or check a new checkbox in the options dialog.

Extensions options

It’s important to stress that we really don’t recommend to anyone that they allow synchronous autoload, but we recognize the need to be able to unblock users and teams to do their job. Even when we know it leads to degraded performance of Visual Studio.

Group policy

To set this option for all team members, the IT admin can now set a registry key through Group Policy. When the Group Policy is set, it takes precedence over the individual user’s ability to change the option themselves, and the checkbox is greyed out and disabled.

Marketplace updates

Extension authors must still use AsyncPackage and enable background load. An update to the Marketplace shows errors when uploading any extension supporting Visual Studio 2019 that uses synchronous autoload. This update is in place since no extension can make assumptions about the users allowing synchronously autoloaded extensions.

Simply put

Here’s a bullet list to sum it up:

  • Marketplace requires autoload to be async and in the background
  • Users and IT admins can opt out of the blocking behavior (not recommended)
  • Autoloading extension should always happen asynchronously in the background

Again, thank you so much for your efforts to make Visual Studio perform better to the benefit of all users. We appreciate the hard work and understand that on many cases it took a considerable amount of work to make this happen. You have our sincerest respect and admiration.

Author

Mads Kristensen
Principal Product Manager

Mads Kristensen is a principal program manager on the Visual Studio team and has published over 150 free Visual Studio extensions. He blogs about anything related to Visual Studio and can often be found hosting various shows on the Visual Studio YouTube channel..

21 comments

Discussion is closed. Login to edit/delete existing comments.

  • Hugo Ribeiro

    Hi. ModelingPackage (from the DSL-Tools in the Modeling SDK) derives from Package and it hasn't changed for years now...
    We use it extensively to customize the IDE for our multiple development teams. We have in fact created our own modeling framework to assist in the development of our business apps (ERP). So, it is very important for us that these DSLs load when Visual Studio loads.
    The option is all well but those warnings are...

    Read more
    • Mads KristensenMicrosoft employee Author

      You’ll have to manually change the generated code to use AsyncPackage from the Modelling SDK. We have no plans to discontinue the Modelling SDK

  • Jez

    I find this change extremely annoying, and whilst Microsoft may wish to make an informational comment on synchronous extension performance, I don't think they should ever officially deprecate these kinds of extensions.  As many have commented, there are lots of useful extensions out there that load this way.  The one that was key for me was the custom document well in the Productivity Power Tools, which has not been ported over to loading asynchronously, meaning...

    Read more
    • Mads KristensenMicrosoft employee Author

      The blog post shows how to allow synchronous extensions to load. The defaults changed, but you’re still in control.

  • Liviu Duma

    Hi,
    I created an extension as in the exemple provided (basically I did a fork of AsyncPackageMigration ), but in Visual Studio 2019, at least, I still get that Async Package Migration was not loaded because it uses deprecated syncronous autoload APIs.
    Can someone please provide some help on this, because it seems that the exemple does not work.

    Thank you

    • Liviu Duma

      Hi,
      I’ll reply here to my own question, may be it will be useful for someone else: when you do the switch from Package to AsyncPackage, remember to update the version number of the extension too, because otherwise, in my case at least, Visual Studio still “remembers” that that extension was loaded Synchronous and it kept showing that the extension is deprecated.
      Cheers,
      Liviu

  • Matthew Fabrizi

    Please continue to support the ability to opt-in to enable synchronously loaded extensions. The developers in my group use an extension we authored that does many things to tailor the build environment, but, most importantly, hooks the OnBuildBegin build event to update header files and resources that are dependencies for the build. Builds may fail or use stale data without this, so it's mandatory that this extension be loaded before a build begins. We experimented...

    Read more
    • Matthew Fabrizi

      The ability to enable synchronously loaded extensions is necessary for our use case, but I also want to point out that we continue to develop and enhance our extension. If possible, we'd like to be able to build our extension in Visual Studio 2019 (and beyond). As it stands, we need to retain Visual Studio 2017 in order to recompile our Package-derived extension because Visual Studio 2019 only supports AsyncPackage. Also, from our perspective Visual...

      Read more
  • Pit J.

    Finally!!! 

  • Matthieu Penant

    I tried to migrate indentGuide to the new format. I have a solution that works, but it seems like a hack , do you have any guideline available for migration? The ones I found don't go in much details, and are too simple to match this case: https://docs.microsoft.com/en-us/visualstudio/extensibility/how-to-use-asyncpackage-to-load-vspackages-in-the-background?view=vs-2019 https://github.com/Microsoft/VSSDK-Extensibility-Samples/tree/master/AsyncPackageMigration https://github.com/MicrosoftDocs/visualstudio-docs/blob/master/docs/extensibility/how-to-provide-an-asynchronous-visual-studio-service.md

    Read more
  • Dave Bacher

    Is this also why Visual Studio no longer picks a plug-in at random (including, in some cases, built-in Visual Studio capabilities) when there is a crappy network connection?
    When connection was bad - say a LTE Hotspot with 1 bar to the tower - Visual Studio 2017 would just pick a plug-in at random, and report "this plug-in is causing the IDE to load slowly."  Sometimes, it would be built in plug-ins like the Solution...

    Read more
  • André Ziegler

    as I commented in your last blog post about extensions, several extension authors have issue to keep compatibility with VS2017 when they switch to AsyncPackage because Microsoft.VisualStudio.Shell.15.0 in Version 16.0.0.0 is not found. What do they have to do to support both? CreateInstance failed for package [FooPackage]Source: 'mscorlib' Description: Die Datei oder Assembly "Microsoft.VisualStudio.Shell.15.0, Version=16.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" oder eine Abhängigkeit davon wurde nicht gefunden. Das System kann die angegebene Datei nicht finden. System.IO.FileNotFoundException: Die Datei...

    Read more
    • Mads KristensenMicrosoft employee Author

      To make the extension work in both 15.0 and 16.0, you must reference VSSDK assemblies with no higher version than 15.0. So for MS.VS.Shell.15.0 you have to use version 15.0 and not version 16.0.

      • André Ziegler

        the authors wrote they referenced the VS SDK nuget package in version 15.9

      • Mads KristensenMicrosoft employee Author

        Oh, well, that is a bug on our side. We’ll get it fixed asap. Thanks for the heads up!

        In the mean time, can you use the Madskristensen.VisualStudio.SDK meta package version 15.0 (-pre) to unblock you?

      • André Ziegler

        I'm not a extension author, but here is an example where developers limit it to 2019 only after migration:
        https://github.com/mike-ward/VSColorOutput/commit/70beddc177e9b1de427aea908fe55bb69e127555
        Author said, he tried downgrade to 15.x packages, but this also doesn't fix it.

        And how long is IAsyncLoadablePackageInitialize supported, which is used as a way by this extension to be async, but still keep comaptibility with really old VS2013? 

        Read more
      • Mads KristensenMicrosoft employee Author

        IAsyncLoadablePackageInitialize remains supported in VS2019. There has been no changes made. Our recommendation is to drop support for 2013 and earlier and then use the AsyncPackage base class instead. It is supported in 2015 and above.

  • Stanton, Andrew

    What good does having a fast solution load do if you are blocking the tools that correct the productivity problems within visual studio? Since you didnt know the answer to that, its "None".Solution loading is really not that slow, and definitely not slow compared to the time I have to spend in the awful VS Merge tool. Make an extension that replaces that so I dont have to keep replacing it manually.EDIT: And why did...

    Read more
  • Richard Pastrick

    This seems like the perfect place for a user controlled white list of extensions allowed to synch load instead of a blanket, everyone can synch load.

    • Mads KristensenMicrosoft employee Author

      It would be, but the ability to load synchronous extension is the exception to the rule. We really don't recommend you ever do that as the post explains. The scenarios is primarily intended for enterprises who has no other workaround. Even if you allow synchronous autoloaded extensions, you will still get a yellow notification when you install a new extension that synchronous autoloads, so you can decise if it's worth keeping it enabled/installed or not.

      Read more