{"id":2383,"date":"2013-10-16T10:42:00","date_gmt":"2013-10-16T10:42:00","guid":{"rendered":"https:\/\/blogs.msdn.microsoft.com\/visualstudioalm\/2013\/10\/16\/switching-to-managed-compatibility-mode-in-visual-studio-2013\/"},"modified":"2019-02-14T17:54:15","modified_gmt":"2019-02-15T01:54:15","slug":"switching-to-managed-compatibility-mode-in-visual-studio-2013","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/devops\/switching-to-managed-compatibility-mode-in-visual-studio-2013\/","title":{"rendered":"Switching to Managed Compatibility Mode in Visual Studio 2013"},"content":{"rendered":"<p>In Visual Studio 2012, we introduced a new managed debug engine that provides us the ability to more rapidly add new features compared to the older implementation. This can be seen by the number of features introduced in Visual Studio 2013 after only a single year including <a href=\"http:\/\/blogs.msdn.com\/b\/visualstudioalm\/archive\/2013\/06\/27\/seeing-function-return-values-in-the-debugger-in-visual-studio-2013.aspx\">Managed Return Values<\/a>, <a href=\"http:\/\/blogs.msdn.com\/b\/visualstudioalm\/archive\/2013\/06\/26\/debugging-support-for-64-bit-edit-and-continue-in-visual-studio-2013.aspx\">.NET 64-bit Edit and Continue<\/a>, <a href=\"http:\/\/blogs.msdn.com\/b\/visualstudioalm\/archive\/2013\/07\/01\/debugging-asynchronous-code-in-visual-studio-2013-call-stack-enhancements.aspx\">Async Callstacks Enhancements<\/a>, and <a href=\"http:\/\/blogs.msdn.com\/b\/visualstudioalm\/archive\/2013\/07\/02\/debugging-asynchronous-code-in-visual-studio-2013-tasks-window.aspx\">Improved Tasks Window<\/a> to name a few. Unfortunately, there are still a couple scenarios that are not supported yet with the new debug engine, so in these cases you will have to switch back to the legacy engine.<\/p>\n<p>To most Visual Studio developers, the current debug engine should only have&nbsp;a positive impact and you need not worry about what happens under the covers. While eventually we plan to completely replace the legacy engine, there are still<br \/>two scenarios where it is needed. In this blog post, I will show you how to switch to managed compatibility mode, which you should do ONLY if you have interest in the two scenarios that the current engine does not yet support.<\/p>\n<ol>\n<li>You are using a .NET language other than C#, VB, or F# that provides its own Expression Evaluator (this includes managed C++)<\/li>\n<li>You want to enable Edit and Continue (EnC) for C++ projects while mixed mode debugging<\/li>\n<\/ol>\n<p>If these scenarios do not apply to you, there is no need for you to switch back to the legacy debug engine.<\/p>\n<p><em>[DISCLAIMER] Enabling Managed Compatibility Mode will disable many features that depend on the current debugger implementation to operate. It is our goal in the future to completely remove the legacy engine from the product and hence remove the options discussed later in this blog post.<\/em><\/p>\n<p>With the disclaimer out of the way, and only if you care about the two aforementioned scenarios in VS2013, please feel free to read on to find out how to enable the legacy managed debug engine through the global options, for an EXE project, during attach, and manually through the project file.<\/p>\n<h2>Global Options<\/h2>\n<p>To switch back to the legacy debug engine globally, select <strong>Tools<\/strong>\/ <strong>Options<\/strong> &#8230;<\/p>\n<p>&nbsp;<a href=\"https:\/\/devblogs.microsoft.com\/00\/00\/00\/45\/92\/4062.legacy1.png\"><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/devops\/wp-content\/uploads\/sites\/6\/2013\/10\/4062.legacy1-1.png\" alt=\"\" border=\"0\" \/><\/a><\/p>\n<p>then check <strong>Use Managed Compatibility Mode<\/strong> on the <strong>Debugging <\/strong>\/ <strong>General<\/strong> tab.<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/00\/00\/00\/45\/92\/8712.legacy2.png\"><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/devops\/wp-content\/uploads\/sites\/6\/2013\/10\/8712.legacy2-1.png\" alt=\"\" border=\"0\" \/><\/a><\/p>\n<p>The global option will force the legacy engine to be used for any launch or attach.<\/p>\n<h2>EXE Project<\/h2>\n<p>The exe project system is used when the user invokes <strong>File<\/strong> \/ <strong>Open Project<\/strong>, and then selects an existing exe file. To specify the legacy debugger engine, choose <strong>Project <\/strong>\/ <strong>Properties<\/strong> and then set the <strong>Use Managed Legacy Engine<\/strong> to <strong>Yes <\/strong>on the General project property page. This setting takes precedence over the <strong>Tools<\/strong> \/ <strong>Options<\/strong> setting.<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/00\/00\/00\/45\/92\/3288.legacy3.png\"><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/devops\/wp-content\/uploads\/sites\/6\/2013\/10\/3288.legacy3-1.png\" alt=\"\" border=\"0\" \/><\/a><\/p>\n<p>&nbsp;<\/p>\n<h2>Attach to a Process<\/h2>\n<p>To specify the legacy debug engine when you attach to a process, choose <strong>Debug<\/strong> \/ <strong>Attach to Process<\/strong>. window<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/00\/00\/00\/45\/92\/3157.legacy4.png\"><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/devops\/wp-content\/uploads\/sites\/6\/2013\/10\/3157.legacy4-1.png\" alt=\"\" border=\"0\" \/><\/a><\/p>\n<p>&nbsp;Then click the <strong>Select <\/strong>button on the <strong>Attach to Process <\/strong>dialog.<em><\/em><\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/00\/00\/00\/45\/92\/0535.legacy5.png\"><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/devops\/wp-content\/uploads\/sites\/6\/2013\/10\/0535.legacy5-1.png\" alt=\"\" border=\"0\" \/><\/a><\/p>\n<p>&nbsp;On the <strong>Select Code Type<\/strong> dialog, make sure the right version of <strong>Managed<\/strong> code is selected, and then select Managed Compatibility Mode.<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/00\/00\/00\/45\/92\/1440.legacy6.png\"><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/devops\/wp-content\/uploads\/sites\/6\/2013\/10\/1440.legacy6-1.png\" alt=\"\" border=\"0\" \/><\/a>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<h2>Through the .csproj\/.vbproj file<\/h2>\n<p>Hand editing the .csproj\/.vbproj, by adding the &lsquo;DebugEngines&rsquo; property within &lsquo;PropertyGroup&rsquo;, you can force the project to use the legacy debugger engine. To enable managed compatibility mode, define the property like this:<\/p>\n<pre><code class=\"mysql\">&lt;PropertyGroup&gt;<br \/> &lt;Configuration Condition=\" '$(Configuration)' == '' \"&gt;Debug&lt;\/Configuration&gt;<br \/> &hellip;<br \/><strong> &lt;DebugEngines&gt;{351668CC-8477-4fbf-BFE3-5F1006E4DB1F}&lt;\/DebugEngines&gt;<\/strong><br \/> &hellip;<br \/> &lt;FileAlignment&gt;512&lt;\/FileAlignment&gt;<br \/>&lt;\/PropertyGroup&gt;<\/code>&nbsp;<\/pre>\n<pre>&nbsp;<\/pre>\n<p>IMPORTANT NOTE: If your project is using the Visual Studio hosting process (the default for many project types), you must disable the hosting process for this fix to correctly change the debug mode. To disable the hosting process go to the Debug pane on the project properties page, and uncheck &#8220;Enable the Visual Studio hosting process&#8221;<\/p>\n<p>Additionally if you are using this with Managed C++ code and want to also debug native code you will need to add the <strong>native debug engine GUID <\/strong>(shown below) to the &lt;DebugEngines&gt; property delimited by a semicolon&nbsp;, manually setting the property overrides&nbsp;the options you can set in the UI including the &#8220;Enable native code debugging&#8221; checkbox.&nbsp; So the property should be:<\/p>\n<p>&lt;DebugEngines&gt;{351668CC-8477-4fbf-BFE3-5F1006E4DB1F};<strong>{3B476D35-A401-11D2-AAD4-00C04F990171}<\/strong>&lt;\/DebugEngines&gt;<\/p>\n<h2>In Closing<\/h2>\n<p>We hope that if you require managed compatibility mode, one of the above options will meet your needs. We are currently working hard to enable these capabilities in the current debug engine.<\/p>\n<p>If any of you have feedback or questions about this, please let me know in the comments section below or in our <a href=\"http:\/\/social.msdn.microsoft.com\/Forums\/vstudio\/en-US\/home?forum=vsdebug\">MSDN forum<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In Visual Studio 2012, we introduced a new managed debug engine that provides us the ability to more rapidly add new features compared to the older implementation. This can be seen by the number of features introduced in Visual Studio 2013 after only a single year including Managed Return Values, .NET 64-bit Edit and Continue, [&hellip;]<\/p>\n","protected":false},"author":74,"featured_media":45953,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[1,225],"tags":[],"class_list":["post-2383","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-devops","category-git"],"acf":[],"blog_post_summary":"<p>In Visual Studio 2012, we introduced a new managed debug engine that provides us the ability to more rapidly add new features compared to the older implementation. This can be seen by the number of features introduced in Visual Studio 2013 after only a single year including Managed Return Values, .NET 64-bit Edit and Continue, [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/devops\/wp-json\/wp\/v2\/posts\/2383","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/devops\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/devops\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/devops\/wp-json\/wp\/v2\/users\/74"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/devops\/wp-json\/wp\/v2\/comments?post=2383"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/devops\/wp-json\/wp\/v2\/posts\/2383\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/devops\/wp-json\/wp\/v2\/media\/45953"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/devops\/wp-json\/wp\/v2\/media?parent=2383"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/devops\/wp-json\/wp\/v2\/categories?post=2383"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/devops\/wp-json\/wp\/v2\/tags?post=2383"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}