{"id":255520,"date":"2026-02-03T07:00:21","date_gmt":"2026-02-03T15:00:21","guid":{"rendered":"https:\/\/devblogs.microsoft.com\/visualstudio\/?p=255520"},"modified":"2026-02-02T14:58:37","modified_gmt":"2026-02-02T22:58:37","slug":"performance-improvements-to-mef-based-editor-productivity-extensions","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/visualstudio\/performance-improvements-to-mef-based-editor-productivity-extensions\/","title":{"rendered":"Performance improvements to MEF-based editor productivity extensions"},"content":{"rendered":"<p><span data-contrast=\"none\">If you use editor productivity extensions for Visual Studio 2026, there&#8217;s good news\u2014they can now load faster! Extension developers with existing MEF-based editor productivity extensions should read this blog to learn about recent changes and how they might be affected.<\/span><span data-ccp-props=\"{}\">\u00a0<\/span><\/p>\n<p><span data-contrast=\"none\">We introduced\u00a0<\/span><a href=\"https:\/\/aka.ms\/VisualStudio.Extensibility\"><span data-contrast=\"none\">VisualStudio.Extensibility<\/span><\/a><span data-contrast=\"none\">\u00a0to simplify the creation of Visual Studio extensions for developers. Previously, handling\u00a0<\/span><a href=\"https:\/\/learn.microsoft.com\/en-us\/visualstudio\/extensibility\/visualstudio.extensibility\/extensibility-models?view=vs-2022#ui-thread-versus-background-thread\"><span data-contrast=\"none\">threads<\/span><\/a><span data-contrast=\"none\">\u00a0in VSSDK-based extensions was often difficult, requiring knowledge of thread affinity and even the ins and outs of COM just to avoid freezing Visual Studio. The new\u00a0extensibility\u00a0model\u00a0abstracts\u00a0these technical details\u00a0away seamlessly.<\/span><span data-ccp-props=\"{}\">\u00a0<\/span><\/p>\n<p><span data-contrast=\"none\">Despite this advancement, we recognize most Visual Studio extensions still use VSSDK, so\u00a0we&#8217;re\u00a0striving to make targeted improvements there as well\u00a0&#8211;\u00a0especially\u00a0regarding\u00a0performance. For Visual Studio 2026,\u00a0we&#8217;ve\u00a0added the ability to load\u00a0MEF-based editor extensions\u00a0on\u00a0a background thread, which significantly speeds up startup times for users.\u00a0<\/span><span data-contrast=\"auto\">A major highlight of Visual Studio 2026 is its improved performance, and the proposed change\u00a0we\u2019re\u00a0making to MEF is just one of many enhancements planned to make it even faster. We<\/span><span data-contrast=\"none\">\u00a0hope\u00a0you&#8217;ll\u00a0be pleased with the results.<\/span><span data-ccp-props=\"{}\">\u00a0<\/span><\/p>\n<h2 aria-level=\"1\"><span data-contrast=\"none\">What changed?<\/span><span data-ccp-props=\"{&quot;134245418&quot;:true,&quot;134245529&quot;:true,&quot;335559738&quot;:360,&quot;335559739&quot;:80}\">\u00a0<\/span><\/h2>\n<p><span data-contrast=\"none\">Visual Studio editor components use the\u00a0<\/span><a href=\"https:\/\/learn.microsoft.com\/en-us\/dotnet\/framework\/mef\/\"><span data-contrast=\"none\">Managed Extensibility Framework (MEF)<\/span><\/a><span data-contrast=\"none\">, which requires that objects be constructed in a free-threaded manner.\u00a0<\/span><span data-contrast=\"auto\">Despite official MEF guidelines,\u00a0we&#8217;ve\u00a0often loaded components on the UI thread, resulting in many extensions relying on this behavior and limiting our ability to enhance startup performance.<\/span><span data-ccp-props=\"{}\">\u00a0<\/span><\/p>\n<p><span data-contrast=\"none\">With Visual Studio 2026,\u00a0we\u2019re\u00a0shifting to a free-threaded model, loading MEF components on background threads. This means extensions with UI thread dependencies might\u00a0fail to\u00a0load.\u00a0We\u2019ve\u00a0been rigorously testing this approach in recent Visual Studio 2022\u00a0updates,\u00a0and we are aware that some extensions\u00a0that expect to load on the UI thread\u00a0will\u00a0fail to\u00a0load with this optimization.\u00a0To support extension developers through this transition,\u00a0we\u2019ve\u00a0provided\u00a0a setting\u00a0and an analyzer\u00a0that\u00a0allows\u00a0you to experiment with background loading\u00a0and detect if your extension could be\u00a0impacted\u00a0by this change\u00a0before we push it out more broadly. This initiative reflects our commitment to\u00a0reducing\u00a0disruptive changes and help extenders adapt when updates are necessary for the overall improvement of the product.<\/span><span data-ccp-props=\"{}\">\u00a0<\/span><\/p>\n<h2 aria-level=\"1\"><span data-contrast=\"none\">Does it impact my extension?<\/span><span data-ccp-props=\"{&quot;134245418&quot;:true,&quot;134245529&quot;:true,&quot;335559738&quot;:360,&quot;335559739&quot;:80}\">\u00a0<\/span><\/h2>\n<p><span data-contrast=\"auto\">To help extension developers\u00a0better detect if this change impacts\u00a0you, we created an analyzer\u00a0to\u00a0identify\u00a0potential issues.\u00a0We hope that this will give you the opportunity to bring your extension in compliance with MEF rules, so that your extension can also get a startup performance boost like the rest of Visual Studio 2026.<\/span><span data-ccp-props=\"{}\">\u00a0<\/span><\/p>\n<p><span data-contrast=\"auto\">The example below shows the analyzer running and reporting access\u202fto\u202fthe <code>Microsoft.VisualStudio.Shell.ThreadHelper<\/code> \u202fand <code>DTE2.StatusBar<\/code>\u202frequire UI thread.<\/span><span data-ccp-props=\"{}\">\u00a0<\/span><\/p>\n<p><span data-ccp-props=\"{}\"><a href=\"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2026\/02\/Picture1.webp\"><img decoding=\"async\" class=\"alignnone size-full wp-image-255522\" src=\"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2026\/02\/Picture1.webp\" alt=\"Picture1 image\" width=\"936\" height=\"486\" srcset=\"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2026\/02\/Picture1.webp 936w, https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2026\/02\/Picture1-300x156.webp 300w, https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2026\/02\/Picture1-768x399.webp 768w\" sizes=\"(max-width: 936px) 100vw, 936px\" \/><\/a>\u00a0<\/span><\/p>\n<p><span data-contrast=\"auto\">\u00a0To use the analyzer,\u202fadd a reference to the latest version of the\u00a0<\/span><a href=\"https:\/\/www.nuget.org\/packages\/microsoft.visualstudio.sdk.analyzers\"><span data-contrast=\"none\">Microsoft.VisualStudio.SDK.Analyzers<\/span><\/a><span data-contrast=\"auto\">\u00a0package:<\/span><span data-ccp-props=\"{}\">\u00a0<\/span><\/p>\n<p><code>&lt;PackageReference\u00a0Include=\"Microsoft.VisualStudio.SDK.Analyzers\" Version=\"17.7.98\"\u00a0PrivateAssets=\"all\" \/&gt;<\/code><\/p>\n<p><span data-contrast=\"auto\">To\u00a0validate\u00a0your extension can\u00a0adapt to this change, enable the Preview Feature flag\u00a0\u201cInitialize editor parts asynchronously during solution load\u201d.<\/span><span data-ccp-props=\"{}\">\u00a0<\/span><\/p>\n<p><span data-ccp-props=\"{}\"> <a href=\"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2026\/02\/Picture2.webp\"><img decoding=\"async\" class=\"alignnone size-full wp-image-255523\" src=\"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2026\/02\/Picture2.webp\" alt=\"Picture2 image\" width=\"918\" height=\"105\" srcset=\"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2026\/02\/Picture2.webp 918w, https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2026\/02\/Picture2-300x34.webp 300w, https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2026\/02\/Picture2-768x88.webp 768w\" sizes=\"(max-width: 918px) 100vw, 918px\" \/><\/a><\/span><\/p>\n<p><span data-contrast=\"auto\">When debugging, you may set\u00a0a\u202fbreakpoint\u202fin MEF part constructors and\u202fevaluate\u202f<code>System.Threading.Thread.CurrentThread.ManagedThreadId<\/code>. If\u202fit\u2019s\u202fdifferent than <\/span><code>1<\/code><span data-contrast=\"auto\">, then\u202fyour code executes on the background thread.\u202f<\/span><span data-ccp-props=\"{}\">\u00a0<\/span><\/p>\n<p><span data-ccp-props=\"{}\"> <a href=\"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2026\/02\/Picture3.webp\"><img decoding=\"async\" class=\"alignnone size-full wp-image-255524\" src=\"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2026\/02\/Picture3.webp\" alt=\"Picture3 image\" width=\"936\" height=\"519\" srcset=\"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2026\/02\/Picture3.webp 936w, https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2026\/02\/Picture3-300x166.webp 300w, https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2026\/02\/Picture3-768x426.webp 768w\" sizes=\"(max-width: 936px) 100vw, 936px\" \/><\/a><\/span><\/p>\n<h2 aria-level=\"1\"><span data-contrast=\"none\">Call to action<\/span><span data-ccp-props=\"{&quot;134245418&quot;:true,&quot;134245529&quot;:true,&quot;335559738&quot;:360,&quot;335559739&quot;:80}\">\u00a0<\/span><\/h2>\n<p><span data-contrast=\"none\">Loading MEF parts on a background thread is essential for improving Visual Studio&#8217;s performance, and we have\u00a0<\/span><span data-contrast=\"auto\">gradually\u00a0enabled\u00a0this change in Visual Studio 2026.<\/span><span data-contrast=\"none\">\u00a0We recognize that code changes can be inconvenient, so\u00a0we&#8217;ve\u00a0made it straightforward to spot and resolve any issues.\u00a0<\/span><span data-contrast=\"auto\">To see examples of removing UI thread affinity,\u00a0please see our\u00a0<\/span><a href=\"https:\/\/github.com\/microsoft\/VSSDK-Analyzers\/blob\/f0823e48d7a43cc84dc0eb3ce622cc149451854b\/doc\/VSSDK008.md\"><span data-contrast=\"none\">documentation<\/span><\/a><span data-contrast=\"auto\">\u00a0or a sample\u00a0<\/span><a href=\"https:\/\/github.com\/dotnet\/razor\/pull\/10593\"><span data-contrast=\"none\">PR<\/span><\/a><span data-contrast=\"auto\">\u00a0on how we made this change ourselves.\u202f<\/span><span data-ccp-props=\"{}\">\u00a0<\/span><\/p>\n<h2 aria-level=\"1\"><span data-contrast=\"none\">We want to hear from you!<\/span><span data-ccp-props=\"{&quot;134245418&quot;:true,&quot;134245529&quot;:true,&quot;335559738&quot;:360,&quot;335559739&quot;:80}\">\u00a0<\/span><\/h2>\n<p><span data-contrast=\"auto\">Thank you for sharing your issues and suggestions with us, and we hope you&#8217;ll keep providing feedback about what you like and what we can improve in Visual Studio.\u00a0For those new and experienced to extending Visual Studio, we invite you to visit\u00a0our\u00a0<\/span><a href=\"https:\/\/aka.ms\/VisualStudio.Extensibility\"><span data-contrast=\"none\">documentation<\/span><\/a><span data-contrast=\"auto\">\u00a0to learn\u00a0more, or\u00a0watch the\u00a0<\/span><a href=\"https:\/\/aka.ms\/vsextensibilityseries\"><span data-contrast=\"none\">video series<\/span><\/a><span data-contrast=\"auto\">\u00a0on Visual Studio Toolbox where Visual Studio engineers take you through how to build extensions using\u00a0our\u00a0<\/span><a href=\"https:\/\/aka.ms\/VisualStudio.Extensibility\/Samples\"><span data-contrast=\"none\">samples<\/span><\/a><span data-contrast=\"auto\">\u00a0on GitHub. Feel free to share feedback with us via<\/span><span data-contrast=\"auto\">\u202f<\/span><a href=\"https:\/\/developercommunity.visualstudio.com\/home%22%20\/t%20%22_blank\"><span data-contrast=\"none\">Developer Community<\/span><\/a><span data-contrast=\"auto\">: report any bugs or issues via<\/span><span data-contrast=\"auto\">\u202f<\/span><a href=\"https:\/\/learn.microsoft.com\/en-us\/visualstudio\/ide\/how-to-report-a-problem-with-visual-studio?view=visualstudio\"><span data-contrast=\"none\">report a problem<\/span><\/a><span data-contrast=\"auto\">\u202f<\/span><span data-contrast=\"auto\">and<\/span><span data-contrast=\"auto\">\u202f<\/span><a href=\"https:\/\/developercommunity.microsoft.com\/VisualStudio\/suggest\"><span data-contrast=\"none\">share your suggestions<\/span><\/a><span data-contrast=\"auto\">\u202f<\/span><span data-contrast=\"auto\">for new features or improvements to existing ones. If you want a closer engagement with other partners in the ecosystem, please visit our\u00a0GitHub repo to\u00a0report\u00a0<\/span><a href=\"https:\/\/github.com\/microsoft\/VSExtensibility\/issues\"><span data-contrast=\"none\">issues<\/span><\/a><span data-contrast=\"auto\">\u00a0as well.<\/span><span data-ccp-props=\"{}\">\u00a0<\/span><\/p>\n<p><span data-contrast=\"auto\">Stay connected with the Visual Studio team by following us on\u00a0<\/span><a href=\"https:\/\/www.youtube.com\/@visualstudio\"><span data-contrast=\"none\">YouTube<\/span><\/a><span data-contrast=\"auto\">,\u00a0<\/span><a href=\"https:\/\/twitter.com\/VisualStudio\"><span data-contrast=\"none\">Twitter<\/span><\/a><span data-contrast=\"auto\">,\u00a0<\/span><a href=\"https:\/\/www.linkedin.com\/showcase\/microsoft-visual-studio\/\"><span data-contrast=\"none\">LinkedIn<\/span><\/a><span data-contrast=\"auto\">,\u00a0<\/span><a href=\"https:\/\/www.twitch.tv\/visualstudio\"><span data-contrast=\"none\">Twitch<\/span><\/a><span data-contrast=\"auto\">\u00a0and on\u00a0<\/span><a href=\"https:\/\/learn.microsoft.com\/en-us\/visualstudio\/?view=vs-2022\"><span data-contrast=\"none\">Microsoft Learn<\/span><\/a><span data-contrast=\"auto\">.\u00a0<\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<p>If you use editor productivity extensions for Visual Studio 2026, there&#8217;s good news\u2014they can now load faster! Extension developers with existing MEF-based editor productivity extensions should read this blog to learn about recent changes and how they might be affected.\u00a0 We introduced\u00a0VisualStudio.Extensibility\u00a0to simplify the creation of Visual Studio extensions for developers. Previously, handling\u00a0threads\u00a0in VSSDK-based extensions [&hellip;]<\/p>\n","protected":false},"author":8002,"featured_media":255522,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[1388,155],"tags":[294,53],"class_list":["post-255520","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-extensibility","category-visual-studio","tag-extensions","tag-performance"],"acf":[],"blog_post_summary":"<p>If you use editor productivity extensions for Visual Studio 2026, there&#8217;s good news\u2014they can now load faster! Extension developers with existing MEF-based editor productivity extensions should read this blog to learn about recent changes and how they might be affected.\u00a0 We introduced\u00a0VisualStudio.Extensibility\u00a0to simplify the creation of Visual Studio extensions for developers. Previously, handling\u00a0threads\u00a0in VSSDK-based extensions [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-json\/wp\/v2\/posts\/255520","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\/8002"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-json\/wp\/v2\/comments?post=255520"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-json\/wp\/v2\/posts\/255520\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-json\/wp\/v2\/media\/255522"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-json\/wp\/v2\/media?parent=255520"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-json\/wp\/v2\/categories?post=255520"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-json\/wp\/v2\/tags?post=255520"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}