{"id":8395,"date":"2016-11-10T09:30:18","date_gmt":"2016-11-10T17:30:18","guid":{"rendered":"https:\/\/blogs.msdn.microsoft.com\/visualstudio\/?p=8395"},"modified":"2019-02-14T15:27:44","modified_gmt":"2019-02-14T23:27:44","slug":"extensibility-in-visual-studio-15-increasing-reliability-and-performance","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/visualstudio\/extensibility-in-visual-studio-15-increasing-reliability-and-performance\/","title":{"rendered":"Extensibility in Visual Studio &#8220;15&#8221;: Increasing Reliability and Performance"},"content":{"rendered":"<p>If you\u2019ve been following this blog, you know that in Visual Studio \u201c15\u201d we\u2019ve been focused on making our developer tools easier to install, increasing performance, and enhancing developer productivity. We\u2019ve been doing the same for extensions, and it\u2019s time to talk a bit more about the implications of these changes both on extension authors and on customers who are using extensions.<\/p>\n<p>A quick summary of the changes we\u2019re making:<\/p>\n<ul>\n<li>We\u2019ve added a performance monitoring system for extensions. Customers will now see a gold notification bar when an extension is slowing load time or typing speed;<\/li>\n<li>We now batch extension updates and installs to make it easier to install or update multiple extensions;<\/li>\n<li>We\u2019ve made it possible for extensions to detect and install dependent components, now that the default installation footprint of Visual Studio is much smaller;<\/li>\n<li>We\u2019ve made several performance improvements that have an impact on extension authors, such as lightweight solution load and NGEN support for extensions;<\/li>\n<li>Lastly, we\u2019ve updated the Visual Studio marketplace to make it easier to find and install extensions;<\/li>\n<\/ul>\n<p>The rest of the post goes into more detail on each of these areas.<\/p>\n<p>If you\u2019re an extension author, you\u2019ll want to read this post carefully, since we\u2019re asking you to do some work in this release to support the performance and installation work we\u2019re making to Visual Studio. There is some inevitable friction here, and so we want to give you a heads-up so that you can make the appropriate changes to your extension before we go live.<\/p>\n<h2>Performance<\/h2>\n<p>One of the <a href=\"https:\/\/visualstudio.uservoice.com\/forums\/121579-visual-studio-ide\/suggestions\/2627855-visual-studio-task-manager\">top extensibility requests in UserVoice<\/a> is for tools that let extension users identify slow extensions and disable them if necessary. We designed the extensibility model in Visual Studio to offer great power \u2013 authors largely have access to the same APIs that we use internally \u2013 so it\u2019s important that extensions do not degrade overall product performance.<\/p>\n<p>In Visual Studio \u201c15\u201d, we have focused on addressing three specific performance bottlenecks in particular: (i) <a href=\"https:\/\/blogs.msdn.microsoft.com\/visualstudio\/2016\/10\/10\/faster-visual-studio-15-startup\/\">Visual Studio startup performance<\/a>; (ii) <a href=\"https:\/\/blogs.msdn.microsoft.com\/visualstudio\/2016\/10\/11\/shorter-solution-load-time-in-visual-studio-15\/\">solution load performance<\/a>; (iii) <a href=\"https:\/\/blogs.msdn.microsoft.com\/visualstudio\/2016\/10\/14\/improved-overall-visual-studio-15-responsiveness\/\">overall responsiveness<\/a>. And in addition to improving our own performance, we\u2019re now also adding features to help you measure and manage extension performance in these areas.<\/p>\n<p>If we detect a slow-performing extension that falls into one of these categories, we will display a message that identifies the extension and gives the user the opportunity to disable it. Here\u2019s an example with a malicious extension that sleeps for six seconds during initialization:<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/4\/2019\/06\/Extensibility-in-VS15-Example-of-Malicious-Extension.png\"><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/4\/2019\/06\/Extensibility-in-VS15-Example-of-Malicious-Extension.png\" width=\"1268\" height=\"514\" \/><\/a><\/p>\n<p>You can see the performance of extensions on your system at any time by selecting the Help \/ Manage Visual Studio Performance menu item.<\/p>\n<p>We trigger this notification by measuring the total initialization time spent by the extension on the main thread. If it exceeds a lower time threshold, we will warn users that the extension is loading slowly; if it exceeds a second, still higher time threshold, we will offer to disable the extension for the user.<b><\/b><\/p>\n<p>We use the same dialog to also track extensions that introduce delays to typing responsiveness. <a href=\"https:\/\/pavelfatin.com\/typing-with-pleasure\/\">Studies have shown<\/a> that input latency greatly impacts the perception of an application\u2019s performance. So, Visual Studio now measures the duration of calls within extensions to extension command filters and editor event handlers that are triggered by typing characters, and if those calls regularly take longer than a predefined threshold, we display an infobar to warn users of the impact of that extension on typing responsiveness:<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/4\/2019\/06\/Extensibility-in-VS15-Infobar-to-warn-users-of-impact-of-extension-on-typing-responsiveness1.png\"><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/4\/2019\/06\/Extensibility-in-VS15-Infobar-to-warn-users-of-impact-of-extension-on-typing-responsiveness1.png\" width=\"692\" height=\"103\" class=\"\" \/><\/a><\/p>\n<p>If you\u2019re an extension author, we recommend these best practices to ensure your extension performs well in Visual Studio:<\/p>\n<ol>\n<li>Use <a href=\"https:\/\/msdn.microsoft.com\/en-us\/library\/mt750411.aspx\">rule-based contexts<\/a> to specify precise conditions when your extension should be loaded. For example, you can ensure that an extension is only loaded when a C# or Visual Basic project is active, rather than at Visual Studio startup.<\/li>\n<li>Use the <a href=\"https:\/\/msdn.microsoft.com\/en-us\/library\/mt750288.aspx\">AsyncPackage support<\/a> in Visual Studio 2015 and above to allow packages to be loaded on a background thread.<\/li>\n<li>Review your extension\u2019s command filters and editor event handlers (such as ITextBuffer.Changed) and perform any operations longer than 50ms asynchronously;<\/li>\n<li>Minimize work performed during package initialization, deferring it instead to occur on invocation of a user action.<\/li>\n<\/ol>\n<h2>Batched Extension Installations<\/h2>\n<p>Another common feature request from Visual Studio 2015 was to make it easier to install, update and remove multiple Visual Studio extensions at once. Visual Studio \u201c15\u201d now lets you batch up extension change operations to occur at once.<\/p>\n<p>Here\u2019s a screenshot:<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/4\/2019\/06\/Extensibility-in-VS15-Batched-Extension-Installations.png\"><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/4\/2019\/06\/Extensibility-in-VS15-Batched-Extension-Installations.png\" width=\"1287\" height=\"892\" \/><\/a><\/p>\n<h2>Size<\/h2>\n<p>With the <a href=\"https:\/\/devblogs.microsoft.com\/visualstudio\/redesigning-visual-studio-installation\/\">new Visual Studio installer<\/a>, we have refactored Visual Studio to be more modular, installing just the features you need for the work you\u2019re doing. The smallest configuration of Visual Studio installs in just a couple of minutes on typical machines, and the increasing number of Visual Studio developers who are using it for new platforms and languages like Python and R no longer need to install support for things like C#, MSBuild and ASP.NET to get a great Visual Studio working environment.<\/p>\n<p>We\u2019ve therefore created a way for extension authors to express their Visual Studio component dependencies by extending the VSIX manifest. The model is designed so that if dependencies are missing, the extension installer can acquire and install the missing components automatically. With this approach, for example, an extension can hint to the installer that it requires the managed language debugger to be available for the extension to run successfully.<\/p>\n<p>We\u2019re updating the extensibility tools to automatically emit these changes for new projects. By default, we set a dependency on just the Core Editor, but you can add additional components by selecting<b> <\/b>them from the Prerequisites tab. Here\u2019s a screenshot:<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/4\/2019\/06\/Extensibility-in-VS15-Inform-installer-about-additional-dependencies-in-the-Prerequisite-tab.png\"><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/4\/2019\/06\/Extensibility-in-VS15-Inform-installer-about-additional-dependencies-in-the-Prerequisite-tab.png\" width=\"1185\" height=\"700\" \/><\/a><\/p>\n<p>The next public build of Visual Studio \u201c15\u201d will contain the updated manifest designer, and we\u2019re planning to ship an update to the tools in Visual Studio 2015 to support the new manifest format before we complete Visual Studio \u201c15\u201d.<\/p>\n<h2>New Extension Capabilities<\/h2>\n<p>We\u2019re taking advantage of the changes to the standard VSIX extension format to add some powerful new capabilities for extension authors.<\/p>\n<ul>\n<li>Extension assemblies can now be compiled into native images (through NGEN) at install time, for added performance. You can specify NGEN options from the Properties toolwindow:<\/li>\n<\/ul>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/4\/2019\/06\/Extensibility-in-VS15-Specifiy-NGEN-options-in-Properties-tool-window.png\"><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/4\/2019\/06\/Extensibility-in-VS15-Specifiy-NGEN-options-in-Properties-tool-window.png\" width=\"620\" height=\"130\" class=\"\" \/><\/a><\/p>\n<ul>\n<li>Extensions may now install files in certain locations outside of the extensions folder. This enables new scenarios like MSBuild tasks to be installed from a VSIX folder.<\/li>\n<\/ul>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/4\/2019\/06\/Extensibility-in-VS15-Specify-install-root-location.png\"><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/4\/2019\/06\/Extensibility-in-VS15-Specify-install-root-location.png\" width=\"376\" height=\"173\" class=\"\" \/><\/a><\/p>\n<p>One caveat: these capabilities are only available for \u201call user\u201d extensions because they require elevation. We hope to encourage extension authors who have until now been forced to wrap their VSIX in an MSI to accomplish these needs to be able to transition to a pure VSIX, enabling better manageability, roaming and auto-update capabilities for users of their extensions.<\/p>\n<h2>Lightweight Solution Load<\/h2>\n<p>In Visual Studio \u201c15\u201d, solutions will load faster due to support for <a href=\"https:\/\/blogs.msdn.microsoft.com\/visualstudio\/2016\/10\/11\/shorter-solution-load-time-in-visual-studio-15\/\">lightweight solution load<\/a>. When lightweight solution load is enabled, Visual Studio will delay fully loading projects until you start working on them. Visual Studio will still preserve common functionality, such as allowing you to navigate through your codebase, edit code, and build projects without fully loading projects. We\u2019ve seen this speed up solution load by a factor of two or more.<\/p>\n<p>This feature is still \u201cexperimental\u201d, so to try out this feature in Visual Studio \u201c15\u201d, you\u2019ll need to manually enable the lightweight solution load checkbox in Tools \/ Options \/ Projects and Solutions.<\/p>\n<p>If you\u2019re an extension author, lightweight solution load may impact your extension if you depend on a project to be fully loaded. Our team is putting together steps and guidance on how extensions can know when projects are not yet fully loaded, and how to respond accordingly. We will share this guidance as soon as possible.<\/p>\n<h2>Detecting Installations<\/h2>\n<p>Some tools need to get more specific information about a Visual Studio installation, for example an external utility that needs the location of the C++ compiler toolset. Along with the <a href=\"https:\/\/blogs.msdn.microsoft.com\/visualstudio\/2016\/10\/11\/shorter-solution-load-time-in-visual-studio-15\/\">changes to Visual Studio to reduce system impact<\/a>, we\u2019ve added some new setup configuration APIs to make it easier to discover instances of Visual Studio \u201c15\u201d. <a href=\"https:\/\/blogs.msdn.microsoft.com\/heaths\/2016\/09\/15\/changes-to-visual-studio-15-setup\/\">Heath Stewart\u2019s blog<\/a> includes more detail about these APIs and samples for managed and unmanaged code.<\/p>\n<h2>Marketplace<\/h2>\n<p>One last significant change: we\u2019re transitioning to the Visual Studio Marketplace as a place for discovering and installing extensions, again in response to your <a href=\"https:\/\/visualstudio.uservoice.com\/forums\/121579-visual-studio-ide\/suggestions\/7220021-give-some-love-to-the-visual-studio-gallery\">feedback<\/a>. The marketplace is a modern website that supports extensions for our developer tools family, including Visual Studio itself, Visual Studio Code and Visual Studio Team Services.<\/p>\n<p>In the next months, we\u2019ll begin the process of retiring the old Visual Studio Gallery. You don\u2019t have any work to do if you\u2019re an extension author \u2013 we\u2019ll migrate all the data across automatically. We are excited by some of the new features we\u2019ll be able to offer extension authors and users alike once we are live on the new site.<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/4\/2019\/06\/Extensibility-in-VS15-Marketplace.png\"><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/4\/2019\/06\/Extensibility-in-VS15-Marketplace.png\" width=\"1050\" height=\"539\" \/><\/a><\/p>\n<h2>More Information<\/h2>\n<p>If you\u2019re building an extension for Visual Studio \u201c15\u201d, we\u2019re glad to hear from you. In particular, the editor and extensibility engineering teams hang out on our <a href=\"https:\/\/gitter.im\/Microsoft\/extendvs\">Gitter team room<\/a> along with many other extension authors. You can also submit or vote on feature requests in <a href=\"https:\/\/visualstudio.uservoice.com\/forums\/121579-visual-studio-ide\/category\/115698-extensibility\">the extensibility area of our UserVoice site<\/a> \u2013 we\u2019re listening!<\/p>\n<table cellspacing=\"0\" cellpadding=\"2\" width=\"600\" border=\"0\">\n<tbody>\n<tr>\n<td valign=\"top\" width=\"150\"><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/4\/2019\/06\/Tim-Sneath.jpg\" width=\"256\" height=\"256\" \/><\/td>\n<td valign=\"top\" width=\"450\"><strong>Tim Sneath<\/strong>, Principal Lead Program Manager, Visual Studio<\/p>\n<p>Tim leads a team focused on Visual Studio acquisition and extensibility. His mission is to see developers create stunning applications built on the Microsoft platform, and to persuade his mother that her computer is not an enemy. Amongst other strange obsessions, Tim collects vintage releases of Windows, and has a near-complete set of shrink-wrapped copies that date back to the late 80s.<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n","protected":false},"excerpt":{"rendered":"<p>If you\u2019ve been following this blog, you know that in Visual Studio \u201c15\u201d we\u2019ve been focused on making our developer tools easier to install, increasing performance, and enhancing developer productivity. We\u2019ve been doing the same for extensions, and it\u2019s time to talk a bit more about the implications of these changes both on extension authors [&hellip;]<\/p>\n","protected":false},"author":13,"featured_media":255385,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[472,155,1029],"tags":[237,85,1383,294,172,585,182,653],"class_list":["post-8395","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-gaming","category-visual-studio","category-web","tag-net","tag-asp-net","tag-c","tag-extensions","tag-python","tag-r","tag-unity","tag-visual-basic"],"acf":[],"blog_post_summary":"<p>If you\u2019ve been following this blog, you know that in Visual Studio \u201c15\u201d we\u2019ve been focused on making our developer tools easier to install, increasing performance, and enhancing developer productivity. We\u2019ve been doing the same for extensions, and it\u2019s time to talk a bit more about the implications of these changes both on extension authors [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-json\/wp\/v2\/posts\/8395","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-json\/wp\/v2\/users\/13"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-json\/wp\/v2\/comments?post=8395"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-json\/wp\/v2\/posts\/8395\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-json\/wp\/v2\/media\/255385"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-json\/wp\/v2\/media?parent=8395"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-json\/wp\/v2\/categories?post=8395"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-json\/wp\/v2\/tags?post=8395"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}