<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.msdn.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>.NET Blog</title><link>http://blogs.msdn.com/b/dotnet/</link><description>A first hand look from the .NET engineering teams</description><dc:language>en-US</dc:language><generator>Telligent Evolution Platform Developer Build (Build: 5.6.50428.7875)</generator><item><title>Introducing the .NET Framework 4.5 RC</title><link>http://blogs.msdn.com/b/dotnet/archive/2012/05/31/introducing-the-net-framework-4-5-rc.aspx</link><pubDate>Thu, 31 May 2012 18:48:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10312552</guid><dc:creator>Brandon Bray</dc:creator><slash:comments>1</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/dotnet/rsscomments.aspx?WeblogPostID=10312552</wfw:commentRss><comments>http://blogs.msdn.com/b/dotnet/archive/2012/05/31/introducing-the-net-framework-4-5-rc.aspx#comments</comments><description>&lt;p&gt;Today, we are announcing the .NET Framework 4.5 RC. We are also announcing Visual Studio 2012 RC, as you can read on &lt;a href="http://blogs.msdn.com/b/jasonz/archive/2012/05/31/announcing-the-release-candidate-rc-of-visual-studio-2012-and-net-framework-4-5.aspx"&gt;Jason Zander’s&lt;/a&gt; and &lt;a href="http://blogs.msdn.com/b/somasegar/archive/2012/05/31/visual-studio-2012-and-net-4-5-release-candidates-available-now.aspx"&gt;Soma’s&lt;/a&gt; blog. Please visit the &lt;a href="http://go.microsoft.com/fwlink/?LinkId=240160"&gt;Visual Studio 2012 RC downloads page&lt;/a&gt; to install both products.&lt;/p&gt;  &lt;p&gt;We have made many improvements since we released the .NET Framework 4.5 Beta in February.&amp;#160; Let’s talk about the changes at a high level:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;&lt;b&gt;Windows Metro style app performance: &lt;/b&gt;We significantly improved the performance of apps that you build using the .NET APIs for Metro style apps across many dimensions since Beta. In particular, we reduced startup time substantially, with improvements observed in the 10% range. We updated the garbage collector to aggressively reclaim memory upon app suspension, which benefits both the end-user experience and the app (avoids termination). We also improved file I/O performance when using the .NET Framework stream adapters by adding automatic buffering of the underlying Windows Runtime streams.&amp;#160;&amp;#160;&amp;#160; Separately, we improved the algorithm by which Metro style apps are optimized for performance, via automatic native image generation. &lt;b&gt;&lt;/b&gt;&lt;/li&gt; &lt;/ul&gt;  &lt;ul&gt;   &lt;li&gt;&lt;b&gt;Metro style app programming experience for C# and Visual Basic: &lt;/b&gt;We made a large number of improvements and also made adjustments to align the .NET Framework with changes in the Windows Runtime API. Examples include better support for IRandomAccessStream from the .NET Framework. We also introduced .NET Framework performance testing in the Windows App Certification Kit.&lt;/li&gt;    &lt;li&gt;&lt;b&gt;ASP.NET:&lt;/b&gt; Many updates, including: better support for async, cancellation, and threading; support for Entity Framework enumerations and spatial data types in Dynamic Data; support for unit testing; support for Entity Framework 5.0 RC; and improvements for extending the Web Forms compilation system. We also updated the ASP.NET Web API to use Json.Net for JSON formatting, added support for creating custom help pages, improved integration with IoC containers, and provided a monitoring and tracing infrastructure.&lt;/li&gt;    &lt;li&gt;&lt;b&gt;WCF: &lt;/b&gt;Many improvements, including: better performance, reliability and scale with WebSockets; support for client-side validation of the server SSL certificate using WCF’s custom X509 certificate validator on a per-request basis , and; support for adding simple WCF service references inside a managed Windows metadata (.WinMD) file, allowing JavaScript apps to call WCF services via the Windows Runtime.&lt;/li&gt; &lt;/ul&gt;  &lt;ul&gt;   &lt;li&gt;&lt;b&gt;Broad range of product improvements: &lt;/b&gt;Many areas of the product benefited from small but important improvements addressing app reliability, compatibility, and performance. We also responded to over 200 Connect feedback bugs and fixed many of the reported issues.&lt;b&gt;&lt;/b&gt;&lt;/li&gt; &lt;/ul&gt;    &lt;p&gt;Take a look at &lt;a href="http://msdn.microsoft.com/library/ms171868(v=vs.110).aspx"&gt;What’s New in the .NET Framework 4.5 RC&lt;/a&gt; to learn more about the new features. We also made significant updates to our performance guidance, in the &lt;a href="http://msdn.microsoft.com/library/windows/apps/hh750313.aspx"&gt;Performance best practices for C# and Visual Basic&lt;/a&gt; topic. Also see &lt;a href="http://hanselman.com/blog/VisualStudio2012RCisreleasedTheBigWebRollup.aspx"&gt;Scott Hanselman’s blog&lt;/a&gt; for more information on ASP.NET. Once again, please do download the &lt;a href="http://go.microsoft.com/fwlink/?LinkId=240160"&gt;.NET Framework 4.5 RC&lt;/a&gt; release. &lt;/p&gt;  &lt;p&gt;As always, we would like to hear from you. Please don’t hesitate to post a comment on the blog or at one of the forums that we monitor: &lt;a href="http://connect.microsoft.com/visualstudio"&gt;Connect&lt;/a&gt; (report bugs), &lt;a href="http://visualstudio.uservoice.com/forums/121579-visual-studio/category/31481-net"&gt;UserVoice&lt;/a&gt; (request features), and &lt;a href="http://social.msdn.microsoft.com/forums/en-us/category/netframeworkvnext"&gt;MSDN Forums&lt;/a&gt; (ask for help).&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10312552" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/b/dotnet/archive/tags/releases/">releases</category><category domain="http://blogs.msdn.com/b/dotnet/archive/tags/-net+framework/">.net framework</category><category domain="http://blogs.msdn.com/b/dotnet/archive/tags/announcement/">announcement</category></item><item><title>.NET for Metro style apps</title><link>http://blogs.msdn.com/b/dotnet/archive/2012/04/17/net-for-metro-style-apps.aspx</link><pubDate>Tue, 17 Apr 2012 21:56:37 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10294713</guid><dc:creator>Brandon Bray</dc:creator><slash:comments>16</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/dotnet/rsscomments.aspx?WeblogPostID=10294713</wfw:commentRss><comments>http://blogs.msdn.com/b/dotnet/archive/2012/04/17/net-for-metro-style-apps.aspx#comments</comments><description>&lt;blockquote&gt;   &lt;p&gt;&lt;em&gt;.NET is now a core part of several Microsoft platforms, and each has focused on specific subset of APIs. A lot of thought has been put into crafting each API surface area. Many of you have asked how the .NET APIs available for Metro style apps were chosen. In the following post, &lt;strong&gt;Immo Landwerth – a program manager on the CLR’s Core Framework team&lt;/strong&gt; – provides an answer to this question. -- Brandon&lt;/em&gt;&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;Since the releases of the Windows 8 Consumer Preview and the Windows Developer Preview, developers have been busy exploring Windows 8, and many have asked questions about the subset of.NET Framework APIs that can be used to develop Windows Metro style apps. The natural tendency has been to compare the .NET APIs for Metro style apps to those available for other platforms such as Windows Phone. In particular, developers are wondering how much of their existing C# or Visual Basic source code they can expect to reasonably port to build a new Metro style app. We asked ourselves the same question when we carefully designed .NET APIs for Metro style apps. &lt;/p&gt;  &lt;p&gt;In this post, I’d like to give you an overview of the APIs that are available to you for building Metro style apps. I will primarily discuss the design principles and requirements we used to decide which .NET Framework APIs to make available for Metro style app development. I will also touch on the relationships between .NET APIs for Metro style apps and other .NET API profiles. &lt;/p&gt;  &lt;h3&gt;Design goals&lt;/h3&gt;  &lt;p&gt;From the start of this project, we realized that we had a great opportunity to simplify app development, but also some interesting challenges to resolve. Metro style apps enable developers to provide compelling end-user experiences across all the supported Windows 8 devices. In order to achieve this goal, many important changes were made within Windows, some of which affected our design approach to the .NET Framework APIs that we would expose. &lt;/p&gt;  &lt;p&gt;The biggest change, in terms of .NET Framework APIs, was the introduction of the Windows Runtime APIs. The Windows Runtime is a new API surface in Windows that exposes the functionality necessary to write Metro style apps. These APIs were designed to be used from a variety of programming languages: C# and Visual Basic and also native C++ and JavaScript. The task for our design team was to ensure that .NET Framework developers would be able to use both .NET Framework and Windows Runtime APIs together in a way that felt natural and intuitive. Also, the Windows Runtime team worked closely with us and approached the same task from the opposite direction.&lt;/p&gt;  &lt;p&gt;We established the following goals to define the API surface of .NET for Metro style apps:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;Avoid duplication of functionality between the Windows Runtime and the .NET Framework. &lt;/li&gt;    &lt;li&gt;Provide a clear focus on .NET Framework APIs that are needed to write Metro style apps. &lt;/li&gt;    &lt;li&gt;Make sure that existing .NET Framework developers will feel at home with this profile. &lt;/li&gt;    &lt;li&gt;Make it easy to port existing C# and Visual Basic code to the profile. &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;We also looked at a collection of Windows Phone and Silverlight apps to determine how developers used .NET Framework APIs in practice. These apps helped us assess the two last goals, in particular.&lt;/p&gt;  &lt;h3&gt;Designing the API profile&lt;/h3&gt;  &lt;p&gt;To design a new profile for Metro style apps, it made sense to start from an existing subset of APIs, and to pare it down while extending it toward the goal, which was to provide &lt;b&gt;simple&lt;/b&gt; and &lt;b&gt;well-designed&lt;/b&gt; .NET Framework APIs that &lt;b&gt;specifically target&lt;/b&gt; Metro style app development. Note that the following diagram is intended for illustrative purposes only, and is not drawn to scale.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-12-34-metablogapi/6204.image_5F00_09BDDF73.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; margin: 0px auto; padding-left: 0px; padding-right: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title=".NET Framework profiles in context" border="0" alt=".NET Framework profiles in context" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-12-34-metablogapi/5621.image_5F00_thumb_5F00_1070E8F6.png" width="500" height="269" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p align="center"&gt;&lt;b&gt;Figure 1:&lt;/b&gt; .NET Framework profiles in context&lt;/p&gt;  &lt;p&gt;In this diagram, the smaller circles represent .NET profiles. The intersection of the profiles represents APIs that are common to all the profiles. Conceptually, you can think of .NET for Metro style apps as a subset of the .NET Framework that shares a relationship with other .NET Framework profiles. &lt;a href="http://msdn.microsoft.com/library/gg597391(v=vs.110).aspx"&gt;Portable Class Library&lt;/a&gt; does not show up in this diagram as a separate profile, but is a separate concept that deserves a post of its own. &lt;/p&gt;  &lt;p&gt;With that diagram in mind, we decided to start with the .NET API subset for the Windows Phone, with selective additions from the full .NET Framework and Silverlight. While Windows Phone apps were likely to be similar to Metro style apps, the introduction of the Windows Runtime in Windows 8 meant that the Windows Phone profile was only a starting point. &lt;/p&gt;  &lt;h3&gt;API selection process &lt;/h3&gt;  &lt;p&gt;In addition to the goals discussed earlier, we established a rigorous selection process. We made sure that every API we considered adding passed the criteria defined below: &lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;&lt;b&gt;Is the API applicable to Metro style apps&lt;/b&gt;? Of course, the answer isn't always obvious. For example, ASP.NET APIs are clearly not relevant to Metro style app development, but console APIs could be considered helpful (for example, during testing). When in doubt, we asked ourselves whether we’d want to ship a Metro style app that called the given API, and we removed APIs that simply won’t work in Metro style apps. For example, file access using paths isn't supported in Metro style apps, because file access is done through a broker process and requires using Windows Runtime APIs, so we removed those APIs. &lt;/li&gt;    &lt;li&gt;&lt;b&gt;Is the API obsolete or outdated?&lt;/b&gt; This includes APIs that are difficult to use correctly, are confusing, or don’t follow basic design guidelines. &lt;/li&gt;    &lt;li&gt;&lt;b&gt;Is the API duplicated by another .NET Framework API in the profile or by a Windows Runtime API?&lt;/b&gt; Duplication of APIs means that you have to choose, and this choice is often arbitrary. Duplication also means that you cannot easily share code with other developers, because they might have chosen to use different types in their signatures. &lt;/li&gt; &lt;/ul&gt;  &lt;h3&gt;Arriving at the final set of APIs&lt;/h3&gt;  &lt;p&gt;After our design phase and a progressive series of refinements, we arrived at a set of APIs that met the stated design goals. We validated this set of APIs with the apps that we had available, and requested feedback from Microsoft developers who were involved in early Metro style app development. We made more changes to enable the set of scenarios that the validation exercise uncovered. With the exception of a few more minor changes, this is the surface area we made available for Metro style app development with Visual Studio 11 Developer Preview, and more recently, with Visual Studio 11 Beta.&lt;/p&gt;  &lt;p&gt;The diagram below shows the functionality exposed in the .NET for Metro style apps profile. The diagram should match what you see available in Visual Studio 11 Beta. The &lt;a href="http://msdn.microsoft.com/en-us/library/windows/apps/br230232(v=VS.85).aspx"&gt;Windows Dev Center&lt;/a&gt; is a great place to explore these new APIs.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-12-34-metablogapi/6201.image_5F00_373EFF36.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; margin: 0px auto; padding-left: 0px; padding-right: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="Feature areas supported by .NET for Metro style apps" border="0" alt="Feature areas supported by .NET for Metro style apps" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-12-34-metablogapi/5224.image_5F00_thumb_5F00_45114531.png" width="500" height="216" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p align="center"&gt;&lt;b&gt;Figure 2:&lt;/b&gt; Feature areas supported by .NET for Metro style apps&lt;/p&gt;  &lt;p&gt;For a more quantitative view, the following table compares the new profile to existing profiles you might be familiar with. It's not surprising that .NET for Metro style apps is much smaller than the full .NET Framework, and similar in size to the profile for Windows Phone. .NET for Metro style apps is even smaller than the Windows Phone profile, because we removed functionality such as the UI stack and sensors, which is exposed by the Windows Runtime. &lt;/p&gt;  &lt;p align="center"&gt;   &lt;table border="1" cellspacing="0" cellpadding="0"&gt;&lt;tbody&gt;       &lt;tr&gt;         &lt;td valign="top" width="94"&gt;           &lt;p&gt;&lt;b&gt;&lt;/b&gt;&lt;/p&gt;         &lt;/td&gt;          &lt;td valign="top" width="178"&gt;           &lt;p align="left"&gt;&lt;b&gt;.NET for Metro style apps&lt;/b&gt;&lt;/p&gt;         &lt;/td&gt;          &lt;td valign="top" width="144"&gt;           &lt;p align="left"&gt;&lt;b&gt;Windows Phone 7.1 &lt;/b&gt;&lt;/p&gt;         &lt;/td&gt;          &lt;td valign="top" width="150"&gt;           &lt;p align="left"&gt;&lt;b&gt;.NET Framework 4.5&lt;/b&gt;&lt;/p&gt;         &lt;/td&gt;       &lt;/tr&gt;        &lt;tr&gt;         &lt;td valign="top" width="94"&gt;           &lt;p align="left"&gt;&lt;b&gt;Namespace&lt;/b&gt;&lt;/p&gt;         &lt;/td&gt;          &lt;td valign="top" width="178"&gt;           &lt;p align="left"&gt;72&lt;/p&gt;         &lt;/td&gt;          &lt;td valign="top" width="144"&gt;           &lt;p align="left"&gt;95 &lt;/p&gt;         &lt;/td&gt;          &lt;td valign="top" width="150"&gt;           &lt;p align="left"&gt;447 &lt;/p&gt;         &lt;/td&gt;       &lt;/tr&gt;        &lt;tr&gt;         &lt;td valign="top" width="94"&gt;           &lt;p align="left"&gt;&lt;b&gt;Type&lt;/b&gt;&lt;/p&gt;         &lt;/td&gt;          &lt;td valign="top" width="178"&gt;           &lt;p align="left"&gt;1,246&lt;/p&gt;         &lt;/td&gt;          &lt;td valign="top" width="144"&gt;           &lt;p align="left"&gt;1,788 &lt;/p&gt;         &lt;/td&gt;          &lt;td valign="top" width="150"&gt;           &lt;p align="left"&gt;14,936 &lt;/p&gt;         &lt;/td&gt;       &lt;/tr&gt;        &lt;tr&gt;         &lt;td valign="top" width="94"&gt;           &lt;p align="left"&gt;&lt;b&gt;Member&lt;/b&gt;&lt;/p&gt;         &lt;/td&gt;          &lt;td valign="top" width="178"&gt;           &lt;p align="left"&gt;15,674&lt;/p&gt;         &lt;/td&gt;          &lt;td valign="top" width="144"&gt;           &lt;p align="left"&gt;20,291 &lt;/p&gt;         &lt;/td&gt;          &lt;td valign="top" width="150"&gt;           &lt;p align="left"&gt;217,166 &lt;/p&gt;         &lt;/td&gt;       &lt;/tr&gt;     &lt;/tbody&gt;&lt;/table&gt; &lt;/p&gt;  &lt;p align="center"&gt;&lt;b&gt;Table:&lt;/b&gt; API surface counts, by .NET Profile&lt;/p&gt;  &lt;h3&gt;Learn more&lt;/h3&gt;  &lt;p&gt;If you want to learn more about the thinking process that went into the design of the API surface area, watch Krzysztof Cwalina’s &lt;a href="http://channel9.msdn.com/events/BUILD/BUILD2011/TOOL-930C"&gt;A .NET developer's view of Windows 8 app development&lt;/a&gt; talk from the BUILD conference.&lt;/p&gt;  &lt;p&gt;If you’re interested in porting your existing .NET Framework code, watch Daniel Plaisted’s BUILD talk &lt;a href="http://channel9.msdn.com/Events/BUILD/BUILD2011/TOOL-790C"&gt;Bringing existing managed code into Metro style apps&lt;/a&gt;, and check out the &lt;a href="http://msdn.microsoft.com/library/windows/apps/br230302.aspx"&gt;.NET for Metro style apps overview&lt;/a&gt; in the Windows Dev Center, especially the section about &lt;a href="http://msdn.microsoft.com/library/windows/apps/br230302.aspx#convert"&gt;converting your existing .NET Framework code&lt;/a&gt;.&lt;/p&gt;  &lt;p&gt;Have you used the .NET for Metro style apps and the Windows Runtime APIs to build Metro style apps? Which APIs do you think are missing? Are there any additional APIs that should have been removed? Please tell us what you think.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10294713" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/b/dotnet/archive/tags/-net+framework/">.net framework</category><category domain="http://blogs.msdn.com/b/dotnet/archive/tags/bcl/">bcl</category><category domain="http://blogs.msdn.com/b/dotnet/archive/tags/metro+style/">metro style</category></item><item><title>Async in 4.5: Worth the Await</title><link>http://blogs.msdn.com/b/dotnet/archive/2012/04/03/async-in-4-5-worth-the-await.aspx</link><pubDate>Tue, 03 Apr 2012 17:17:23 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10290445</guid><dc:creator>Brandon Bray</dc:creator><slash:comments>10</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/dotnet/rsscomments.aspx?WeblogPostID=10290445</wfw:commentRss><comments>http://blogs.msdn.com/b/dotnet/archive/2012/04/03/async-in-4-5-worth-the-await.aspx#comments</comments><description>&lt;blockquote&gt;&lt;em&gt;Developers often ask for guidance on how to write responsive user interfaces. Reading most books about the .NET Framework over the past ten years, you’ll see coverage of the asynchronous programming model which requires a lot of careful attention while coding. That’s why the async&lt;/em&gt;&lt;em&gt; features in the latest versions of C# and Visual Basic are tremendous step forward. And language innovation like async needs a great library to bring forward the potential. In this post, &lt;strong&gt;Alok Shriram – a Program Manager from the .NET Base Class Library team&lt;/strong&gt; – shows the work done in the .NET Framework to be async ready.&lt;/em&gt; &lt;/blockquote&gt;  &lt;p&gt;&amp;quot;Performance&amp;quot; is a term that is used a lot when talking about apps, but it's actually a pretty vague term. There are at least two aspects of performance that most people think about: app launch time and throughput. Both of these can be measured and described with actual numbers. The true test of an app, however, is end-user perception. A stop-watch may tell us one thing, but a user may see something else. End-user perception is the basis of asynchrony and related features that we have built into the .NET Framework 4.5 Beta. Essentially, we can provide a more responsive UI experience if some of the more expensive app operations can be delayed. This will make the end-user happier, and it will help us make better use of computing resources than would be possible otherwise. While you’ve always been able to implement this pattern in the .NET Framework, the implementation has been difficult in practice. We’ve fixed that in the .NET Framework 4.5 Beta.&lt;/p&gt;  &lt;p&gt;This post introduces the asynchronous features in the .NET Framework 4.5 Beta. Many of you have been introduced to “async” via the language changes in C#, but we also want to tell you about accompanying changes that we’ve made in the .NET Framework.&lt;/p&gt;  &lt;h4&gt;Asynchrony in the .NET Framework&lt;/h4&gt;  &lt;p&gt;If you have ever written any UI code, chances are that you have used the asynchronous capabilities of the .NET Framework. Asynchrony keeps the UI responsive while expensive operations are being performed. For instance, if you implement a mouse click event that has to go and fetch a large page from the Internet, and you implement it using the WebClient.DownloadString method, depending on the amount of time this call takes to return, the thread on which the UI is running will be blocked. This means that any subsequent actions performed on the UI will be delayed, and you will wind up getting a frozen UI. However, if you use an asynchronous version of the method instead (specifically, WebClient.DownloadStringAsync), the request will return control immediately, and subsequent UI interactions can be handled as they arrive, while the content is being asynchronously fetched from the resource.&lt;/p&gt;  &lt;p&gt;In server apps, resource requests like database calls and networks calls are typically written in a synchronous manner, so a large number of threads are blocked on I/O operations. This approach can lead to a larger memory footprint for the app and poor utilization of the server hardware.&lt;/p&gt;  &lt;p&gt;Writing code that utilizes asynchronous paradigms is useful for both client and server apps. However, despite all the benefits, asynchronous code is hard to write, debug, and maintain. The new language features introduced by the .NET Framework 4.5 make writing asynchronous code comparable to writing synchronous code.&lt;/p&gt;  &lt;h4&gt;The new async/await keywords&lt;/h4&gt;  &lt;p&gt;Before the .NET Framework 4.5 Beta, asynchronous APIs in the .NET Framework followed three patterns: &lt;/p&gt;  &lt;ol&gt;   &lt;li&gt;The Asynchronous Programming Model (APM), which has the format &lt;i&gt;BeginMethodName&lt;/i&gt; and &lt;i&gt;EndMethodName.&lt;/i&gt; &lt;/li&gt;    &lt;li&gt;The Event based Asynchronous Pattern (EAP), which relies on assigning delegates to event handlers that will be invoked when an event is triggered. &lt;/li&gt;    &lt;li&gt;The Task-based Asynchronous Pattern (TAP), which relies on the Task Parallel Library (TPL) and the &lt;b&gt;System.Threading.Task&lt;/b&gt; namespace that was introduced with the .NET Framework 4. &lt;/li&gt; &lt;/ol&gt;  &lt;p&gt;I won't get into the pros and cons of the different schemes, since there are plenty of articles covering that. (A great starting point is Stephen Toub’s &lt;a href="http://download.microsoft.com/download/5/B/9/5B924336-AA5D-4903-95A0-56C6336E32C9/TAP.docx"&gt;TAP&lt;/a&gt; doc.) However, to illustrate the differences in complexity, let’s consider a synchronous implementation of CopyTo( ) and the code that we would have to write in the TAP and APM models to implement a CopyToAsync() function.&lt;/p&gt;  &lt;p&gt;&lt;b&gt;Synchronous example:&lt;/b&gt;&lt;/p&gt;  &lt;blockquote&gt;   &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;font color="#0000ff"&gt;public static void&lt;/font&gt; CopyTo(&lt;font color="#006080"&gt;Stream&lt;/font&gt; source, &lt;font color="#006080"&gt;Stream&lt;/font&gt; destination)&lt;br /&gt;{&lt;br /&gt;  &lt;font color="#0000ff"&gt;byte&lt;/font&gt;[] buffer = &lt;font color="#0000ff"&gt;new byte&lt;/font&gt;[0x1000]; &lt;br /&gt;  &lt;font color="#0000ff"&gt;int&lt;/font&gt; numRead;&lt;br /&gt;  &lt;font color="#0000ff"&gt;while&lt;/font&gt;((numRead = source.Read(buffer, 0, buffer.Length)) &amp;gt; 0)&lt;br /&gt;  {&lt;br /&gt;    destination.Write(buffer, 0, numRead);&lt;br /&gt;  }&lt;br /&gt;}&lt;/pre&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;b&gt;APM example: &lt;/b&gt;&lt;/p&gt;

&lt;blockquote&gt;
  &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;font color="#0000ff"&gt;public static&lt;/font&gt; &lt;font color="#006080"&gt;IAsyncResult&lt;/font&gt; BeginCopyTo(&lt;font color="#006080"&gt;Stream&lt;/font&gt; source, &lt;font color="#006080"&gt;Stream&lt;/font&gt; destination)&lt;br /&gt;{&lt;br /&gt;  &lt;font color="#0000ff"&gt;var&lt;/font&gt; tcs = &lt;font color="#0000ff"&gt;new&lt;/font&gt; TaskCompletionSource&lt;bool&gt;();&lt;br /&gt;&lt;br /&gt;  &lt;font color="#0000ff"&gt;byte&lt;/font&gt;[] buffer = &lt;font color="#0000ff"&gt;new byte&lt;/font&gt;[0x1000];&lt;br /&gt;  &lt;font color="#006080"&gt;Action&lt;/font&gt;&amp;lt;&lt;font color="#006080"&gt;IAsyncResult&lt;/font&gt;&amp;gt; readWriteLoop = &lt;font color="#0000ff"&gt;null&lt;/font&gt;;&lt;br /&gt;  readWriteLoop = iar =&amp;gt;&lt;br /&gt;  {&lt;br /&gt;    &lt;font color="#0000ff"&gt;try&lt;/font&gt;&lt;br /&gt;    {&lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;font color="#0000ff"&gt;for&lt;/font&gt; (&lt;font color="#0000ff"&gt;bool&lt;/font&gt; isRead = iar == &lt;font color="#0000ff"&gt;null&lt;/font&gt;; ; isRead = !isRead)&lt;br /&gt;      {&lt;br /&gt;        &lt;font color="#0000ff"&gt;switch&lt;/font&gt; (isRead)&lt;br /&gt;        {&lt;br /&gt;          &lt;font color="#0000ff"&gt;case true&lt;/font&gt;:&lt;br /&gt;            iar = source.BeginRead(buffer, 0, buffer.Length, readResult =&amp;gt;&lt;br /&gt;            {&lt;br /&gt;              &lt;font color="#0000ff"&gt;if&lt;/font&gt; (readResult.CompletedSynchronously) &lt;font color="#0000ff"&gt;return&lt;/font&gt;;&lt;br /&gt;              readWriteLoop(readResult);&lt;br /&gt;            }, &lt;font color="#0000ff"&gt;null&lt;/font&gt;);&lt;br /&gt;            &lt;font color="#0000ff"&gt;if&lt;/font&gt; (!iar.CompletedSynchronously) &lt;font color="#0000ff"&gt;return&lt;/font&gt;;&lt;br /&gt;            &lt;font color="#0000ff"&gt;break&lt;/font&gt;;&lt;br /&gt;&lt;br /&gt;          &lt;font color="#0000ff"&gt;case false&lt;/font&gt;:&lt;br /&gt;            &lt;font color="#0000ff"&gt;int&lt;/font&gt; numRead = source.EndRead(iar);&lt;br /&gt;            &lt;font color="#0000ff"&gt;if&lt;/font&gt; (numRead == 0)&lt;br /&gt;            {&lt;br /&gt;              tcs.TrySetResult(&lt;font color="#0000ff"&gt;true&lt;/font&gt;);&lt;br /&gt;              &lt;font color="#0000ff"&gt;return&lt;/font&gt;;&lt;br /&gt;            }&lt;br /&gt;            iar = destination.BeginWrite(buffer, 0, numRead, writeResult =&amp;gt;&lt;br /&gt;            {&lt;br /&gt;              &lt;font color="#0000ff"&gt;try&lt;/font&gt;&lt;br /&gt;              {&lt;br /&gt;                &lt;font color="#0000ff"&gt;if&lt;/font&gt; (writeResult.CompletedSynchronously) &lt;font color="#0000ff"&gt;return&lt;/font&gt;;&lt;br /&gt;                destination.EndWrite(writeResult);&lt;br /&gt;                readWriteLoop(&lt;font color="#0000ff"&gt;null&lt;/font&gt;);&lt;br /&gt;              }&lt;br /&gt;              &lt;font color="#0000ff"&gt;catch&lt;/font&gt;(&lt;font color="#0000ff"&gt;Exception&lt;/font&gt; e) { tcs.TrySetException(e); }&lt;br /&gt;            }, &lt;font color="#0000ff"&gt;null&lt;/font&gt;);&lt;br /&gt;            &lt;font color="#0000ff"&gt;if&lt;/font&gt; (!iar.CompletedSynchronously) &lt;font color="#0000ff"&gt;return&lt;/font&gt;;&lt;br /&gt;            destination.EndWrite(iar);&lt;br /&gt;            &lt;font color="#0000ff"&gt;break&lt;/font&gt;;&lt;br /&gt;          }&lt;br /&gt;        }&lt;br /&gt;      }&lt;br /&gt;    }&lt;br /&gt;    &lt;font color="#0000ff"&gt;catch&lt;/font&gt;(&lt;font color="#006080"&gt;Exception&lt;/font&gt; e) { tcs.TrySetException(e); }&lt;br /&gt;  };&lt;br /&gt;  readWriteLoop(&lt;font color="#0000ff"&gt;null&lt;/font&gt;);&lt;br /&gt;&lt;br /&gt;  &lt;font color="#0000ff"&gt;return&lt;/font&gt; tcs.Task;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;font color="#0000ff"&gt;public static void&lt;/font&gt; EndCopyTo(&lt;font color="#006080"&gt;IAsyncResult&lt;/font&gt; asyncResult)&lt;br /&gt;{&lt;br /&gt;  ((&lt;font color="#006080"&gt;Task&lt;/font&gt;)asyncResult).Wait();&lt;br /&gt;}&lt;/pre&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;b&gt;TAP example with the new C# language async support:&lt;/b&gt;&lt;/p&gt;

&lt;blockquote&gt;
  &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;font color="#0000ff"&gt;public static &lt;font style="background-color: #ffff00"&gt;async&lt;/font&gt; void&lt;/font&gt; CopyToAsync(&lt;font color="#006080"&gt;Stream&lt;/font&gt; source, &lt;font color="#006080"&gt;Stream&lt;/font&gt; destination)&lt;br /&gt;{&lt;br /&gt;  &lt;font color="#0000ff"&gt;byte&lt;/font&gt;[] buffer = &lt;font color="#0000ff"&gt;new byte&lt;/font&gt;[0x1000];&lt;br /&gt;  &lt;font color="#0000ff"&gt;int&lt;/font&gt; numRead;&lt;br /&gt;  &lt;font color="#0000ff"&gt;while&lt;/font&gt;((numRead = &lt;font style="background-color: #ffff00" color="#0000ff"&gt;await&lt;/font&gt; source.ReadAsync(buffer, 0, buffer.Length)) &amp;gt; 0)&lt;br /&gt;  {&lt;br /&gt;    &lt;font style="background-color: #ffff00" color="#0000ff"&gt;await&lt;/font&gt; destination.WriteAsync(buffer, 0, numRead);&lt;br /&gt;  }&lt;br /&gt;}&lt;/pre&gt;
&lt;/blockquote&gt;

&lt;p&gt;It’s pretty clear that there is a huge difference in the complexity of the code that you have to write with the APM, as compared to either of the other two examples. You may have written asynchronous code before, but you probably didn't find it straightforward. Ideally, the C# and Visual Basic languages (and compilers) should be doing all of the heavy lifting, and you should only need to declare your intent via a set of new keywords.&lt;/p&gt;

&lt;p&gt;There are two new language keywords introduced in C# and Visual Basic: async and await (highlighted in yellow in the code above). There are also a significant number of new .NET Framework methods that support asynchronous apps. For example, the .NET Framework 4 Stream class has a CopyTo method. In the .NET Framework 4.5 Beta, we added a CopyToAsync method, which (not coincidentally) shares an implementation not unlike the TAP example above. &lt;/p&gt;

&lt;h4&gt;Starting with synchronous code&lt;/h4&gt;

&lt;p&gt;Most of you will likely end up using async with synchronous code, as opposed to moving code that is already asynchronous to this new pattern. So we’ll start with synchronous code, too. &lt;/p&gt;

&lt;p&gt;This post covers the experience of developing a simple app that gets a list of movies from the Netflix OData catalog and displays the box art and movie title/summary. We will look at the initial, synchronous implementation and explain what we did to convert it to a responsive async app (it wasn't much). &lt;/p&gt;

&lt;p&gt;First, let's start off by declaring a simple class called &lt;b&gt;Movie&lt;/b&gt; to hold some details about each movie. Let's also add a single utility method and use it to parse an HTTP response into a &lt;b&gt;Movie&lt;/b&gt; object:&lt;/p&gt;

&lt;blockquote&gt;
  &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;font color="#0000ff"&gt;using&lt;/font&gt; System;&lt;br /&gt;&lt;font color="#0000ff"&gt;using&lt;/font&gt; System.Collections.Generic;&lt;br /&gt;&lt;font color="#0000ff"&gt;using&lt;/font&gt; System.Linq;&lt;br /&gt;&lt;font color="#0000ff"&gt;using&lt;/font&gt; System.Net.Http;&lt;br /&gt;&lt;font color="#0000ff"&gt;using&lt;/font&gt; System.Threading.Tasks;&lt;br /&gt;&lt;font color="#0000ff"&gt;using&lt;/font&gt; System.Xml.Linq;&lt;br /&gt;&lt;br /&gt;&lt;font color="#0000ff"&gt;public class&lt;/font&gt; &lt;font color="#006080"&gt;Movie&lt;/font&gt;&lt;br /&gt;{&lt;br /&gt;  &lt;font color="#0000ff"&gt;public string&lt;/font&gt; Title&lt;br /&gt;  { &lt;font color="#0000ff"&gt;get&lt;/font&gt;; &lt;font color="#0000ff"&gt;set&lt;/font&gt;; }&lt;br /&gt;  &lt;font color="#0000ff"&gt;public string&lt;/font&gt; BoxArtUrl&lt;br /&gt;  { &lt;font color="#0000ff"&gt;get&lt;/font&gt;; &lt;font color="#0000ff"&gt;set&lt;/font&gt;; }&lt;br /&gt;  &lt;font color="#0000ff"&gt;public string&lt;/font&gt; Summary&lt;br /&gt;  { &lt;font color="#0000ff"&gt;get&lt;/font&gt;; &lt;font color="#0000ff"&gt;set&lt;/font&gt;; }&lt;br /&gt;}&lt;br /&gt;    &lt;br /&gt;&lt;font color="#0000ff"&gt;public class&lt;/font&gt; &lt;font color="#006080"&gt;MainPage&lt;/font&gt;&lt;br /&gt;{&lt;br /&gt;  &lt;font color="#0000ff"&gt;private&lt;/font&gt; &lt;font color="#006080"&gt;IEnumerable&lt;/font&gt;&amp;lt;&lt;font color="#006080"&gt;Movie&lt;/font&gt;&amp;gt; GetMovieDataFromXDoc(&lt;font color="#006080"&gt;XDocument&lt;/font&gt; doc)&lt;br /&gt;  {&lt;br /&gt;    &lt;font color="#006080"&gt;XNamespace&lt;/font&gt; dRss = &lt;font color="#a31515"&gt;&amp;quot;http://www.w3.org/2005/Atom&amp;quot;&lt;/font&gt;;&lt;br /&gt;    &lt;font color="#006080"&gt;XNamespace&lt;/font&gt; odata = &lt;font color="#a31515"&gt;&amp;quot;http://schemas.microsoft.com/ado/2007/08/dataservices&amp;quot;&lt;/font&gt;;&lt;br /&gt;&lt;br /&gt;    &lt;font color="#006080"&gt;List&lt;/font&gt;&amp;lt;&lt;font color="#006080"&gt;XElement&lt;/font&gt;&amp;gt; dox = doc.Descendants(dRss + &lt;font color="#a31515"&gt;&amp;quot;entry&amp;quot;&lt;/font&gt;).ToList();&lt;br /&gt;    &lt;font color="#006080"&gt;List&lt;/font&gt;&amp;lt;&lt;font color="#006080"&gt;Movie&lt;/font&gt;&amp;gt; movieList = new &lt;font color="#006080"&gt;List&lt;/font&gt;&amp;lt;&lt;font color="#006080"&gt;Movie&lt;/font&gt;&amp;gt;();&lt;br /&gt;    &lt;font color="#0000ff"&gt;foreach&lt;/font&gt; (&lt;font color="#006080"&gt;XElement&lt;/font&gt; ele &lt;font color="#0000ff"&gt;in&lt;/font&gt; dox)&lt;br /&gt;    {&lt;br /&gt;      &lt;font color="#006080"&gt;XElement&lt;/font&gt; movieSummary = ele.Descendants(dRss + &lt;font color="#a31515"&gt;&amp;quot;summary&amp;quot;&lt;/font&gt;).First();&lt;br /&gt;      &lt;font color="#006080"&gt;XElement&lt;/font&gt; movieName = ele.Descendants(odata + &lt;font color="#a31515"&gt;&amp;quot;Name&amp;quot;&lt;/font&gt;).First();&lt;br /&gt;      &lt;font color="#006080"&gt;XElement&lt;/font&gt; boxArtUrl = ele.Descendants(odata + &lt;font color="#a31515"&gt;&amp;quot;MediumUrl&amp;quot;&lt;/font&gt;).First();&lt;br /&gt;      &lt;font color="#006080"&gt;Movie&lt;/font&gt; tempMovie = &lt;font color="#0000ff"&gt;new&lt;/font&gt; &lt;font color="#006080"&gt;Movie&lt;/font&gt;() { &lt;br /&gt;                              BoxArtUrl = boxArtUrl.Value, &lt;br /&gt;                              Title = movieName.Value, &lt;br /&gt;                              Summary = movieSummary.Value };&lt;br /&gt;      movieList.Add(tempMovie);&lt;br /&gt;    }&lt;br /&gt;    &lt;font color="#0000ff"&gt;return&lt;/font&gt; movieList;&lt;br /&gt;  }&lt;br /&gt;}&lt;/pre&gt;
&lt;/blockquote&gt;

&lt;h4&gt;Adding async support &lt;/h4&gt;

&lt;p&gt;The new async support is built on the Task Parallel Library (TPL) that was introduced in the .NET Framework 4. It uses the Task framework, and adds language support through the async and await keywords to make writing asynchronous code almost equivalent to writing synchronous code.&lt;/p&gt;

&lt;p&gt;You use the async keyword to annotate that this method could be invoked asynchronously. You then apply the await keyword to a task inside an async method to suspend the execution of the method until that task is complete. Let’s explore these concepts by starting with some synchronous code in the MainPage class:&lt;/p&gt;

&lt;blockquote&gt;
  &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;font color="#0000ff"&gt;public&lt;/font&gt; &lt;font color="#006080"&gt;List&lt;/font&gt;&amp;lt;&lt;font color="#006080"&gt;Movie&lt;/font&gt;&amp;gt; GetMovies()&lt;br /&gt;{&lt;br /&gt;  &lt;font color="#0000ff"&gt;string&lt;/font&gt; query = &lt;br /&gt;    &lt;font color="#a31515"&gt;@&amp;quot;http://odata.netflix.com/Catalog/Titles?&amp;quot;&lt;/font&gt; +&lt;br /&gt;    &lt;font color="#a31515"&gt;@&amp;quot;$filter=ReleaseYear le 1989 and ReleaseYear ge 1980 &amp;quot;&lt;/font&gt; +&lt;br /&gt;    &lt;font color="#a31515"&gt;@&amp;quot;and AverageRating gt 4&amp;quot;&lt;/font&gt;;&lt;br /&gt;  &lt;font color="#006080"&gt;HttpClient&lt;/font&gt; client = &lt;font color="#0000ff"&gt;new&lt;/font&gt; &lt;font color="#006080"&gt;HttpClient&lt;/font&gt;();&lt;br /&gt;  client.MaxResponseContentBufferSize = &lt;font color="#006080"&gt;Int32&lt;/font&gt;.MaxValue;&lt;br /&gt;  &lt;font color="#0000ff"&gt;try&lt;/font&gt;&lt;br /&gt;  {&lt;br /&gt;    &lt;font color="#006080"&gt;HttpResponseMessage&lt;/font&gt; resp = client.Get(&lt;font color="#0000ff"&gt;new&lt;/font&gt; &lt;font color="#006080"&gt;Uri&lt;/font&gt;(query));&lt;br /&gt;    &lt;font color="#0000ff"&gt;string&lt;/font&gt; content = resp.Content.ReadAsString();&lt;br /&gt;    &lt;font color="#006080"&gt;XDocument&lt;/font&gt; xml = &lt;font color="#006080"&gt;XDocument&lt;/font&gt;.Parse(content);&lt;br /&gt;    &lt;font color="#006080"&gt;List&lt;/font&gt;&amp;lt;&lt;font color="#006080"&gt;Movie&lt;/font&gt;&amp;gt; movieList = GetMovieDataFromXDoc(xml).ToList();&lt;br /&gt;    &lt;font color="#0000ff"&gt;return&lt;/font&gt; movieList;&lt;br /&gt;  }&lt;br /&gt;  &lt;font color="#0000ff"&gt;catch&lt;/font&gt; (Do your catch logic here)&lt;br /&gt;  {&lt;br /&gt;    ... and here &lt;br /&gt;  }&lt;br /&gt;}&lt;/pre&gt;
&lt;/blockquote&gt;

&lt;p&gt;The code above constructs an HTTP query, sets the buffer size to a large value, and does a synchronous &lt;b&gt;get&lt;/b&gt; to retrieve the contents of the target. It queries the Netflix OData catalog for all of the movies that were released in 1989 and that have a Netflix rating greater than four stars. We wrap it in a try/catch block to make sure we handle any exceptions, and we make a blocking call to the network with the client.Get(new Uri(query)) call. If this call were made from a UI app and the returned page was large or network latency was high or server processing time was long, then your UI would likely freeze while waiting for the query to return. We’d much prefer to make the code run the same way, but not freeze up the UI, right? To show you how to achieve that, I’ve updated the code for async, and grayed out the code that hasn't changed (most of it).&lt;/p&gt;

&lt;blockquote&gt;
  &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;font color="#cccccc"&gt;public &lt;font color="#0000ff"&gt;async&lt;/font&gt; &lt;font color="#006080"&gt;Task&lt;/font&gt;&lt;font color="#000000"&gt;&amp;lt;&lt;/font&gt;&lt;font color="#006080"&gt;List&lt;/font&gt;&lt;font color="#000000"&gt;&amp;lt;&lt;/font&gt;&lt;font color="#006080"&gt;Movie&lt;/font&gt;&lt;font color="#000000"&gt;&amp;gt;&amp;gt;&lt;/font&gt; GetMovies&lt;font color="#000000"&gt;Async&lt;/font&gt;()&lt;br /&gt;{&lt;br /&gt;  string query = &lt;br /&gt;    @&amp;quot;http://odata.netflix.com/Catalog/Titles?&amp;quot; +&lt;br /&gt;    @&amp;quot;$filter=ReleaseYear le 1989 and ReleaseYear ge 1980 &amp;quot; +&lt;br /&gt;    @&amp;quot;and AverageRating gt 4&amp;quot;;&lt;br /&gt;  HttpClient client = new HttpClient();&lt;br /&gt;  client.MaxResponseContentBufferSize=Int32.MaxValue;&lt;br /&gt;  try&lt;br /&gt;  {&lt;br /&gt;    HttpResponseMessage resp = &lt;font color="#0000ff"&gt;await&lt;/font&gt; client.Get&lt;font color="#000000"&gt;Async&lt;/font&gt;(new Uri(query));&lt;br /&gt;    string content = resp.Content.ReadAsString();&lt;br /&gt;    List&amp;lt;Movie&amp;gt; movieList = GetMovieDataFromXDoc(xml).ToList();&lt;br /&gt;    return movieList;&lt;br /&gt;  }&lt;br /&gt;  catch (Do your catch logic here)&lt;br /&gt;  {&lt;br /&gt;    ... and here&lt;br /&gt;  }&lt;br /&gt;}&lt;/font&gt;&lt;/pre&gt;
&lt;/blockquote&gt;

&lt;p&gt;As you can see, the changes that we had to make are minor. First we use the async keyword to mark our method so that we’re allowed to use the await keyword in it. We also change the return type to Task, so that callers of our method will have a handle through which to wait for our asynchronous operation’s completion. Then, we use the GetAsync method instead of the Get method on the HttpClient class. This returns a Task&amp;lt;HttpResponseMessage&amp;gt; (instead of the HttpResponseMessage that Get returns), which we await. &lt;/p&gt;

&lt;p&gt;Finally, the pattern specifies that any method that uses an await internally should be annotated with an Async suffix, so we rename our method to GetMoviesAsync. That’s it! Now, when this method is called in the UI, it will not lock up the UI, because it will return immediately. The UI will be populated when the results are obtained. Since the UI is still interactive, you should make sure that any user interactions that might require reading or writing data (a list of movies in this example) are prepared for the case where the data is not yet populated because it is waiting on an async call.&lt;/p&gt;

&lt;h4&gt;How async works&lt;/h4&gt;

&lt;p&gt;Before we move on, it's probably a good idea to understand what is happening in terms of code flow when we encounter an await. Let's take a look at our asynchronous code again.&lt;/p&gt;

&lt;blockquote&gt;
  &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;font color="#cccccc"&gt;public &lt;font color="#0000ff"&gt;async&lt;/font&gt; &lt;font color="#000000"&gt;&lt;font color="#006080"&gt;Task&lt;/font&gt;&amp;lt;&lt;font color="#006080"&gt;List&lt;/font&gt;&amp;lt;&lt;font color="#006080"&gt;Movie&lt;/font&gt;&amp;gt;&amp;gt; &lt;/font&gt;GetMovies&lt;font color="#000000"&gt;Async&lt;/font&gt;()&lt;br /&gt;{&lt;br /&gt;  string query =  &amp;quot;...&amp;quot;;&lt;br /&gt;    ...&lt;br /&gt;  try&lt;br /&gt;  {&lt;br /&gt;    HttpResponseMessage resp = &lt;font color="#0000ff"&gt;await&lt;/font&gt; client.Get&lt;font color="#000000"&gt;Async&lt;/font&gt;(new Uri(query));&lt;br /&gt;    string content = resp.Content.ReadAsString();&lt;br /&gt;    List&amp;lt;Movie&amp;gt; movieList = GetMovieDataFromXDoc(xml).ToList();&lt;br /&gt;    return movieList;&lt;br /&gt;  }&lt;br /&gt;  catch (Do your catch logic here)&lt;br /&gt;  {&lt;br /&gt;    ... and here&lt;br /&gt;  }&lt;br /&gt;}&lt;/font&gt;&lt;/pre&gt;
&lt;/blockquote&gt;

&lt;p&gt;In terms of control flow, what happens here is that when the compiler parses an await keyword, it wraps all the code following the await into a continuation function, which is invoked when the call to GetAsync() returns a result. This essentially means that when GetMoviesAsync() is called, control is going to flow until the await client.GetAsync(new Uri(query)) method. None of the code following this method is going to be executed until this function has returned. So, although it might appear that the GetAsync is a non-blocking call, it’s actually doing a “yield return” to the calling function. For a deeper look at the mechanics of how async works, see the resources provided at the end of this post.&lt;/p&gt;

&lt;h4&gt;Propagation of the async keyword through the call stack&lt;/h4&gt;

&lt;p&gt;Once you start using async, you’ll quickly find that it isn’t intended to be used in just a single function, but for an entire flow in your application. You’ll see that your use of await and async keywords will propagate all of the way up to the top of a logical call stack. Let’s take a look.&lt;/p&gt;

&lt;p&gt;We defined the following async method in the earlier example: &lt;/p&gt;

&lt;blockquote&gt;
  &lt;pre&gt;&lt;font color="#0000ff"&gt;public async&lt;/font&gt; &lt;font color="#006080"&gt;Task&lt;/font&gt;&amp;lt;&lt;font color="#006080"&gt;List&lt;/font&gt;&amp;lt;&lt;font color="#006080"&gt;Movie&lt;/font&gt;&amp;gt;&amp;gt; GetMoviesAsync() {...}&lt;/pre&gt;
&lt;/blockquote&gt;

&lt;p&gt;This tells us that we will have to do an &lt;i&gt;await&lt;/i&gt; on any call to this method, such as in the example below:&lt;/p&gt;

&lt;blockquote&gt;
  &lt;pre&gt;&lt;font color="#0000ff"&gt;await&lt;/font&gt; viewer.GetMoviesAsync();&lt;/pre&gt;
&lt;/blockquote&gt;

&lt;p&gt;This essentially means that the method that contains the GetMoviesAsync() call will have to be marked as an async, which leads to the async keyword being propagated through the call stack. For a UI app, this async propagation would likely end at an event handler. When you think about it, that’s exactly what needs to happen in order to get the benefit of asynchrony. The language forces this behavior, leading you to do the right thing.&lt;/p&gt;

&lt;blockquote&gt;
  &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;font color="#0000ff"&gt;async void&lt;/font&gt; SearchButton_Click(&lt;font color="#0000ff"&gt;object&lt;/font&gt; sender, &lt;font color="#006080"&gt;RoutedEventArgs&lt;/font&gt; e)&lt;br /&gt;{&lt;br /&gt;  ...&lt;br /&gt;  &lt;font color="#0000ff"&gt;await&lt;/font&gt; viewer.GetMoviesAsync();&lt;br /&gt;  ...&lt;br /&gt;}&lt;/pre&gt;
&lt;/blockquote&gt;

&lt;p&gt;This propagation is normal and just annotates the methods that are potentially &lt;i&gt;awaitable&lt;/i&gt;. The propagation of the keywords and the return type change (on each method signature) are really the bulk of the work to migrate your code from the sync to async models. That’s pretty reasonable!&lt;/p&gt;

&lt;p&gt;Another point to keep in mind is that the async keyword propagation will stop once you have a void return on a method. A void return async function is essentially a “fire and forget” async call. This is why, for example, you can mark an event handler delegate with the async keyword in a UI app and not worry about doing anything in the app logic that invokes the event handler.&lt;/p&gt;

&lt;h4&gt;Async APIs in .NET Framework 4.5 Beta&lt;/h4&gt;

&lt;p&gt;You are probably wondering where to first start using async in your app. An important consideration is the set of APIs that you call within your apps. First and foremost among those will be the .NET Framework APIs. In the .NET Framework 4.5 Beta, we included a significant set of new async variants of existing synchronous APIs. You will want to move to using these new APIs when you move to async for your own code.&lt;/p&gt;

&lt;p&gt;The following is the set of async APIs that we added just for the &lt;a href="http://msdn.microsoft.com/library/system.io.stream(v=vs.110).aspx"&gt;Stream&lt;/a&gt; class, to give you a sense of what we’ve done in the .NET Framework to support async. You’ll find this same pattern on many other types. (You’ll be able to recognize the async APIs by the “Async” in their names.) &lt;/p&gt;

&lt;p style="margin-bottom: 0px"&gt;System.IO.Stream&lt;/p&gt;

&lt;ul style="margin-top: 0px"&gt;
  &lt;li&gt;public Task&amp;lt;Int32&amp;gt; ReadAsync(Byte[] buffer, Int32 offset, Int32 count); &lt;/li&gt;

  &lt;li&gt;public virtual Task&amp;lt;Int32&amp;gt; ReadAsync(Byte[] buffer, Int32 offset, Int32 count, CancellationToken cancellationToken); &lt;/li&gt;

  &lt;li&gt;public Task WriteAsync(Byte[] buffer, Int32 offset, Int32 count); &lt;/li&gt;

  &lt;li&gt;public virtual Task WriteAsync(Byte[] buffer, Int32 offset, Int32 count, CancellationToken cancellationToken); &lt;/li&gt;

  &lt;li&gt;public Task FlushAsync(); &lt;/li&gt;

  &lt;li&gt;public virtual Task FlushAsync(CancellationToken cancellationToken); &lt;/li&gt;

  &lt;li&gt;public Task CopyToAsync(Stream destination); &lt;/li&gt;

  &lt;li&gt;public Task CopyToAsync(Stream destination, Int32 bufferSize); &lt;/li&gt;

  &lt;li&gt;public virtual Task CopyToAsync(Stream destination, Int32 bufferSize, CancellationToken cancellationToken); &lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;Summary&lt;/h4&gt;

&lt;p&gt;Async is an important new feature in the .NET Framework 4.5 Beta. The new async and await keywords enable you to provide significant user experience improvements in your apps without much effort on your part. In addition, we've added a large set of new async APIs within the .NET Framework in the areas where they make the most sense. We see the combination of the language features and the new .NET Framework APIs as completing the async scenario, leaving the rest to you.&lt;/p&gt;

&lt;p&gt;The &lt;a href="http://msdn.microsoft.com/en-us/vstudio/async.aspx"&gt;Visual Studio Asynchronous Programming&lt;/a&gt; site on MSDN is a great resource for samples, white papers and talks on the new language features and support. You can also learn more about the Task-based Asynchronous Pattern by reading &lt;a href="http://download.microsoft.com/download/5/B/9/5B924336-AA5D-4903-95A0-56C6336E32C9/TAP.docx"&gt;Stephen Toub’s document&lt;/a&gt; on the topic. You might also want to check out &lt;a href="http://msdn.microsoft.com/library/kztecsys(v=VS.110).aspx"&gt;Asynchronous File I/O&lt;/a&gt; and &lt;a href="http://msdn.microsoft.com/en-us/library/hh191443(v=vs.110).aspx"&gt;Asynchronous Programming with Async and Await&lt;/a&gt; in the MSDN Library, and &lt;a href="http://msdn.microsoft.com/en-us/library/windows/apps/hh464924.aspx"&gt;Asynchronous programming&lt;/a&gt; in the Windows Dev Center.&lt;/p&gt;

&lt;p&gt;Have you used async? Was it as easy to migrate your synchronous code to async as this post suggested? Are there any other .NET Framework APIs that you think need async variants? Please tell us what you think.&lt;/p&gt;

&lt;p&gt;Cheers 
  &lt;br /&gt;-Alok&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10290445" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/b/dotnet/archive/tags/async/">async</category><category domain="http://blogs.msdn.com/b/dotnet/archive/tags/bcl/">bcl</category></item><item><title>Improving Launch Performance for Your Desktop Applications</title><link>http://blogs.msdn.com/b/dotnet/archive/2012/03/20/improving-launch-performance-for-your-desktop-applications.aspx</link><pubDate>Tue, 20 Mar 2012 22:55:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10285685</guid><dc:creator>Brandon Bray</dc:creator><slash:comments>16</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/dotnet/rsscomments.aspx?WeblogPostID=10285685</wfw:commentRss><comments>http://blogs.msdn.com/b/dotnet/archive/2012/03/20/improving-launch-performance-for-your-desktop-applications.aspx#comments</comments><description>&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;Application performance is something we hear about all the time. It almost always falls into one of the top three issues when we aggregate all of the feedback channels from .NET developers. While performance has many characteristics, application startup time is something that everyone can easily relate to. With the .NET Framework 4.5 Beta and the &amp;ldquo;Visual Studio 11&amp;rdquo; Beta we&amp;rsquo;re now sharing with you some of the same techniques we&amp;rsquo;ve successfully used to make the .NET Framework faster. The following post was written by &lt;strong&gt;Ashwin Kamath, a program manager on the CLR performance team&lt;/strong&gt;. --Brandon&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;With every release of the .NET Framework, the .NET Framework product team looks for new ways to improve the launch performance of desktop applications. We often find opportunities for the .NET Framework to do less work on startup to achieve small performance improvements, but we also look for broader changes. In the .NET Framework 2.0, we created a new technology that significantly decreases the time it takes to read and execute precompiled native images. We have been using this technology on .NET Framework assemblies since, and it has resulted in significant improvements in application launch performance (startup times) for all managed applications. We call this technology managed profile guided optimization (MPGO). In Visual Studio 11 Ultimate Beta, MPGO is available for you to use with your application code, so you can achieve faster application startup times.&lt;/p&gt;
&lt;p&gt;In this blog post, I&amp;rsquo;ll discuss this new performance technology and how you can use it with managed desktop applications.&lt;/p&gt;
&lt;h4&gt;.NET Framework Code Compilation Background&lt;/h4&gt;
&lt;p&gt;.NET Framework assemblies contain intermediate language (IL) byte-code that needs to be compiled to machine code in order to run on a given processor. The .NET Framework provides two options for code compilation: just-in-time (JIT) compilation and precompilation. With JIT compilation, IL code is compiled at run time prior to execution. This approach is very convenient since it happens automatically and only compiles the subset of your application that is actually needed or executed. You can think of precompilation as ahead-of-time compilation. It requires the use of the &lt;a href="http://msdn.microsoft.com/library/6t9t5wcf(v=vs.110).aspx"&gt;Native Image Generator (Ngen.exe)&lt;/a&gt; on the same machine as the application in order to precompile a set of assemblies. All of the .NET Framework assemblies (for example, System.dll) are typically precompiled.&lt;/p&gt;
&lt;p&gt;Precompiled native images typically result in better application launch performance because JIT compilation is no longer necessary. There are also other important benefits, such as a lower working set (memory usage). We recommend that you create precompiled native images for scenarios where application launch performance is critical, typically for larger desktop applications.&lt;/p&gt;
&lt;p&gt;The generation of precompiled native images follows the workflow illustrated in the figure below. Invoking the NGen tool to generate native images must occur on the end-user machine (denoted by the blue box). Native images are not included with your application setup package &amp;ndash; the application is shipped to end users as IL, and the NGen tool invoked as part of the application setup on the end-user machine to create native images. For more details on NGen, you may want to refer to the &lt;a href="http://msdn.microsoft.com/en-us/magazine/cc163610.aspx"&gt;MSDN article on NGen&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-12-34-metablogapi/4571.image_5F00_772C1EDB.png"&gt;&lt;img style="background-image: none; margin: 0px auto; padding-left: 0px; padding-right: 0px; display: block; float: none; padding-top: 0px; border-width: 0px;" title="Workflow for precompiled native image generation" border="0" alt="Workflow for precompiled native image generation" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-12-34-metablogapi/7217.image_5F00_thumb_5F00_421F8FAB.png" width="380" height="126" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p align="center"&gt;&lt;b&gt;Figure 1: &lt;/b&gt;Workflow for&lt;b&gt; &lt;/b&gt;precompiled native image generation&lt;/p&gt;
&lt;h4&gt;Even Faster Precompiled Native Images&lt;/h4&gt;
&lt;p&gt;The .NET Framework has been using an innovative technology to further improve the performance of precompiled .NET Framework native images for years. Most managed applications already enjoy the benefits of this technology, by virtue of the .NET Framework using it. For larger applications more performance wins may be gained by adopting this technology, and for these applications, we recommend its use.&lt;/p&gt;
&lt;p&gt;We call this technology managed profile guided optimization (MPGO). It can improve the startup and working set (memory usage) of managed applications by optimizing the layout of precompiled native images. In particular, MPGO co-locates frequently used image data within a native image, such that each request for a disk page of image data has a higher density of useful image data for the running program.&lt;/p&gt;
&lt;p&gt;As a result, the running program will make fewer disk page requests -- often referred to as &amp;ldquo;page faults&amp;rdquo; -- which will result in improved performance. MPGO provides its greatest benefit on machines with rotational hard disks; however, it is still beneficial to use on customer machines with solid state disks (SSDs).&lt;/p&gt;
&lt;p&gt;MPGO is centered on a process called &amp;ldquo;training.&amp;rdquo; You use the MPGO tool to launch your application and collect training data. During training, you exercise a variety of representative user scenarios within your application. It is important to not exercise every possible scenario that your application offers, but the most typical ones for your users. The benefit of MPGO will be based on the quality of this training process. So, you should experiment with this process until you determine the set of training scenarios that result in the best performance for your customers.&lt;/p&gt;
&lt;p&gt;Training data is stored in a profile (hence the name of the technology), and the profile is stored as a resource within each IL assembly that is trained. This profile is then used by the &lt;a href="http://msdn.microsoft.com/library/6t9t5wcf(v=vs.110).aspx"&gt;NGen tool&lt;/a&gt; during compilation of each IL assembly, to optimize the layout of precompiled native images that it generates. MPGO can be thought of as providing extra information to NGen in order to generate higher-quality native images.&lt;/p&gt;
&lt;p&gt;The generation of training data and precompiled native images follows the workflow illustrated in the figure below. As in Figure 1, red boxes represent artifacts created on the developer machine and blue boxes represent artifacts generated on end-user machines.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-12-34-metablogapi/3021.image_5F00_68EDA5EB.png"&gt;&lt;img style="background-image: none; margin: 0px auto; padding-left: 0px; padding-right: 0px; display: block; float: none; padding-top: 0px; border-width: 0px;" title="Workflow for optimized precompiled native image generation" border="0" alt="Workflow for optimized precompiled native image generation" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-12-34-metablogapi/3581.image_5F00_thumb_5F00_7ACA39B8.png" width="640" height="133" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p align="center"&gt;&lt;b&gt;Figure 2: &lt;/b&gt;Workflow for&lt;b&gt; &lt;/b&gt;optimized precompiled native image generation &lt;b&gt;&lt;/b&gt;&lt;/p&gt;
&lt;h4&gt;Developer Guidance&lt;/h4&gt;
&lt;p&gt;As already stated, both NGen and MPGO are recommended for use with larger desktop applications, because the benefit of precompiled native images is typically seen only when it replaces significant JIT compilation at run time. In addition, these technologies are not recommended for ASP.NET and WCF services, given the dynamic deployment models available for those application types, and because startup is typically less important in those scenarios.&lt;/p&gt;
&lt;p&gt;Assuming that you do have a large desktop application that is a candidate for MPGO, we recommend that you start by using NGen and measure the performance improvement. If you measure native image performance and still need additional performance improvements, you can also try using MPGO. The MPGO tool does not support Windows Metro style apps in the .NET Framework 4.5 Beta.&lt;/p&gt;
&lt;p&gt;Your customers do not need to have the MPGO tool on their machines. They only need to have the NGen tool, which is included in the .NET Framework 4.5 Beta.&lt;/p&gt;
&lt;h4&gt;Using the MPGO Tool&lt;/h4&gt;
&lt;p&gt;The MPGO tool is included with Visual Studio 11 Ultimate Beta. The tool can be found at the following path, after you have installed Visual Studio 11 Ultimate Beta:&lt;/p&gt;
&lt;p&gt;&lt;tt&gt;C:\program files(x86)\microsoft visual studio 11.0\team tools\performance tools\mpgo.exe&lt;/tt&gt;&lt;/p&gt;
&lt;p&gt;You can experiment with the tool by following these steps:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Obtain a machine with Visual Studio 11 Ultimate Beta and your application installed.&lt;/li&gt;
&lt;li&gt;Run the MPGO tool (as an administrator) with the necessary parameters: &lt;br /&gt;&lt;tt&gt;&amp;nbsp; MPGO -scenario MyLargeApp.exe -AssembyList *.* -OutDir C:\Optimized\&lt;/tt&gt; &lt;br /&gt;The optimized IL assemblies are created in the C:\Optimized folder.&lt;/li&gt;
&lt;li&gt;Run the NGen tool (as an administrator) with the necessary parameters for each application DLL: &lt;br /&gt;&lt;tt&gt;&amp;nbsp; NGEN.exe myLargeApp.exe&lt;/tt&gt;&lt;/li&gt;
&lt;li&gt;Run your application &amp;ndash; it will now use the optimized native images.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;In closing, the .NET Framework 4.5 enables a new innovative technology for use with desktop applications, called managed profile guided optimization. This technology is used by the .NET Framework itself to benefit all managed applications, including ASP.NET, WPF, WCF, and Metro style apps. In the case of larger desktop applications, it is worth considering both NGen and MPGO as part of your application launch performance plan.&lt;/p&gt;
&lt;p&gt;Have you tried NGen and MPGO? Did you see a startup performance improvement with your application? Were you able to integrate these tools into your existing process? Tell us what you think in the comments and with our other feedback options.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10285685" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/b/dotnet/archive/tags/clr/">clr</category><category domain="http://blogs.msdn.com/b/dotnet/archive/tags/performance/">performance</category></item><item><title>Optimizing the .NET Framework Deployment Experience for Users and Developers</title><link>http://blogs.msdn.com/b/dotnet/archive/2012/03/07/optimizing-the-net-framework-deployment-experience-for-users-and-developers.aspx</link><pubDate>Wed, 07 Mar 2012 22:32:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10279433</guid><dc:creator>Brandon Bray</dc:creator><slash:comments>11</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/dotnet/rsscomments.aspx?WeblogPostID=10279433</wfw:commentRss><comments>http://blogs.msdn.com/b/dotnet/archive/2012/03/07/optimizing-the-net-framework-deployment-experience-for-users-and-developers.aspx#comments</comments><description>&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;Rapid development has been one of the enduring themes behind the design of the .NET Framework. We know that authoring application installers is particularly difficult and could be improved. The following post is by &lt;strong&gt;Richard&lt;/strong&gt; &lt;strong&gt;Lander from the program management team on the Common Language Runtime&lt;/strong&gt;. He explains our motivations for introducing a new model for deploying the .NET Framework as seen in the Windows 8 Developer Preview and updated in the Windows 8 Consumer Preview.&amp;nbsp; &amp;ndash; Brandon&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Everyone knows that it's all about the apps. I can think back to the early 1990s, when I was using both WordPerfect 5.1 and Microsoft Word 2.0c, both awesome desktop apps for the time, on Windows. Fast forward to the 2000s, and you&amp;rsquo;ll find many developers using the .NET Framework to build both desktop apps and websites and services. For many developers, the .NET Framework is the only Windows development platform that they know and love.&lt;/p&gt;
&lt;p&gt;In this blog post, I&amp;rsquo;ll discuss how Windows 8 significantly improves the end-user experience of using .NET Framework apps, when the app depends on a .NET Framework version that isn&amp;rsquo;t a built-in component of a particular version of Windows. We will look at the integrated experience that Windows 8 provides to run apps built for the .NET Framework 3.5 and earlier versions.&lt;/p&gt;
&lt;h3&gt;User Experience on Windows 7 (and earlier versions)&lt;/h3&gt;
&lt;p&gt;While developers have created huge numbers of great apps with the .NET Framework, they don't always deploy the required .NET Framework version as part of the installation experience, and sometimes leave that step to end-users. In that case, end-users have to go out and download the .NET Framework themselves. In the early years of the .NET Framework, end-users had just one or two versions to choose from, and could manage this task. By 2012, there are quite a few .NET Framework versions that have been shipped, and knowing which version is the right or best one to install to get an app to run presents a little too much of a guessing-game for most end-users.&lt;/p&gt;
&lt;p&gt;On Windows 7 (and earlier Windows versions), we provide an easier experience for Windows users who attempt to run .NET Framework apps but do not have the correct version of the .NET Framework installed. This experience is oriented around a simple error dialog, which takes users directly to the download page for the required .NET Framework version.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-12-34-metablogapi/8004.image_5F00_571738C4.png"&gt;&lt;img style="background-image: none; margin: 0px auto; padding-left: 0px; padding-right: 0px; display: block; float: none; padding-top: 0px; border: 0px;" title=".NET Framework missing error dialog" border="0" alt=".NET Framework missing error dialog" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-12-34-metablogapi/6431.image_5F00_thumb_5F00_48D8BFD4.png" width="394" height="176" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p align="center"&gt;&lt;em&gt;Error dialog for missing .NET Framework versions in Windows 7&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;All in all, this is a reasonable experience, but when you think about it in broader terms, the dialog and web-page are simply guiding the users through a manual, if well-orchestrated, .NET Framework installation process. In the planning of Windows 8, we decided that this experience wasn&amp;rsquo;t good enough for our customers.&lt;/p&gt;
&lt;h3&gt;Looking at the Numbers&lt;/h3&gt;
&lt;p&gt;The dialog above simply directs end-users to a set of web-pages, so we have access to data that gives us a partial view into which versions of the .NET Framework are actively in use, and which versions end-users most often need to (sadly) deploy themselves. The following chart provides a high-level view of the data coming in through our existing dialog.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-12-34-metablogapi/8372.clip_5F00_image004_5F00_3001690E.png"&gt;&lt;img style="background-image: none; padding-left: 0px; padding-right: 0px; display: block; float: none; margin-left: auto; margin-right: auto; padding-top: 0px; border: 0px;" title="Chart of missing .NET version distribution" border="0" alt="Chart of missing .NET version distribution" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-12-34-metablogapi/7384.clip_5F00_image004_5F00_thumb_5F00_56CF7F4E.png" width="536" height="259" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p align="center"&gt;&lt;em&gt;.NET Framework versions missing on Windows XP, Windows Vista, and Windows 7&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;This chart is open to wild interpretation unless you have the right context. You may have noticed two major trends with the .NET Framework and Windows over the last decade:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;The .NET Framework is built into Windows, starting with later Windows XP SKUs (for example, the Media Center Edition) and then in earnest with Windows Server 2003 and Windows Vista.&lt;/li&gt;
&lt;li&gt;Each Windows version includes only one version of the .NET Framework.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Re-interpreting the chart with this information in mind, one would guess that:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;A significant percentage of the .NET Framework 2.0 traffic is coming from Windows XP, which generally did not ship with a .NET Framework version, whereas both Windows Vista and Windows 7 can run .NET Framework 2.0 and 3.5 apps.&lt;/li&gt;
&lt;li&gt;The .NET Framework 4 is a significant part of the chart above, since no released Windows version has included that version.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;The chart below demonstrates the theory that nearly all the missing .NET Framework 2.0 installations are specific to Windows XP.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-12-34-metablogapi/1031.clip_5F00_image006_5F00_4FB042D6.png"&gt;&lt;img style="background-image: none; padding-left: 0px; padding-right: 0px; display: block; float: none; margin-left: auto; margin-right: auto; padding-top: 0px; border: 0px;" title="Chart of OS versions missing .NET 2.0" border="0" alt="Chart of OS versions missing .NET 2.0" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-12-34-metablogapi/0044.clip_5F00_image006_5F00_thumb_5F00_767E5916.png" width="481" height="289" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p align="center"&gt;&lt;em&gt;End-users missing .NET Framework 2.0 (or 3.5), by Windows OS version&lt;/em&gt;&lt;/p&gt;
&lt;h3&gt;User Experience on Windows 8&lt;/h3&gt;
&lt;p&gt;The Windows 8 Consumer Preview includes .NET Framework 4.5 Beta, and will include .NET Framework 4.5 RTM when the new OS ships. Note that the .NET Framework 4.5 can be thought of as &lt;a href="http://blogs.msdn.com/b/dotnet/archive/2011/09/26/compatibility-of-net-framework-4-5.aspx"&gt;including the .NET Framework 4&lt;/a&gt;, because the .NET Framework 4 does not need to be additionally installed. That leaves end-users in the position of needing to deploy the .NET Framework 3.5 onto their Windows 8 machines, to run .NET Framework 2.0, 3.0, and 3.5 desktop apps, if we continued with the Windows 7 user experience. Given the data from Windows XP and the fact that the .NET Framework 3.5 is included in Windows Vista and Windows 7, one can assume that there are a great number of .NET Framework 3.5 apps that Windows 8 customers will want to run on their PCs.&lt;/p&gt;
&lt;p&gt;Unlike Windows 7, Windows 8 automatically downloads and installs the .NET Framework 3.5 from Windows Update. There are no links to follow, no risk of missteps by customers who are not sure which .NET Framework versions to download and install from MSDN. The whole experience requires just a few simple clicks, and then you are done.&lt;/p&gt;
&lt;p&gt;The new experience centers around a new dialog box, which users will typically see when they attempt to install a .NET Framework 3.5 (or earlier version) app, or run the app, if it doesn&amp;rsquo;t have an installer. We released this new experience with the Windows Developer Preview at the Microsoft BUILD conference, and have updated it for the Windows 8 Consumer Preview. See the latest user experience in the image below.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-12-34-metablogapi/5857.image_5F00_1D9428CD.png"&gt;&lt;img style="background-image: none; padding-left: 0px; padding-right: 0px; display: block; float: none; margin-left: auto; margin-right: auto; padding-top: 0px; border: 0px;" title=".NET 3.5 deployment experience with Windows 8 Consumer Preview" border="0" alt=".NET 3.5 deployment experience with Windows 8 Consumer Preview" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-12-34-metablogapi/6036.image_5F00_thumb_5F00_7659DF97.png" width="464" height="368" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p align="center"&gt;&lt;em&gt;The .NET Framework 3.5 deployment experience in the Windows 8 Consumer Preview build&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;We&amp;rsquo;ve seen significant uptake of this new experience. With the Windows Developer Preview, we saw users opt to download the .NET Framework 3.5 on ~25% of machines via the new experience.&lt;/p&gt;
&lt;p&gt;Additionally, the .NET Framework 3.5 can be installed via the existing control panel experience.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-12-34-metablogapi/4774.image_5F00_3623C61D.png"&gt;&lt;img style="background-image: none; margin: 0px auto; padding-left: 0px; padding-right: 0px; display: block; float: none; padding-top: 0px; border: 0px;" title=".NET 3.5 installation via Windows control panel" border="0" alt=".NET 3.5 installation via Windows control panel" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-12-34-metablogapi/0576.image_5F00_thumb_5F00_0EE97CE8.png" width="357" height="308" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;For more information about these user experiences, see &lt;a href="http://msdn.microsoft.com/library/hh506443(v=VS.110).aspx"&gt;Installing the .NET Framework 3.5 on Windows 8 Consumer Preview&lt;/a&gt; in the MSDN Library.&lt;/p&gt;
&lt;h3&gt;In Closing&lt;/h3&gt;
&lt;p&gt;Developers have built many apps with the .NET Framework platform. On Windows 8, developers can count on the .NET Framework 4.5 being built into the operating system, and .NET Framework 3.5 being easily accessible via Windows Update. With both versions at hand, end-users will have a great experience running .NET Framework apps on Windows 8.&lt;/p&gt;
&lt;p&gt;Do you like this experience? Do you see it as an improvement? Is there anything about it that you would change?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10279433" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/b/dotnet/archive/tags/fundamentals/">fundamentals</category><category domain="http://blogs.msdn.com/b/dotnet/archive/tags/releases/">releases</category><category domain="http://blogs.msdn.com/b/dotnet/archive/tags/-net+framework/">.net framework</category></item><item><title>Update 4.0.3 for the Microsoft .NET Framework 4</title><link>http://blogs.msdn.com/b/dotnet/archive/2012/03/05/update-4-0-3-for-the-microsoft-net-framework-4.aspx</link><pubDate>Tue, 06 Mar 2012 02:04:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10278128</guid><dc:creator>Layla Driscoll</dc:creator><slash:comments>6</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/dotnet/rsscomments.aspx?WeblogPostID=10278128</wfw:commentRss><comments>http://blogs.msdn.com/b/dotnet/archive/2012/03/05/update-4-0-3-for-the-microsoft-net-framework-4.aspx#comments</comments><description>&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;We continue to bring certain features through updates to .NET 4 without having to wait for the .NET 4.5 release. This post covers what the latest platform update has to offer. Vivek Mishra from the .NET Servicing team authored the following. &amp;ndash; Layla&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Update 4.0.3 for the Microsoft .NET Framework 4 is now available for download. This is the third platform update that offers new features on top of the initial release for the .NET Framework 4. You can learn about earlier platform updates via the following links: &lt;a href="http://blogs.msdn.com/b/dotnet/archive/2011/10/27/update-4-0-2-for-the-microsoft-net-framework-4.aspx"&gt;Update 4.0.2&lt;/a&gt; and &lt;a href="http://blogs.msdn.com/b/endpoint/archive/2011/04/18/microsoft-net-framework-4-platform-update-1.aspx"&gt;Update 4.0.1&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Update 4.0.3 introduces five new features spanning the common language runtime, Windows Workflow Foundation (WF), and SqlClient. In addition, Update 4.0.3 includes all the features released in Update 4.0.1 and 4.0.2.&lt;/p&gt;
&lt;p&gt;This post briefly describes the features included in Update 4.0.3 and provides links to the download packages and Microsoft Knowledge Base articles, which describe the changes in detail. You can find further information about how to use this release, setup instructions, and links to documentation in the &lt;a href="http://go.microsoft.com/fwlink/?LinkID=243221"&gt;.NET Framework Developer Center&lt;/a&gt;.&lt;/p&gt;
&lt;h3&gt;What are the features in 4.0.3?&lt;/h3&gt;
&lt;p&gt;The following table lists all the features included in this update. Note that features from earlier platform updates are also included in 4.0.3 and remain unchanged from their initial release.&lt;/p&gt;
&lt;table border="1" cellspacing="0" cellpadding="0" unselectable="on"&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td valign="top" width="393"&gt;
&lt;p&gt;&lt;b&gt;Feature&lt;/b&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;td width="74"&gt;
&lt;p&gt;&lt;b&gt;4.0.1&lt;/b&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;td width="74"&gt;
&lt;p&gt;&lt;b&gt;4.0.2&lt;/b&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;td width="74"&gt;
&lt;p&gt;&lt;b&gt;4.0.3&lt;/b&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td width="393"&gt;
&lt;p&gt;Support for running workflows in partial trust&lt;/p&gt;
&lt;/td&gt;
&lt;td style="text-align: center;" width="74"&gt;
&lt;p&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;td style="text-align: center;" width="74"&gt;
&lt;p&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;td style="text-align: center;" width="74"&gt;
&lt;p&gt;&lt;b&gt;&lt;span style="color: #1f497d; font-family: 'MS Gothic'; font-size: 11pt; mso-bidi-font-family: Calibri; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA;"&gt;✓&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td width="393"&gt;
&lt;p&gt;Windows Workflow Foundation messaging activities enabled across multiple hosts&lt;/p&gt;
&lt;/td&gt;
&lt;td style="text-align: center;" width="74"&gt;
&lt;p&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;td style="text-align: center;" width="74"&gt;
&lt;p&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;td style="text-align: center;" width="74"&gt;
&lt;p&gt;&lt;b&gt;&lt;span style="color: #1f497d; font-family: 'MS Gothic'; font-size: 11pt; mso-bidi-font-family: Calibri; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA;"&gt;✓&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td width="393"&gt;
&lt;p&gt;New GCLatencyMode enumeration value for garbage collection behavior&lt;/p&gt;
&lt;/td&gt;
&lt;td style="text-align: center;" width="74"&gt;
&lt;p&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;td style="text-align: center;" width="74"&gt;
&lt;p&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;td style="text-align: center;" width="74"&gt;
&lt;p&gt;&lt;b&gt;&lt;span style="color: #1f497d; font-family: 'MS Gothic'; font-size: 11pt; mso-bidi-font-family: Calibri; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA;"&gt;✓&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td width="393"&gt;
&lt;p&gt;Support for Correlated Connection ID in SqlClient&lt;/p&gt;
&lt;/td&gt;
&lt;td style="text-align: center;" width="74"&gt;
&lt;p&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;td style="text-align: center;" width="74"&gt;
&lt;p&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;td style="text-align: center;" width="74"&gt;
&lt;p&gt;&lt;b&gt;&lt;span style="color: #1f497d; font-family: 'MS Gothic'; font-size: 11pt; mso-bidi-font-family: Calibri; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA;"&gt;✓&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td width="393"&gt;
&lt;p&gt;New support in .NET Framework 4 Portable Class Libraries&lt;/p&gt;
&lt;/td&gt;
&lt;td style="text-align: center;" width="74"&gt;
&lt;p&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;td style="text-align: center;" width="74"&gt;
&lt;p&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;td style="text-align: center;" width="74"&gt;
&lt;p&gt;&lt;b&gt;&lt;span style="color: #1f497d; font-family: 'MS Gothic'; font-size: 11pt; mso-bidi-font-family: Calibri; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA;"&gt;✓&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td width="393"&gt;
&lt;p&gt;AlwaysOn support in SqlClient&lt;/p&gt;
&lt;/td&gt;
&lt;td style="text-align: center;" width="74"&gt;
&lt;p&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;td style="text-align: center;" width="74"&gt;
&lt;p&gt;&lt;b&gt;&lt;span style="color: #1f497d; font-family: 'MS Gothic'; font-size: 11pt; mso-bidi-font-family: Calibri; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA;"&gt;✓&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;td style="text-align: center;" width="74"&gt;
&lt;p&gt;&lt;b&gt;&lt;span style="color: #1f497d; font-family: 'MS Gothic'; font-size: 11pt; mso-bidi-font-family: Calibri; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA;"&gt;✓&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td width="393"&gt;
&lt;p&gt;SQL Server Express Local Database Runtime support in SqlClient&lt;/p&gt;
&lt;/td&gt;
&lt;td style="text-align: center;" width="74"&gt;
&lt;p&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;td style="text-align: center;" width="74"&gt;
&lt;p&gt;&lt;b&gt;&lt;span style="color: #1f497d; font-family: 'MS Gothic'; font-size: 11pt; mso-bidi-font-family: Calibri; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA;"&gt;✓&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;td style="text-align: center;" width="74"&gt;
&lt;p&gt;&lt;b&gt;&lt;span style="color: #1f497d; font-family: 'MS Gothic'; font-size: 11pt; mso-bidi-font-family: Calibri; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA;"&gt;✓&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td width="393"&gt;
&lt;p&gt;StateMachine (including designer support)&lt;/p&gt;
&lt;/td&gt;
&lt;td style="text-align: center;" width="74"&gt;
&lt;p&gt;&lt;b&gt;&lt;span style="color: #1f497d; font-family: 'MS Gothic'; font-size: 11pt; mso-bidi-font-family: Calibri; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA;"&gt;✓&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;td style="text-align: center;" width="74"&gt;
&lt;p&gt;&lt;b&gt;&lt;span style="color: #1f497d; font-family: 'MS Gothic'; font-size: 11pt; mso-bidi-font-family: Calibri; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA;"&gt;✓&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;td style="text-align: center;" width="74"&gt;
&lt;p&gt;&lt;b&gt;&lt;span style="color: #1f497d; font-family: 'MS Gothic'; font-size: 11pt; mso-bidi-font-family: Calibri; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA;"&gt;✓&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td width="393"&gt;
&lt;p&gt;SqlWorkflowInstanceStore on SQL Azure&lt;/p&gt;
&lt;/td&gt;
&lt;td style="text-align: center;" width="74"&gt;
&lt;p&gt;&lt;b&gt;&lt;span style="color: #1f497d; font-family: 'MS Gothic'; font-size: 11pt; mso-bidi-font-family: Calibri; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA;"&gt;✓&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;td style="text-align: center;" width="74"&gt;
&lt;p&gt;&lt;b&gt;&lt;span style="color: #1f497d; font-family: 'MS Gothic'; font-size: 11pt; mso-bidi-font-family: Calibri; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA;"&gt;✓&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;td style="text-align: center;" width="74"&gt;
&lt;p&gt;&lt;b&gt;&lt;span style="color: #1f497d; font-family: 'MS Gothic'; font-size: 11pt; mso-bidi-font-family: Calibri; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA;"&gt;✓&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td width="393"&gt;
&lt;p&gt;Compensation for custom hosts&lt;/p&gt;
&lt;/td&gt;
&lt;td style="text-align: center;" width="74"&gt;
&lt;p&gt;&lt;b&gt;&lt;span style="color: #1f497d; font-family: 'MS Gothic'; font-size: 11pt; mso-bidi-font-family: Calibri; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA;"&gt;✓&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;td style="text-align: center;" width="74"&gt;
&lt;p&gt;&lt;b&gt;&lt;span style="color: #1f497d; font-family: 'MS Gothic'; font-size: 11pt; mso-bidi-font-family: Calibri; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA;"&gt;✓&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;td style="text-align: center;" width="74"&gt;
&lt;p&gt;&lt;b&gt;&lt;span style="color: #1f497d; font-family: 'MS Gothic'; font-size: 11pt; mso-bidi-font-family: Calibri; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA;"&gt;✓&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;h3&gt;&lt;/h3&gt;
&lt;h3&gt;Where can I get 4.0.3?&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;If you want to set up your development environment for building .NET Framework 4.0.3 applications in Visual Studio 2010 Service Pack 1 (SP1), download and install the &lt;a href="http://go.microsoft.com/fwlink/?LinkID=226779"&gt;Design-time Update (KB2600214)&lt;/a&gt;; for more information, see the &lt;a href="http://go.microsoft.com/fwlink/?LinkID=226778"&gt;Knowledge Base article&lt;/a&gt; on the update. You must install &lt;a href="http://www.microsoft.com/downloads/en/details.aspx?FamilyID=75568aa6-8107-475d-948a-ef22627e57a5"&gt;Visual Studio 2010 SP1&lt;/a&gt; before you can use this package.&lt;/li&gt;
&lt;li&gt;If you want to set up your development environment for building .NET Framework 4.0.3 applications in Visual Studio 11 Beta or later, download the &lt;a href="http://go.microsoft.com/fwlink/?LinkID=226777"&gt;Multi-Targeting Pack (KB2600213)&lt;/a&gt; standalone installer; for more information, see the &lt;a href="http://go.microsoft.com/fwlink/?LinkID=226776"&gt;Knowledge Base article&lt;/a&gt; on this update.&lt;/li&gt;
&lt;li&gt;If you don't need the design-time features and just want to deploy your applications built with the .NET Framework 4.0.3, redistribute the &lt;a href="http://go.microsoft.com/fwlink/?LinkID=226775"&gt;Run-time Update (KB2600211)&lt;/a&gt; with your applications; for more information, see the &lt;a href="http://go.microsoft.com/fwlink/?LinkID=226774"&gt;Knowledge Base article&lt;/a&gt;. You must install the &lt;a href="http://go.microsoft.com/fwlink/?linkid=186916"&gt;.NET Framework 4&lt;/a&gt; or &lt;a href="http://go.microsoft.com/fwlink/?linkid=186919"&gt;.NET Framework 4 Client Profile&lt;/a&gt; before installing the Run-time Update.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;If you discover any issues while working with this update, please send them our way via &lt;a href="http://connect.microsoft.com/VisualStudio"&gt;Microsoft Connect&lt;/a&gt;.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10278128" width="1" height="1"&gt;</description></item><item><title>Introducing .NET Framework 4.5 Beta</title><link>http://blogs.msdn.com/b/dotnet/archive/2012/02/29/introducing-net-framework-4-5-beta.aspx</link><pubDate>Wed, 29 Feb 2012 14:29:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10274372</guid><dc:creator>Layla Driscoll</dc:creator><slash:comments>16</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/dotnet/rsscomments.aspx?WeblogPostID=10274372</wfw:commentRss><comments>http://blogs.msdn.com/b/dotnet/archive/2012/02/29/introducing-net-framework-4-5-beta.aspx#comments</comments><description>&lt;p&gt;In September, we released the &lt;a href="http://blogs.msdn.com/b/dotnet/archive/2011/09/21/introducing-net-framework-4-5.aspx"&gt;.NET Framework 4.5 Developer Preview&lt;/a&gt;. The Developer Preview was essentially a &amp;ldquo;feature complete&amp;rdquo; release, enabling you to &amp;ldquo;kick the tires&amp;rdquo; and otherwise get a good sense of what we were in the process of building for you. Across the many downloads of the Developer Preview, we expect that many of you tried a broad range of developer activities with the new pre-release version of the product, such as: using the new .NET Framework 4.5 features, trying out &lt;a href="http://blogs.msdn.com/b/jasonz/archive/2011/09/14/announcing-visual-studio-11-developer-preview.aspx"&gt;Visual Studio 11 Developer Preview&lt;/a&gt; and building proof-of-concept Windows Metro style apps. We send a big shout-out to the developers who submitted an app to the &lt;a href="https://buildwindowscontest.com/"&gt;Windows 8 First Apps Contest&lt;/a&gt;. Thank you for all of your interest and support.&lt;/p&gt;
&lt;p&gt;As you may have seen on &lt;a href="http://blogs.msdn.com/b/jasonz/archive/2012/02/29/welcome-to-the-beta-of-visual-studio-11-and-net-framework-4-5.aspx"&gt;Jason&amp;rsquo;s blog&lt;/a&gt;, we&amp;rsquo;ve now taken another step forward with .NET Framework 4.5, releasing &lt;a href="http://msdn.microsoft.com/netframework/hh854779.aspx"&gt;.NET Framework 4.5 Beta&lt;/a&gt; and &lt;a href="http://go.microsoft.com/fwlink/?LinkId=240160"&gt;Visual Studio 11 Beta&lt;/a&gt;.&lt;/p&gt;
&lt;h3&gt;.NET Framework 4.5 Beta&lt;/h3&gt;
&lt;p&gt;At this point, most product features in the core of the .NET Framework are in a near-final state and are ready for you to take the proof-of-concept apps that you built with the Developer Preview and transform them into actual apps that you will make available to your customers. Obviously, you can &lt;a href="http://msdn.microsoft.com/library/ff657133(v=VS.110).aspx"&gt;update your existing .NET Framework 4 and 3.5 apps&lt;/a&gt;, too.&lt;/p&gt;
&lt;p&gt;You can download &lt;a href="http://go.microsoft.com/fwlink/?LinkId=237555"&gt;.NET Framework 4.5 Beta&lt;/a&gt; now.&lt;/p&gt;
&lt;p&gt;Take a look at &lt;a href="http://msdn.microsoft.com/library/ms171868(v=vs.110).aspx"&gt;What&amp;rsquo;s New in the .NET Framework 4.5 Beta&lt;/a&gt; to learn more about the new features.&lt;/p&gt;
&lt;h3&gt;Next on the .NET Blog&lt;/h3&gt;
&lt;p&gt;Over the next while, we will tell you the in-depth stories about a number of features that are included in the beta. We know that you will want much more inside information about the features that we&amp;rsquo;ve built, and what you can expect from them.&lt;/p&gt;
&lt;p&gt;You can expect to see posts on the following topics shortly, and other topics will follow:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;.NET Framework 3.5 Feature on Demand, on Windows 8&lt;/li&gt;
&lt;li&gt;A response to the comments about in-place update releases&lt;/li&gt;
&lt;li&gt;[What you care about goes here &amp;ndash; post suggestions in the comments]&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;As always, we would like to hear from you. Please don&amp;rsquo;t hesitate to post a comment on the blog or at one of the forums that we monitor: &lt;a href="http://connect.microsoft.com/visualstudio"&gt;Connect&lt;/a&gt; (report bugs), &lt;a href="http://visualstudio.uservoice.com/forums/121579-visual-studio/category/31481-net"&gt;UserVoice&lt;/a&gt; (request features) and &lt;a href="http://social.msdn.microsoft.com/forums/en-us/category/netframeworkvnext"&gt;MSDN Forums&lt;/a&gt; (ask for help).&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10274372" width="1" height="1"&gt;</description></item><item><title>Update 4.0.2 for the Microsoft .NET Framework 4</title><link>http://blogs.msdn.com/b/dotnet/archive/2011/10/27/update-4-0-2-for-the-microsoft-net-framework-4.aspx</link><pubDate>Thu, 27 Oct 2011 22:24:22 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10230803</guid><dc:creator>Brandon Bray</dc:creator><slash:comments>9</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/dotnet/rsscomments.aspx?WeblogPostID=10230803</wfw:commentRss><comments>http://blogs.msdn.com/b/dotnet/archive/2011/10/27/update-4-0-2-for-the-microsoft-net-framework-4.aspx#comments</comments><description>&lt;blockquote&gt;   &lt;p&gt;&lt;em&gt;With .NET 4, we’ve focused on bringing certain features to market through updates without having to wait for the .NET 4.5 release. This post covers what the latest platform update has to offer. Vivek Mishra from the .NET Servicing team authored the following. -- Brandon&lt;/em&gt;&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;The .NET Framework team is excited to announce that Update 4.0.2 for the Microsoft .NET Framework 4 is now available. This is a platform update that offers a set of additional functionality on top of the .NET Framework 4. In this release, we have added support for &lt;a href="http://go.microsoft.com/fwlink/?LinkID=232281"&gt;AlwaysOn &lt;/a&gt;and &lt;a href="http://go.microsoft.com/fwlink/?LinkId=232277"&gt;LocalDB&lt;/a&gt; in SqlClient. These features were introduced in SQL Server Code Name &amp;quot;Denali.&amp;quot; This post briefly describes what is included in the release and links to the download packages. &lt;/p&gt;  &lt;p&gt;You can find further information about how to use this release, setup instructions, and links to documentation in the &lt;a href="http://go.microsoft.com/fwlink/?LinkID=231323"&gt;.NET Framework Developer Center&lt;/a&gt;.&lt;/p&gt;  &lt;h4&gt;What are the features in 4.0.2?&lt;/h4&gt;  &lt;div&gt;4.0.2 introduces new features for supporting AlwaysOn and LocalDB with SqlClient. 4.0.2 also includes the features that were released as part of &lt;a href="http://blogs.msdn.com/b/endpoint/archive/2011/04/18/microsoft-net-framework-4-platform-update-1.aspx"&gt;4.0.1&lt;/a&gt;. Here's a complete list of features included in this update:&lt;/div&gt;  &lt;blockquote&gt;   &lt;table border="1" cellspacing="0" cellpadding="0"&gt;&lt;tbody&gt;       &lt;tr&gt;         &lt;td valign="top" width="416"&gt;           &lt;p&gt;AlwaysOn support in SqlClient&lt;/p&gt;         &lt;/td&gt;          &lt;td valign="top" width="142"&gt;           &lt;p&gt;New 4.0.2 feature&lt;/p&gt;         &lt;/td&gt;       &lt;/tr&gt;        &lt;tr&gt;         &lt;td valign="top" width="416"&gt;           &lt;p&gt;SQL Server Express Local Database Runtime support in SqlClient&lt;/p&gt;         &lt;/td&gt;          &lt;td valign="top" width="142"&gt;           &lt;p&gt;New 4.0.2 feature&lt;/p&gt;         &lt;/td&gt;       &lt;/tr&gt;        &lt;tr&gt;         &lt;td valign="top" width="416"&gt;           &lt;p&gt;StateMachine (including designer support)&lt;/p&gt;         &lt;/td&gt;          &lt;td valign="top" width="142"&gt;           &lt;p&gt;Existing 4.0.1 feature&lt;/p&gt;         &lt;/td&gt;       &lt;/tr&gt;        &lt;tr&gt;         &lt;td valign="top" width="416"&gt;           &lt;p&gt;SqlWorkflowInstanceStore on SQL Azure&lt;/p&gt;         &lt;/td&gt;          &lt;td valign="top" width="142"&gt;           &lt;p&gt;Existing 4.0.1 feature&lt;/p&gt;         &lt;/td&gt;       &lt;/tr&gt;        &lt;tr&gt;         &lt;td valign="top" width="416"&gt;           &lt;p&gt;Compensation for custom hosts&lt;/p&gt;         &lt;/td&gt;          &lt;td valign="top" width="142"&gt;           &lt;p&gt;Existing 4.0.1 feature&lt;/p&gt;         &lt;/td&gt;       &lt;/tr&gt;     &lt;/tbody&gt;&lt;/table&gt;    &lt;p&gt;&lt;i&gt;Note that we did not make any changes to the features that were shipped in Update 4.0.1.&lt;/i&gt;&lt;/p&gt; &lt;/blockquote&gt;  &lt;h4&gt;Where can I get 4.0.2?&lt;/h4&gt;  &lt;ul&gt;   &lt;li&gt;If you want to set up your development environment for building .NET Framework 4.0.2 applications in Visual Studio 2010 Service Pack 1 (SP1), download and install the &lt;a href="http://go.microsoft.com/fwlink/?LinkID=217406"&gt;Design-time Update (KB2544525)&lt;/a&gt;; for more information, see the &lt;a href="http://go.microsoft.com/fwlink/?LinkID=217405"&gt;Knowledge Base article&lt;/a&gt;. You must install &lt;a href="http://www.microsoft.com/downloads/en/details.aspx?FamilyID=75568aa6-8107-475d-948a-ef22627e57a5"&gt;Visual Studio 2010 SP1&lt;/a&gt; first, before you can use this package. &lt;/li&gt;    &lt;li&gt;If you want to deploy your .NET Framework 4.0.2 applications, download and install the &lt;a href="http://go.microsoft.com/fwlink/?LinkID=217408"&gt;Run-time Update (KB2544514)&lt;/a&gt;; for more information, see the &lt;a href="http://go.microsoft.com/fwlink/?LinkID=217407"&gt;Knowledge Base article&lt;/a&gt;. You must install the &lt;a href="http://go.microsoft.com/fwlink/?linkid=186916"&gt;.NET Framework 4&lt;/a&gt; or &lt;a href="http://go.microsoft.com/fwlink/?linkid=186919"&gt;.NET Framework 4 Client Profile&lt;/a&gt; before installing the Run-time update. &lt;/li&gt;    &lt;li&gt;If you want to set up your development environment for building .NET Framework 4.0.2 applications in Visual Studio 11 Developer Preview or later, download the &lt;a href="http://go.microsoft.com/fwlink/?LinkID=226767"&gt;Multi-Targeting Pack (KB2544526)&lt;/a&gt; standalone installer for Visual Studio 11 Developer Preview or later; for more information, see the &lt;a href="http://go.microsoft.com/fwlink/?LinkID=217404"&gt;Knowledge Base article&lt;/a&gt;. &lt;/li&gt; &lt;/ul&gt;  &lt;h4&gt;Target framework changes in Visual Studio &lt;/h4&gt;  &lt;p&gt;Based on recent customer feedback, 4.0.2 exposes the full .NET Framework version number in the format &lt;i&gt;Major.Minor,Revision&lt;/i&gt; (.NET Framework 4.0.2) in the &lt;b&gt;Target framework&lt;/b&gt; dropdown in Visual Studio. Note that this update does not change the file versioning system for the .NET Framework files -- it only exposes the underlying target framework that you can use. &lt;/p&gt;  &lt;p&gt;If you discover any issues while working with this update, please send them our way via &lt;a href="http://connect.microsoft.com/VisualStudio"&gt;Microsoft Connect&lt;/a&gt;. &lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10230803" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/b/dotnet/archive/tags/releases/">releases</category></item><item><title>Large Object Heap Improvements in .NET 4.5</title><link>http://blogs.msdn.com/b/dotnet/archive/2011/10/04/large-object-heap-improvements-in-net-4-5.aspx</link><pubDate>Tue, 04 Oct 2011 01:57:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10219510</guid><dc:creator>Brandon Bray</dc:creator><slash:comments>22</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/dotnet/rsscomments.aspx?WeblogPostID=10219510</wfw:commentRss><comments>http://blogs.msdn.com/b/dotnet/archive/2011/10/04/large-object-heap-improvements-in-net-4-5.aspx#comments</comments><description>&lt;blockquote&gt;&lt;i&gt;Garbage collection is one of premiere features of the .NET managed coding platform. As the platform has become more capable, we&amp;rsquo;re seeing developers allocate more and more large objects. Since large objects are managed differently than small objects, we&amp;rsquo;ve heard a lot of feedback requesting improvement. Today&amp;rsquo;s post is by Surupa Biswas and Maoni Stephens from the garbage collection feature team. -- Brandon&lt;/i&gt;&lt;/blockquote&gt;
&lt;p&gt;The CLR manages two different heaps for allocation, the small object heap (SOH) and the &lt;a href="http://msdn.microsoft.com/en-us/magazine/cc534993.aspx"&gt;large object heap&lt;/a&gt; (LOH). Any allocation greater than or equal to 85,000 bytes goes on the LOH. Copying large objects has a performance penalty, so the LOH is not compacted unlike the SOH. Another defining characteristic is that the LOH is only collected during a &lt;a href="http://msdn.microsoft.com/en-us/library/ms973837.aspx"&gt;generation 2&lt;/a&gt; collection. Together, these have the built-in assumption that large object allocations are infrequent.&lt;/p&gt;
&lt;p&gt;Because the LOH is not compacted, memory management is more like a traditional allocator. The CLR keeps a free list of available blocks of memory. When allocating a large object, the runtime first looks at the free list to see if it will satisfy the allocation request. When the GC discovers adjacent objects that died, it combines the space they used into one free block which can be used for allocation. Because a lot of interaction with the free list takes place at the time of allocation, there are tradeoffs between speed and optimal placement of memory blocks.&lt;/p&gt;
&lt;p&gt;A condition known as fragmentation can occur when nothing on the free list can be used. This can result in an out-of-memory exception despite the fact that collectively there is enough free memory. For developers who work with a lot of large objects, this error condition may be familiar. We&amp;rsquo;ve received a lot of feedback requesting for a solution to LOH fragmentation.&lt;/p&gt;
&lt;h4&gt;A Better LOH Allocator&lt;/h4&gt;
&lt;p&gt;In .NET 4.5, we made two improvements to the large object heap. First, we significantly improved the way the runtime manages the free list, thereby making more effective use of fragments. Now the memory allocator will revisit the memory fragments that earlier allocation couldn&amp;rsquo;t use. Second, when in &lt;a href="http://msdn.microsoft.com/en-us/library/ee787088(v=VS.110).aspx#workstation_and_server_garbage_collection"&gt;server GC&lt;/a&gt; mode, the runtime balances LOH allocations between each heap. Prior to .NET 4.5, we only balanced the SOH. We&amp;rsquo;ve observed substantial improvements in some of our LOH allocation benchmarks as a result of both changes.&lt;/p&gt;
&lt;p&gt;We&amp;rsquo;re also starting to collect telemetry about how the LOH is used. We&amp;rsquo;re tracking how often out-of-memory conditions in managed applications are due to LOH fragmentation. We&amp;rsquo;ll use this data to measure and improve memory management of real-world applications.&lt;/p&gt;
&lt;p&gt;We still recommend some traditional techniques are for getting the best performance from the LOH. Many large objects are quite similar in nature, which creates the opportunity for &lt;a href="http://en.wikipedia.org/wiki/Object_pool_pattern"&gt;object pooling&lt;/a&gt;. Frequently, types allocated on the LOH are byte-buffers that are filled by third-party libraries or devices. Rather than allocating and freeing the buffer, an object pool would let you reuse a previously-allocated buffer. Since fewer allocations and collections take place on the LOH, fragmentation is less likely to occur and the program&amp;rsquo;s performance is likely to improve.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10219510" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/b/dotnet/archive/tags/clr/">clr</category><category domain="http://blogs.msdn.com/b/dotnet/archive/tags/performance/">performance</category></item><item><title>Compatibility of .NET Framework 4.5</title><link>http://blogs.msdn.com/b/dotnet/archive/2011/09/26/compatibility-of-net-framework-4-5.aspx</link><pubDate>Tue, 27 Sep 2011 02:36:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10216973</guid><dc:creator>Brandon Bray</dc:creator><slash:comments>36</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/dotnet/rsscomments.aspx?WeblogPostID=10216973</wfw:commentRss><comments>http://blogs.msdn.com/b/dotnet/archive/2011/09/26/compatibility-of-net-framework-4-5.aspx#comments</comments><description>&lt;blockquote&gt;&lt;i&gt;Fundamentals were a big part of our focus while building .NET 4.5. We divided fundamentals into seven areas called &amp;ldquo;tenets&amp;rdquo;. One of these tenets is compatibility. Today&amp;rsquo;s post is by Manish Agnihotri, a program manager who is driving compatibility across the .NET Framework. -- Brandon&lt;/i&gt;&lt;/blockquote&gt;
&lt;p&gt;.NET Framework 4.5 is an in-place update that replaces .NET Framework 4 (rather than a side-by-side installation). Our goal is for .NET 4.5 to be fully &lt;a href="http://en.wikipedia.org/wiki/Backward_compatibility"&gt;backward compatible&lt;/a&gt; with applications built for .NET 4 (.NET 3.5 and .NET 4.5 will be side-by-side). We&amp;rsquo;ll talk about the compatibility story for .NET 3.5 in a later post. One of the first things you&amp;rsquo;ll notice about .NET 4.5 is the version number (4.0.30319) is the same as .NET 4; this is the practice used by other in-place updates.&lt;/p&gt;
&lt;p&gt;Our primary concern is guaranteeing applications you use do not break after you install .NET 4.5. We accomplish this by running hundreds of application in our compatibility lab to find issues as soon as they&amp;rsquo;re introduced. While designing new features or changing existing code, we keep compatibility in mind. And a small group of us, the &lt;i&gt;Developer Division Compatibility Council&lt;/i&gt; (DDCC), monitor changes made by developers. We review potential breaking changes, and help teams understand and assess the compatibility impact of new features and bug fixes. For .NET 4.5, members of DDCC reviewed every proposed breaking change, every new feature, and a majority of the bug fixes for the release.&lt;/p&gt;
&lt;p&gt;We&amp;rsquo;ve put a lot of effort into maintaining a consistently high bar for compatibility across the product, yet we know some issues may get past us. Many applications will exercise the .NET Framework in ways that we did not expect or we lack test coverage for. Still we care about knowing every issue, even those that may seem like corner cases. Once you &lt;a href="http://go.microsoft.com/fwlink/?LinkId=225767"&gt;install .NET 4.5 Developer Preview&lt;/a&gt; on a machine that previously had .NET 4, any compatibility issues can be sent to the &lt;a href="http://connect.microsoft.com/visualstudio"&gt;Connect&lt;/a&gt; feedback site.&lt;/p&gt;
&lt;h4&gt;Types of compatibility issues&lt;/h4&gt;
&lt;p&gt;There are three kinds of &lt;a href="http://msdn.microsoft.com/en-us/library/ff602939(v=VS.110).aspx"&gt;version compatibility&lt;/a&gt; testing we do: (1) binary compatibility, (2) source compatibility, and (3) serialization compatibility. You may also find these approaches useful in your testing, and should an issue arise this may help you narrow down the root cause. Having a wide range of scenarios within each kind of tests is also critical to ensuring good compatibility coverage.&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Binary compatibility&lt;/b&gt; uses binaries built targeting .NET 4 and then are run on .NET 4.5. Essentially, we&amp;rsquo;re testing that the behavior of newer .NET libraries is equivalent to previous versions. This can range from making sure the return value of a function is the same or that the same exceptions are raised. The hardest issues are multi-threading behaviors &amp;ndash; sometimes performance improvements can be a breaking change.&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Source compatibility &lt;/b&gt;takes an application that builds and runs successfully against .NET 4 then does the same with .NET 4.5. An interesting case is a machine where Visual Studio 2010 runs on a machine with .NET 4.5 installed &amp;ndash; since reference assemblies are used for targeting versions of the framework, building an app in VS2010 and then running it is actually binary compatibility testing. To do source compatibility testing, we build against the .NET 4.5 targeting pack (which is part of the &lt;a href="http://msdn.microsoft.com/en-us/vstudio/hh127353"&gt;Visual Studio 11 Developer Preview&lt;/a&gt;).&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Serialization compatibility&lt;/b&gt; deals with data and has several permutations. First, we let an app running on .NET 4 serialize data (e.g. save to disk) and then an app running on .NET 4.5 de-serializes (e.g. read from disk). Second, we do this in reverse by serializing from .NET 4.5 apps and de-serialize in .NET 4 apps. Third, we take a web service running on .NET 4.5 reading serialized data created by a .NET 4 based client. Fourth and last, we do the inverse with a .NET 4 web service and a .NET 4.5 client. A serialization problem will often show up as corrupted data or some kind of serialization exception.&lt;/p&gt;
&lt;h4&gt;Feedback welcome&lt;/h4&gt;
&lt;p&gt;Compatibility is an important part of migrating apps forward, though in rare cases it is necessary for a framework library to make breaking changes. We try to avoid this, using it as a last resort. MSDN documents the &lt;a href="http://msdn.microsoft.com/en-us/library/hh367887(v=VS.110).aspx"&gt;known breaking changes in .NET 4.5&lt;/a&gt;. We also have a &lt;a href="http://msdn.microsoft.com/en-us/library/ff657133(v=VS.110).aspx"&gt;migration guide&lt;/a&gt; with advice for testing your app.&lt;/p&gt;
&lt;p&gt;If you discover any compatibility issues while working with previews and betas, we want to hear about them via &lt;a href="http://connect.microsoft.com/VisualStudio"&gt;Connect&lt;/a&gt;. Hopefully, all our work to make this a highly compatible release makes it easy for you to upgrade to .NET 4.5.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10216973" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/b/dotnet/archive/tags/fundamentals/">fundamentals</category></item><item><title>Introducing .NET Framework 4.5</title><link>http://blogs.msdn.com/b/dotnet/archive/2011/09/21/introducing-net-framework-4-5.aspx</link><pubDate>Thu, 22 Sep 2011 04:08:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10215124</guid><dc:creator>Brandon Bray</dc:creator><slash:comments>11</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/dotnet/rsscomments.aspx?WeblogPostID=10215124</wfw:commentRss><comments>http://blogs.msdn.com/b/dotnet/archive/2011/09/21/introducing-net-framework-4-5.aspx#comments</comments><description>&lt;p&gt;Last week at the BUILD conference, we had the pleasure of announcing the next version of the .NET Framework and releasing a &lt;a href="http://msdn.microsoft.com/en-us/netframework/hh403373"&gt;developer preview&lt;/a&gt; at the same time. We have so many &lt;a href="http://msdn.microsoft.com/en-us/library/ms171868(v=vs.110).aspx"&gt;new things in .NET 4.5&lt;/a&gt; to discuss with our developer community &amp;ndash; we&amp;rsquo;re excited to have this opportunity to begin a discussion about each of them.&lt;/p&gt;
&lt;p&gt;At the BUILD conference, many talks provided a glimpse of what .NET 4.5 has to offer. These are some of our favorite talks:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="http://channel9.msdn.com/events/BUILD/BUILD2011/TOOL-834T"&gt;What&amp;rsquo;s new in .NET Framework 4.5&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://channel9.msdn.com/Events/BUILD/BUILD2011/TOOL-930C"&gt;A .NET developer&amp;rsquo;s view of Windows 8 app development&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://channel9.msdn.com/Events/BUILD/BUILD2011/TOOL-531T"&gt;Using the Windows Runtime from C# and Visual Basic&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://channel9.msdn.com/Events/BUILD/BUILD2011/TOOL-790C"&gt;Bringing existing managed code into Metro style apps&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://channel9.msdn.com/Events/BUILD/BUILD2011/TOOL-813T"&gt;Deep dive into the kernel of the .NET Framework&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://channel9.msdn.com/Events/BUILD/BUILD2011/SAC-808T"&gt;Building parallelized apps with .NET and Visual Studio&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://channel9.msdn.com/Events/BUILD/BUILD2011/TOOL-810T"&gt;Async made simple in Windows 8, with C# and Visual Basic&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://channel9.msdn.com/Events/BUILD/BUILD2011/TOOL-829T"&gt;The zen of async: Best practices for best performance&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://channel9.msdn.com/Events/BUILD/BUILD2011/SAC-812T"&gt;Creating immersive data experiences with Entity Framework&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://channel9.msdn.com/Events/BUILD/BUILD2011/SAC-807T"&gt;Building real-time web apps with WebSockets using IIS, ASP.NET and WCF&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The .NET platform is crucial to so many developers&amp;rsquo; day to day lives. We&amp;rsquo;ve been working for the past two years to build the best platform yet. We started the last release by listening to what customer&amp;rsquo;s wanted, and worked hard to make improvements where we could while supporting important new Microsoft releases like Windows 8. Over this release, a few themes drove a lot of our decisions:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;First class support for writing Metro style applications with .NET&lt;/li&gt;
&lt;li&gt;Improve performance with little to no effort from application developers&lt;/li&gt;
&lt;li&gt;Write code more easily for data access and web services&lt;/li&gt;
&lt;li&gt;Make it possible to write portable libraries across platforms, and support a new processor&lt;/li&gt;
&lt;li&gt;Address many top developer requests for .NET APIs and tools&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;We want to dive into each of these areas. Blogging allows us to have a two-way discussion about the data and considerations that went into the design-decisions. We&amp;rsquo;re very excited to talk about what we&amp;rsquo;ve been building.&lt;/p&gt;
&lt;h4&gt;Who are we&lt;/h4&gt;
&lt;p&gt;Together, &lt;a href="http://social.msdn.microsoft.com/profile/layla%20driscoll"&gt;Layla Driscoll&lt;/a&gt; and &lt;a href="http://social.msdn.microsoft.com/Profile/Brandon%20Bray"&gt;I&lt;/a&gt; will be your hosts on this blog series as we tour what you can expect from .NET 4.5. We&amp;rsquo;ll invite others from across all the .NET teams to give an inside look at the features and scenarios now available in the preview. While we both are on the CLR team, together we have driven a great deal of the planning and experiences for this release of .NET.&lt;/p&gt;
&lt;p&gt;It doesn&amp;rsquo;t take long before developers see how much .NET has to offer. That&amp;rsquo;s because so many teams from all over Microsoft contribute to the framework. We have much to share, and we&amp;rsquo;ll do our best to bring the work of many teams into the discussion. All of the posts will be written by engineers on the .NET team.&lt;/p&gt;
&lt;h4&gt;Starting a new discussion&lt;/h4&gt;
&lt;p&gt;Keeping a line of discussion open with the developer community is a critical factor in how we make decisions for the .NET Framework. That&amp;rsquo;s one of the reasons why we keep the &lt;a href="http://connect.microsoft.com/visualstudio"&gt;Connect&lt;/a&gt; site open for suggestions and bug submissions year round. Then we recently joined &lt;a href="http://visualstudio.uservoice.com/forums/121579-visual-studio/category/31481-net"&gt;UserVoice&lt;/a&gt; to give the community a way to vote on requests and wishes important to you. Lastly, the &lt;a href="http://social.msdn.microsoft.com/forums/en-us/category/netframeworkvnext"&gt;MSDN Forums&lt;/a&gt; give the community a place to ask questions and provide answers.&lt;/p&gt;
&lt;p&gt;Here on the &lt;a href="http://blogs.msdn.com/b/dotnet/"&gt;.NET blog&lt;/a&gt;, we hope to spark new discussions about specific work. We want to share with you the context and decisions that went into the features and scenarios we built. We hope that the community will share their opinions and participate in helping us make this an outstanding developer product. Admittedly, we&amp;rsquo;ll make mistakes and we&amp;rsquo;ll recognize when we do. We&amp;rsquo;ll work hard to make the conversation constructive and learn from what you all have to say.&lt;/p&gt;
&lt;p&gt;We do want comments, and many of us on the .NET teams will be watching. Like other Microsoft blogs, we hope to see in comments:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;On topic discussions about .NET and the posts on this site&lt;/li&gt;
&lt;li&gt;Respect for everyone in the conversation&lt;/li&gt;
&lt;li&gt;Focus on the content of the post; do ask for more details&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;And please refrain from comments that would be considered abusive (according to the community standard), misrepresentation, repeatedly posting the same comment, or blog-spam.&lt;/p&gt;
&lt;p&gt;With that, I want to say thank you for reading and I look forward to joining us in the discussion about .NET.&lt;/p&gt;
&lt;p&gt;--Brandon Bray&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10215124" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/b/dotnet/archive/tags/blog/">blog</category></item><item><title>Changes coming to ClickOnce applications running in the Internet Zone</title><link>http://blogs.msdn.com/b/dotnet/archive/2011/06/06/changes-coming-to-clickonce-applications-running-in-the-internet-zone.aspx</link><pubDate>Tue, 07 Jun 2011 00:02:40 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10171822</guid><dc:creator>Abhishek_Mondal</dc:creator><slash:comments>4</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/dotnet/rsscomments.aspx?WeblogPostID=10171822</wfw:commentRss><comments>http://blogs.msdn.com/b/dotnet/archive/2011/06/06/changes-coming-to-clickonce-applications-running-in-the-internet-zone.aspx#comments</comments><description>&lt;p&gt;We wanted to let you know that we’ll be changing the signature verification process for ClickOnce applications and WPF XAML Browser Applications (XBAPs) in an upcoming update.&amp;#160; This change will help users recognize when they’re running untrusted applications from the Internet Zone, but may require you to make changes to your applications. Currently, applications configured to run “online-only” will not display notifications requesting that the user make a decision whether to run the application or not. After the update, users will see an Application Run dialog commonly encountered when accessing applications over the Internet using Internet Explorer.&lt;/p&gt;  &lt;p&gt;In some situations you may want to retain the current application launch behavior. There are two ways to achieve this: &lt;/p&gt;  &lt;p&gt;1.&amp;#160;&amp;#160;&amp;#160;&amp;#160; Add the application publisher to the Trusted Publisher list. (&lt;a href="http://msdn.microsoft.com/en-us/library/ms172241.aspx"&gt;http://msdn.microsoft.com/en-us/library/ms172241.aspx&lt;/a&gt;)&lt;/p&gt;  &lt;p&gt;2.&amp;#160;&amp;#160;&amp;#160;&amp;#160; Add the application URL to the Trusted Sites list (&lt;a href="http://windows.microsoft.com/en-US/windows-vista/Security-zones-adding-or-removing-websites"&gt;http://windows.microsoft.com/en-US/windows-vista/Security-zones-adding-or-removing-websites&lt;/a&gt;)&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10171822" width="1" height="1"&gt;</description></item><item><title>Hardening Server Applications</title><link>http://blogs.msdn.com/b/dotnet/archive/2011/04/01/hardening-server-applications.aspx</link><pubDate>Fri, 01 Apr 2011 16:09:14 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10148843</guid><dc:creator>Abhishek_Mondal</dc:creator><slash:comments>2</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/dotnet/rsscomments.aspx?WeblogPostID=10148843</wfw:commentRss><comments>http://blogs.msdn.com/b/dotnet/archive/2011/04/01/hardening-server-applications.aspx#comments</comments><description>&lt;p&gt;The Base Class Libraries team, the wider CLR team and Microsoft Research worked hard on this new technology and we are very proud to be able to share the news. Read the &lt;a href="http://blogs.msdn.com/b/bclteam/archive/2011/04/01/hardening-server-applications.aspx"&gt;full article&lt;/a&gt; for details.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10148843" width="1" height="1"&gt;</description></item><item><title>Is That the Right Version of Mscoreei.dll?</title><link>http://blogs.msdn.com/b/dotnet/archive/2010/09/13/is-that-the-right-version-of-mscoreei-dll.aspx</link><pubDate>Mon, 13 Sep 2010 22:39:10 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10061454</guid><dc:creator>Abhishek_Mondal</dc:creator><slash:comments>6</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/dotnet/rsscomments.aspx?WeblogPostID=10061454</wfw:commentRss><comments>http://blogs.msdn.com/b/dotnet/archive/2010/09/13/is-that-the-right-version-of-mscoreei-dll.aspx#comments</comments><description>&lt;p&gt;After installing .NET 4.0 or later you may notice something a little unusual about your .NET processes. Here is a partial list of the loaded modules of a simple “Hello World” executable compiled with the .NET 2.0 compiler.&lt;/p&gt;  &lt;p&gt;start end module name&lt;/p&gt;  &lt;p&gt;60f00000 61491000 mscorwks C:\Windows\Microsoft.NET\Framework\v2.0.50727\mscorwks.dll&lt;/p&gt;  &lt;p&gt;6c650000 6c6b6000 mscoreei C:\Windows\Microsoft.NET\Framework\v4.0.30319\mscoreei.dll&lt;/p&gt;  &lt;p&gt;6d420000 6d46a000 MSCOREE C:\Windows\SYSTEM32\MSCOREE.DLL&lt;/p&gt;  &lt;p&gt;75a80000 75aca000 KERNELBASE C:\Windows\system32\KERNELBASE.dll&lt;/p&gt;  &lt;p&gt;Something here looks out of place – the mscoreei.dll file is loaded from the v4.0.30319 folder. What is it doing there next to the main clr dll (mscorwks.dll) from v2.0.50727? Actually, that’s the expected behavior. We call mscoreei.dll the “shim implementation”, or “shim impl” for short, and it’s new for .NET 4.0. The third dll in the list above, previously known as the “shim”, is now more accurately known as the “shell shim”. The two are tightly paired to do the main job that was previously done by mscoree alone – providing the interfaces for loading the runtime. Generally speaking, the shell shim now consists of thin wrapper functions, each of which delegates its functionality to a corresponding function in the shim implementation.&lt;/p&gt;  &lt;p&gt;Why the split? We’ve seen significant numbers of machine reboots as part of .NET redist installation, typically due to needing to update a file that is in use. The most common file in use has been mscoree.dll, which is loaded by every single .NET application, and even some services such as MSI. As a result, we undertook the mscoree “split” to avoid machine reboots. By moving the shim implementation into a version-specific file, we are able to deploy a new version of mscoreei.dll (say in the v5.0 .NET folder, as part of .NET 5.0 installation), without touching the machine-wide mscoree.dll file. The next time a managed app is run, mscoree will dynamically find the new mscoreei and defer each of its function calls to it. That way we can deploy new versions of the framework on a machine running existing managed applications without requiring a restart.&lt;/p&gt;  &lt;p&gt;Note that mscoree always uses the newest mscoreei it can find, but the actual runtime that is loaded is a completely different question. Therefore it shouldn’t be a surprise to see a newer version of mscoreei loaded with older versions of runtime dlls in the same process. In fact, CLR versions have been running with the latest shim for many years now. If I examine file versions when running a .NET 1.1 app on a machine that has both .NET 1.1 and .NET 2.0 installed I can see that I am using a shim newer than the runtime.&lt;/p&gt;  &lt;p&gt;start end module name&lt;/p&gt;  &lt;p&gt;79000000 79045000 mscoree C:\WINDOWS\system32\mscoree.dll&lt;/p&gt;  &lt;p&gt;File version: 2.0.50727.42&lt;/p&gt;  &lt;p&gt;791b0000 79412000 mscorwks C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\mscorwks.dll&lt;/p&gt;  &lt;p&gt;File version: 1.1.4322.573&lt;/p&gt;  &lt;p&gt;The difference now is that the split of the shim makes it more obvious that the shim version doesn’t always match the runtime version because the version number is right there in the path of the shim impl.&lt;/p&gt;  &lt;p&gt;This brings to mind an aphorism from David Wheeler: &lt;i&gt;All problems in computer science can be solved by another level of indirection.&lt;/i&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10061454" width="1" height="1"&gt;</description></item><item><title>In-Proc SxS and Migration Quick Start</title><link>http://blogs.msdn.com/b/dotnet/archive/2010/06/23/in-proc-sxs-and-migration-quick-start.aspx</link><pubDate>Wed, 23 Jun 2010 21:41:06 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10029237</guid><dc:creator>Abhishek_Mondal</dc:creator><slash:comments>1</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/dotnet/rsscomments.aspx?WeblogPostID=10029237</wfw:commentRss><comments>http://blogs.msdn.com/b/dotnet/archive/2010/06/23/in-proc-sxs-and-migration-quick-start.aspx#comments</comments><description>&lt;div class="WordSection1"&gt;   &lt;div style="border-bottom: #4f81bd 1pt solid; padding-bottom: 4pt; border-right-style: none; padding-left: 0in; padding-right: 0in; border-top-style: none; border-left-style: none; padding-top: 0in; mso-border-bottom-themecolor: accent1; mso-element: para-border-div"&gt;&amp;#160;&lt;/div&gt;    &lt;p class="MsoNormal"&gt;This post is meant to help you understand what runtime in-process side-by-side is, how to think about it, how to use it, and how it affects application and component migration to the .NET 4 Runtime. This post is relevant to you if you use native runtime activation APIs, depend on specific runtime activation behaviors, or use mixed mode assemblies built with Visual Studio Managed Extensions for C++ v8 or v9, or if you’re just interested in how we handle pre-.NET 4 and .NET 4 code coexisting on a machine.&lt;/p&gt;    &lt;h1&gt;The problem&lt;/h1&gt;    &lt;p class="MsoNormal"&gt;Prior to the .NET 4 Runtime, any given process was limited to loading only one runtime version, and was bound to that runtime for remainder of that process lifetime. In environments where independently authored components built and tested against different .NET Runtime versions can be loaded into a single process, this sometimes caused compatibility problems for the components that did not target the runtime that was loaded into the process.&lt;/p&gt;    &lt;h1&gt;Our Solution&lt;/h1&gt;    &lt;p class="MsoNormal"&gt;A new feature in the .NET 4 Runtime, “in-process runtime side-by-side” (or “in-proc SxS” for short) describes the ability to load more than one .NET Runtime version into the same process and have them run “side by side”. This ability to load multiple runtimes into the same process gives us with the ability to provide the highest level of compatibility possible for environments in which multiple independent managed components are loaded by, and communicate with, a native layer. COM is the biggest example of a native layer through which managed code must communicate, and this means that in an environment in which multiple independently-authored managed COM components are activated, each may be loaded into the runtime for which it was built and tested, which maximizes compatibility. The upcoming release of Visual Studio Tools for Office (VSTO) will take advantage of this by enabling all managed office &lt;span class="SpellE"&gt;addins&lt;/span&gt; to be loaded within their targeted runtime.&lt;/p&gt;    &lt;h1&gt;Our Solution Is&lt;i style="mso-bidi-font-style: normal"&gt; Not…&lt;/i&gt;&lt;/h1&gt;    &lt;p class="MsoNormal"&gt;In-proc SxS does not affect managed assembly loading, such as &lt;span class="SpellE"&gt;Assembly.Load&lt;/span&gt; or loads due to assembly references – these scenarios continue to load the target assembly in the runtime where the load request was made. To take advantage of in-proc SxS, a managed component must be activated by a native host and interact with its environment through a native &lt;span class="SpellE"&gt;interop&lt;/span&gt; layer such as COM &lt;span class="SpellE"&gt;interop&lt;/span&gt; and P/Invoke. &lt;/p&gt;    &lt;p class="MsoNormal"&gt;This may be easier to understand if you consider that that two runtimes loaded into a process operate completely independently; i.e., runtime X has no more knowledge about runtime Y than it does about any other native DLL loaded into a process. Each runtime has its own GC; each runtime creates, owns, and manages its own Application Domains (never the other way around), including Shared and Default domains for each; and each runtime interacts with unmanaged DLLs through &lt;span class="SpellE"&gt;interop&lt;/span&gt; layers.&lt;/p&gt;    &lt;h1&gt;How to Think About In-Proc SxS&lt;/h1&gt;    &lt;p class="MsoNormal"&gt;Thinking about multiple runtimes in the same process without additional context isn’t all that helpful; in fact, it just leads to more questions: “How and when does this happen?&lt;span class="GramE"&gt;”;&lt;/span&gt; and most importantly, “Does this affect me?”&lt;/p&gt;    &lt;h2&gt;Does In-Proc SxS Affect Me?&lt;/h2&gt;    &lt;p class="MsoNormal"&gt;In-proc SxS was designed so that existing applications, components and libraries should be completely unaffected by an installation of the .NET 4 Framework - applications that were running against a pre-v4 framework will remain blissfully unaware of the install.&lt;/p&gt;    &lt;p class="MsoNormal"&gt;In addition, &lt;span class="GramE"&gt;migrating&lt;/span&gt; a product to .NET 4 is unlikely to be affected by in-proc SxS if:&lt;/p&gt;    &lt;p style="mso-list: l9 level1 lfo3" class="MsoListBulletCxSpFirst"&gt;&lt;span style="font-family: symbol; mso-fareast-font-family: symbol; mso-bidi-font-family: symbol"&gt;&lt;span style="mso-list: ignore"&gt;·&lt;span style="font: 7pt &amp;quot;Times New Roman&amp;quot;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;The product is a pure managed application;&lt;/p&gt;    &lt;p style="mso-list: l9 level1 lfo3" class="MsoListBulletCxSpMiddle"&gt;&lt;span style="font-family: symbol; mso-fareast-font-family: symbol; mso-bidi-font-family: symbol"&gt;&lt;span style="mso-list: ignore"&gt;·&lt;span style="font: 7pt &amp;quot;Times New Roman&amp;quot;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;The product is a pure managed library; or&lt;/p&gt;    &lt;p style="mso-list: l9 level1 lfo3" class="MsoListBulletCxSpLast"&gt;&lt;span style="font-family: symbol; mso-fareast-font-family: symbol; mso-bidi-font-family: symbol"&gt;&lt;span style="mso-list: ignore"&gt;·&lt;span style="font: 7pt &amp;quot;Times New Roman&amp;quot;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;The product is a pure managed COM component.&lt;/p&gt;    &lt;p class="MsoNormal"&gt;However, a product may be affected by in-proc SxS during migration if:&lt;/p&gt;    &lt;p style="mso-list: l9 level1 lfo3" class="MsoListBulletCxSpFirst"&gt;&lt;span style="font-family: symbol; mso-fareast-font-family: symbol; mso-bidi-font-family: symbol"&gt;&lt;span style="mso-list: ignore"&gt;·&lt;span style="font: 7pt &amp;quot;Times New Roman&amp;quot;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;The product makes use of one or more deprecated APIs; or &lt;/p&gt;    &lt;p style="mso-list: l9 level1 lfo3" class="MsoListBulletCxSpMiddle"&gt;&lt;span style="font-family: symbol; mso-fareast-font-family: symbol; mso-bidi-font-family: symbol"&gt;&lt;span style="mso-list: ignore"&gt;·&lt;span style="font: 7pt &amp;quot;Times New Roman&amp;quot;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;The product contains, or takes a dependency on, a &lt;a href="http://msdn.microsoft.com/en-us/library/x0w2664k.aspx"&gt;mixed mode assembly&lt;/a&gt; built with Visual Studio Managed Extensions for C++ version 8 or 9.&lt;/p&gt;    &lt;p style="mso-list: none; tab-stops: .5in" class="MsoListBulletCxSpMiddle"&gt;&lt;/p&gt;    &lt;p&gt;&amp;#160;&lt;/p&gt;    &lt;p&gt;&lt;/p&gt;    &lt;p style="mso-list: none; tab-stops: .5in" class="MsoListBulletCxSpLast"&gt;See the migration section below for more information.&lt;/p&gt;    &lt;h2&gt;Runtime Activation&lt;/h2&gt;    &lt;p style="text-justify: inter-ideograph; text-align: justify" class="MsoNormal"&gt;For the small number of you who &lt;i style="mso-bidi-font-style: normal"&gt;may&lt;/i&gt; be affected by in-proc SxS and need to gain a better understanding of it, the easiest way to understand how and where in-proc SxS fits into the managed world is to think about it as a &lt;span class="MsoIntenseEmphasis"&gt;&lt;em&gt;fundamental change to our runtime activation model&lt;/em&gt;&lt;/span&gt;. &lt;b style="mso-bidi-font-weight: normal"&gt;&lt;i style="mso-bidi-font-style: normal"&gt;Runtime activation&lt;/i&gt;&lt;/b&gt; describes the process by which the most appropriate runtime version is found, located, and loaded. A runtime request consists of a set of inputs, which can include (among others) an assembly (often the application’s EXE), an &lt;a href="http://msdn.microsoft.com/en-us/library/aa374182%28VS.85%29.aspx"&gt;application configuration file&lt;/a&gt; (often found next to the application’s EXE), a version string, or any combination thereof, and runtime activation uses these inputs to determine the most suitable match from among the set of installed runtimes. Common examples are: managed EXE launch, &lt;a href="http://msdn.microsoft.com/en-us/library/ms686615%28VS.85%29.aspx"&gt;&lt;span class="SpellE"&gt;CoCreateInstanceInstance&lt;/span&gt;&lt;/a&gt; of COM-visible managed types, and &lt;a href="http://msdn.microsoft.com/en-us/library/x0w2664k.aspx"&gt;mixed-mode assemblies&lt;/a&gt; loaded from native code.&lt;/p&gt;    &lt;h3&gt;Old Activation Model&lt;/h3&gt;    &lt;p class="MsoNormal"&gt;In prior releases, when in-proc SxS did not exist, our runtime activation policy had to take into consideration the reality that only one runtime could ever be loaded into a process. For self-contained managed applications the obvious choice was invariably the right one: activate the runtime that the application targets (derived either from metadata in the managed executable itself or from an application configuration file if one exists). And since virtually all managed application installers out there list the application’s target runtime as a pre-requisite, the application could count on the target runtime being installed. Unfortunately, runtime activation was not always as clear cut in other important scenarios, the most prevalent of which is the activation of managed COM components. In such scenarios, the chosen policy has always been to activate in the latest installed runtime when no runtime has yet been loaded – a policy we call “bind to latest.”&lt;/p&gt;    &lt;div style="border-bottom: #4f81bd 1pt solid; border-left: #4f81bd 1pt solid; padding-bottom: 10pt; padding-left: 10pt; padding-right: 10pt; margin-left: 0.2in; border-top: #4f81bd 1pt solid; margin-right: 0.2in; border-right: #4f81bd 1pt solid; padding-top: 10pt; mso-border-alt: solid #4f81bd .25pt; mso-border-themecolor: accent1; mso-element: para-border-div"&gt;     &lt;p style="border-bottom-style: none; padding-bottom: 0in; border-right-style: none; margin: 0in 0in 10pt; padding-left: 0in; padding-right: 0in; border-top-style: none; border-left-style: none; padding-top: 0in; mso-padding-alt: 10.0pt 10.0pt 10.0pt 10.0pt; mso-border-alt: solid #4f81bd .25pt; mso-border-themecolor: accent1; mso-border-shadow: yes; mso-prop-change: &amp;#39;Abhishek Mondal&amp;#39; 20100623t1426" class="MsoBlockText"&gt;Consider the following example to help understand why this policy was chosen for managed COM class activation. Let’s say that a native application X exposes an extensibility mechanism through COM, and two authors separately write managed extensions A and B that target .NET Frameworks v1.1 and v2.0 respectively, and that application X and both extensions are installed on machine Z with both .NET Frameworks v1.1 and v2.0 installed.&lt;/p&gt;      &lt;p style="border-bottom-style: none; padding-bottom: 0in; border-right-style: none; margin: 0in 0in 10pt; padding-left: 0in; padding-right: 0in; border-top-style: none; border-left-style: none; padding-top: 0in; mso-padding-alt: 10.0pt 10.0pt 10.0pt 10.0pt; mso-border-alt: solid #4f81bd .25pt; mso-border-themecolor: accent1; mso-border-shadow: yes; mso-prop-change: &amp;#39;Abhishek Mondal&amp;#39; 20100623t1426" class="MsoBlockText"&gt;Say that, in the course of normal execution, application X &lt;span class="SpellE"&gt;CoCreateInstances&lt;/span&gt; component A. In this case it may be tempting to use the same activation policy as that of managed &lt;span class="SpellE"&gt;executables&lt;/span&gt; and pick the runtime that the component targets (v1.1). However, this choice would cause a later attempt to &lt;span class="SpellE"&gt;CoCreateInstance&lt;/span&gt; component B to fail, because the .NET Runtime v1.1 (to which the process has been locked) cannot load a v2.0 assembly.&lt;/p&gt;      &lt;p style="border-bottom-style: none; padding-bottom: 0in; border-right-style: none; margin: 0in 0in 10pt; padding-left: 0in; padding-right: 0in; border-top-style: none; border-left-style: none; padding-top: 0in; mso-padding-alt: 10.0pt 10.0pt 10.0pt 10.0pt; mso-border-alt: solid #4f81bd .25pt; mso-border-themecolor: accent1; mso-border-shadow: yes; mso-prop-change: &amp;#39;Abhishek Mondal&amp;#39; 20100623t1426" class="MsoBlockText"&gt;To avoid this problem, the policy for managed COM component activation has always been to activate and load the component into the latest installed runtime, if a runtime has not yet been loaded. However, this policy created an impossibly high compatibility burden: we would need to provide 100% release-to-release compatibility, and to do so we would need to test every possible usage scenario for every managed application ever built on any previous .NET Runtime! So, while the entire .NET team will always set very high release-to-release compatibility requirements, we can all sleep a bit easier knowing that in-process side-by-side enables us to provide a much better compatibility model for our customers, insulating them from the small but inevitable accidental breaking changes that occur in a major product release.&lt;/p&gt;   &lt;/div&gt;    &lt;h3&gt;New Activation Model&lt;/h3&gt;    &lt;p class="MsoNormal"&gt;I’m sure you’ve guessed the fundamental change to our activation policy by now: &lt;em&gt;&lt;span class="MsoIntenseEmphasis"&gt;starting with version 4, the&lt;span style="mso-spacerun: yes"&gt; &lt;/span&gt;.NET Runtime&lt;/span&gt;&lt;span class="MsoCommentReference"&gt;&lt;span style="line-height: 115%; font-size: 8pt"&gt; &lt;/span&gt;&lt;/span&gt;&lt;span class="MsoIntenseEmphasis"&gt;activation policy may now load the most appropriate runtime version for a given activation request, without regard for the set of runtime version(s) that may already be loaded into the process&lt;/span&gt;&lt;/em&gt;. The activation policy will no longer target the latest runtime on the machine as it did in previous versions (more details on this below). Again, there are some restrictions with when dealing with pre-v4 runtimes, but the above statement will hold true, without restriction, for all .NET Runtimes version 4 and higher.&lt;/p&gt;    &lt;div style="border-bottom: #4f81bd 1pt solid; border-left: #4f81bd 1pt solid; padding-bottom: 10pt; padding-left: 10pt; padding-right: 10pt; margin-left: 0.2in; border-top: #4f81bd 1pt solid; margin-right: 0.2in; border-right: #4f81bd 1pt solid; padding-top: 10pt; mso-border-alt: solid #4f81bd .25pt; mso-border-themecolor: accent1; mso-element: para-border-div"&gt;     &lt;p style="border-bottom-style: none; padding-bottom: 0in; border-right-style: none; margin: 0in 0in 10pt; padding-left: 0in; padding-right: 0in; border-top-style: none; border-left-style: none; padding-top: 0in; mso-padding-alt: 10.0pt 10.0pt 10.0pt 10.0pt; mso-border-alt: solid #4f81bd .25pt; mso-border-themecolor: accent1; mso-border-shadow: yes; mso-prop-change: &amp;#39;Abhishek Mondal&amp;#39; 20100623t1426" class="MsoBlockText"&gt;Using the previous example, but with the small change that component A has been updated to target .NET 4, runtime activation policy is now free to activate component A in the v4 runtime and later activate component B in the v2 runtime. This provides the greatest compatibility by allowing components to run within their target runtime, without regard for the process environment into which it is loaded.&lt;/p&gt;   &lt;/div&gt;    &lt;p class="MsoNormal"&gt;Now that we’ve covered the basics of the new in-proc SxS feature and activation model, let’s look at the necessary considerations when &lt;span class="GramE"&gt;migrating&lt;/span&gt; an application, component or library to .NET 4 from an earlier runtime.&lt;/p&gt;    &lt;h1&gt;Migration&lt;/h1&gt;    &lt;div style="border-bottom: #4f81bd 1pt solid; border-left: #4f81bd 1pt solid; padding-bottom: 10pt; padding-left: 10pt; padding-right: 10pt; margin-left: 0.2in; border-top: #4f81bd 1pt solid; margin-right: 0.2in; border-right: #4f81bd 1pt solid; padding-top: 10pt; mso-border-alt: solid #4f81bd .25pt; mso-border-themecolor: accent1; mso-element: para-border-div"&gt;     &lt;p style="border-bottom-style: none; padding-bottom: 0in; border-right-style: none; margin: 0in 0in 10pt; padding-left: 0in; padding-right: 0in; border-top-style: none; border-left-style: none; padding-top: 0in; mso-padding-alt: 10.0pt 10.0pt 10.0pt 10.0pt; mso-border-alt: solid #4f81bd .25pt; mso-border-themecolor: accent1; mso-border-shadow: yes; mso-prop-change: &amp;#39;Abhishek Mondal&amp;#39; 20100623t1426" class="MsoBlockText"&gt;In the vast majority of cases it is simple to migrate an application to run on .NET Framework 4: if you are migrating an application at the source level, import your solution into Visual Studio 2010 and choose “.NET Framework 4” for the Target Framework in each project’s properties page, then recompile; if you are migrating an application without recompiling, create or update the application configuration file to target .NET 4.For example, the following is the recommended &amp;lt;startup&amp;gt; section to use when migrating an application that targets .NET 3.5 to also target .NET 4:&lt;/p&gt;      &lt;p style="border-bottom-style: none; padding-bottom: 0in; line-height: normal; border-right-style: none; margin: 0in 0in 0pt; padding-left: 0in; padding-right: 0in; border-top-style: none; border-left-style: none; padding-top: 0in; mso-padding-alt: 10.0pt 10.0pt 10.0pt 10.0pt; mso-border-alt: solid #4f81bd .25pt; mso-border-themecolor: accent1; mso-border-shadow: yes; mso-prop-change: &amp;#39;Abhishek Mondal&amp;#39; 20100623t1426" class="MsoBlockText"&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt"&gt;&lt;span style="mso-spacerun: yes"&gt;&lt;/span&gt;&lt;span class="GramE"&gt;&amp;lt;?xml&lt;/span&gt; version =&amp;quot;1.0&amp;quot;?&amp;gt; &lt;/span&gt;        &lt;p&gt;&lt;/p&gt;     &lt;/p&gt;      &lt;p&gt;&lt;/p&gt;      &lt;p style="border-bottom-style: none; padding-bottom: 0in; line-height: normal; border-right-style: none; margin: 0in 0in 0pt; padding-left: 0in; padding-right: 0in; border-top-style: none; border-left-style: none; padding-top: 0in; mso-padding-alt: 10.0pt 10.0pt 10.0pt 10.0pt; mso-border-alt: solid #4f81bd .25pt; mso-border-themecolor: accent1; mso-border-shadow: yes; mso-prop-change: &amp;#39;Abhishek Mondal&amp;#39; 20100623t1426" class="MsoBlockText"&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt"&gt;&lt;span style="mso-spacerun: yes"&gt;&lt;/span&gt;&amp;lt;&lt;span class="GramE"&gt;configuration&lt;/span&gt;&amp;gt; &lt;/span&gt;        &lt;p&gt;&lt;/p&gt;     &lt;/p&gt;      &lt;p&gt;&lt;/p&gt;      &lt;p style="border-bottom-style: none; padding-bottom: 0in; line-height: normal; border-right-style: none; margin: 0in 0in 0pt; padding-left: 0in; padding-right: 0in; border-top-style: none; border-left-style: none; padding-top: 0in; mso-padding-alt: 10.0pt 10.0pt 10.0pt 10.0pt; mso-border-alt: solid #4f81bd .25pt; mso-border-themecolor: accent1; mso-border-shadow: yes; mso-prop-change: &amp;#39;Abhishek Mondal&amp;#39; 20100623t1426" class="MsoBlockText"&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt"&gt;&lt;span style="mso-spacerun: yes"&gt;&lt;/span&gt;&amp;lt;&lt;span class="GramE"&gt;startup&lt;/span&gt;&amp;gt; &lt;/span&gt;        &lt;p&gt;&lt;/p&gt;     &lt;/p&gt;      &lt;p&gt;&lt;/p&gt;      &lt;p style="border-bottom-style: none; padding-bottom: 0in; line-height: normal; border-right-style: none; margin: 0in 0in 0pt; padding-left: 0in; padding-right: 0in; border-top-style: none; border-left-style: none; padding-top: 0in; mso-padding-alt: 10.0pt 10.0pt 10.0pt 10.0pt; mso-border-alt: solid #4f81bd .25pt; mso-border-themecolor: accent1; mso-border-shadow: yes; mso-prop-change: &amp;#39;Abhishek Mondal&amp;#39; 20100623t1426" class="MsoBlockText"&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt"&gt;&lt;span style="mso-spacerun: yes"&gt;&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&lt;/span&gt;&amp;lt;&lt;span class="SpellE"&gt;supportedRuntime&lt;/span&gt; version=&amp;quot;v4.0&amp;quot;/&amp;gt; &lt;/span&gt;        &lt;p&gt;&lt;/p&gt;     &lt;/p&gt;      &lt;p&gt;&lt;/p&gt;      &lt;p style="border-bottom-style: none; padding-bottom: 0in; line-height: normal; border-right-style: none; margin: 0in 0in 0pt; padding-left: 0in; padding-right: 0in; border-top-style: none; border-left-style: none; padding-top: 0in; mso-padding-alt: 10.0pt 10.0pt 10.0pt 10.0pt; mso-border-alt: solid #4f81bd .25pt; mso-border-themecolor: accent1; mso-border-shadow: yes; mso-prop-change: &amp;#39;Abhishek Mondal&amp;#39; 20100623t1426" class="MsoBlockText"&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt"&gt;&lt;span style="mso-spacerun: yes"&gt;&lt;/span&gt;&amp;lt;&lt;span class="SpellE"&gt;&lt;span class="GramE"&gt;supportedRuntime&lt;/span&gt;&lt;/span&gt; version=&amp;quot;v2.0.50727&amp;quot;/&amp;gt; &lt;/span&gt;        &lt;p&gt;&lt;/p&gt;     &lt;/p&gt;      &lt;p&gt;&lt;/p&gt;      &lt;p style="border-bottom-style: none; padding-bottom: 0in; line-height: normal; border-right-style: none; margin: 0in 0in 0pt; padding-left: 0in; padding-right: 0in; border-top-style: none; border-left-style: none; padding-top: 0in; mso-padding-alt: 10.0pt 10.0pt 10.0pt 10.0pt; mso-border-alt: solid #4f81bd .25pt; mso-border-themecolor: accent1; mso-border-shadow: yes; mso-prop-change: &amp;#39;Abhishek Mondal&amp;#39; 20100623t1426" class="MsoBlockText"&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt"&gt;&lt;span style="mso-spacerun: yes"&gt;&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&lt;/span&gt;&amp;lt;/startup&amp;gt; &lt;/span&gt;        &lt;p&gt;&lt;/p&gt;     &lt;/p&gt;      &lt;p&gt;&lt;/p&gt;      &lt;p style="border-bottom-style: none; padding-bottom: 0in; border-right-style: none; margin: 0in 0in 10pt; padding-left: 0in; padding-right: 0in; border-top-style: none; border-left-style: none; padding-top: 0in; mso-padding-alt: 10.0pt 10.0pt 10.0pt 10.0pt; mso-border-alt: solid #4f81bd .25pt; mso-border-themecolor: accent1; mso-border-shadow: yes; mso-prop-change: &amp;#39;Abhishek Mondal&amp;#39; 20100623t1426" class="MsoBlockText"&gt;&lt;span style="line-height: 115%; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt"&gt;&lt;span style="mso-spacerun: yes"&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;"&gt;&amp;lt;/configuration&amp;gt; &lt;/span&gt;        &lt;p&gt;&lt;/p&gt;     &lt;/p&gt;      &lt;p&gt;&lt;/p&gt;      &lt;p style="border-bottom-style: none; padding-bottom: 0in; border-right-style: none; margin: 0in 0in 10pt; padding-left: 0in; padding-right: 0in; border-top-style: none; border-left-style: none; padding-top: 0in; mso-padding-alt: 10.0pt 10.0pt 10.0pt 10.0pt; mso-border-alt: solid #4f81bd .25pt; mso-border-themecolor: accent1; mso-border-shadow: yes; mso-prop-change: &amp;#39;Abhishek Mondal&amp;#39; 20100623t1426" class="MsoBlockText"&gt;Note that starting with .NET Framework 4, only a two-part version string is required, though three-part version strings are still accepted.&lt;/p&gt;   &lt;/div&gt;    &lt;p class="MsoNormal"&gt;A migration decision tree is provided later in this section.&lt;/p&gt;    &lt;h2&gt;Limitations and Exceptions&lt;/h2&gt;    &lt;p class="MsoNormal"&gt;When transitioning code originally targeting an in-proc-SxS-unaware runtime to an in-proc-SxS-aware runtime, some additional steps will need to be taken if your application contains one or more of the following:&lt;/p&gt;    &lt;p style="text-indent: -0.25in; mso-list: l17 level1 lfo1" class="MsoListParagraphCxSpFirst"&gt;&lt;span style="font-family: symbol; mso-fareast-font-family: symbol; mso-bidi-font-family: symbol"&gt;&lt;span style="mso-list: ignore"&gt;·&lt;span style="font: 7pt &amp;quot;Times New Roman&amp;quot;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;calls to any of the &lt;a href="http://msdn.microsoft.com/en-us/library/aa964945.aspx"&gt;hosting global static functions&lt;/a&gt;, from native and/or managed code;&lt;/p&gt;    &lt;p style="text-indent: -0.25in; mso-list: l17 level1 lfo1" class="MsoListParagraphCxSpMiddle"&gt;&lt;span style="font-family: symbol; mso-fareast-font-family: symbol; mso-bidi-font-family: symbol"&gt;&lt;span style="mso-list: ignore"&gt;·&lt;span style="font: 7pt &amp;quot;Times New Roman&amp;quot;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;calls to any of the &lt;a href="http://msdn.microsoft.com/en-us/library/aa964998.aspx"&gt;Strong Naming Global Static Functions&lt;/a&gt;, from native and/or managed code;&lt;/p&gt;    &lt;p style="text-indent: -0.25in; mso-list: l17 level1 lfo1" class="MsoListParagraphCxSpMiddle"&gt;&lt;span style="font-family: symbol; mso-fareast-font-family: symbol; mso-bidi-font-family: symbol"&gt;&lt;span style="mso-list: ignore"&gt;·&lt;span style="font: 7pt &amp;quot;Times New Roman&amp;quot;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;native code that calls &lt;span class="SpellE"&gt;CoCreateInstance&lt;/span&gt; using any of the &lt;a href="http://msdn.microsoft.com/en-us/library/aa964987.aspx"&gt;hosting &lt;span class="SpellE"&gt;CoClasses&lt;/span&gt;&lt;/a&gt; (&lt;span class="SpellE"&gt;CLSID_CorRuntimeHost&lt;/span&gt;, &lt;span class="SpellE"&gt;CLSID_CLRRuntimeHost&lt;/span&gt;, &lt;span class="SpellE"&gt;CLSID_TypeNameFactory&lt;/span&gt;, or &lt;span class="SpellE"&gt;ComCallUnmarshal&lt;/span&gt;), or is managed code that uses COM &lt;span class="SpellE"&gt;interop&lt;/span&gt; to access interfaces implemented by any of the same CLSIDs;&lt;/p&gt;    &lt;p style="text-indent: -0.25in; mso-list: l17 level1 lfo1" class="MsoListParagraphCxSpMiddle"&gt;&lt;span style="font-family: symbol; mso-fareast-font-family: symbol; mso-bidi-font-family: symbol"&gt;&lt;span style="mso-list: ignore"&gt;·&lt;span style="font: 7pt &amp;quot;Times New Roman&amp;quot;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;calls to &lt;span class="SpellE"&gt;CoCreateInstance&lt;/span&gt;, from native code, using any of the metadata &lt;span class="SpellE"&gt;CoClasses&lt;/span&gt; (&lt;span class="SpellE"&gt;CLSID_CorMetaDataDispenser&lt;/span&gt;, or &lt;span class="SpellE"&gt;CLSID_CorMetaDataDispenserRuntime&lt;/span&gt;), or managed code that uses COM &lt;span class="SpellE"&gt;interop&lt;/span&gt; to access interfaces implemented by any of the same CLSIDs;&lt;/p&gt;    &lt;p style="text-indent: -0.25in; mso-list: l17 level1 lfo1" class="MsoListParagraphCxSpMiddle"&gt;&lt;span style="font-family: symbol; mso-fareast-font-family: symbol; mso-bidi-font-family: symbol"&gt;&lt;span style="mso-list: ignore"&gt;·&lt;span style="font: 7pt &amp;quot;Times New Roman&amp;quot;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;calls to &lt;span class="SpellE"&gt;CoCreateInstance&lt;/span&gt;, from native code, using the &lt;span class="SpellE"&gt;CoClass&lt;/span&gt; of any COM-registered .NET Framework type;&lt;/p&gt;    &lt;p style="text-indent: -0.25in; mso-list: l17 level1 lfo1" class="MsoListParagraphCxSpMiddle"&gt;&lt;span style="font-family: symbol; mso-fareast-font-family: symbol; mso-bidi-font-family: symbol"&gt;&lt;span style="mso-list: ignore"&gt;·&lt;span style="font: 7pt &amp;quot;Times New Roman&amp;quot;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;a managed COM component (in the binary migration case only);&lt;/p&gt;    &lt;p style="page-break-after: avoid; text-indent: -0.25in; mso-list: l17 level1 lfo1" class="MsoListParagraphCxSpLast"&gt;&lt;span style="font-family: symbol; mso-fareast-font-family: symbol; mso-bidi-font-family: symbol"&gt;&lt;span style="mso-list: ignore"&gt;·&lt;span style="font: 7pt &amp;quot;Times New Roman&amp;quot;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="GramE"&gt;an&lt;/span&gt; assembly produced with the Visual Studio Managed Extensions for C++ compiler (otherwise known as a &lt;a href="http://msdn.microsoft.com/en-us/library/68td296t(VS.100).aspx"&gt;managed C++ assembly&lt;/a&gt;), or a dependency, either direct or indirect, on such an assembly.&lt;/p&gt;    &lt;p class="MsoCaption"&gt;&lt;a name="_Ref248574332"&gt;Figure &lt;/a&gt;&lt;span style="mso-bookmark: _ref248574332"&gt;&lt;span style="mso-no-proof: yes"&gt;1&lt;/span&gt;&lt;/span&gt;&lt;span style="mso-bookmark: _ref248574332"&gt;&lt;/span&gt;&lt;/p&gt;    &lt;p class="MsoNormal"&gt;The functionality in the above list was created for prior releases, and each lacks the ability to specify the target framework that is needed for in-proc SxS, and could not be retrofitted to do so. For the most part, all of these chose the same “bind to latest” activation policy as managed COM component activation.&lt;/p&gt;    &lt;h3&gt;Non-Impactful Install and “Latest Runtime” Activation Model&lt;/h3&gt;    &lt;p class="MsoNormal"&gt;Why am I even talking about our “bind to latest” activation policy? Well, there’s a very good reason: one of the primary compatibility-related goals of the .NET 4 Framework is to ensure that its installation is non-impactful to pre-existing managed application or component. To achieve this, we have had to modify the “bind to latest” activation policy’s semantics in the .NET 4 &lt;span class="GramE"&gt;release&lt;/span&gt;.&lt;/p&gt;    &lt;div style="border-bottom: #4f81bd 1pt solid; border-left: #4f81bd 1pt solid; padding-bottom: 10pt; padding-left: 10pt; padding-right: 10pt; margin-left: 0.2in; border-top: #4f81bd 1pt solid; margin-right: 0.2in; border-right: #4f81bd 1pt solid; padding-top: 10pt; mso-border-alt: solid #4f81bd .25pt; mso-border-themecolor: accent1; mso-element: para-border-div"&gt;     &lt;p style="border-bottom-style: none; padding-bottom: 0in; border-right-style: none; margin: 0in 0in 10pt; padding-left: 0in; padding-right: 0in; border-top-style: none; border-left-style: none; padding-top: 0in; mso-padding-alt: 10.0pt 10.0pt 10.0pt 10.0pt; mso-border-alt: solid #4f81bd .25pt; mso-border-themecolor: accent1; mso-border-shadow: yes; mso-prop-change: &amp;#39;Abhishek Mondal&amp;#39; 20100623t1426" class="MsoBlockText"&gt;The “bind to latest” runtime activation model kicks in when no target runtime version information is provided with the activation request, such as through a managed assembly’s built-in version, a configuration file’s list of &amp;lt;&lt;span class="SpellE"&gt;supportedRuntime&lt;/span&gt;&amp;gt; entries, and/or an explicit version string passed into any of the native hosting APIs that accept them. In these cases, in previous versions of the runtime, “bind to latest” activation would pick the very latest .NET Runtime installed on the machine. This is also the activation model used for managed COM classes built against pre-v4 runtimes, for precisely the reasons stated in the earlier example.&lt;/p&gt;   &lt;/div&gt;    &lt;p class="MsoNormal"&gt;Starting with the .NET 4 Runtime, this “bind to latest” activation policy has been modified so that, by default, it will only consider pre-v4 runtimes. By making this the default behavior, all pre-existing applications and components using this activation model will be unaffected by the installation of .NET 4.&lt;/p&gt;    &lt;h3&gt;Source Migration&lt;/h3&gt;    &lt;p class="MsoNormal"&gt;If you intend to retarget your application or component to .NET 4 and rebuild, and it uses any of the functionality listed above, then you need to migrate to the equivalent functionality provided in the new &lt;a href="http://msdn.microsoft.com/en-us/library/dd380851%28VS.100%29.aspx"&gt;.NET 4 Framework Hosting interfaces&lt;/a&gt;:&lt;/p&gt;    &lt;p style="text-indent: -0.25in; mso-list: l11 level1 lfo2" class="MsoListParagraphCxSpFirst"&gt;&lt;span style="font-family: symbol; mso-fareast-font-family: symbol; mso-bidi-font-family: symbol"&gt;&lt;span style="mso-list: ignore"&gt;·&lt;span style="font: 7pt &amp;quot;Times New Roman&amp;quot;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;for calls to any of the &lt;a href="http://msdn.microsoft.com/en-us/library/aa964945.aspx"&gt;hosting global static functions&lt;/a&gt;, use the corresponding methods provided by the new &lt;a href="http://msdn.microsoft.com/en-us/library/dd233134%28VS.100%29.aspx"&gt;&lt;span class="SpellE"&gt;ICLRMetaHost&lt;/span&gt;&lt;/a&gt;, &lt;a href="http://msdn.microsoft.com/en-us/library/dd233117%28VS.100%29.aspx"&gt;&lt;span class="SpellE"&gt;ICLRMetaHostPolicy&lt;/span&gt;&lt;/a&gt; and &lt;a href="http://msdn.microsoft.com/en-us/library/dd233121%28VS.100%29.aspx"&gt;&lt;span class="SpellE"&gt;ICLRRuntimeInfo&lt;/span&gt;&lt;/a&gt; interfaces;&lt;/p&gt;    &lt;p style="text-indent: -0.25in; mso-list: l11 level1 lfo2" class="MsoListParagraphCxSpMiddle"&gt;&lt;span style="font-family: symbol; mso-fareast-font-family: symbol; mso-bidi-font-family: symbol"&gt;&lt;span style="mso-list: ignore"&gt;·&lt;span style="font: 7pt &amp;quot;Times New Roman&amp;quot;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;for calls to any of the &lt;a href="http://msdn.microsoft.com/en-us/library/aa964998.aspx"&gt;Strong Naming Global Static Functions&lt;/a&gt;, use the corresponding methods provided by the new &lt;a href="http://msdn.microsoft.com/en-us/library/dd409349%28VS.100%29.aspx"&gt;&lt;span class="SpellE"&gt;ICLRStrongName&lt;/span&gt;&lt;/a&gt; interface;&lt;/p&gt;    &lt;p style="text-indent: -0.25in; mso-list: l11 level1 lfo2" class="MsoListParagraphCxSpLast"&gt;&lt;span style="font-family: symbol; mso-fareast-font-family: symbol; mso-bidi-font-family: symbol"&gt;&lt;span style="mso-list: ignore"&gt;·&lt;span style="font: 7pt &amp;quot;Times New Roman&amp;quot;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="GramE"&gt;for&lt;/span&gt; instance creation of any of the &lt;a href="http://msdn.microsoft.com/en-us/library/aa964987.aspx"&gt;hosting &lt;span class="SpellE"&gt;CoClasses&lt;/span&gt;&lt;/a&gt;, metadata &lt;span class="SpellE"&gt;CoClasses&lt;/span&gt;, or COM-visible Framework types, use &lt;a href="http://msdn.microsoft.com/en-us/library/dd233135%28VS.100%29.aspx"&gt;&lt;span class="SpellE"&gt;ICLRRuntimeInfo&lt;/span&gt;::&lt;span class="SpellE"&gt;GetInterface&lt;/span&gt;&lt;/a&gt;.&lt;/p&gt;    &lt;p class="MsoCaption"&gt;Figure &lt;span style="mso-no-proof: yes"&gt;2&lt;/span&gt;&lt;/p&gt;    &lt;p class="MsoNormal"&gt;Each &lt;a href="http://msdn.microsoft.com/en-us/library/dd233121%28VS.100%29.aspx"&gt;&lt;span class="SpellE"&gt;ICLRRuntimeInfo&lt;/span&gt;&lt;/a&gt; and &lt;a href="http://msdn.microsoft.com/en-us/library/dd409349%28VS.100%29.aspx"&gt;&lt;span class="SpellE"&gt;ICLRStrongName&lt;/span&gt;&lt;/a&gt; interface instance targets a specific runtime, and each method exposes functionality specific to, or provided by, that targeted runtime.&lt;/p&gt;    &lt;h3&gt;Binary Migration&lt;/h3&gt;    &lt;p class="MsoNormal"&gt;If the preferred option of source migration and re-compilation is not possible, and the application or component also depends on any of the functionalities listed above, an application configuration extension is available to make migration possible in many cases. Adding this extension to the application’s configuration file will modify the “bind to latest” policy to cause it to bind to the same runtime as the application itself. The extension takes the form of an attribute named &lt;span style="font-family: &amp;quot;Courier New&amp;quot;"&gt;useLegacyV2RuntimeActivationPolicy&lt;/span&gt;, to be placed in the &lt;span style="font-family: &amp;quot;Courier New&amp;quot;"&gt;&amp;lt;startup&amp;gt;&lt;/span&gt; element of an application configuration file. The attribute’s valid values are “&lt;span style="font-family: &amp;quot;Courier New&amp;quot;"&gt;true&lt;/span&gt;” and “&lt;span style="font-family: &amp;quot;Courier New&amp;quot;"&gt;false&lt;/span&gt;”, of which “&lt;span style="font-family: &amp;quot;Courier New&amp;quot;"&gt;false&lt;/span&gt;” is the default. When set to “&lt;span style="font-family: &amp;quot;Courier New&amp;quot;"&gt;true&lt;/span&gt;”, this attribute instructs “bind to latest” runtime activation policy to consider all &lt;span style="font-family: &amp;quot;Courier New&amp;quot;"&gt;&amp;lt;&lt;span class="SpellE"&gt;supportedRuntime&lt;/span&gt;&amp;gt;&lt;/span&gt; entries in the application configuration file; when set to false, the policy considers only those &lt;span style="font-family: &amp;quot;Courier New&amp;quot;"&gt;&amp;lt;&lt;span class="SpellE"&gt;supportedRuntime&lt;/span&gt;&amp;gt;&lt;/span&gt; entries with a major version number of 2 or less. When a configuration file does not contain any &lt;span style="font-family: &amp;quot;Courier New&amp;quot;"&gt;&amp;lt;&lt;span class="SpellE"&gt;supportedRuntime&lt;/span&gt;&amp;gt;&lt;/span&gt; entries (or a deprecated &lt;span style="font-family: &amp;quot;Courier New&amp;quot;"&gt;&amp;lt;&lt;span class="SpellE"&gt;requiredRuntime&lt;/span&gt;&amp;gt;&lt;/span&gt; entry), then the version number contained in the executable image, which represents the runtime version against which the executable was built, is treated as an implicit &lt;span style="font-family: &amp;quot;Courier New&amp;quot;"&gt;&amp;lt;&lt;span class="SpellE"&gt;supportedRuntime&lt;/span&gt;&amp;gt;&lt;/span&gt; entry (roughly speaking).&lt;/p&gt;    &lt;div style="border-bottom: #4f81bd 1pt solid; border-left: #4f81bd 1pt solid; padding-bottom: 10pt; padding-left: 10pt; padding-right: 10pt; margin-left: 0.2in; border-top: #4f81bd 1pt solid; margin-right: 0.2in; border-right: #4f81bd 1pt solid; padding-top: 10pt; mso-border-alt: solid #4f81bd .25pt; mso-border-themecolor: accent1; mso-element: para-border-div"&gt;     &lt;p style="border-bottom-style: none; padding-bottom: 0in; border-right-style: none; margin: 0in 0in 10pt; padding-left: 0in; padding-right: 0in; border-top-style: none; border-left-style: none; padding-top: 0in; mso-padding-alt: 10.0pt 10.0pt 10.0pt 10.0pt; mso-border-alt: solid #4f81bd .25pt; mso-border-themecolor: accent1; mso-border-shadow: yes; mso-prop-change: &amp;#39;Abhishek Mondal&amp;#39; 20100623t1426" class="MsoBlockText"&gt;Thus, if you were &lt;span class="GramE"&gt;migrating&lt;/span&gt; a .NET 3.5 application to .NET 4, your configuration file might look like this:&lt;/p&gt;      &lt;p style="border-bottom-style: none; padding-bottom: 0in; border-right-style: none; margin: 0in 0in 10pt; padding-left: 0in; padding-right: 0in; border-top-style: none; border-left-style: none; padding-top: 0in; mso-padding-alt: 10.0pt 10.0pt 10.0pt 10.0pt; mso-border-alt: solid #4f81bd .25pt; mso-border-themecolor: accent1; mso-border-shadow: yes; mso-prop-change: &amp;#39;Abhishek Mondal&amp;#39; 20100623t1426" class="MsoBlockText"&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;"&gt;&lt;span style="mso-spacerun: yes"&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="line-height: 115%; font-style: normal; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; mso-bidi-font-style: italic"&gt;&amp;lt;&lt;span class="GramE"&gt;configuration&lt;/span&gt;&amp;gt;           &lt;br /&gt;&lt;span style="mso-spacerun: yes"&gt;&lt;/span&gt;&amp;lt;startup useLegacyV2RuntimeActivationPolicy=&amp;quot;true&amp;quot;&amp;gt;           &lt;br /&gt;&lt;span style="mso-spacerun: yes"&gt;&lt;/span&gt;&amp;lt;&lt;span class="SpellE"&gt;supportedRuntime&lt;/span&gt; version=&amp;quot;v4.0&amp;quot;/&amp;gt;           &lt;br /&gt;&lt;span style="mso-spacerun: yes"&gt;&lt;/span&gt;&amp;lt;/startup&amp;gt;           &lt;br /&gt;&lt;span style="mso-spacerun: yes"&gt;&lt;/span&gt;&amp;lt;/configuration&amp;gt;&lt;/span&gt;&lt;span style="line-height: 115%; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt"&gt; &lt;/span&gt;        &lt;p&gt;&lt;/p&gt;     &lt;/p&gt;      &lt;p&gt;&lt;/p&gt;   &lt;/div&gt;    &lt;p class="MsoCaption"&gt;Figure &lt;span style="mso-no-proof: yes"&gt;3&lt;/span&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt"&gt; &lt;/span&gt;      &lt;p&gt;&lt;/p&gt;   &lt;/p&gt;    &lt;p&gt;&lt;/p&gt;    &lt;h4&gt;Managed COM Component&lt;/h4&gt;    &lt;p class="MsoNormal"&gt;To accommodate managed COM component authors (who in most cases cannot modify application configuration files), a separate mechanism is available: a semicolon delimited list of supported runtimes may be added to the component’s InprocServer32 registration. Specifically, add the string value “&lt;span class="SpellE"&gt;SupportedRuntimeVersions&lt;/span&gt;” to “HKCR\CLSID\&amp;lt;COM component &lt;span class="SpellE"&gt;clsid&lt;/span&gt;&amp;gt;\InprocServer32\&amp;lt;COM component version&amp;gt;”.&lt;span style="line-height: 115%; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt"&gt; &lt;/span&gt;      &lt;p&gt;&lt;/p&gt;   &lt;/p&gt;    &lt;p&gt;&lt;/p&gt;    &lt;p class="MsoNormal"&gt;It is important to note that &lt;span class="MsoIntenseEmphasis"&gt;if a managed COM component depends on any of the items in &lt;/span&gt;&lt;span class="MsoIntenseEmphasis"&gt;&lt;span style="font-style: normal; color: windowtext; font-weight: normal"&gt;&lt;span style="mso-prop-change: &amp;#39;Abhishek Mondal&amp;#39; 20100618t0054"&gt;&lt;span class="msoIns"&gt;&lt;ins datetime="2010-06-18T00:54" cite="mailto:Abhishek%20Mondal"&gt;Figure &lt;span style="mso-no-proof: yes"&gt;&lt;span style="mso-no-proof: yes"&gt;&lt;span style="mso-no-proof: no"&gt;1&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/ins&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="MsoIntenseEmphasis"&gt;&lt;span style="mso-no-proof: no"&gt;, then it must be migrated at the source level&lt;/span&gt;&lt;/span&gt;&lt;span style="mso-no-proof: no"&gt;. This is because the COM component would need functionality equivalent to the new &lt;/span&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;; mso-no-proof: no"&gt;useLegacyV2RuntimeActivationPolicy&lt;/span&gt;&lt;span style="mso-no-proof: no"&gt; configuration extension to work, which is a process-wide policy decision that must be made by the application author rather than by extensibility components. &lt;/span&gt;&lt;/p&gt;    &lt;p class="MsoNormal"&gt;&lt;span style="mso-no-proof: no"&gt;If a managed COM component is activated through a &lt;span class="SpellE"&gt;reg&lt;/span&gt;-free manifest (which cannot be extended to contain a &lt;span class="SpellE"&gt;SupportedRuntimes&lt;/span&gt; entry), runtime activation will look for a configuration file next to the assembly containing the COM visible class. Note that a &lt;/span&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;; mso-no-proof: no"&gt;useLegacyV2RuntimeActivationPolicy&lt;/span&gt;&lt;span style="mso-no-proof: no"&gt; entry will be ignored in this scenario.&lt;/span&gt;&lt;/p&gt;    &lt;h4&gt;&lt;span style="mso-no-proof: no"&gt;Assemblies Built with Managed Extensions for Visual C++ Compiler&lt;/span&gt;&lt;/h4&gt;    &lt;p class="MsoNormal"&gt;&lt;span style="mso-no-proof: no"&gt;There are two additional limitations with &lt;a href="http://msdn.microsoft.com/en-us/library/68td296t(VS.100).aspx"&gt;managed C++ assemblies&lt;/a&gt;.&lt;/span&gt;&lt;/p&gt;    &lt;p class="MsoNormal"&gt;&lt;span style="mso-no-proof: no"&gt;First, any dependency on a &lt;a href="http://msdn.microsoft.com/en-us/library/x0w2664k.aspx"&gt;mixed-mode assembly&lt;/a&gt; built with a previous release of Visual C++ must be migrated using the &lt;/span&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;; mso-no-proof: no"&gt;useLegacyV2RuntimeActivationPolicy&lt;/span&gt;&lt;span style="mso-no-proof: no"&gt; configuration file extension. This is because all such assemblies depend implicitly on the managed CRT, which in turn contains dependencies on functionality listed in &lt;/span&gt;&lt;span style="mso-no-proof: no"&gt;Figure &lt;/span&gt;1&lt;span style="mso-no-proof: no"&gt;&lt;/span&gt;&lt;span style="mso-no-proof: no"&gt;.This dependency has been removed in the upcoming release.&lt;/span&gt;&lt;/p&gt;    &lt;p class="MsoNormal"&gt;&lt;span style="mso-no-proof: no"&gt;Second, all &lt;a href="http://msdn.microsoft.com/en-us/library/x0w2664k.aspx"&gt;mixed-mode&lt;/a&gt; assemblies (including those built using this release of Visual C++) and all assemblies built with a previous release of Visual C++ may be loaded into at most one runtime per process, because they may contain process-global static image data that cannot be virtualized across runtimes, and/or because they depend on a prior release of the managed CRT. This limitation is virtually identical in nature to the current limitation restricting these types of assemblies to no more than one application domain at once.&lt;/span&gt;&lt;/p&gt;    &lt;h2&gt;&lt;span style="mso-no-proof: no"&gt;Migration Decision Tree&lt;/span&gt;&lt;/h2&gt;    &lt;p class="MsoNormal"&gt;&lt;span style="mso-no-proof: no"&gt;Use the following decision tree to decide the correct migration path for your component in the most common scenarios.&lt;/span&gt;&lt;/p&gt;    &lt;p class="MsoNormal"&gt;&lt;span style="mso-no-proof: no"&gt;&lt;/span&gt;&lt;/p&gt;    &lt;p class="MsoNormal"&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-12-34-metablogapi/8004.decision_5F00_tree_5F00_2.png"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: block; float: none; margin-left: auto; border-top: 0px; margin-right: auto; border-right: 0px" title="decision_tree" border="0" alt="decision_tree" src="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-12-34-metablogapi/2211.decision_5F00_tree_5F00_thumb.png" width="533" height="571" /&gt;&lt;/a&gt; &lt;/p&gt;    &lt;p style="text-align: center" class="MsoNormal" align="center"&gt;&lt;span style="mso-no-proof: no"&gt;&lt;span style="mso-spacerun: yes"&gt;&lt;/span&gt;&lt;shapetype id="_x0000_t75"&gt;&lt;stroke&gt;&lt;/stroke&gt;&lt;formulas&gt;&lt;f&gt;&lt;/f&gt;&lt;f&gt;&lt;/f&gt;&lt;f&gt;&lt;/f&gt;&lt;f&gt;&lt;/f&gt;&lt;f&gt;&lt;/f&gt;&lt;f&gt;&lt;/f&gt;&lt;f&gt;&lt;/f&gt;&lt;f&gt;&lt;/f&gt;&lt;f&gt;&lt;/f&gt;&lt;f&gt;&lt;/f&gt;&lt;f&gt;&lt;/f&gt;&lt;f&gt;&lt;/f&gt;&lt;/formulas&gt;&lt;path&gt;&lt;/path&gt;&lt;lock aspectratio="t" v:ext="edit"&gt;&lt;/lock&gt;&lt;/shapetype&gt;&lt;shape style="width: 377.25pt; height: 514.5pt" id="_x0000_i1025" o:ole="o:ole"&gt;&lt;imagedata o:title="o:title"&gt;&lt;/imagedata&gt;&lt;/shape&gt;&lt;/span&gt;&lt;/p&gt;    &lt;h1&gt;&lt;span style="mso-no-proof: no"&gt;Binary Migration Examples&lt;/span&gt;&lt;/h1&gt;    &lt;h2&gt;&lt;a name="_Application:_Target_v2"&gt;&lt;/a&gt;&lt;span style="mso-no-proof: no"&gt;Application: Target v2 and v4&lt;/span&gt;&lt;/h2&gt;    &lt;p class="MsoNormal"&gt;&lt;span style="mso-no-proof: no"&gt;Create an application configuration file with the following contents, where the highlighted portion is required only if the application depends on functionality from &lt;/span&gt;&lt;span style="mso-no-proof: no"&gt;Figure &lt;/span&gt;1&lt;span style="mso-no-proof: no"&gt;&lt;/span&gt;&lt;span style="mso-no-proof: no"&gt;:&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin-left: 0.5in" class="MsoNoSpacing"&gt;&lt;code&gt;&lt;span style="font-size: 10pt; mso-no-proof: no"&gt;&amp;lt;&lt;span class="GramE"&gt;configuration&lt;/span&gt;&amp;gt; &lt;/span&gt;        &lt;p&gt;&lt;/p&gt;     &lt;/code&gt;&lt;/p&gt;    &lt;p&gt;&lt;/p&gt;    &lt;p style="margin-left: 0.5in" class="MsoNoSpacing"&gt;&lt;code&gt;&lt;span style="font-size: 10pt; mso-no-proof: no"&gt;&lt;span style="mso-spacerun: yes"&gt;&lt;/span&gt;&amp;lt;startup &lt;span style="background: yellow; mso-highlight: yellow"&gt;useLegacyV2RuntimeActivationPolicy=&amp;quot;true&amp;quot;&lt;/span&gt;&amp;gt; &lt;/span&gt;        &lt;p&gt;&lt;/p&gt;     &lt;/code&gt;&lt;/p&gt;    &lt;p&gt;&lt;/p&gt;    &lt;p style="margin-left: 0.5in" class="MsoNoSpacing"&gt;&lt;code&gt;&lt;span style="font-size: 10pt; mso-no-proof: no"&gt;&lt;span style="mso-spacerun: yes"&gt;&lt;/span&gt;&amp;lt;&lt;span class="SpellE"&gt;supportedRuntime&lt;/span&gt; version=&amp;quot;v4.0&amp;quot;/&amp;gt; &lt;/span&gt;        &lt;p&gt;&lt;/p&gt;     &lt;/code&gt;&lt;/p&gt;    &lt;p&gt;&lt;/p&gt;    &lt;p style="margin-left: 0.5in" class="MsoNoSpacing"&gt;&lt;code&gt;&lt;span style="font-size: 10pt; mso-no-proof: no"&gt;&lt;span style="mso-spacerun: yes"&gt;&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&lt;/span&gt;&amp;lt;&lt;span class="SpellE"&gt;&lt;span class="GramE"&gt;supportedRuntime&lt;/span&gt;&lt;/span&gt; version=&amp;quot;v2.0.50727&amp;quot;/&amp;gt; &lt;/span&gt;        &lt;p&gt;&lt;/p&gt;     &lt;/code&gt;&lt;/p&gt;    &lt;p&gt;&lt;/p&gt;    &lt;p style="margin-left: 0.5in" class="MsoNoSpacing"&gt;&lt;code&gt;&lt;span style="font-size: 10pt; mso-no-proof: no"&gt;&lt;span style="mso-spacerun: yes"&gt;&lt;/span&gt;&amp;lt;/startup&amp;gt; &lt;/span&gt;        &lt;p&gt;&lt;/p&gt;     &lt;/code&gt;&lt;/p&gt;    &lt;p&gt;&lt;/p&gt;    &lt;p style="margin-left: 0.5in" class="MsoNoSpacing"&gt;&lt;code&gt;&lt;span style="font-size: 10pt; mso-no-proof: no"&gt;&amp;lt;/configuration&amp;gt; &lt;/span&gt;        &lt;p&gt;&lt;/p&gt;     &lt;/code&gt;&lt;/p&gt;    &lt;p&gt;&lt;/p&gt;    &lt;p class="MsoNoSpacing"&gt;&lt;code&gt;&lt;span style="font-size: 10pt; mso-no-proof: no"&gt;&lt;/span&gt;        &lt;p&gt;&amp;#160;&lt;/p&gt;     &lt;/code&gt;&lt;/p&gt;    &lt;p&gt;&lt;/p&gt;    &lt;p class="MsoNormal"&gt;&lt;code&gt;&lt;span style="line-height: 115%; font-family: &amp;quot;Calibri&amp;quot;,&amp;quot;sans-serif&amp;quot;; mso-bidi-theme-font: minor-latin; mso-ascii-theme-font: minor-latin; mso-hansi-theme-font: minor-latin; mso-ansi-font-size: 11.0pt; mso-bidi-font-size: 11.0pt; mso-no-proof: no"&gt;As always, &lt;/span&gt;&lt;/code&gt;&lt;span class="SpellE"&gt;&lt;code&gt;&lt;span style="line-height: 115%; font-size: 10pt; mso-no-proof: no"&gt;supportedRuntime&lt;/span&gt;&lt;/code&gt;&lt;/span&gt;&lt;code&gt;&lt;span style="line-height: 115%; font-family: &amp;quot;Calibri&amp;quot;,&amp;quot;sans-serif&amp;quot;; mso-bidi-theme-font: minor-latin; mso-ascii-theme-font: minor-latin; mso-hansi-theme-font: minor-latin; mso-ansi-font-size: 11.0pt; mso-bidi-font-size: 11.0pt; mso-no-proof: no"&gt; entries are considered to be listed in decreasing preference; if the .NET 2 Runtime is preferred, the entries should be reversed.&lt;b&gt; &lt;/b&gt;          &lt;p&gt;&lt;/p&gt;       &lt;/span&gt;&lt;/code&gt;&lt;/p&gt;    &lt;p&gt;&lt;/p&gt;    &lt;h2&gt;&lt;span style="mso-fareast-font-family: &amp;#39;Times New Roman&amp;#39;; mso-fareast-theme-font: minor-fareast; mso-no-proof: no"&gt;Application: Target v4 &lt;span class="GramE"&gt;Only&lt;/span&gt;         &lt;p&gt;&lt;/p&gt;     &lt;/span&gt;&lt;/h2&gt;    &lt;p class="MsoNormal"&gt;&lt;span style="mso-no-proof: no"&gt;Use the same application configuration file as above, but remove the v2-specific &lt;/span&gt;&lt;span class="SpellE"&gt;&lt;code&gt;&lt;span style="line-height: 115%; font-size: 10pt; mso-no-proof: no"&gt;supportedRuntime&lt;/span&gt;&lt;/code&gt;&lt;/span&gt;&lt;span style="mso-no-proof: no"&gt; entry.&lt;/span&gt;&lt;/p&gt;    &lt;h2&gt;&lt;span style="mso-no-proof: no"&gt;Managed COM Component: Target v2 and v4&lt;/span&gt;&lt;/h2&gt;    &lt;p class="MsoNormal"&gt;&lt;span style="mso-no-proof: no"&gt;If you authored a managed COM component built against the .NET 2 Runtime, with a CLSID of &lt;/span&gt;&lt;code&gt;&lt;span style="line-height: 115%; font-size: 10pt; mso-no-proof: no"&gt;{DFEEABC2-17FF-4ce6-B25B-A35F7A156C68}&lt;/span&gt;&lt;/code&gt;&lt;span style="mso-no-proof: no"&gt; and a version of &lt;/span&gt;&lt;code&gt;&lt;span style="line-height: 115%; font-size: 10pt; mso-no-proof: no"&gt;6.2.0.0&lt;/span&gt;&lt;/code&gt;&lt;span style="mso-no-proof: no"&gt;, and you wanted the component to run within either the .NET 2 Runtime or the .NET 4 Runtime (in that order of preference), the registry update (in &lt;span class="SpellE"&gt;RegEdit&lt;/span&gt; syntax) would be:&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin-left: 0.5in" class="MsoNoSpacing"&gt;&lt;code&gt;&lt;span style="font-size: 10pt; mso-no-proof: no"&gt;[HKCR\CLSID\{DFEEABC2-17FF-4ce6-B25B-A35F7A156C68}\InprocServer32\6.2.0.0] &lt;/span&gt;        &lt;p&gt;&lt;/p&gt;     &lt;/code&gt;&lt;/p&gt;    &lt;p&gt;&lt;/p&gt;    &lt;p style="margin-left: 0.5in" class="MsoNoSpacing"&gt;&lt;code&gt;&lt;span style="font-size: 10pt; mso-no-proof: no"&gt;&amp;quot;&lt;span class="SpellE"&gt;SupportedRuntimeVersions&lt;/span&gt;&amp;quot;=&amp;quot;v2.0.50727&lt;span class="GramE"&gt;;v4.0&lt;/span&gt;&amp;quot;&lt;/span&gt;&lt;/code&gt;&lt;span style="font-family: consolas; font-size: 10pt; mso-no-proof: no"&gt; &lt;/span&gt;      &lt;p&gt;&lt;/p&gt;   &lt;/p&gt;    &lt;p&gt;&lt;/p&gt;    &lt;p class="MsoNoSpacing"&gt;&lt;span style="mso-no-proof: no"&gt;&lt;/span&gt;      &lt;p&gt;&amp;#160;&lt;/p&gt;   &lt;/p&gt;    &lt;p&gt;&lt;/p&gt;    &lt;p class="MsoNormal"&gt;&lt;span style="mso-no-proof: no"&gt;If your component was registered without the assembly version portion of the registry key name, you would remove “&lt;/span&gt;&lt;code&gt;&lt;span style="line-height: 115%; font-size: 10pt; mso-no-proof: no"&gt;\6.2.0.0&lt;/span&gt;&lt;/code&gt;&lt;span style="mso-no-proof: no"&gt;” from the key name.&lt;/span&gt;&lt;/p&gt;    &lt;p class="MsoNormal"&gt;&lt;span style="mso-no-proof: no"&gt;Or, if your managed COM component is activated through registry-free COM, you would place an application configuration file (should we coin the term &lt;i style="mso-bidi-font-style: normal"&gt;component configuration file&lt;/i&gt;?) next to the managed COM assembly with contents similar to the &lt;a href="#_Application:_Target_v2"&gt;example above&lt;/a&gt; (without the highlighted portion, and with the &lt;/span&gt;&lt;span class="SpellE"&gt;&lt;code&gt;&lt;span style="line-height: 115%; font-size: 10pt; mso-no-proof: no"&gt;supportedRuntime&lt;/span&gt;&lt;/code&gt;&lt;/span&gt;&lt;span style="mso-no-proof: no"&gt; entries reversed).&lt;/span&gt;&lt;/p&gt;    &lt;h1&gt;&lt;span style="mso-fareast-font-family: &amp;#39;Times New Roman&amp;#39;; mso-fareast-theme-font: minor-fareast; mso-no-proof: no"&gt;Troubleshooting        &lt;p&gt;&lt;/p&gt;     &lt;/span&gt;&lt;/h1&gt;    &lt;h2&gt;&lt;span style="mso-no-proof: no"&gt;Instantiating Managed COM Components &lt;span class="GramE"&gt;From&lt;/span&gt; Managed Code&lt;/span&gt;&lt;/h2&gt;    &lt;p class="MsoNormal"&gt;&lt;span style="mso-no-proof: no"&gt;If your application instantiates and uses COM components through the .NET Runtime’s managed &lt;span class="SpellE"&gt;interop&lt;/span&gt; layer, and one of those COM components happens to be managed, then there is a small chance that after migrating your application you might run into an error similar to this:&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin-left: 0.5in" class="MsoNoSpacing"&gt;&lt;code&gt;&lt;span style="font-size: 10pt; mso-no-proof: no"&gt;Error: Unable to cast COM object of type 'System.__&lt;span class="SpellE"&gt;ComObject&lt;/span&gt;' to interface type '&lt;i style="mso-bidi-font-style: normal"&gt;X&lt;/i&gt;'. This operation failed because the &lt;span class="SpellE"&gt;QueryInterface&lt;/span&gt; call on the COM component for the interface with IID '{&lt;i style="mso-bidi-font-style: normal"&gt;12345678-1234-1234-1234-123456789012&lt;/i&gt;}' failed due to the following error: No such interface supported (Exception from HRESULT: 0x80004002 (E_NOINTERFACE)).&lt;b&gt; &lt;/b&gt;          &lt;p&gt;&lt;/p&gt;       &lt;/span&gt;&lt;/code&gt;&lt;/p&gt;    &lt;p&gt;&lt;/p&gt;    &lt;p class="MsoNoSpacing"&gt;&lt;code&gt;&lt;b&gt;&lt;span style="font-size: 10pt; mso-no-proof: no"&gt;&lt;/span&gt;          &lt;p&gt;&amp;#160;&lt;/p&gt;       &lt;/b&gt;&lt;/code&gt;&lt;/p&gt;    &lt;p&gt;&lt;/p&gt;    &lt;p class="MsoNormal"&gt;&lt;span style="mso-no-proof: no"&gt;This error can occur as a result of the following two combined conditions:&lt;/span&gt;&lt;/p&gt;    &lt;p style="text-indent: -0.25in; mso-list: l15 level1 lfo16" class="MsoListParagraphCxSpFirst"&gt;&lt;code&gt;&lt;b&gt;&lt;span style="line-height: 115%; font-family: &amp;quot;Calibri&amp;quot;,&amp;quot;sans-serif&amp;quot;; mso-fareast-font-family: calibri; mso-fareast-theme-font: minor-latin; mso-bidi-theme-font: minor-latin; mso-ascii-theme-font: minor-latin; mso-hansi-theme-font: minor-latin; mso-ansi-font-size: 11.0pt; mso-bidi-font-size: 11.0pt; mso-no-proof: no"&gt;&lt;span style="mso-list: ignore"&gt;1.&lt;span style="font: 7pt &amp;quot;Times New Roman&amp;quot;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;/code&gt;&lt;code&gt;&lt;span style="line-height: 115%; font-family: &amp;quot;Calibri&amp;quot;,&amp;quot;sans-serif&amp;quot;; mso-bidi-theme-font: minor-latin; mso-ascii-theme-font: minor-latin; mso-hansi-theme-font: minor-latin; mso-ansi-font-size: 11.0pt; mso-bidi-font-size: 11.0pt; mso-no-proof: no"&gt;The managed COM component is registered against a different .NET Runtime version from that of the instantiating caller, causing it to be activated in another runtime than that of the instantiating caller.&lt;/span&gt;&lt;/code&gt;&lt;code&gt;&lt;b&gt;&lt;span style="line-height: 115%; font-size: 10pt; mso-no-proof: no"&gt; &lt;/span&gt;          &lt;p&gt;&lt;/p&gt;       &lt;/b&gt;&lt;/code&gt;&lt;/p&gt;    &lt;p&gt;&lt;/p&gt;    &lt;p style="text-indent: -0.25in; mso-list: l15 level1 lfo16" class="MsoListParagraphCxSpLast"&gt;&lt;code&gt;&lt;b&gt;&lt;span style="line-height: 115%; font-family: &amp;quot;Calibri&amp;quot;,&amp;quot;sans-serif&amp;quot;; mso-fareast-font-family: calibri; mso-fareast-theme-font: minor-latin; mso-bidi-theme-font: minor-latin; mso-ascii-theme-font: minor-latin; mso-hansi-theme-font: minor-latin; mso-ansi-font-size: 11.0pt; mso-bidi-font-size: 11.0pt; mso-no-proof: no"&gt;&lt;span style="mso-list: ignore"&gt;2.&lt;span style="font: 7pt &amp;quot;Times New Roman&amp;quot;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;/code&gt;&lt;code&gt;&lt;span style="line-height: 115%; font-family: &amp;quot;Calibri&amp;quot;,&amp;quot;sans-serif&amp;quot;; mso-bidi-theme-font: minor-latin; mso-ascii-theme-font: minor-latin; mso-hansi-theme-font: minor-latin; mso-ansi-font-size: 11.0pt; mso-bidi-font-size: 11.0pt; mso-no-proof: no"&gt;The interface is not marked with &lt;/span&gt;&lt;/code&gt;&lt;span class="SpellE"&gt;&lt;code&gt;&lt;span style="line-height: 115%; font-size: 10pt; mso-no-proof: no"&gt;System.Runtime.InteropServices.ComVisibleAttribute&lt;/span&gt;&lt;/code&gt;&lt;/span&gt;&lt;code&gt;&lt;span style="line-height: 115%; font-family: &amp;quot;Calibri&amp;quot;,&amp;quot;sans-serif&amp;quot;; mso-bidi-theme-font: minor-latin; mso-ascii-theme-font: minor-latin; mso-hansi-theme-font: minor-latin; mso-ansi-font-size: 11.0pt; mso-bidi-font-size: 11.0pt; mso-no-proof: no"&gt;, with a value of &lt;/span&gt;&lt;/code&gt;&lt;code&gt;&lt;span style="line-height: 115%; font-size: 10pt; mso-no-proof: no"&gt;true&lt;/span&gt;&lt;/code&gt;&lt;code&gt;&lt;span style="line-height: 115%; font-family: &amp;quot;Calibri&amp;quot;,&amp;quot;sans-serif&amp;quot;; mso-bidi-theme-font: minor-latin; mso-ascii-theme-font: minor-latin; mso-hansi-theme-font: minor-latin; mso-ansi-font-size: 11.0pt; mso-bidi-font-size: 11.0pt; mso-no-proof: no"&gt;.&lt;/span&gt;&lt;/code&gt;&lt;code&gt;&lt;b&gt;&lt;span style="line-height: 115%; font-size: 10pt; mso-no-proof: no"&gt; &lt;/span&gt;          &lt;p&gt;&lt;/p&gt;       &lt;/b&gt;&lt;/code&gt;&lt;/p&gt;    &lt;p&gt;&lt;/p&gt;    &lt;p class="MsoNormal"&gt;&lt;code&gt;&lt;span style="line-height: 115%; font-family: &amp;quot;Calibri&amp;quot;,&amp;quot;sans-serif&amp;quot;; mso-bidi-theme-font: minor-latin; mso-ascii-theme-font: minor-latin; mso-hansi-theme-font: minor-latin; mso-ansi-font-size: 11.0pt; mso-bidi-font-size: 11.0pt; mso-no-proof: no"&gt;This scenario worked in the past because of a runtime optimization: when the .NET Runtime notices that a COM type it instantiates has a managed implementation, and that it was instantiated into the same Application Domain as the instantiating caller, it bypasses the managed &lt;span class="SpellE"&gt;interop&lt;/span&gt; layer and returns to the caller the managed object itself. In prior .NET Framework releases (where in-proc SxS was not available), all managed COM types and their managed clients were commonly loaded into the same Application Domain, allowing the implementing managed object to be returned, and in turn allowing the interface cast succeed without being marked as &lt;span class="SpellE"&gt;ComVisible&lt;/span&gt;.&lt;b&gt; &lt;/b&gt;          &lt;p&gt;&lt;/p&gt;       &lt;/span&gt;&lt;/code&gt;&lt;/p&gt;    &lt;p&gt;&lt;/p&gt;    &lt;p class="MsoNormal"&gt;&lt;span class="GramE"&gt;&lt;code&gt;&lt;span style="line-height: 115%; font-family: &amp;quot;Calibri&amp;quot;,&amp;quot;sans-serif&amp;quot;; mso-bidi-theme-font: minor-latin; mso-ascii-theme-font: minor-latin; mso-hansi-theme-font: minor-latin; mso-ansi-font-size: 11.0pt; mso-bidi-font-size: 11.0pt; mso-no-proof: no"&gt;Migrating&lt;/span&gt;&lt;/code&gt;&lt;/span&gt;&lt;code&gt;&lt;span style="line-height: 115%; font-family: &amp;quot;Calibri&amp;quot;,&amp;quot;sans-serif&amp;quot;; mso-bidi-theme-font: minor-latin; mso-ascii-theme-font: minor-latin; mso-hansi-theme-font: minor-latin; mso-ansi-font-size: 11.0pt; mso-bidi-font-size: 11.0pt; mso-no-proof: no"&gt; an application can easily create condition 1; if the application also relies on condition 2 (which is much less common), then the above error will be encountered. There are a couple of solutions available:&lt;b&gt; &lt;/b&gt;          &lt;p&gt;&lt;/p&gt;       &lt;/span&gt;&lt;/code&gt;&lt;/p&gt;    &lt;p&gt;&lt;/p&gt;    &lt;p style="text-indent: -0.25in; mso-list: l12 level1 lfo17" class="MsoListParagraphCxSpFirst"&gt;&lt;code&gt;&lt;span style="line-height: 115%; font-family: &amp;quot;Calibri&amp;quot;,&amp;quot;sans-serif&amp;quot;; mso-fareast-font-family: calibri; mso-fareast-theme-font: minor-latin; mso-bidi-theme-font: minor-latin; mso-ascii-theme-font: minor-latin; mso-hansi-theme-font: minor-latin; mso-ansi-font-size: 11.0pt; mso-bidi-font-size: 11.0pt; mso-bidi-font-weight: bold; mso-no-proof: no"&gt;&lt;span style="mso-list: ignore"&gt;1.&lt;span style="font: 7pt &amp;quot;Times New Roman&amp;quot;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;code&gt;&lt;span style="line-height: 115%; font-family: &amp;quot;Calibri&amp;quot;,&amp;quot;sans-serif&amp;quot;; mso-bidi-theme-font: minor-latin; mso-ascii-theme-font: minor-latin; mso-hansi-theme-font: minor-latin; mso-ansi-font-size: 11.0pt; mso-bidi-font-size: 11.0pt; mso-no-proof: no"&gt;Get an updated version of the managed COM type that properly declares the interface as &lt;span class="SpellE"&gt;ComVisible&lt;/span&gt;.&lt;span style="mso-bidi-font-weight: bold"&gt; &lt;/span&gt;          &lt;p&gt;&lt;/p&gt;       &lt;/span&gt;&lt;/code&gt;&lt;/p&gt;    &lt;p&gt;&lt;/p&gt;    &lt;p style="text-indent: -0.25in; mso-list: l12 level1 lfo17" class="MsoListParagraphCxSpLast"&gt;&lt;span style="mso-fareast-font-family: calibri; mso-fareast-theme-font: minor-latin; mso-bidi-font-family: calibri; mso-bidi-theme-font: minor-latin; mso-ascii-font-family: calibri; mso-ascii-theme-font: minor-latin; mso-hansi-font-family: calibri; mso-hansi-theme-font: minor-latin; mso-no-proof: no"&gt;&lt;span style="mso-list: ignore"&gt;2.&lt;span style="font: 7pt &amp;quot;Times New Roman&amp;quot;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;code&gt;&lt;span style="line-height: 115%; font-family: &amp;quot;Calibri&amp;quot;,&amp;quot;sans-serif&amp;quot;; mso-bidi-theme-font: minor-latin; mso-ascii-theme-font: minor-latin; mso-hansi-theme-font: minor-latin; mso-ansi-font-size: 11.0pt; mso-bidi-font-size: 11.0pt; mso-no-proof: no"&gt;Update the application configuration file to use the &lt;/span&gt;&lt;/code&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;; mso-no-proof: no"&gt;useLegacyV2RuntimeActivationPolicy&lt;/span&gt;&lt;span style="mso-no-proof: no"&gt; extension.&lt;/span&gt;&lt;span style="mso-bidi-font-family: calibri; mso-bidi-theme-font: minor-latin; mso-ascii-font-family: calibri; mso-ascii-theme-font: minor-latin; mso-hansi-font-family: calibri; mso-hansi-theme-font: minor-latin; mso-no-proof: no"&gt; &lt;/span&gt;      &lt;p&gt;&lt;/p&gt;   &lt;/p&gt;    &lt;p&gt;&lt;/p&gt;    &lt;h2&gt;&lt;span style="mso-no-proof: no"&gt;Loading Managed C++ Assemblies Built Against Previous .NET Runtime Versions&lt;/span&gt;&lt;/h2&gt;    &lt;p class="MsoNormal"&gt;&lt;span style="mso-no-proof: no"&gt;Attempting to load a managed C++ assembly that was built with an earlier compiler into the .NET 4 Runtime when the application has not been configured with the &lt;/span&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;; mso-no-proof: no"&gt;useLegacyV2RuntimeActivationPolicy&lt;/span&gt;&lt;span style="mso-no-proof: no"&gt; configuration file extension will result in the following error:&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin-left: 0.5in" class="MsoNormal"&gt;&lt;span class="SpellE"&gt;&lt;code&gt;&lt;span style="line-height: 115%; font-size: 10pt; mso-no-proof: no"&gt;System.IO.FileLoadException&lt;/span&gt;&lt;/code&gt;&lt;/span&gt;&lt;code&gt;&lt;span style="line-height: 115%; font-size: 10pt; mso-no-proof: no"&gt;: Mixed mode assembly is built against version 'v2.0.50727' of the runtime and cannot be loaded in the 4.0 runtime without additional configuration information. &lt;/span&gt;        &lt;p&gt;&lt;/p&gt;     &lt;/code&gt;&lt;/p&gt;    &lt;p&gt;&lt;/p&gt;    &lt;p class="MsoNormal"&gt;&lt;span style="mso-no-proof: no"&gt;Note: the error is not 100% correct, as it specifies that only mixed mode assemblies are subject to this problem; it should say “Managed C++” instead of “Mixed mode”, as managed C++ assemblies compiled with &lt;/span&gt;&lt;code&gt;&lt;span style="line-height: 115%; font-size: 10pt; mso-no-proof: no"&gt;/&lt;span class="SpellE"&gt;clr:pure&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;span style="mso-no-proof: no"&gt; will also encounter this error.&lt;/span&gt;&lt;/p&gt;    &lt;p class="MsoNormal"&gt;&lt;span style="mso-no-proof: no"&gt;It is possible to correct this issue with either of the following:&lt;/span&gt;&lt;/p&gt;    &lt;p style="text-indent: -0.25in; mso-list: l13 level1 lfo18" class="MsoListParagraphCxSpFirst"&gt;&lt;span style="mso-fareast-font-family: calibri; mso-bidi-font-family: calibri; mso-no-proof: no"&gt;&lt;span style="mso-list: ignore"&gt;1.&lt;span style="font: 7pt &amp;quot;Times New Roman&amp;quot;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="mso-no-proof: no"&gt;Recompile the assembly with the .NET 4 managed C++ &lt;span class="GramE"&gt;compiler&lt;/span&gt;.&lt;/span&gt;&lt;/p&gt;    &lt;p style="text-indent: -0.25in; mso-list: l13 level1 lfo18" class="MsoListParagraphCxSpLast"&gt;&lt;span style="mso-fareast-font-family: calibri; mso-bidi-font-family: calibri; mso-no-proof: no"&gt;&lt;span style="mso-list: ignore"&gt;2.&lt;span style="font: 7pt &amp;quot;Times New Roman&amp;quot;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="mso-no-proof: no"&gt;Update the application to use the &lt;/span&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;; mso-no-proof: no"&gt;useLegacyV2RuntimeActivationPolicy&lt;/span&gt;&lt;span style="mso-no-proof: no"&gt; configuration file extension.&lt;/span&gt;&lt;/p&gt; &lt;/div&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10029237" width="1" height="1"&gt;</description></item><item><title>NGen: Walk-through Series</title><link>http://blogs.msdn.com/b/dotnet/archive/2010/05/03/ngen-walk-through-series.aspx</link><pubDate>Tue, 04 May 2010 01:22:51 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10006778</guid><dc:creator>Abhishek_Mondal</dc:creator><slash:comments>2</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/dotnet/rsscomments.aspx?WeblogPostID=10006778</wfw:commentRss><comments>http://blogs.msdn.com/b/dotnet/archive/2010/05/03/ngen-walk-through-series.aspx#comments</comments><description>&lt;p&gt;The &lt;a href="http://blogs.msdn.com/clrcodegeneration"&gt;CLR Code Generation team blog&lt;/a&gt; has a series of new posts featuring hands-on style content around how to use the NGen technology and how to measure performance benefits from it. You can find the series &lt;a href="http://blogs.msdn.com/clrcodegeneration/archive/2010/04/27/ngen-walk-through-series.aspx"&gt;here&lt;/a&gt;.&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10006778" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/b/dotnet/archive/tags/performance/">performance</category></item><item><title>Connect</title><link>http://blogs.msdn.com/b/dotnet/archive/2010/04/13/connect.aspx</link><pubDate>Tue, 13 Apr 2010 23:42:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9995488</guid><dc:creator>Abhishek_Mondal</dc:creator><slash:comments>19</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/dotnet/rsscomments.aspx?WeblogPostID=9995488</wfw:commentRss><comments>http://blogs.msdn.com/b/dotnet/archive/2010/04/13/connect.aspx#comments</comments><description>&lt;P style="MARGIN: 0in 0in 10pt" class=MsoNormal&gt;&lt;FONT size=3 face=Calibri&gt;As hopefully most of you know, Microsoft has a site called Connect where customers can log bugs and suggestions (&lt;/FONT&gt;&lt;A href="http://connect.microsoft.com/"&gt;&lt;FONT color=#0000ff size=3 face=Calibri&gt;http://connect.microsoft.com/&lt;/FONT&gt;&lt;/A&gt;&lt;FONT size=3 face=Calibri&gt;).&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;Issues for .NET can be found in the Visual Studio and .NET Framework feedback category (&lt;/FONT&gt;&lt;A href="http://connect.microsoft.com/VisualStudio/Feedback"&gt;&lt;FONT size=3 face=Calibri&gt;http://connect.microsoft.com/VisualStudio/Feedback&lt;/FONT&gt;&lt;/A&gt;&lt;FONT size=3 face=Calibri&gt;) and can be logged from the main Visual Studio Connect page (&lt;/FONT&gt;&lt;A href="http://connect.microsoft.com/VisualStudio/"&gt;&lt;FONT size=3 face=Calibri&gt;http://connect.microsoft.com/VisualStudio/&lt;/FONT&gt;&lt;/A&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;).&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 10pt" class=MsoNormal&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;One of the complaints we often hear from customers is that they don’t know what happens to a Connect issue after they file it.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;So I wanted to take this chance to tell you a little about how the process works on the CLR team.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 10pt" class=MsoNormal&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;Once the issue is opened, there’s a first level of screening just to figure out which team it should be sent to.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;It usually ends up assigned to someone in the product within a few days.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;If the initial assignment was incorrect, though, it could take a couple more days to get it to the right person.&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 10pt" class=MsoNormal&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;If the issue is a code defect, we treat it like any other product bug.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;We make sure it’s reproducible and not by design and something we can fix for the current release depending on where we are in the product cycle.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;We don’t necessarily do this right away, though.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;There are times in our product cycle when we’re more focused on bugs than others, and the bar gets higher toward the end of the release when all changes are riskier.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;Any change can introduce regressions in compatibility, performance, or behavior, and taking changes toward the end gives us less time for stabilization.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;We might not be as good about delivering status updates on Connect as we could be, but we do try to comment on each issue.&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 10pt" class=MsoNormal&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;When deciding whether to fix a bug, there are several criteria we look at.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;One of them is whether anyone might have taken a hard dependency on the existing behavior.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;We don’t want to solve one problem but end up with a bunch of customers whose applications no longer work after upgrading to the newest version or applying the latest patch.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;There are occasionally security reasons to make breaking changes, but we try to avoid them when we can.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;We also look at things like how hard it is to work around the bug and how many votes there are on the issue.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;The severity of the issue also affects the priority: Is this a bug that will crash your machine, or is it just a minor annoyance?&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 10pt" class=MsoNormal&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;Another thing we look at when deciding to fix a bug is how many people are likely impacted.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;If you find a new bug in an older product, like .NET 2.0 that’s been out for 5 years and used by hundreds of thousands of developers, you might be one of only a few people who is impacted by that bug.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;But if you file a bug on a newer product, like .NET 4, that’s has just been released, there’s a good chance that hundreds or even thousands of people are impacted.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;Because of this, we take bugs on products in Beta, or that have just been released, particularly seriously.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 10pt" class=MsoNormal&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;Once we do decide to fix a bug, we have to decide where to fix it.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;Our default answer is generally to fix it in the next major or service pack release (which is usually the one we’re working on at the time).&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;Only fixes for particularly severe bugs might be included in an update to an existing release.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;If you are blocked on a bug for an existing release that’s been out for longer, e.g. .NET 2.0, and you need a fix, Connect is not the place to file a bug.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;You should be contacting Microsoft customer support to request a QFE.&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 10pt" class=MsoNormal&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;We tend to get a high number of suggestions, both from Connect and other sources, and we don’t always get a chance to look at them and respond right away.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;But we do look at all the suggestions that come in on Connect.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;When suggestions come in, we consider whether it’s something we might do in this release or a future release.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;We also check to see if it’s a duplicate of an existing suggestion &lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 10pt 0.5in" class=MsoNormal&gt;&lt;I style="mso-bidi-font-style: normal"&gt;&lt;FONT size=3 face=Calibri&gt;Aside: please search before you file.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;One suggestion with 20 votes has more impact than 20 suggestions with 1 vote.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;You can &lt;/FONT&gt;&lt;/I&gt;&lt;A href="http://connect.microsoft.com/VisualStudio/SearchResults.aspx?FeedbackType=2&amp;amp;Status=1&amp;amp;Scope=0&amp;amp;SortOrder=15&amp;amp;TabView=1"&gt;&lt;I style="mso-bidi-font-style: normal"&gt;&lt;FONT size=3 face=Calibri&gt;sort by number of votes&lt;/FONT&gt;&lt;/I&gt;&lt;/A&gt;&lt;I style="mso-bidi-font-style: normal"&gt;&lt;FONT size=3 face=Calibri&gt; on the site, and that helps us focus our attention when it comes to suggestions.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;For example, we recently fixed a &lt;/FONT&gt;&lt;A href="http://connect.microsoft.com/VisualStudio/feedback/details/140018/serialport-crashes-after-disconnect-of-usb-com-port"&gt;&lt;FONT size=3 face=Calibri&gt;SerialPort&lt;/FONT&gt;&lt;/A&gt;&lt;FONT size=3 face=Calibri&gt; issue and a &lt;/FONT&gt;&lt;A href="http://connect.microsoft.com/VisualStudio/feedback/details/361615/serialization-hangs-or-throws-an-outofmemoryexception-with-static-delegate-and-iserializable-on-3-5-sp1"&gt;&lt;FONT size=3 face=Calibri&gt;serialization&lt;/FONT&gt;&lt;/A&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt; issue that had a high number of votes.&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/I&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 10pt" class=MsoNormal&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;We try to close issues if there isn’t a chance we’d ever do them, but we leave ones we might consider open so that the community has a chance to vote and comment on them.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;Again, these can go for a while without comment, until we get to a point where we can act on them.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;However, we do have a mechanism to be alerted when someone comments on an issue.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;It’s opt-in, so it may not be universally used, but it may get someone’s attention.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;If suggestions come in while we’re working on a release and already have plans, it’s less likely we’ll be able to implement anything large for that release.&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 10pt" class=MsoNormal&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;One thing that really helps us with suggestions is when the poster or commenter includes details on what problem this would help them solve.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;With a lot of suggestions, people jump straight to the suggested solution.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;You may think this is a shortcut for us, but it’s not always.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;We see those and realize that maybe we could do that, but don’t necessarily know why we should.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;What would you be able to do if you had this that you can’t do now?&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;Often there are several ways to solve a problem (at least).&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;If we know what you’re trying to accomplish, it helps us measure whether our solution really met the goal.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;Or if we see lots of customers with similar problems, we might be able to come up with a slightly different solution that meets lots of needs.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;And it’s a lot easier to reason about that from the problem descriptions than from the often-diverse solution descriptions.&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 10pt" class=MsoNormal&gt;&lt;FONT size=3 face=Calibri&gt;If you’re wondering about the kinds of suggestions we’ve acted on, in .NET 4 we took suggestions ranging from new &lt;/FONT&gt;&lt;A href="http://connect.microsoft.com/VisualStudio/feedback/details/295714/please-bring-back-system-numeric-biginteger"&gt;&lt;FONT size=3 face=Calibri&gt;numeric&lt;/FONT&gt;&lt;/A&gt;&lt;FONT size=3 face=Calibri&gt; &lt;/FONT&gt;&lt;A href="http://connect.microsoft.com/VisualStudioJapan/feedback/details/436360"&gt;&lt;FONT size=3 face=Calibri&gt;types&lt;/FONT&gt;&lt;/A&gt;&lt;FONT size=3 face=Calibri&gt; to adding single &lt;/FONT&gt;&lt;A href="http://connect.microsoft.com/VisualStudio/feedback/details/328938/implement-enum-parse-t-string-value"&gt;&lt;FONT size=3 face=Calibri&gt;APIs&lt;/FONT&gt;&lt;/A&gt;&lt;FONT size=3 face=Calibri&gt; or &lt;/FONT&gt;&lt;A href="http://connect.microsoft.com/VisualStudio/feedback/details/543737/string-join-for-ienumerable-string-fixed"&gt;&lt;FONT size=3 face=Calibri&gt;overloads&lt;/FONT&gt;&lt;/A&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt; that helped customers out.&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 10pt" class=MsoNormal&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;For those of you wondering when we’ll get to these suggestions, the answer is now.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;With work on .NET Framework 4 coming to an end, we’re starting to look at the open suggestions in more detail.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;Through May we’ll be trying to close ones we don’t think we’ll be able to do in our next cycle.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;We’ll also be trying to work through any bugs that might still be open.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;The fact that a suggestion is still open in June doesn’t mean you’ll necessarily be seeing it any time soon, but only that we’ll take the time to look into it more closely.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 10pt" class=MsoNormal&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;If you’ve been thinking about voting or commenting on a suggestion, or opening a new one, now would be a good time.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;If we close one that you feel passionately is more important than some of that other stuff we’ve left open, let us know that, too.&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9995488" width="1" height="1"&gt;</description></item><item><title>Announcing a new CLR Team Codeplex Project: CLR Runtime Activation</title><link>http://blogs.msdn.com/b/dotnet/archive/2010/02/16/announcing-a-new-clr-team-codeplex-project-clr-runtime-activation.aspx</link><pubDate>Tue, 16 Feb 2010 21:04:23 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9964618</guid><dc:creator>Abhishek_Mondal</dc:creator><slash:comments>5</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/dotnet/rsscomments.aspx?WeblogPostID=9964618</wfw:commentRss><comments>http://blogs.msdn.com/b/dotnet/archive/2010/02/16/announcing-a-new-clr-team-codeplex-project-clr-runtime-activation.aspx#comments</comments><description>&lt;p&gt;This Codeplex site will feature demos, samples, and helper libraries related to the selection and activation of the CLR: &lt;a href="http://clractivation.codeplex.com/"&gt;http://clractivation.codeplex.com/&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;With .Net Framework 4 and VS 2010 the new ability to load multiple versions of the runtime has changed the way a version is chosen for any particular piece of managed code and gives developers much more control over the runtime their code will end up running against. For a detailed introduction to this new functionality you can see this &lt;a href="http://msdn.microsoft.com/magazine/ee819091.aspx"&gt;MSDN magazine article&lt;/a&gt;. This CodePlex project will focus on the various ways to start up the runtime and how to influence these choices using the new runtime activation APIs introduced in .Net Framework 4. Our first two projects include a helper library to ease migration from the old to the new APIs and a managed wrapper of our new native activation APIs.&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9964618" width="1" height="1"&gt;</description></item><item><title>Sharing Silverlight Assemblies with .NET Apps</title><link>http://blogs.msdn.com/b/dotnet/archive/2009/12/01/sharing-silverlight-assemblies-with-net-apps.aspx</link><pubDate>Tue, 01 Dec 2009 23:08:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9931140</guid><dc:creator>Abhishek_Mondal</dc:creator><slash:comments>34</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/dotnet/rsscomments.aspx?WeblogPostID=9931140</wfw:commentRss><comments>http://blogs.msdn.com/b/dotnet/archive/2009/12/01/sharing-silverlight-assemblies-with-net-apps.aspx#comments</comments><description>&lt;P&gt;At the recent PDC, Scott Guthrie announced in his Silverlight 4 keynote that we had implemented a new feature, to enable developers to share certain assemblies between Silverlight and .NET. There are many differences between Silverlight and full .NET including WPF, and this new feature doesn’t solve those differences – in those cases, you’ll still need to compile your code twice. But in some cases, developers will write code that only uses features whose behavior is identical between Silverlight and full .NET, and in those cases, we want to enable that code to be shared. This post provides more detail on that sharing, and explains how developers can target it, and what the restrictions are.&lt;/P&gt;
&lt;H4&gt;Developer Scenario&lt;/H4&gt;
&lt;P&gt;Today, many developers write code that is intended to run on both Silverlight and .NET. A good example would be validation code: when writing a client-server application, you want to validate the data at the client (to make sure the user gets quick feedback) and then re-validate it again at the server (to make sure a rogue client implementation can’t send back bad data.) Today, in order to get that scenario to work, developers need to compile their source for Silverlight and also for .NET. In addition to dual-compilation, developers need to manage and deploy those assemblies separately, ensuring that they end up being deployed to the right places and consumed by the right platform (Silverlight or .NET). Today’s model is certainly workable, but it is not ideal.&lt;B&gt;&lt;/B&gt;&lt;/P&gt;
&lt;P&gt;We’ve heard from many developers that you want something better. We’ve also read quite a number of blog and forum posts stating the same. We’ve even seen some interesting workarounds to try and make the situation better for themselves and other developers. Cool! Specifically, developers want to write and compile their code once and deploy it as part of both their Silverlight and .NET apps, without having to dual-compile or worry about paying attention to the compilation target. This ability has the obvious benefit of avoiding duplication of effort for a number of the steps in your development and deployment processes. &lt;/P&gt;
&lt;H4&gt;Portability Explained&lt;/H4&gt;
&lt;P&gt;We named this new feature “assembly portability”, given that the feature allows your code to be “ported” between both Silverlight and .NET. Portability provides the ability to compile your source with the Silverlight tools, and run your built assemblies on both the Silverlight and .NET runtimes. This feature &lt;I&gt;doesn’t &lt;/I&gt;change the underlying implementation of either the Silverlight or .NET runtimes; instead, if you write code that only uses APIs that have the same behavior across Silverlight and .NET, it allows you to use one set of binaries to target both. But how do you know if the APIs you are using are compatible? We have identified five key assemblies that are compatible between Silverlight and .NET. (The Silverlight UI layer is of course not one of these – there are some important differences between Silverlight UI and WPF.)&lt;/P&gt;
&lt;P&gt;Like most features we build, we had a lot of choice about how to design the feature, and which scenarios we would enable. At the heart of the feature, a major design choice was to enable portability from Silverlight to .NET. The motivation for this choice was that Silverlight exposes an API subset of .NET, and so assemblies built with Silverlight should “just work” on .NET, whereas the reverse direction (.NET assemblies running on Silverlight) would have proven more technically challenging (for us all). &lt;/P&gt;
&lt;P&gt;Another important design choice was identifying the set of Silverlight/.NET assemblies that developers could safely use, while still maintaining binary comparability. We looked at the scenarios that would both most benefit from portability, and would be straightforward for developers to use. We looked at a bunch of scenarios, including: the most low-level, typical business logic, networking and also UI. We decided we would start with the most fundamental and requested scenarios for this release. As a result, for .NET 4 and SL4, we have enabled portability for a significant set of low-level assemblies that we believe will enable a variety of interesting scenarios. &lt;/P&gt;
&lt;P&gt;For SL 4 and .NET 4, we have made the following assemblies portable:&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;Mscorlib &lt;/LI&gt;
&lt;LI&gt;System &lt;/LI&gt;
&lt;LI&gt;System.Core &lt;/LI&gt;
&lt;LI&gt;System.ComponentModel.Composition &lt;/LI&gt;
&lt;LI&gt;Microsoft.VisualBasic &lt;/LI&gt;&lt;/UL&gt;
&lt;P&gt;Note again that the Silverlight surface area for these assemblies is what we made portable. There are a great number of types and members in the .NET surface area that cannot run on Silverlight. As a result, you need to write code that targets the Silverlight versions of these assemblies in order to get this scenario to work.&lt;/P&gt;
&lt;P&gt;Also note that there may be some behaviors that are not strictly identical across both platforms. We’ve worked to avoid those behaviors, however, those differences are sometimes very subtle and difficult to identify. Please do contact us if you do see behavioral differences between Silverlight and .NET, for portable APIs, which are bothering you.&lt;/P&gt;
&lt;H4&gt;Visual Studio Experience&lt;/H4&gt;
&lt;P&gt;Like all .NET features, it is important that we provide good tooling support in Visual Studio. This feature can be used in Visual Studio, in just the way that one might imagine. Developers should write their portable logic in Silverlight Class Library projects, and then are free to reference such projects from both Silverlight and .NET application projects. To clarify, on the .NET side, you can reference such a library from any kind of .NET project (Ex: WPF, winforms, WCF, WF, ASP.NET, …).&lt;/P&gt;
&lt;P&gt;The only caveat is that the support in Visual Studio was implemented in such a way that you need to click a few extra times to get a reference to a portable project correct setup. For VS 2010, you must rely on browsing to the binary – AKA “binary reference” – that is built from the Silverlight class library to setup a reference. You cannot just reference the project itself – AKA “project to project reference”. Note that this restriction only exists for .NET apps, and not Silverlight ones.&lt;/P&gt;
&lt;P&gt;The following are the basic steps to follow to enable the use of portable code in Visual Studio 2010, followed by a set of screen caps that hopefully make it super clear what to do.&lt;/P&gt;
&lt;P&gt;&lt;B&gt;Steps:&lt;/B&gt;&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;Setup projects 
&lt;OL type=a&gt;
&lt;LI&gt;Create .NET application &lt;/LI&gt;
&lt;LI&gt;Create or add existing Silverlight class library project &lt;/LI&gt;
&lt;LI&gt;Build Silverlight project &lt;/LI&gt;&lt;/OL&gt;&lt;/LI&gt;
&lt;LI&gt;Establish portable code reference 
&lt;OL type=a&gt;
&lt;LI&gt;Reference Silverlight class library binary from the .NET project &lt;/LI&gt;&lt;/OL&gt;&lt;/LI&gt;
&lt;LI&gt;Code &lt;/LI&gt;
&lt;LI&gt;Run App! &lt;/LI&gt;&lt;/OL&gt;
&lt;P&gt;&lt;B&gt;Screen Caps:&lt;/B&gt;&lt;/P&gt;
&lt;P&gt;Step 1 – Setup projects&lt;/P&gt;
&lt;P&gt;&lt;A href="http://blogs.msdn.com/blogfiles/clrteam/WindowsLiveWriter/SharingSilverlightAssemblieswith.NETApps_D4EF/clip_image001%5B4%5D.png" mce_href="http://blogs.msdn.com/blogfiles/clrteam/WindowsLiveWriter/SharingSilverlightAssemblieswith.NETApps_D4EF/clip_image001%5B4%5D.png"&gt;&lt;IMG style="BORDER-RIGHT-WIDTH: 0px; DISPLAY: inline; BORDER-TOP-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; BORDER-LEFT-WIDTH: 0px" title=clip_image001[4] border=0 alt=clip_image001[4] src="http://blogs.msdn.com/blogfiles/clrteam/WindowsLiveWriter/SharingSilverlightAssemblieswith.NETApps_D4EF/clip_image001%5B4%5D_thumb.png" width=404 height=331 mce_src="http://blogs.msdn.com/blogfiles/clrteam/WindowsLiveWriter/SharingSilverlightAssemblieswith.NETApps_D4EF/clip_image001%5B4%5D_thumb.png"&gt;&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;Step 2 -- Establish portable code reference to the other project (required going up and back down the directory structure to the Silverlight library project).&lt;/P&gt;
&lt;P&gt;&lt;A href="http://blogs.msdn.com/blogfiles/clrteam/WindowsLiveWriter/SharingSilverlightAssemblieswith.NETApps_D4EF/image_6.png" mce_href="http://blogs.msdn.com/blogfiles/clrteam/WindowsLiveWriter/SharingSilverlightAssemblieswith.NETApps_D4EF/image_6.png"&gt;&lt;IMG style="BORDER-BOTTOM: 0px; BORDER-LEFT: 0px; DISPLAY: inline; BORDER-TOP: 0px; BORDER-RIGHT: 0px" title=image border=0 alt=image src="http://blogs.msdn.com/blogfiles/clrteam/WindowsLiveWriter/SharingSilverlightAssemblieswith.NETApps_D4EF/image_thumb_2.png" width=504 height=416 mce_src="http://blogs.msdn.com/blogfiles/clrteam/WindowsLiveWriter/SharingSilverlightAssemblieswith.NETApps_D4EF/image_thumb_2.png"&gt;&lt;/A&gt; &lt;/P&gt;
&lt;P&gt;&lt;A href="http://blogs.msdn.com/blogfiles/clrteam/WindowsLiveWriter/SharingSilverlightAssemblieswith.NETApps_D4EF/image_2.png" mce_href="http://blogs.msdn.com/blogfiles/clrteam/WindowsLiveWriter/SharingSilverlightAssemblieswith.NETApps_D4EF/image_2.png"&gt;&lt;IMG style="BORDER-BOTTOM: 0px; BORDER-LEFT: 0px; DISPLAY: inline; BORDER-TOP: 0px; BORDER-RIGHT: 0px" title=image border=0 alt=image src="http://blogs.msdn.com/blogfiles/clrteam/WindowsLiveWriter/SharingSilverlightAssemblieswith.NETApps_D4EF/image_thumb.png" width=404 height=470 mce_src="http://blogs.msdn.com/blogfiles/clrteam/WindowsLiveWriter/SharingSilverlightAssemblieswith.NETApps_D4EF/image_thumb.png"&gt;&lt;/A&gt; &lt;/P&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Step 3 – Code&lt;/P&gt;
&lt;P&gt;&lt;A href="http://blogs.msdn.com/blogfiles/clrteam/WindowsLiveWriter/SharingSilverlightAssemblieswith.NETApps_D4EF/image_4.png" mce_href="http://blogs.msdn.com/blogfiles/clrteam/WindowsLiveWriter/SharingSilverlightAssemblieswith.NETApps_D4EF/image_4.png"&gt;&lt;IMG style="BORDER-BOTTOM: 0px; BORDER-LEFT: 0px; DISPLAY: inline; BORDER-TOP: 0px; BORDER-RIGHT: 0px" title=image border=0 alt=image src="http://blogs.msdn.com/blogfiles/clrteam/WindowsLiveWriter/SharingSilverlightAssemblieswith.NETApps_D4EF/image_thumb_1.png" width=654 height=159 mce_src="http://blogs.msdn.com/blogfiles/clrteam/WindowsLiveWriter/SharingSilverlightAssemblieswith.NETApps_D4EF/image_thumb_1.png"&gt;&lt;/A&gt; &lt;/P&gt;
&lt;P&gt;Step 4 – Run App!&lt;/P&gt;
&lt;P&gt;&lt;B&gt;&lt;A href="http://blogs.msdn.com/blogfiles/clrteam/WindowsLiveWriter/SharingSilverlightAssemblieswith.NETApps_D4EF/clip_image002%5B8%5D.png" mce_href="http://blogs.msdn.com/blogfiles/clrteam/WindowsLiveWriter/SharingSilverlightAssemblieswith.NETApps_D4EF/clip_image002%5B8%5D.png"&gt;&lt;IMG style="BORDER-BOTTOM: 0px; BORDER-LEFT: 0px; DISPLAY: inline; BORDER-TOP: 0px; BORDER-RIGHT: 0px" title=clip_image002[8] border=0 alt=clip_image002[8] src="http://blogs.msdn.com/blogfiles/clrteam/WindowsLiveWriter/SharingSilverlightAssemblieswith.NETApps_D4EF/clip_image002%5B8%5D_thumb.png" width=654 height=329 mce_src="http://blogs.msdn.com/blogfiles/clrteam/WindowsLiveWriter/SharingSilverlightAssemblieswith.NETApps_D4EF/clip_image002%5B8%5D_thumb.png"&gt;&lt;/A&gt;&lt;/B&gt;&lt;/P&gt;
&lt;P&gt;Note: My app is a WPF app that is intended to display how many days there are until the Vancouver 2010 Olympics start, from today. The Silverlight library is the one that does the actual countdown calculation, and is (naturally) usable in both .NET and Silverlight apps. Cool!&lt;/P&gt;
&lt;H4&gt;Looking Forward and Feedback&lt;/H4&gt;
&lt;P&gt;It is great to see so much energy around both .NET and Silverlight, and particularly around the maximal sharing of code across the platforms. I encourage you to use this new scenario to its fullest extent, and to communicate back to us where you’d like to see the feature expanded in the future. &lt;B&gt;&lt;/B&gt;&lt;/P&gt;
&lt;P&gt;We are aware of some scenarios that are not currently enabled to be portable, but that developers will probably run up against pretty quickly. The most obvious ones are XML, networking, calling WCF web-services and UI code. Another interesting one is portable XAML. It would be really useful to hear from you on the specific scenarios that you would like to implement in portable code, but cannot implement due to the limitations that I’ve mentioned. I’d also like to hear why you saw being able to implement that scenario in portable code as being such a benefit. Your feedback will help guide us with future changes in the portable code space.&lt;/P&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;UL&gt;&lt;/UL&gt;
&lt;UL&gt;&lt;/UL&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9931140" width="1" height="1"&gt;</description></item><item><title>How to Make the Most of Your .NET Server Code</title><link>http://blogs.msdn.com/b/dotnet/archive/2009/11/13/how-to-make-the-most-of-your-net-server-code.aspx</link><pubDate>Fri, 13 Nov 2009 18:32:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9922132</guid><dc:creator>Abhishek_Mondal</dc:creator><slash:comments>4</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/dotnet/rsscomments.aspx?WeblogPostID=9922132</wfw:commentRss><comments>http://blogs.msdn.com/b/dotnet/archive/2009/11/13/how-to-make-the-most-of-your-net-server-code.aspx#comments</comments><description>&lt;P&gt;One of our team’s field engineers recently sent a link to a Channel 9 video: &lt;A class="" href="http://channel9.msdn.com/shows/ARCast.TV/ARCastTV-Steve-Michelotti-of-eimagination-on-High-Performance-Web-Solutions/" mce_href="http://channel9.msdn.com/shows/ARCast.TV/ARCastTV-Steve-Michelotti-of-eimagination-on-High-Performance-Web-Solutions/"&gt;Steve Michelotti of e.magination on High Performance Web Solutions&lt;/A&gt;. This company built a 64-bit web server that handles over 3 billion transactions a day and guarantees a 250 ms response time.&amp;nbsp; And it goes without saying that they built it on top of .NET.&lt;/P&gt;
&lt;P&gt;The team optimized their code to avoid implicit allocations, pool and reuse objects and allocate large collections directly on the Large Object Heap. But they still saw some latencies that were greater than their contract allowed. So they worked with their field engineer and the GC team to get a new feature implemented in .NET 3.5 SP1 that let them work around the problem. &lt;/P&gt;
&lt;P&gt;The problem comes from the size of their managed heaps. When you try to manage memory on a 16 GB server it can take a few seconds to run through the heaps. There’s not much you can do on a single machine besides keeping your heaps reasonably sized. Having millions of objects in memory is expensive. But their architecture is such that they can direct requests from the web server to any of a set of identical application servers. This means that they can take any individual server offline for the few seconds it takes to do a full collection. All they needed is to know when a GC is going to happen and when it’s completed. &lt;A class="" href="http://msdn.microsoft.com/en-us/library/system.gc.registerforfullgcnotification(VS.100).aspx" mce_href="http://msdn.microsoft.com/en-us/library/system.gc.registerforfullgcnotification(VS.100).aspx"&gt;Full GC notifications&lt;/A&gt; is a new feature in 3.5 SP1 that gave e.magination necessary insight into the GC’s behavior that lets them redirect requests away from servers that are doing full GCs. &lt;/P&gt;
&lt;P&gt;This video is only about 20 minutes long but it’s packed with great insights into how to make the most of your .NET server code. It shows the team at e.magination doing a fantastic job of analyzing and tuning their system for optimum performance. I found it interesting and inspiring. I hope you do too.&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9922132" width="1" height="1"&gt;</description></item><item><title>Automatically Capturing a Dump When a Process Crashes</title><link>http://blogs.msdn.com/b/dotnet/archive/2009/10/15/automatically-capturing-a-dump-when-a-process-crashes.aspx</link><pubDate>Fri, 16 Oct 2009 03:35:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9907935</guid><dc:creator>Abhishek_Mondal</dc:creator><slash:comments>7</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/dotnet/rsscomments.aspx?WeblogPostID=9907935</wfw:commentRss><comments>http://blogs.msdn.com/b/dotnet/archive/2009/10/15/automatically-capturing-a-dump-when-a-process-crashes.aspx#comments</comments><description>&lt;LINK rel=File-List href="JIT_debug_blog_post_files/filelist.xml" mce_href="JIT_debug_blog_post_files/filelist.xml"&gt;&lt;LINK rel=dataStoreItem href="JIT_debug_blog_post_files/item0001.xml" target=JIT_debug_blog_post_files/props0002.xml mce_href="JIT_debug_blog_post_files/item0001.xml"&gt;&lt;LINK rel=dataStoreItem href="JIT_debug_blog_post_files/item0003.xml" target=JIT_debug_blog_post_files/props0004.xml mce_href="JIT_debug_blog_post_files/item0003.xml"&gt;&lt;LINK rel=themeData href="JIT_debug_blog_post_files/themedata.thmx" mce_href="JIT_debug_blog_post_files/themedata.thmx"&gt;&lt;LINK rel=colorSchemeMapping href="JIT_debug_blog_post_files/colorschememapping.xml" mce_href="JIT_debug_blog_post_files/colorschememapping.xml"&gt;
&lt;STYLE&gt; 
&lt;!--
 /* Font Definitions */
 @font-face
	{font-family:Wingdings;
	panose-1:5 0 0 0 0 0 0 0 0 0;
	mso-font-charset:2;
	mso-generic-font-family:auto;
	mso-font-pitch:variable;
	mso-font-signature:0 268435456 0 0 -2147483648 0;}
@font-face
	{font-family:"Cambria Math";
	panose-1:2 4 5 3 5 4 6 3 2 4;
	mso-font-charset:1;
	mso-generic-font-family:roman;
	mso-font-format:other;
	mso-font-pitch:variable;
	mso-font-signature:0 0 0 0 0 0;}
@font-face
	{font-family:Calibri;
	panose-1:2 15 5 2 2 2 4 3 2 4;
	mso-font-charset:0;
	mso-generic-font-family:swiss;
	mso-font-pitch:variable;
	mso-font-signature:-520092929 1073786111 9 0 415 0;}
@font-face
	{font-family:Consolas;
	panose-1:2 11 6 9 2 2 4 3 2 4;
	mso-font-charset:0;
	mso-generic-font-family:modern;
	mso-font-pitch:fixed;
	mso-font-signature:-520092929 1073806591 9 0 415 0;}
 /* Style Definitions */
 p.MsoNormal, li.MsoNormal, div.MsoNormal
	{mso-style-unhide:no;
	mso-style-qformat:yes;
	mso-style-parent:"";
	margin:0in;
	margin-bottom:.0001pt;
	mso-pagination:widow-orphan;
	font-size:11.0pt;
	font-family:"Calibri","sans-serif";
	mso-fareast-font-family:"Times New Roman";}
p.MsoHeader, li.MsoHeader, div.MsoHeader
	{mso-style-priority:99;
	mso-style-link:"Header Char";
	margin:0in;
	margin-bottom:.0001pt;
	mso-pagination:widow-orphan;
	tab-stops:center 3.25in right 6.5in;
	font-size:11.0pt;
	font-family:"Calibri","sans-serif";
	mso-fareast-font-family:"Times New Roman";}
p.MsoFooter, li.MsoFooter, div.MsoFooter
	{mso-style-priority:99;
	mso-style-link:"Footer Char";
	margin:0in;
	margin-bottom:.0001pt;
	mso-pagination:widow-orphan;
	tab-stops:center 3.25in right 6.5in;
	font-size:11.0pt;
	font-family:"Calibri","sans-serif";
	mso-fareast-font-family:"Times New Roman";}
a:link, span.MsoHyperlink
	{mso-style-priority:99;
	color:blue;
	mso-themecolor:hyperlink;
	text-decoration:underline;
	text-underline:single;}
a:visited, span.MsoHyperlinkFollowed
	{mso-style-noshow:yes;
	mso-style-priority:99;
	color:purple;
	mso-themecolor:followedhyperlink;
	text-decoration:underline;
	text-underline:single;}
p.MsoNoSpacing, li.MsoNoSpacing, div.MsoNoSpacing
	{mso-style-priority:1;
	mso-style-unhide:no;
	mso-style-qformat:yes;
	mso-style-parent:"";
	margin:0in;
	margin-bottom:.0001pt;
	mso-pagination:widow-orphan;
	font-size:11.0pt;
	font-family:"Calibri","sans-serif";
	mso-ascii-font-family:Calibri;
	mso-ascii-theme-font:minor-latin;
	mso-fareast-font-family:Calibri;
	mso-fareast-theme-font:minor-latin;
	mso-hansi-font-family:Calibri;
	mso-hansi-theme-font:minor-latin;
	mso-bidi-font-family:"Times New Roman";
	mso-bidi-theme-font:minor-bidi;}
p.MsoListParagraph, li.MsoListParagraph, div.MsoListParagraph
	{mso-style-priority:34;
	mso-style-unhide:no;
	mso-style-qformat:yes;
	margin-top:0in;
	margin-right:0in;
	margin-bottom:0in;
	margin-left:.5in;
	margin-bottom:.0001pt;
	mso-add-space:auto;
	mso-pagination:widow-orphan;
	font-size:11.0pt;
	font-family:"Calibri","sans-serif";
	mso-fareast-font-family:"Times New Roman";}
p.MsoListParagraphCxSpFirst, li.MsoListParagraphCxSpFirst, div.MsoListParagraphCxSpFirst
	{mso-style-priority:34;
	mso-style-unhide:no;
	mso-style-qformat:yes;
	mso-style-type:export-only;
	margin-top:0in;
	margin-right:0in;
	margin-bottom:0in;
	margin-left:.5in;
	margin-bottom:.0001pt;
	mso-add-space:auto;
	mso-pagination:widow-orphan;
	font-size:11.0pt;
	font-family:"Calibri","sans-serif";
	mso-fareast-font-family:"Times New Roman";}
p.MsoListParagraphCxSpMiddle, li.MsoListParagraphCxSpMiddle, div.MsoListParagraphCxSpMiddle
	{mso-style-priority:34;
	mso-style-unhide:no;
	mso-style-qformat:yes;
	mso-style-type:export-only;
	margin-top:0in;
	margin-right:0in;
	margin-bottom:0in;
	margin-left:.5in;
	margin-bottom:.0001pt;
	mso-add-space:auto;
	mso-pagination:widow-orphan;
	font-size:11.0pt;
	font-family:"Calibri","sans-serif";
	mso-fareast-font-family:"Times New Roman";}
p.MsoListParagraphCxSpLast, li.MsoListParagraphCxSpLast, div.MsoListParagraphCxSpLast
	{mso-style-priority:34;
	mso-style-unhide:no;
	mso-style-qformat:yes;
	mso-style-type:export-only;
	margin-top:0in;
	margin-right:0in;
	margin-bottom:0in;
	margin-left:.5in;
	margin-bottom:.0001pt;
	mso-add-space:auto;
	mso-pagination:widow-orphan;
	font-size:11.0pt;
	font-family:"Calibri","sans-serif";
	mso-fareast-font-family:"Times New Roman";}
span.HeaderChar
	{mso-style-name:"Header Char";
	mso-style-priority:99;
	mso-style-unhide:no;
	mso-style-locked:yes;
	mso-style-link:Header;
	font-family:"Calibri","sans-serif";
	mso-ascii-font-family:Calibri;
	mso-fareast-font-family:"Times New Roman";
	mso-hansi-font-family:Calibri;
	mso-bidi-font-family:Calibri;}
span.FooterChar
	{mso-style-name:"Footer Char";
	mso-style-priority:99;
	mso-style-unhide:no;
	mso-style-locked:yes;
	mso-style-link:Footer;
	font-family:"Calibri","sans-serif";
	mso-ascii-font-family:Calibri;
	mso-fareast-font-family:"Times New Roman";
	mso-hansi-font-family:Calibri;
	mso-bidi-font-family:Calibri;}
span.SpellE
	{mso-style-name:"";
	mso-spl-e:yes;}
span.GramE
	{mso-style-name:"";
	mso-gram-e:yes;}
.MsoChpDefault
	{mso-style-type:export-only;
	mso-default-props:yes;
	font-family:"Calibri","sans-serif";
	mso-ascii-font-family:Calibri;
	mso-ascii-theme-font:minor-latin;
	mso-fareast-font-family:Calibri;
	mso-fareast-theme-font:minor-latin;
	mso-hansi-font-family:Calibri;
	mso-hansi-theme-font:minor-latin;
	mso-bidi-font-family:"Times New Roman";
	mso-bidi-theme-font:minor-bidi;}
.MsoPapDefault
	{mso-style-type:export-only;
	margin-bottom:10.0pt;
	line-height:115%;}
 /* Page Definitions */
 @page
	{mso-footnote-separator:url("JIT_debug_blog_post_files/header.htm") fs;
	mso-footnote-continuation-separator:url("JIT_debug_blog_post_files/header.htm") fcs;
	mso-endnote-separator:url("JIT_debug_blog_post_files/header.htm") es;
	mso-endnote-continuation-separator:url("JIT_debug_blog_post_files/header.htm") ecs;}
@page WordSection1
	{size:8.5in 11.0in;
	margin:1.0in 1.1in 1.0in 1.0in;
	mso-header-margin:.5in;
	mso-footer-margin:.5in;
	mso-even-header:url("JIT_debug_blog_post_files/header.htm") eh1;
	mso-header:url("JIT_debug_blog_post_files/header.htm") h1;
	mso-even-footer:url("JIT_debug_blog_post_files/header.htm") ef1;
	mso-footer:url("JIT_debug_blog_post_files/header.htm") f1;
	mso-first-header:url("JIT_debug_blog_post_files/header.htm") fh1;
	mso-first-footer:url("JIT_debug_blog_post_files/header.htm") ff1;
	mso-paper-source:0;}
div.WordSection1
	{page:WordSection1;}
 /* List Definitions */
 @list l0
	{mso-list-id:162402067;
	mso-list-type:hybrid;
	mso-list-template-ids:134626156 67698689 67698691 67698693 67698689 67698691 67698693 67698689 67698691 67698693;}
@list l0:level1
	{mso-level-number-format:bullet;
	mso-level-text:\F0B7;
	mso-level-tab-stop:none;
	mso-level-number-position:left;
	text-indent:-.25in;
	font-family:Symbol;}
@list l0:level2
	{mso-level-number-format:bullet;
	mso-level-text:o;
	mso-level-tab-stop:none;
	mso-level-number-position:left;
	text-indent:-.25in;
	font-family:"Courier New";}
@list l0:level3
	{mso-level-number-format:bullet;
	mso-level-text:\F0A7;
	mso-level-tab-stop:none;
	mso-level-number-position:left;
	text-indent:-.25in;
	font-family:Wingdings;}
@list l0:level4
	{mso-level-number-format:bullet;
	mso-level-text:\F0B7;
	mso-level-tab-stop:none;
	mso-level-number-position:left;
	text-indent:-.25in;
	font-family:Symbol;}
@list l0:level5
	{mso-level-number-format:bullet;
	mso-level-text:o;
	mso-level-tab-stop:none;
	mso-level-number-position:left;
	text-indent:-.25in;
	font-family:"Courier New";}
@list l0:level6
	{mso-level-number-format:bullet;
	mso-level-text:\F0A7;
	mso-level-tab-stop:none;
	mso-level-number-position:left;
	text-indent:-.25in;
	font-family:Wingdings;}
@list l0:level7
	{mso-level-number-format:bullet;
	mso-level-text:\F0B7;
	mso-level-tab-stop:none;
	mso-level-number-position:left;
	text-indent:-.25in;
	font-family:Symbol;}
@list l0:level8
	{mso-level-number-format:bullet;
	mso-level-text:o;
	mso-level-tab-stop:none;
	mso-level-number-position:left;
	text-indent:-.25in;
	font-family:"Courier New";}
@list l0:level9
	{mso-level-number-format:bullet;
	mso-level-text:\F0A7;
	mso-level-tab-stop:none;
	mso-level-number-position:left;
	text-indent:-.25in;
	font-family:Wingdings;}
@list l1
	{mso-list-id:263732964;
	mso-list-type:hybrid;
	mso-list-template-ids:-861501162 67698689 67698691 67698693 67698689 67698691 67698693 67698689 67698691 67698693;}
@list l1:level1
	{mso-level-number-format:bullet;
	mso-level-text:\F0B7;
	mso-level-tab-stop:none;
	mso-level-number-position:left;
	text-indent:-.25in;
	font-family:Symbol;}
@list l1:level2
	{mso-level-number-format:bullet;
	mso-level-text:o;
	mso-level-tab-stop:none;
	mso-level-number-position:left;
	text-indent:-.25in;
	font-family:"Courier New";}
@list l1:level3
	{mso-level-number-format:bullet;
	mso-level-text:\F0A7;
	mso-level-tab-stop:none;
	mso-level-number-position:left;
	text-indent:-.25in;
	font-family:Wingdings;}
@list l1:level4
	{mso-level-number-format:bullet;
	mso-level-text:\F0B7;
	mso-level-tab-stop:none;
	mso-level-number-position:left;
	text-indent:-.25in;
	font-family:Symbol;}
@list l1:level5
	{mso-level-number-format:bullet;
	mso-level-text:o;
	mso-level-tab-stop:none;
	mso-level-number-position:left;
	text-indent:-.25in;
	font-family:"Courier New";}
@list l1:level6
	{mso-level-number-format:bullet;
	mso-level-text:\F0A7;
	mso-level-tab-stop:none;
	mso-level-number-position:left;
	text-indent:-.25in;
	font-family:Wingdings;}
@list l1:level7
	{mso-level-number-format:bullet;
	mso-level-text:\F0B7;
	mso-level-tab-stop:none;
	mso-level-number-position:left;
	text-indent:-.25in;
	font-family:Symbol;}
@list l1:level8
	{mso-level-number-format:bullet;
	mso-level-text:o;
	mso-level-tab-stop:none;
	mso-level-number-position:left;
	text-indent:-.25in;
	font-family:"Courier New";}
@list l1:level9
	{mso-level-number-format:bullet;
	mso-level-text:\F0A7;
	mso-level-tab-stop:none;
	mso-level-number-position:left;
	text-indent:-.25in;
	font-family:Wingdings;}
@list l2
	{mso-list-id:317417813;
	mso-list-type:hybrid;
	mso-list-template-ids:1997541624 67698689 67698691 67698693 67698689 67698691 67698693 67698689 67698691 67698693;}
@list l2:level1
	{mso-level-number-format:bullet;
	mso-level-text:\F0B7;
	mso-level-tab-stop:none;
	mso-level-number-position:left;
	text-indent:-.25in;
	font-family:Symbol;}
@list l2:level2
	{mso-level-number-format:bullet;
	mso-level-text:o;
	mso-level-tab-stop:none;
	mso-level-number-position:left;
	text-indent:-.25in;
	font-family:"Courier New";}
@list l2:level3
	{mso-level-number-format:bullet;
	mso-level-text:\F0A7;
	mso-level-tab-stop:none;
	mso-level-number-position:left;
	text-indent:-.25in;
	font-family:Wingdings;}
@list l2:level4
	{mso-level-number-format:bullet;
	mso-level-text:\F0B7;
	mso-level-tab-stop:none;
	mso-level-number-position:left;
	text-indent:-.25in;
	font-family:Symbol;}
@list l2:level5
	{mso-level-number-format:bullet;
	mso-level-text:o;
	mso-level-tab-stop:none;
	mso-level-number-position:left;
	text-indent:-.25in;
	font-family:"Courier New";}
@list l2:level6
	{mso-level-number-format:bullet;
	mso-level-text:\F0A7;
	mso-level-tab-stop:none;
	mso-level-number-position:left;
	text-indent:-.25in;
	font-family:Wingdings;}
@list l2:level7
	{mso-level-number-format:bullet;
	mso-level-text:\F0B7;
	mso-level-tab-stop:none;
	mso-level-number-position:left;
	text-indent:-.25in;
	font-family:Symbol;}
@list l2:level8
	{mso-level-number-format:bullet;
	mso-level-text:o;
	mso-level-tab-stop:none;
	mso-level-number-position:left;
	text-indent:-.25in;
	font-family:"Courier New";}
@list l2:level9
	{mso-level-number-format:bullet;
	mso-level-text:\F0A7;
	mso-level-tab-stop:none;
	mso-level-number-position:left;
	text-indent:-.25in;
	font-family:Wingdings;}
@list l3
	{mso-list-id:483202760;
	mso-list-type:hybrid;
	mso-list-template-ids:2074404390 67698703 67698713 67698715 67698703 67698713 67698715 67698703 67698713 67698715;}
@list l3:level1
	{mso-level-tab-stop:none;
	mso-level-number-position:left;
	text-indent:-.25in;}
@list l3:level2
	{mso-level-number-format:alpha-lower;
	mso-level-tab-stop:none;
	mso-level-number-position:left;
	text-indent:-.25in;}
@list l3:level3
	{mso-level-number-format:roman-lower;
	mso-level-tab-stop:none;
	mso-level-number-position:right;
	text-indent:-9.0pt;}
@list l3:level4
	{mso-level-tab-stop:none;
	mso-level-number-position:left;
	text-indent:-.25in;}
@list l3:level5
	{mso-level-number-format:alpha-lower;
	mso-level-tab-stop:none;
	mso-level-number-position:left;
	text-indent:-.25in;}
@list l3:level6
	{mso-level-number-format:roman-lower;
	mso-level-tab-stop:none;
	mso-level-number-position:right;
	text-indent:-9.0pt;}
@list l3:level7
	{mso-level-tab-stop:none;
	mso-level-number-position:left;
	text-indent:-.25in;}
@list l3:level8
	{mso-level-number-format:alpha-lower;
	mso-level-tab-stop:none;
	mso-level-number-position:left;
	text-indent:-.25in;}
@list l3:level9
	{mso-level-number-format:roman-lower;
	mso-level-tab-stop:none;
	mso-level-number-position:right;
	text-indent:-9.0pt;}
@list l4
	{mso-list-id:595097563;
	mso-list-type:hybrid;
	mso-list-template-ids:-1072645780 67698689 67698691 67698693 67698689 67698691 67698693 67698689 67698691 67698693;}
@list l4:level1
	{mso-level-number-format:bullet;
	mso-level-text:\F0B7;
	mso-level-tab-stop:none;
	mso-level-number-position:left;
	text-indent:-.25in;
	font-family:Symbol;}
@list l4:level2
	{mso-level-number-format:bullet;
	mso-level-text:o;
	mso-level-tab-stop:none;
	mso-level-number-position:left;
	text-indent:-.25in;
	font-family:"Courier New";}
@list l4:level3
	{mso-level-number-format:bullet;
	mso-level-text:\F0A7;
	mso-level-tab-stop:none;
	mso-level-number-position:left;
	text-indent:-.25in;
	font-family:Wingdings;}
@list l4:level4
	{mso-level-number-format:bullet;
	mso-level-text:\F0B7;
	mso-level-tab-stop:none;
	mso-level-number-position:left;
	text-indent:-.25in;
	font-family:Symbol;}
@list l4:level5
	{mso-level-number-format:bullet;
	mso-level-text:o;
	mso-level-tab-stop:none;
	mso-level-number-position:left;
	text-indent:-.25in;
	font-family:"Courier New";}
@list l4:level6
	{mso-level-number-format:bullet;
	mso-level-text:\F0A7;
	mso-level-tab-stop:none;
	mso-level-number-position:left;
	text-indent:-.25in;
	font-family:Wingdings;}
@list l4:level7
	{mso-level-number-format:bullet;
	mso-level-text:\F0B7;
	mso-level-tab-stop:none;
	mso-level-number-position:left;
	text-indent:-.25in;
	font-family:Symbol;}
@list l4:level8
	{mso-level-number-format:bullet;
	mso-level-text:o;
	mso-level-tab-stop:none;
	mso-level-number-position:left;
	text-indent:-.25in;
	font-family:"Courier New";}
@list l4:level9
	{mso-level-number-format:bullet;
	mso-level-text:\F0A7;
	mso-level-tab-stop:none;
	mso-level-number-position:left;
	text-indent:-.25in;
	font-family:Wingdings;}
@list l5
	{mso-list-id:1026711222;
	mso-list-type:hybrid;
	mso-list-template-ids:-1929239168 67698689 67698691 67698693 67698689 67698691 67698693 67698689 67698691 67698693;}
@list l5:level1
	{mso-level-number-format:bullet;
	mso-level-text:\F0B7;
	mso-level-tab-stop:none;
	mso-level-number-position:left;
	text-indent:-.25in;
	font-family:Symbol;}
@list l5:level2
	{mso-level-number-format:bullet;
	mso-level-text:o;
	mso-level-tab-stop:none;
	mso-level-number-position:left;
	text-indent:-.25in;
	font-family:"Courier New";}
@list l5:level3
	{mso-level-number-format:bullet;
	mso-level-text:\F0A7;
	mso-level-tab-stop:none;
	mso-level-number-position:left;
	text-indent:-.25in;
	font-family:Wingdings;}
@list l5:level4
	{mso-level-number-format:bullet;
	mso-level-text:\F0B7;
	mso-level-tab-stop:none;
	mso-level-number-position:left;
	text-indent:-.25in;
	font-family:Symbol;}
@list l5:level5
	{mso-level-number-format:bullet;
	mso-level-text:o;
	mso-level-tab-stop:none;
	mso-level-number-position:left;
	text-indent:-.25in;
	font-family:"Courier New";}
@list l5:level6
	{mso-level-number-format:bullet;
	mso-level-text:\F0A7;
	mso-level-tab-stop:none;
	mso-level-number-position:left;
	text-indent:-.25in;
	font-family:Wingdings;}
@list l5:level7
	{mso-level-number-format:bullet;
	mso-level-text:\F0B7;
	mso-level-tab-stop:none;
	mso-level-number-position:left;
	text-indent:-.25in;
	font-family:Symbol;}
@list l5:level8
	{mso-level-number-format:bullet;
	mso-level-text:o;
	mso-level-tab-stop:none;
	mso-level-number-position:left;
	text-indent:-.25in;
	font-family:"Courier New";}
@list l5:level9
	{mso-level-number-format:bullet;
	mso-level-text:\F0A7;
	mso-level-tab-stop:none;
	mso-level-number-position:left;
	text-indent:-.25in;
	font-family:Wingdings;}
@list l6
	{mso-list-id:1050617575;
	mso-list-type:hybrid;
	mso-list-template-ids:1478801912 67698689 67698691 67698693 67698689 67698691 67698693 67698689 67698691 67698693;}
@list l6:level1
	{mso-level-number-format:bullet;
	mso-level-text:\F0B7;
	mso-level-tab-stop:none;
	mso-level-number-position:left;
	margin-left:38.25pt;
	text-indent:-.25in;
	font-family:Symbol;}
@list l6:level2
	{mso-level-number-format:bullet;
	mso-level-text:o;
	mso-level-tab-stop:none;
	mso-level-number-position:left;
	margin-left:74.25pt;
	text-indent:-.25in;
	font-family:"Courier New";}
@list l6:level3
	{mso-level-number-format:bullet;
	mso-level-text:\F0A7;
	mso-level-tab-stop:none;
	mso-level-number-position:left;
	margin-left:110.25pt;
	text-indent:-.25in;
	font-family:Wingdings;}
@list l6:level4
	{mso-level-number-format:bullet;
	mso-level-text:\F0B7;
	mso-level-tab-stop:none;
	mso-level-number-position:left;
	margin-left:146.25pt;
	text-indent:-.25in;
	font-family:Symbol;}
@list l6:level5
	{mso-level-number-format:bullet;
	mso-level-text:o;
	mso-level-tab-stop:none;
	mso-level-number-position:left;
	margin-left:182.25pt;
	text-indent:-.25in;
	font-family:"Courier New";}
@list l6:level6
	{mso-level-number-format:bullet;
	mso-level-text:\F0A7;
	mso-level-tab-stop:none;
	mso-level-number-position:left;
	margin-left:218.25pt;
	text-indent:-.25in;
	font-family:Wingdings;}
@list l6:level7
	{mso-level-number-format:bullet;
	mso-level-text:\F0B7;
	mso-level-tab-stop:none;
	mso-level-number-position:left;
	margin-left:254.25pt;
	text-indent:-.25in;
	font-family:Symbol;}
@list l6:level8
	{mso-level-number-format:bullet;
	mso-level-text:o;
	mso-level-tab-stop:none;
	mso-level-number-position:left;
	margin-left:290.25pt;
	text-indent:-.25in;
	font-family:"Courier New";}
@list l6:level9
	{mso-level-number-format:bullet;
	mso-level-text:\F0A7;
	mso-level-tab-stop:none;
	mso-level-number-position:left;
	margin-left:326.25pt;
	text-indent:-.25in;
	font-family:Wingdings;}
@list l7
	{mso-list-id:2101828680;
	mso-list-type:hybrid;
	mso-list-template-ids:211084144 67698703 67698713 67698715 67698703 67698713 67698715 67698703 67698713 67698715;}
@list l7:level1
	{mso-level-tab-stop:none;
	mso-level-number-position:left;
	text-indent:-.25in;}
@list l7:level2
	{mso-level-number-format:alpha-lower;
	mso-level-tab-stop:none;
	mso-level-number-position:left;
	text-indent:-.25in;}
@list l7:level3
	{mso-level-number-format:roman-lower;
	mso-level-tab-stop:none;
	mso-level-number-position:right;
	text-indent:-9.0pt;}
@list l7:level4
	{mso-level-tab-stop:none;
	mso-level-number-position:left;
	text-indent:-.25in;}
@list l7:level5
	{mso-level-number-format:alpha-lower;
	mso-level-tab-stop:none;
	mso-level-number-position:left;
	text-indent:-.25in;}
@list l7:level6
	{mso-level-number-format:roman-lower;
	mso-level-tab-stop:none;
	mso-level-number-position:right;
	text-indent:-9.0pt;}
@list l7:level7
	{mso-level-tab-stop:none;
	mso-level-number-position:left;
	text-indent:-.25in;}
@list l7:level8
	{mso-level-number-format:alpha-lower;
	mso-level-tab-stop:none;
	mso-level-number-position:left;
	text-indent:-.25in;}
@list l7:level9
	{mso-level-number-format:roman-lower;
	mso-level-tab-stop:none;
	mso-level-number-position:right;
	text-indent:-9.0pt;}
ol
	{margin-bottom:0in;}
ul
	{margin-bottom:0in;}
--&gt;
&lt;/STYLE&gt;

&lt;DIV class=WordSection1&gt;
&lt;P class=MsoNoSpacing&gt;I recently received the following question from a customer: &lt;/P&gt;
&lt;P class=MsoNoSpacing&gt;&lt;?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing&gt;“During our test runs (which might run for hours), if a process crashes, we’d like to create full memory dumps for later diagnosis. Can I configure the machine to do this automatically?”&lt;/P&gt;
&lt;P class=MsoNormal&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNormal&gt;I’ve actually gotten this question numerous times over the past couple of years. It comes in various forms but the general scenario is: A user wants to be able to diagnose application crashes and the environment does not lend &lt;SPAN class=GramE&gt;itself&lt;/SPAN&gt; to live debugging. The latter criterion could be for a number of reasons, but the most common I see are:&lt;/P&gt;
&lt;P style="TEXT-INDENT: -0.25in; mso-list: l1 level1 lfo2" class=MsoListParagraphCxSpFirst&gt;&lt;SPAN style="FONT-FAMILY: Symbol; mso-fareast-font-family: Symbol; mso-bidi-font-family: Symbol"&gt;&lt;SPAN style="mso-list: Ignore"&gt;·&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;We have an intermittent failure in production and want to gather a dump to debug the issue offline.&lt;/P&gt;
&lt;P style="TEXT-INDENT: -0.25in; mso-list: l1 level1 lfo2" class=MsoListParagraphCxSpMiddle&gt;&lt;SPAN style="FONT-FAMILY: Symbol; mso-fareast-font-family: Symbol; mso-bidi-font-family: Symbol"&gt;&lt;SPAN style="mso-list: Ignore"&gt;·&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;I’m running a bunch of tests and when one crashes I don’t want to interrupt the whole run to diagnose the issue at failure time. Let’s just gather some information for triaging. &lt;/P&gt;
&lt;P style="TEXT-INDENT: -0.25in; mso-list: l1 level1 lfo2" class=MsoListParagraphCxSpLast&gt;&lt;SPAN style="FONT-FAMILY: Symbol; mso-fareast-font-family: Symbol; mso-bidi-font-family: Symbol"&gt;&lt;SPAN style="mso-list: Ignore"&gt;·&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;Our issue isn’t reproducible under a debugger. E.g. a stress bug.&lt;/P&gt;
&lt;P class=MsoNormal&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNormal&gt;These essentially reduce to: You want to get as much data as you can, while minimizing the impact to the environment. Given these requirements, the solution I find meeting most people’s needs is to configure a just-in-time (JIT) debugger to launch, grab a dump, and exit whenever a process crashes. &lt;/P&gt;
&lt;P class=MsoNormal&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNormal&gt;Support for just-in-time debugging has been in the CLR since V1x and in the OS for as long as I can remember. The basic idea behind a JIT debugger is: when a process crashes, launch and attach a debugger so you can figure out why.&lt;/P&gt;
&lt;P class=MsoNormal&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNormal&gt;There are registry keys which provide this general ability for both managed and native code (support for the latter might actually be in Win.ini for 9x/&lt;SPAN class=GramE&gt;Me&lt;/SPAN&gt;). If your application is written in managed code (which is the case I’m often presented) you might ask, “My application is managed code, why do I care about native code?” Given that even the most simple managed applications run native code (e.g. the runtime itself)&lt;SPAN class=GramE&gt;,&lt;/SPAN&gt; if your requirement is to gather data for any crash, you’ll need to set the keys for both types of code. In CLR V4 we’ve actually unified the key which controls the managed JIT debugger with the native one. However, that change does not change my guidance since, for the time being, we’ll be living in a world where V2 managed code exists alongside V4.&lt;/P&gt;
&lt;P class=MsoNormal&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNormal&gt;&lt;B style="mso-bidi-font-weight: normal"&gt;How do I configure the debugger?&lt;o:p&gt;&lt;/o:p&gt;&lt;/B&gt;&lt;/P&gt;
&lt;P class=MsoNormal&gt;&lt;B style="mso-bidi-font-weight: normal"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/B&gt;&lt;/P&gt;
&lt;P style="TEXT-INDENT: -0.25in; mso-list: l3 level1 lfo3" class=MsoListParagraphCxSpFirst&gt;&lt;SPAN style="mso-fareast-font-family: Calibri"&gt;&lt;SPAN style="mso-list: Ignore"&gt;1.&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;Download and install the latest “Debugging Tools for Windows.”&lt;/P&gt;
&lt;P style="TEXT-INDENT: -0.25in; MARGIN-LEFT: 1in; mso-list: l3 level2 lfo3; mso-add-space: auto" class=MsoListParagraphCxSpMiddle&gt;&lt;SPAN style="mso-fareast-font-family: Calibri"&gt;&lt;SPAN style="mso-list: Ignore"&gt;a.&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;If you’re running a 64-bit OS, you’ll want both the &lt;A href="http://www.microsoft.com/whdc/devtools/debugging/installx86.mspx#a" mce_href="http://www.microsoft.com/whdc/devtools/debugging/installx86.mspx#a"&gt;32-&lt;/A&gt; and &lt;A href="http://www.microsoft.com/whdc/devtools/debugging/install64bit.mspx" mce_href="http://www.microsoft.com/whdc/devtools/debugging/install64bit.mspx"&gt;64-bit&lt;/A&gt; versions*&lt;/P&gt;
&lt;P style="TEXT-INDENT: -0.25in; MARGIN-LEFT: 1in; mso-list: l3 level2 lfo3; mso-add-space: auto" class=MsoListParagraphCxSpLast&gt;&lt;SPAN style="mso-fareast-font-family: Calibri"&gt;&lt;SPAN style="mso-list: Ignore"&gt;b.&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;You can either install the entire set of tools on the machine (it’s a quick, small install) or you can install to one machine and copy “cdb.exe” from the install directory to any number of target machines. &lt;/P&gt;
&lt;P class=MsoNormal&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/P&gt;
&lt;P style="MARGIN-LEFT: 0.5in" class=MsoNormal&gt;&lt;I style="mso-bidi-font-style: normal"&gt;*Note: My sample .&lt;SPAN class=SpellE&gt;reg&lt;/SPAN&gt; files below assume you install the 32-bit debugger to c:\debuggers\x86\ and the 64-bit version to c:\debuggers\x64\.&lt;o:p&gt;&lt;/o:p&gt;&lt;/I&gt;&lt;/P&gt;
&lt;P style="MARGIN-LEFT: 0.5in" class=MsoNormal&gt;&lt;I style="mso-bidi-font-style: normal"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/I&gt;&lt;/P&gt;
&lt;P style="TEXT-INDENT: -0.25in; mso-list: l3 level1 lfo3" class=MsoListParagraphCxSpFirst&gt;&lt;SPAN style="mso-fareast-font-family: Calibri"&gt;&lt;SPAN style="mso-list: Ignore"&gt;2.&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;Create/set the following registry keys and values (If you’re working on a 64-bit version of Windows, you’ll need to set these keys under the Wow6432node as well&lt;SPAN class=GramE&gt;.†&lt;/SPAN&gt;):&lt;/P&gt;
&lt;P style="TEXT-INDENT: -0.25in; MARGIN-LEFT: 1in; mso-list: l3 level2 lfo3; mso-add-space: auto" class=MsoListParagraphCxSpMiddle&gt;&lt;SPAN style="mso-fareast-font-family: Calibri"&gt;&lt;SPAN style="mso-list: Ignore"&gt;a.&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;Key: HKLM\Software\Microsoft\Windows NT\Current Version\&lt;SPAN class=SpellE&gt;AeDebug&lt;/SPAN&gt;:&lt;/P&gt;
&lt;P style="TEXT-INDENT: -1.5in; MARGIN-LEFT: 1.5in; mso-list: l3 level3 lfo3; mso-add-space: auto; mso-text-indent-alt: -9.0pt" class=MsoListParagraphCxSpMiddle&gt;&lt;SPAN style="mso-fareast-font-family: Calibri"&gt;&lt;SPAN style="mso-list: Ignore"&gt;&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;i.&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;Value: “Debugger”&lt;/P&gt;
&lt;P style="TEXT-INDENT: -0.25in; MARGIN-LEFT: 2in; mso-list: l3 level4 lfo3; mso-add-space: auto" class=MsoListParagraphCxSpMiddle&gt;&lt;SPAN style="mso-fareast-font-family: Calibri"&gt;&lt;SPAN style="mso-list: Ignore"&gt;1.&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;Type: String&lt;/P&gt;
&lt;P style="TEXT-INDENT: -0.25in; MARGIN-LEFT: 2in; mso-list: l3 level4 lfo3; mso-add-space: auto" class=MsoListParagraphCxSpMiddle&gt;&lt;SPAN style="mso-fareast-font-family: Calibri"&gt;&lt;SPAN style="mso-list: Ignore"&gt;2.&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;Value data: &lt;I style="mso-bidi-font-style: normal"&gt;&amp;lt;path to &lt;SPAN class=SpellE&gt;cdb&lt;/SPAN&gt;&amp;gt;&lt;/I&gt; -&lt;SPAN class=SpellE&gt;pv&lt;/SPAN&gt; -p %&lt;SPAN class=SpellE&gt;ld&lt;/SPAN&gt; -c “.dump /u /ma &lt;I style="mso-bidi-font-style: normal"&gt;&amp;lt;dump file path\&lt;SPAN class=SpellE&gt;name.dmp&lt;/SPAN&gt;&amp;gt;&lt;/I&gt;;.&lt;SPAN class=SpellE&gt;kill;qd&lt;/SPAN&gt;"&lt;/P&gt;
&lt;P style="TEXT-INDENT: -1.5in; MARGIN-LEFT: 1.5in; mso-list: l3 level3 lfo3; mso-add-space: auto; mso-text-indent-alt: -9.0pt" class=MsoListParagraphCxSpMiddle&gt;&lt;SPAN style="mso-fareast-font-family: Calibri"&gt;&lt;SPAN style="mso-list: Ignore"&gt;&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;ii.&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;Value: “Auto”&lt;/P&gt;
&lt;P style="TEXT-INDENT: -0.25in; MARGIN-LEFT: 2in; mso-list: l3 level4 lfo3; mso-add-space: auto" class=MsoListParagraphCxSpMiddle&gt;&lt;SPAN style="mso-fareast-font-family: Calibri"&gt;&lt;SPAN style="mso-list: Ignore"&gt;1.&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;Type: String&lt;/P&gt;
&lt;P style="TEXT-INDENT: -0.25in; MARGIN-LEFT: 2in; mso-list: l3 level4 lfo3; mso-add-space: auto" class=MsoListParagraphCxSpMiddle&gt;&lt;SPAN style="mso-fareast-font-family: Calibri"&gt;&lt;SPAN style="mso-list: Ignore"&gt;2.&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;Value data: “1”&lt;SPAN style="mso-tab-count: 1"&gt; &lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="TEXT-INDENT: -0.25in; MARGIN-LEFT: 1in; mso-list: l3 level2 lfo3; mso-add-space: auto" class=MsoListParagraphCxSpMiddle&gt;&lt;SPAN style="mso-fareast-font-family: Calibri"&gt;&lt;SPAN style="mso-list: Ignore"&gt;b.&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;Key: HKLM\Software\Microsoft\.&lt;SPAN class=SpellE&gt;NETFramework&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="TEXT-INDENT: -1.5in; MARGIN-LEFT: 1.5in; mso-list: l3 level3 lfo3; mso-add-space: auto; mso-text-indent-alt: -9.0pt" class=MsoListParagraphCxSpMiddle&gt;&lt;SPAN style="mso-fareast-font-family: Calibri"&gt;&lt;SPAN style="mso-list: Ignore"&gt;&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;i.&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;Value: “&lt;SPAN class=SpellE&gt;DbgManagedDebugger&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="TEXT-INDENT: -0.25in; MARGIN-LEFT: 2in; mso-list: l3 level4 lfo3; mso-add-space: auto" class=MsoListParagraphCxSpMiddle&gt;&lt;SPAN style="mso-fareast-font-family: Calibri"&gt;&lt;SPAN style="mso-list: Ignore"&gt;1.&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;Type: String&lt;/P&gt;
&lt;P style="TEXT-INDENT: -0.25in; MARGIN-LEFT: 2in; mso-list: l3 level4 lfo3; mso-add-space: auto" class=MsoListParagraphCxSpMiddle&gt;&lt;SPAN style="mso-fareast-font-family: Calibri"&gt;&lt;SPAN style="mso-list: Ignore"&gt;2.&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;Value data: &lt;I style="mso-bidi-font-style: normal"&gt;&amp;lt;path to &lt;SPAN class=SpellE&gt;cdb&lt;/SPAN&gt;&amp;gt;&lt;/I&gt; -&lt;SPAN class=SpellE&gt;pv&lt;/SPAN&gt; -p %&lt;SPAN class=SpellE&gt;ld&lt;/SPAN&gt; -c ".dump /u /ma &lt;I style="mso-bidi-font-style: normal"&gt;&amp;lt;dump file path\&lt;SPAN class=SpellE&gt;name.dmp&lt;/SPAN&gt;&amp;gt;&lt;/I&gt;;.&lt;SPAN class=SpellE&gt;kill;qd&lt;/SPAN&gt;"&lt;/P&gt;
&lt;P style="TEXT-INDENT: -1.5in; MARGIN-LEFT: 1.5in; mso-list: l3 level3 lfo3; mso-add-space: auto; mso-text-indent-alt: -9.0pt" class=MsoListParagraphCxSpMiddle&gt;&lt;SPAN style="mso-fareast-font-family: Calibri"&gt;&lt;SPAN style="mso-list: Ignore"&gt;&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;ii.&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;Value: &lt;SPAN class=SpellE&gt;DbgJITDebugLaunchSetting&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="TEXT-INDENT: -0.25in; MARGIN-LEFT: 2in; mso-list: l3 level4 lfo3; mso-add-space: auto" class=MsoListParagraphCxSpMiddle&gt;&lt;SPAN style="mso-fareast-font-family: Calibri"&gt;&lt;SPAN style="mso-list: Ignore"&gt;1.&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;Type: DWORD (32-bit)&lt;/P&gt;
&lt;P style="TEXT-INDENT: -0.25in; MARGIN-LEFT: 2in; mso-list: l3 level4 lfo3; mso-add-space: auto" class=MsoListParagraphCxSpLast&gt;&lt;SPAN style="mso-fareast-font-family: Calibri"&gt;&lt;SPAN style="mso-list: Ignore"&gt;2.&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;Value data: 2&lt;/P&gt;
&lt;P class=MsoNormal&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/P&gt;
&lt;P style="MARGIN-LEFT: 0.5in" class=MsoNormal&gt;†&lt;I style="mso-bidi-font-style: normal"&gt;Note: You should set the keys to point to the appropriate “&lt;SPAN class=SpellE&gt;bitness&lt;/SPAN&gt;” debugger. I.e. you want the OS/CLR to launch the 64-bit debugger for 64-bit process crashes and the 32-bit version for 32-bit crashes. Make sure your debugger paths are set accordingly.&lt;o:p&gt;&lt;/o:p&gt;&lt;/I&gt;&lt;/P&gt;
&lt;P class=MsoNormal&gt;&lt;I style="mso-bidi-font-style: normal"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/I&gt;&lt;/P&gt;
&lt;P class=MsoNormal&gt;The following sample .&lt;SPAN class=SpellE&gt;reg&lt;/SPAN&gt; file will set cdb.exe to auto-launch and generate a crash dump for every process crash on the machine. Note the assumptions the file makes about debugger paths and the dump-file-placement path.&lt;/P&gt;
&lt;P class=MsoNormal&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/P&gt;
&lt;TABLE style="BORDER-BOTTOM: medium none; BORDER-LEFT: medium none; BORDER-COLLAPSE: collapse; BORDER-TOP: medium none; BORDER-RIGHT: medium none; mso-border-alt: solid black .5pt; mso-border-themecolor: text1; mso-yfti-tbllook: 1184; mso-padding-alt: 0in 5.4pt 0in 5.4pt" class=MsoTableGrid border=1 cellSpacing=0 cellPadding=0 class="MsoTableGrid"&gt;
&lt;TBODY&gt;
&lt;TR style="mso-yfti-irow: 0; mso-yfti-firstrow: yes; mso-yfti-lastrow: yes"&gt;
&lt;TD style="BORDER-BOTTOM: medium none; BORDER-LEFT: medium none; PADDING-BOTTOM: 0in; PADDING-LEFT: 5.4pt; WIDTH: 6.65in; PADDING-RIGHT: 5.4pt; BACKGROUND: #d9d9d9; BORDER-TOP: medium none; BORDER-RIGHT: medium none; PADDING-TOP: 0in; mso-background-themecolor: background1; mso-background-themeshade: 217" vAlign=top width=638&gt;
&lt;P class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: Consolas; FONT-SIZE: 10pt"&gt;Windows Registry Editor Version 5.00&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: Consolas; FONT-SIZE: 10pt"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal&gt;&lt;SPAN class=GramE&gt;&lt;SPAN style="FONT-FAMILY: Consolas; FONT-SIZE: 10pt"&gt;;This&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: Consolas; FONT-SIZE: 10pt"&gt; &lt;SPAN class=SpellE&gt;reg&lt;/SPAN&gt; file installs just-in-time debuggers to capture a dump of all process&lt;BR&gt;;crashes for the machine.&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: Consolas; FONT-SIZE: 10pt"&gt;;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal&gt;&lt;SPAN class=GramE&gt;&lt;SPAN style="FONT-FAMILY: Consolas; FONT-SIZE: 10pt"&gt;;Assumes&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: Consolas; FONT-SIZE: 10pt"&gt; 32-bit debugger is cdb.exe and is installed to c:\debuggers\x86\.&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal&gt;&lt;SPAN class=GramE&gt;&lt;SPAN style="FONT-FAMILY: Consolas; FONT-SIZE: 10pt"&gt;;Assumes&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: Consolas; FONT-SIZE: 10pt"&gt; 64-bit debugger is cdb.exe and is installed to c:\debuggers\x64\.&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: Consolas; FONT-SIZE: 10pt"&gt;;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal&gt;&lt;SPAN class=GramE&gt;&lt;SPAN style="FONT-FAMILY: Consolas; FONT-SIZE: 10pt"&gt;;Assumes&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: Consolas; FONT-SIZE: 10pt"&gt; crash dumps can be written to c:\crash_dumps\. &lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal&gt;&lt;SPAN class=GramE&gt;&lt;SPAN style="FONT-FAMILY: Consolas; FONT-SIZE: 10pt"&gt;;Make&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: Consolas; FONT-SIZE: 10pt"&gt; sure all users have write access to this directory.&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: Consolas; FONT-SIZE: 10pt"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: Consolas; FONT-SIZE: 10pt"&gt;[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.&lt;SPAN class=SpellE&gt;NETFramework&lt;/SPAN&gt;]&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: Consolas; FONT-SIZE: 10pt"&gt;"&lt;SPAN class=SpellE&gt;DbgManagedDebugger&lt;/SPAN&gt;"="\"c:\\debuggers\\x64\\cdb.exe\" -&lt;SPAN class=SpellE&gt;pv&lt;/SPAN&gt; -p %&lt;SPAN class=SpellE&gt;ld&lt;/SPAN&gt; -c \".dump /u /ma c:\\crash_dumps\\crash.dmp;.kill;qd\""&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: Consolas; FONT-SIZE: 10pt"&gt;"&lt;SPAN class=SpellE&gt;DbgJITDebugLaunchSetting&lt;/SPAN&gt;"=dword:00000002&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: Consolas; FONT-SIZE: 10pt"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: Consolas; FONT-SIZE: 10pt"&gt;[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\&lt;SPAN class=SpellE&gt;CurrentVersion&lt;/SPAN&gt;\&lt;SPAN class=SpellE&gt;AeDebug&lt;/SPAN&gt;]&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: Consolas; FONT-SIZE: 10pt"&gt;"Debugger"="\"c:\\debuggers\\x64\\cdb.exe\" -&lt;SPAN class=SpellE&gt;pv&lt;/SPAN&gt; -p %&lt;SPAN class=SpellE&gt;ld&lt;/SPAN&gt; -c \".dump /u /ma c:\\crash_dumps\\crash.dmp;.kill;qd\""&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: Consolas; FONT-SIZE: 10pt"&gt;"Auto"="1"&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: Consolas; FONT-SIZE: 10pt"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal&gt;&lt;SPAN class=GramE&gt;&lt;SPAN style="FONT-FAMILY: Consolas; FONT-SIZE: 10pt"&gt;;The&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: Consolas; FONT-SIZE: 10pt"&gt; following keys are only used on 64-bit versions of Windows (note Wow6432Node).&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal&gt;&lt;SPAN class=GramE&gt;&lt;SPAN style="FONT-FAMILY: Consolas; FONT-SIZE: 10pt"&gt;;They&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: Consolas; FONT-SIZE: 10pt"&gt; can be safely created with no side-effects on 32-bit versions of Windows.&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: Consolas; FONT-SIZE: 10pt"&gt;;Alternatively, you can delete the remainder of this file if you’re running a &lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal&gt;&lt;SPAN class=GramE&gt;&lt;SPAN style="FONT-FAMILY: Consolas; FONT-SIZE: 10pt"&gt;;32&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: Consolas; FONT-SIZE: 10pt"&gt;-bit version of Windows.&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: Consolas; FONT-SIZE: 10pt"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: Consolas; FONT-SIZE: 10pt"&gt;[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows NT\&lt;SPAN class=SpellE&gt;CurrentVersion&lt;/SPAN&gt;\&lt;SPAN class=SpellE&gt;AeDebug&lt;/SPAN&gt;]&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: Consolas; FONT-SIZE: 10pt"&gt;"Debugger"="\"c:\\debuggers\\x86\\cdb.exe\" -&lt;SPAN class=SpellE&gt;pv&lt;/SPAN&gt; -p %&lt;SPAN class=SpellE&gt;ld&lt;/SPAN&gt; -c \".dump /u /ma c:\\crash_dumps\\crash.dmp;.kill;qd\""&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: Consolas; FONT-SIZE: 10pt"&gt;"Auto"="1"&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: Consolas; FONT-SIZE: 10pt"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: Consolas; FONT-SIZE: 10pt"&gt;[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\.NETFramework]&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: Consolas; FONT-SIZE: 10pt"&gt;"&lt;SPAN class=SpellE&gt;DbgManagedDebugger&lt;/SPAN&gt;"="\"c:\\debuggers\\x86\\cdb.exe\" -&lt;SPAN class=SpellE&gt;pv&lt;/SPAN&gt; -p %&lt;SPAN class=SpellE&gt;ld&lt;/SPAN&gt; -c \".dump /u /ma c:\\crash_dumps\\crash.dmp;.kill;qd\""&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: Consolas; FONT-SIZE: 10pt"&gt;"&lt;SPAN class=SpellE&gt;DbgJITDebugLaunchSetting&lt;/SPAN&gt;"=dword:00000002&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;
&lt;P class=MsoNormal&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNormal&gt;&lt;B style="mso-bidi-font-weight: normal"&gt;What do these keys do?&lt;o:p&gt;&lt;/o:p&gt;&lt;/B&gt;&lt;/P&gt;
&lt;P class=MsoNormal&gt;&lt;B style="mso-bidi-font-weight: normal"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/B&gt;&lt;/P&gt;
&lt;P class=MsoNormal&gt;The “Debugger” and “&lt;SPAN class=SpellE&gt;DbgManagedDebugger&lt;/SPAN&gt;” value data are basically command lines (&lt;SPAN class=SpellE&gt;printf&lt;/SPAN&gt; format strings) that are run when a process crashes. The OS or CLR will substitute values for the format &lt;SPAN class=SpellE&gt;specifiers&lt;/SPAN&gt; (e.g. in the case above it substitutes the crashing process ID for the “%&lt;SPAN class=SpellE&gt;&lt;SPAN class=GramE&gt;ld&lt;/SPAN&gt;&lt;/SPAN&gt;”) and run the command in the user context of the crashing process. The command line I’ve supplied:&lt;BR style="mso-special-character: line-break"&gt;&lt;BR style="mso-special-character: line-break"&gt;&lt;/P&gt;
&lt;P style="TEXT-INDENT: -0.25in; MARGIN-LEFT: 38.25pt; mso-list: l6 level1 lfo4; mso-add-space: auto" class=MsoListParagraphCxSpFirst&gt;&lt;SPAN style="FONT-FAMILY: Symbol; mso-fareast-font-family: Symbol; mso-bidi-font-family: Symbol"&gt;&lt;SPAN style="mso-list: Ignore"&gt;·&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN class=GramE&gt;launches&lt;/SPAN&gt; cdb.exe, the debugger.&lt;/P&gt;
&lt;P style="TEXT-INDENT: -0.25in; MARGIN-LEFT: 74.25pt; mso-list: l6 level2 lfo4; mso-add-space: auto" class=MsoListParagraphCxSpMiddle&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; mso-fareast-font-family: 'Courier New'"&gt;&lt;SPAN style="mso-list: Ignore"&gt;o&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;Obviously, you must specify the correct path to the debugger.&lt;/P&gt;
&lt;P style="TEXT-INDENT: -0.25in; MARGIN-LEFT: 38.25pt; mso-list: l6 level1 lfo4; mso-add-space: auto" class=MsoListParagraphCxSpMiddle&gt;&lt;SPAN style="FONT-FAMILY: Symbol; mso-fareast-font-family: Symbol; mso-bidi-font-family: Symbol"&gt;&lt;SPAN style="mso-list: Ignore"&gt;·&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;“-&lt;SPAN class=SpellE&gt;pv&lt;/SPAN&gt; %&lt;SPAN class=SpellE&gt;ld&lt;/SPAN&gt;&lt;SPAN class=GramE&gt;” :&lt;/SPAN&gt; Attaches non-invasively (just suspends the threads) to the crashing process (the OS or the CLR will actually fill in the PID for you).&lt;/P&gt;
&lt;P style="TEXT-INDENT: -0.25in; MARGIN-LEFT: 38.25pt; mso-list: l6 level1 lfo4; mso-add-space: auto" class=MsoListParagraphCxSpMiddle&gt;&lt;SPAN style="FONT-FAMILY: Symbol; mso-fareast-font-family: Symbol; mso-bidi-font-family: Symbol"&gt;&lt;SPAN style="mso-list: Ignore"&gt;·&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;“.dump /u /ma &lt;I style="mso-bidi-font-style: normal"&gt;&amp;lt;dump file path\&lt;SPAN class=SpellE&gt;name.dmp&lt;/SPAN&gt;&amp;gt;&lt;/I&gt;”: &lt;SPAN style="mso-spacerun: yes"&gt;&lt;/SPAN&gt;Takes a full memory dump with a unique name (appends the date, time and process ID) and stores it in the path defined.&lt;/P&gt;
&lt;P style="TEXT-INDENT: -0.25in; MARGIN-LEFT: 74.25pt; mso-list: l6 level2 lfo4; mso-add-space: auto" class=MsoListParagraphCxSpMiddle&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; mso-fareast-font-family: 'Courier New'"&gt;&lt;SPAN style="mso-list: Ignore"&gt;o&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;The path and file name can be whatever you want them to be. Since the debugger is launched in the context of the crashing process, make sure the path points to a location all accounts can write to.&lt;/P&gt;
&lt;P style="TEXT-INDENT: -0.25in; MARGIN-LEFT: 38.25pt; mso-list: l6 level1 lfo4; mso-add-space: auto" class=MsoListParagraphCxSpMiddle&gt;&lt;SPAN style="FONT-FAMILY: Symbol; mso-fareast-font-family: Symbol; mso-bidi-font-family: Symbol"&gt;&lt;SPAN style="mso-list: Ignore"&gt;·&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;“.kill”: Kills the target process (you’ve gotten the data you need).&lt;/P&gt;
&lt;P style="TEXT-INDENT: -0.25in; MARGIN-LEFT: 38.25pt; mso-list: l6 level1 lfo4; mso-add-space: auto" class=MsoListParagraphCxSpLast&gt;&lt;SPAN style="FONT-FAMILY: Symbol; mso-fareast-font-family: Symbol; mso-bidi-font-family: Symbol"&gt;&lt;SPAN style="mso-list: Ignore"&gt;·&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;“&lt;SPAN class=SpellE&gt;&lt;SPAN class=GramE&gt;qd&lt;/SPAN&gt;&lt;/SPAN&gt;”: Quits the debugger.&lt;/P&gt;
&lt;P class=MsoNormal&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNormal&gt;The “Auto” and “&lt;SPAN class=SpellE&gt;DbgJITDebugLaunchSetting&lt;/SPAN&gt;” values set the policy for when to launch the debugger. As I wrote above, we want to get our data as quickly as possible and move on, so we don’t want to require any user intervention. For example, in the server scenario, there may be no one logged into the machine to click some “OK” button. The settings I described will automatically launch the registered debugger for all processes on the machine, without prompting (see &lt;A href="http://msdn.microsoft.com/en-us/library/2ac5yxx6.aspx" mce_href="http://msdn.microsoft.com/en-us/library/2ac5yxx6.aspx"&gt;Enabling JIT-attach &lt;SPAN class=GramE&gt;Debugging&lt;/SPAN&gt;&lt;/A&gt; for more details on the settings). Note that when these settings are in place, the debugger will be launched for crashes in all processes running on the machine and you will not have the option of submitting the crash through “Windows Error Reporting.” In future posts I’ll discuss ways of enabling both.&lt;/P&gt;
&lt;P class=MsoNormal&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNormal&gt;&lt;B style="mso-bidi-font-weight: normal"&gt;I don’t care about most processes on a machine. Can I just target specific ones?&lt;o:p&gt;&lt;/o:p&gt;&lt;/B&gt;&lt;/P&gt;
&lt;P class=MsoNormal&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNormal&gt;The answer depends on the version of the OS and the version of CLR. Here are the rules:&lt;/P&gt;
&lt;P style="TEXT-INDENT: -0.25in; mso-list: l4 level1 lfo5" class=MsoListParagraphCxSpFirst&gt;&lt;SPAN style="FONT-FAMILY: Symbol; mso-fareast-font-family: Symbol; mso-bidi-font-family: Symbol"&gt;&lt;SPAN style="mso-list: Ignore"&gt;·&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;For native code: your OS must be Vista/Server 2008 or higher.&lt;/P&gt;
&lt;P style="TEXT-INDENT: -0.25in; mso-list: l4 level1 lfo5" class=MsoListParagraphCxSpLast&gt;&lt;SPAN style="FONT-FAMILY: Symbol; mso-fareast-font-family: Symbol; mso-bidi-font-family: Symbol"&gt;&lt;SPAN style="mso-list: Ignore"&gt;·&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;For managed code: Your version of the CLR must be V4 (or higher, if you’re reading this from the future). &lt;/P&gt;
&lt;P class=MsoNormal&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNormal&gt;And here is how you configure:&lt;BR style="mso-special-character: line-break"&gt;&lt;BR style="mso-special-character: line-break"&gt;&lt;/P&gt;
&lt;P style="TEXT-INDENT: -0.25in; mso-list: l7 level1 lfo8" class=MsoListParagraphCxSpFirst&gt;&lt;SPAN style="mso-fareast-font-family: Calibri"&gt;&lt;SPAN style="mso-list: Ignore"&gt;1.&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;Set the debugger keys (&lt;SPAN class=SpellE&gt;AeDebug&lt;/SPAN&gt;\Debugger and .&lt;SPAN class=SpellE&gt;NETFramework&lt;/SPAN&gt;\&lt;SPAN class=SpellE&gt;DbgManagedDebugger&lt;/SPAN&gt;) just as you did in 2.a.i and 2.b.i, above.&lt;SPAN style="mso-spacerun: yes"&gt; &lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="TEXT-INDENT: -0.25in; mso-list: l7 level1 lfo8" class=MsoListParagraphCxSpMiddle&gt;&lt;SPAN style="mso-fareast-font-family: Calibri"&gt;&lt;SPAN style="mso-list: Ignore"&gt;2.&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;Ensure &lt;SPAN class=SpellE&gt;AeDebug&lt;/SPAN&gt;\Auto and .&lt;SPAN class=SpellE&gt;NETFramework&lt;/SPAN&gt;\&lt;SPAN class=SpellE&gt;DbgJITDebugLaunchSetting&lt;/SPAN&gt; are not set to auto-launch (again, see &lt;A href="http://msdn.microsoft.com/en-us/library/2ac5yxx6.aspx" mce_href="http://msdn.microsoft.com/en-us/library/2ac5yxx6.aspx"&gt;Enabling JIT-attach Debugging&lt;/A&gt; for more details on the settings).&lt;/P&gt;
&lt;P style="TEXT-INDENT: -0.25in; MARGIN-LEFT: 1in; mso-list: l7 level2 lfo8; mso-add-space: auto" class=MsoListParagraphCxSpMiddle&gt;&lt;SPAN style="mso-fareast-font-family: Calibri"&gt;&lt;SPAN style="mso-list: Ignore"&gt;a.&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;Or you can delete them.&lt;/P&gt;
&lt;P style="TEXT-INDENT: -0.25in; mso-list: l7 level1 lfo8" class=MsoListParagraphCxSpMiddle&gt;&lt;SPAN style="mso-fareast-font-family: Calibri"&gt;&lt;SPAN style="mso-list: Ignore"&gt;3.&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;Create the following registry keys and values:&lt;/P&gt;
&lt;P style="TEXT-INDENT: -0.25in; MARGIN-LEFT: 1in; mso-list: l7 level2 lfo8; mso-add-space: auto" class=MsoListParagraphCxSpMiddle&gt;&lt;SPAN style="mso-fareast-font-family: Calibri"&gt;&lt;SPAN style="mso-list: Ignore"&gt;a.&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;HKLM\Software\Microsoft\Windows\Windows Error Reporting\&lt;SPAN class=SpellE&gt;DebugApplications&lt;/SPAN&gt; &lt;/P&gt;
&lt;P style="TEXT-INDENT: -1.5in; MARGIN-LEFT: 1.5in; mso-list: l7 level3 lfo8; mso-add-space: auto; mso-text-indent-alt: -9.0pt" class=MsoListParagraphCxSpMiddle&gt;&lt;SPAN style="mso-fareast-font-family: Calibri"&gt;&lt;SPAN style="mso-list: Ignore"&gt;&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;i.&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;Value: &amp;lt;Name of application executable&amp;gt; (e.g. “myapp.exe”)&lt;/P&gt;
&lt;P style="TEXT-INDENT: -0.25in; MARGIN-LEFT: 2in; mso-list: l7 level4 lfo8; mso-add-space: auto" class=MsoListParagraphCxSpMiddle&gt;&lt;SPAN style="mso-fareast-font-family: Calibri"&gt;&lt;SPAN style="mso-list: Ignore"&gt;1.&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;Type: DWORD (32-bit)&lt;/P&gt;
&lt;P style="TEXT-INDENT: -0.25in; MARGIN-LEFT: 2in; mso-list: l7 level4 lfo8; mso-add-space: auto" class=MsoListParagraphCxSpMiddle&gt;&lt;SPAN style="mso-fareast-font-family: Calibri"&gt;&lt;SPAN style="mso-list: Ignore"&gt;2.&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;Value data: 1&lt;/P&gt;
&lt;P style="TEXT-INDENT: -0.25in; MARGIN-LEFT: 1in; mso-list: l7 level2 lfo8; mso-add-space: auto" class=MsoListParagraphCxSpLast&gt;&lt;SPAN style="mso-fareast-font-family: Calibri"&gt;&lt;SPAN style="mso-list: Ignore"&gt;b.&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;Repeat this for each application you want the debugger to be auto-launched.&lt;/P&gt;
&lt;P class=MsoNormal&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNormal&gt;You can set the &lt;SPAN class=SpellE&gt;DebugApplications&lt;/SPAN&gt; key and values in HKCU if you prefer per-user control. When these settings are in effect the debugger will be launched for only the processes you specify and normal error handling will occur for all other processes (e.g. for most default configurations, a prompt to submit an error report to Microsoft).&lt;/P&gt;
&lt;P class=MsoNormal&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNormal&gt;The following sample .&lt;SPAN class=SpellE&gt;reg&lt;/SPAN&gt; file will set cdb.exe to be auto-launched only for HelloWorld.exe. Replace HelloWorld.exe with the name(s) of the application(s) for which you’re interested in generating crash dumps.&lt;/P&gt;
&lt;P class=MsoNormal&gt;&lt;I style="mso-bidi-font-style: normal"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/I&gt;&lt;/P&gt;
&lt;TABLE style="BORDER-BOTTOM: medium none; BORDER-LEFT: medium none; BORDER-COLLAPSE: collapse; BORDER-TOP: medium none; BORDER-RIGHT: medium none; mso-border-alt: solid black .5pt; mso-border-themecolor: text1; mso-yfti-tbllook: 1184; mso-padding-alt: 0in 5.4pt 0in 5.4pt" class=MsoTableGrid border=1 cellSpacing=0 cellPadding=0 class="MsoTableGrid"&gt;
&lt;TBODY&gt;
&lt;TR style="mso-yfti-irow: 0; mso-yfti-firstrow: yes; mso-yfti-lastrow: yes"&gt;
&lt;TD style="BORDER-BOTTOM: medium none; BORDER-LEFT: medium none; PADDING-BOTTOM: 0in; PADDING-LEFT: 5.4pt; WIDTH: 477pt; PADDING-RIGHT: 5.4pt; BACKGROUND: #d9d9d9; BORDER-TOP: medium none; BORDER-RIGHT: medium none; PADDING-TOP: 0in; mso-background-themecolor: background1; mso-background-themeshade: 217" vAlign=top width=636&gt;
&lt;P style="BACKGROUND: #d9d9d9; mso-background-themecolor: background1; mso-background-themeshade: 217" class=MsoNoSpacing&gt;&lt;SPAN style="FONT-FAMILY: Consolas; FONT-SIZE: 10pt"&gt;Windows Registry Editor Version 5.00&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="BACKGROUND: #d9d9d9; mso-background-themecolor: background1; mso-background-themeshade: 217" class=MsoNoSpacing&gt;&lt;SPAN style="FONT-FAMILY: Consolas; FONT-SIZE: 10pt"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="BACKGROUND: #d9d9d9; mso-background-themecolor: background1; mso-background-themeshade: 217" class=MsoNoSpacing&gt;&lt;SPAN class=GramE&gt;&lt;SPAN style="FONT-FAMILY: Consolas; FONT-SIZE: 10pt"&gt;;This&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: Consolas; FONT-SIZE: 10pt"&gt; &lt;SPAN class=SpellE&gt;reg&lt;/SPAN&gt; file installs just-in-time debuggers to capture a dump of only the&lt;BR&gt;;processes listed under the [&lt;SPAN class=SpellE&gt;DebugApplications&lt;/SPAN&gt;] key, below.&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="BACKGROUND: #d9d9d9; mso-background-themecolor: background1; mso-background-themeshade: 217" class=MsoNoSpacing&gt;&lt;SPAN style="FONT-FAMILY: Consolas; FONT-SIZE: 10pt"&gt;;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="BACKGROUND: #d9d9d9; mso-background-themecolor: background1; mso-background-themeshade: 217" class=MsoNoSpacing&gt;&lt;SPAN class=GramE&gt;&lt;SPAN style="FONT-FAMILY: Consolas; FONT-SIZE: 10pt"&gt;;Assumes&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: Consolas; FONT-SIZE: 10pt"&gt; 32-bit debugger is cdb.exe and is installed to c:\debuggers\x86\.&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="BACKGROUND: #d9d9d9; mso-background-themecolor: background1; mso-background-themeshade: 217" class=MsoNoSpacing&gt;&lt;SPAN class=GramE&gt;&lt;SPAN style="FONT-FAMILY: Consolas; FONT-SIZE: 10pt"&gt;;Assumes&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: Consolas; FONT-SIZE: 10pt"&gt; 64-bit debugger is cdb.exe and is installed to c:\debuggers\x64\.&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="BACKGROUND: #d9d9d9; mso-background-themecolor: background1; mso-background-themeshade: 217" class=MsoNoSpacing&gt;&lt;SPAN style="FONT-FAMILY: Consolas; FONT-SIZE: 10pt"&gt;;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="BACKGROUND: #d9d9d9; mso-background-themecolor: background1; mso-background-themeshade: 217" class=MsoNoSpacing&gt;&lt;SPAN class=GramE&gt;&lt;SPAN style="FONT-FAMILY: Consolas; FONT-SIZE: 10pt"&gt;;Assumes&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: Consolas; FONT-SIZE: 10pt"&gt; crash dumps can be written to c:\crash_dumps\. &lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="BACKGROUND: #d9d9d9; mso-background-themecolor: background1; mso-background-themeshade: 217" class=MsoNoSpacing&gt;&lt;SPAN class=GramE&gt;&lt;SPAN style="FONT-FAMILY: Consolas; FONT-SIZE: 10pt"&gt;;Make&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: Consolas; FONT-SIZE: 10pt"&gt; sure all users have write access to this directory.&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="BACKGROUND: #d9d9d9; mso-background-themecolor: background1; mso-background-themeshade: 217" class=MsoNoSpacing&gt;&lt;SPAN style="FONT-FAMILY: Consolas; FONT-SIZE: 10pt"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="BACKGROUND: #d9d9d9; mso-background-themecolor: background1; mso-background-themeshade: 217" class=MsoNoSpacing&gt;&lt;SPAN style="FONT-FAMILY: Consolas; FONT-SIZE: 10pt"&gt;[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.&lt;SPAN class=SpellE&gt;NETFramework&lt;/SPAN&gt;]&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="BACKGROUND: #d9d9d9; mso-background-themecolor: background1; mso-background-themeshade: 217" class=MsoNoSpacing&gt;&lt;SPAN style="FONT-FAMILY: Consolas; FONT-SIZE: 10pt"&gt;"&lt;SPAN class=SpellE&gt;DbgManagedDebugger&lt;/SPAN&gt;"="\"c:\\debuggers\\x64\\cdb.exe\" -&lt;SPAN class=SpellE&gt;pv&lt;/SPAN&gt; -p %&lt;SPAN class=SpellE&gt;ld&lt;/SPAN&gt; -c \".dump /u /ma c:\\crash_dumps\\crash.dmp;.kill;qd\""&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="BACKGROUND: #d9d9d9; mso-background-themecolor: background1; mso-background-themeshade: 217" class=MsoNoSpacing&gt;&lt;SPAN style="FONT-FAMILY: Consolas; FONT-SIZE: 10pt"&gt;"&lt;SPAN class=SpellE&gt;DbgJITDebugLaunchSetting&lt;/SPAN&gt;"=dword:00000000&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="BACKGROUND: #d9d9d9; mso-background-themecolor: background1; mso-background-themeshade: 217" class=MsoNoSpacing&gt;&lt;SPAN style="FONT-FAMILY: Consolas; FONT-SIZE: 10pt"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="BACKGROUND: #d9d9d9; mso-background-themecolor: background1; mso-background-themeshade: 217" class=MsoNoSpacing&gt;&lt;SPAN style="FONT-FAMILY: Consolas; FONT-SIZE: 10pt"&gt;[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\&lt;SPAN class=SpellE&gt;CurrentVersion&lt;/SPAN&gt;\&lt;SPAN class=SpellE&gt;AeDebug&lt;/SPAN&gt;]&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="BACKGROUND: #d9d9d9; mso-background-themecolor: background1; mso-background-themeshade: 217" class=MsoNoSpacing&gt;&lt;SPAN style="FONT-FAMILY: Consolas; FONT-SIZE: 10pt"&gt;"Debugger"="\"c:\\debuggers\\x64\\cdb.exe\" -&lt;SPAN class=SpellE&gt;pv&lt;/SPAN&gt; -p %&lt;SPAN class=SpellE&gt;ld&lt;/SPAN&gt; -c \".dump /u /ma c:\\crash_dumps\\crash.dmp;.kill;qd\""&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="BACKGROUND: #d9d9d9; mso-background-themecolor: background1; mso-background-themeshade: 217" class=MsoNoSpacing&gt;&lt;SPAN style="FONT-FAMILY: Consolas; FONT-SIZE: 10pt"&gt;"Auto"="0"&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="BACKGROUND: #d9d9d9; mso-background-themecolor: background1; mso-background-themeshade: 217" class=MsoNoSpacing&gt;&lt;SPAN style="FONT-FAMILY: Consolas; FONT-SIZE: 10pt"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="BACKGROUND: #d9d9d9; mso-background-themecolor: background1; mso-background-themeshade: 217" class=MsoNoSpacing&gt;&lt;SPAN class=GramE&gt;&lt;SPAN style="FONT-FAMILY: Consolas; FONT-SIZE: 10pt"&gt;;The&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: Consolas; FONT-SIZE: 10pt"&gt; following keys are only used on 64-bit versions of Windows (note Wow6432Node).&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="BACKGROUND: #d9d9d9; mso-background-themecolor: background1; mso-background-themeshade: 217" class=MsoNoSpacing&gt;&lt;SPAN class=GramE&gt;&lt;SPAN style="FONT-FAMILY: Consolas; FONT-SIZE: 10pt"&gt;;They&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: Consolas; FONT-SIZE: 10pt"&gt; can be safely created with no side-effects on 32-bit versions of Windows.&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="BACKGROUND: #d9d9d9; mso-background-themecolor: background1; mso-background-themeshade: 217" class=MsoNoSpacing&gt;&lt;SPAN style="FONT-FAMILY: Consolas; FONT-SIZE: 10pt"&gt;;Alternatively, you can delete the remainder of this file if you’re running a &lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="BACKGROUND: #d9d9d9; mso-background-themecolor: background1; mso-background-themeshade: 217" class=MsoNoSpacing&gt;&lt;SPAN class=GramE&gt;&lt;SPAN style="FONT-FAMILY: Consolas; FONT-SIZE: 10pt"&gt;;32&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: Consolas; FONT-SIZE: 10pt"&gt;-bit version of Windows.&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="BACKGROUND: #d9d9d9; mso-background-themecolor: background1; mso-background-themeshade: 217" class=MsoNoSpacing&gt;&lt;SPAN style="FONT-FAMILY: Consolas; FONT-SIZE: 10pt"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="BACKGROUND: #d9d9d9; mso-background-themecolor: background1; mso-background-themeshade: 217" class=MsoNoSpacing&gt;&lt;SPAN style="FONT-FAMILY: Consolas; FONT-SIZE: 10pt"&gt;[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows NT\&lt;SPAN class=SpellE&gt;CurrentVersion&lt;/SPAN&gt;\&lt;SPAN class=SpellE&gt;AeDebug&lt;/SPAN&gt;]&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="BACKGROUND: #d9d9d9; mso-background-themecolor: background1; mso-background-themeshade: 217" class=MsoNoSpacing&gt;&lt;SPAN style="FONT-FAMILY: Consolas; FONT-SIZE: 10pt"&gt;"Debugger"="\"c:\\debuggers\\x86\\cdb.exe\" -&lt;SPAN class=SpellE&gt;pv&lt;/SPAN&gt; -p %&lt;SPAN class=SpellE&gt;ld&lt;/SPAN&gt; -c \".dump /u /ma c:\\crash_dumps\\crash.dmp;.kill;qd\""&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="BACKGROUND: #d9d9d9; mso-background-themecolor: background1; mso-background-themeshade: 217" class=MsoNoSpacing&gt;&lt;SPAN style="FONT-FAMILY: Consolas; FONT-SIZE: 10pt"&gt;"Auto"="0"&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="BACKGROUND: #d9d9d9; mso-background-themecolor: background1; mso-background-themeshade: 217" class=MsoNoSpacing&gt;&lt;SPAN style="FONT-FAMILY: Consolas; FONT-SIZE: 10pt"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="BACKGROUND: #d9d9d9; mso-background-themecolor: background1; mso-background-themeshade: 217" class=MsoNoSpacing&gt;&lt;SPAN style="FONT-FAMILY: Consolas; FONT-SIZE: 10pt"&gt;[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\.NETFramework]&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="BACKGROUND: #d9d9d9; mso-background-themecolor: background1; mso-background-themeshade: 217" class=MsoNoSpacing&gt;&lt;SPAN style="FONT-FAMILY: Consolas; FONT-SIZE: 10pt"&gt;"&lt;SPAN class=SpellE&gt;DbgManagedDebugger&lt;/SPAN&gt;"="\"c:\\debuggers\\x86\\cdb.exe\" -&lt;SPAN class=SpellE&gt;pv&lt;/SPAN&gt; -p %&lt;SPAN class=SpellE&gt;ld&lt;/SPAN&gt; -c \".dump /u /ma c:\\crash_dumps\\crash.dmp;.kill;qd\""&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="BACKGROUND: #d9d9d9; mso-background-themecolor: background1; mso-background-themeshade: 217" class=MsoNoSpacing&gt;&lt;SPAN style="FONT-FAMILY: Consolas; FONT-SIZE: 10pt"&gt;"&lt;SPAN class=SpellE&gt;DbgJITDebugLaunchSetting&lt;/SPAN&gt;"=dword:00000000&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="BACKGROUND: #d9d9d9; mso-background-themecolor: background1; mso-background-themeshade: 217" class=MsoNoSpacing&gt;&lt;SPAN style="FONT-FAMILY: Consolas; FONT-SIZE: 10pt"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="BACKGROUND: #d9d9d9; mso-background-themecolor: background1; mso-background-themeshade: 217" class=MsoNoSpacing&gt;&lt;SPAN style="FONT-FAMILY: Consolas; FONT-SIZE: 10pt"&gt;;For each application you want the debugger to be auto-launched, add a row below&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="BACKGROUND: #d9d9d9; mso-background-themecolor: background1; mso-background-themeshade: 217" class=MsoNoSpacing&gt;&lt;SPAN style="FONT-FAMILY: Consolas; FONT-SIZE: 10pt"&gt;;similar to “HelloWorld.exe"=dword:00000001 but replacing HelloWorld.exe with&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="BACKGROUND: #d9d9d9; mso-background-themecolor: background1; mso-background-themeshade: 217" class=MsoNoSpacing&gt;&lt;SPAN class=GramE&gt;&lt;SPAN style="FONT-FAMILY: Consolas; FONT-SIZE: 10pt"&gt;;your&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: Consolas; FONT-SIZE: 10pt"&gt; application .exe name.&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="BACKGROUND: #d9d9d9; mso-background-themecolor: background1; mso-background-themeshade: 217" class=MsoNoSpacing&gt;&lt;SPAN style="FONT-FAMILY: Consolas; FONT-SIZE: 10pt"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="BACKGROUND: #d9d9d9; mso-background-themecolor: background1; mso-background-themeshade: 217" class=MsoNoSpacing&gt;&lt;SPAN style="FONT-FAMILY: Consolas; FONT-SIZE: 10pt"&gt;[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\Windows Error Reporting\&lt;SPAN class=SpellE&gt;DebugApplications&lt;/SPAN&gt;]&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="BACKGROUND: #d9d9d9; mso-background-themecolor: background1; mso-background-themeshade: 217" class=MsoNoSpacing&gt;&lt;SPAN style="FONT-FAMILY: Consolas; FONT-SIZE: 10pt"&gt;"HelloWorld.exe"=dword:00000001&lt;/SPAN&gt;&lt;I style="mso-bidi-font-style: normal"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/I&gt;&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;
&lt;P class=MsoNormal&gt;&lt;I style="mso-bidi-font-style: normal"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/I&gt;&lt;/P&gt;
&lt;P class=MsoNormal&gt;&lt;B style="mso-bidi-font-weight: normal"&gt;Can I do more than just capture a dump?&lt;o:p&gt;&lt;/o:p&gt;&lt;/B&gt;&lt;/P&gt;
&lt;P class=MsoNormal&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNormal&gt;More information on the command-line switches for the Windows Debuggers can be found in the documentation included with the Debugging Tools for Windows. You’re not limited just to dumps. You can perform quite a bit of debugger automation if you choose.&lt;/P&gt;
&lt;P class=MsoNormal&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNormal&gt;&lt;B style="mso-bidi-font-weight: normal"&gt;So what happened?&lt;o:p&gt;&lt;/o:p&gt;&lt;/B&gt;&lt;/P&gt;
&lt;P class=MsoNormal&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNormal&gt;Now that you have your dump, it’s time to figure out why your application crashed. For those of you familiar with dump debugging, at this point you’re about to fire up &lt;SPAN class=SpellE&gt;WinDbg&lt;/SPAN&gt; + SOS (the managed debugging extension) and dive in. But wait! If your application runs on V4 of the CLR (.Net Framework 4.0) you can &lt;A href="http://blogs.msdn.com/tess/archive/2009/06/16/first-look-at-debugging-net-4-0-dumps-in-visual-studio-2010.aspx" mce_href="http://blogs.msdn.com/tess/archive/2009/06/16/first-look-at-debugging-net-4-0-dumps-in-visual-studio-2010.aspx"&gt;debug the dump in Visual Studio 2010&lt;/A&gt;. Our desire for the experience in VS 2010 is that it feels very similar to stopped-state live debugging (like you’ve hit a breakpoint). The fact that you’re often debugging optimized code can make this a bit trickier, but that’s a topic for another day. &lt;/P&gt;
&lt;P class=MsoNormal&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNormal&gt;For more information about how to debug crashes in managed code, a search for “managed dump debugging” yields quite a few helpful results. A great place to start is &lt;A href="http://blogs.msdn.com/tess/default.aspx" mce_href="http://blogs.msdn.com/tess/default.aspx"&gt;Tess &lt;SPAN class=SpellE&gt;Ferrandez’s&lt;/SPAN&gt; blog&lt;/A&gt; (a support engineer at Microsoft). She has a number of great posts on the topic, including a post on &lt;A href="http://blogs.msdn.com/tess/archive/2009/06/16/first-look-at-debugging-net-4-0-dumps-in-visual-studio-2010.aspx" mce_href="http://blogs.msdn.com/tess/archive/2009/06/16/first-look-at-debugging-net-4-0-dumps-in-visual-studio-2010.aspx"&gt;dump debugging in VS 2010&lt;/A&gt;, and some labs/walkthroughs as well.&lt;/P&gt;
&lt;P class=MsoNormal&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNormal&gt;Jon Langdon,&lt;/P&gt;
&lt;P class=MsoNormal&gt;PM, CLR&lt;/P&gt;&lt;/DIV&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9907935" width="1" height="1"&gt;</description></item><item><title>Five Myths about Managed Code</title><link>http://blogs.msdn.com/b/dotnet/archive/2009/10/02/five-myths-about-managed-code.aspx</link><pubDate>Sat, 03 Oct 2009 03:41:40 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9902647</guid><dc:creator>Abhishek_Mondal</dc:creator><slash:comments>12</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/dotnet/rsscomments.aspx?WeblogPostID=9902647</wfw:commentRss><comments>http://blogs.msdn.com/b/dotnet/archive/2009/10/02/five-myths-about-managed-code.aspx#comments</comments><description>&lt;p&gt;My name is Immo Landwerth and I was a Program Manager intern this year in the CLR team. In this blog post I am not going to showcase any of the fantastic features that will ship with .NET 4.0 – my colleagues in the CLR team know them much better and already did a fabulous job discussing them &lt;a href="http://blogs.msdn.com/clrteam/"&gt;here&lt;/a&gt;, &lt;a href="http://msdn.microsoft.com/en-us/magazine/cc501040.aspx"&gt;over there&lt;/a&gt; and on &lt;a href="http://channel9.msdn.com/tags/CLR+4/"&gt;Channel 9&lt;/a&gt;.&lt;/p&gt;  &lt;p&gt;Instead I want to discuss the following five myths about managed code and in particular about the CLR:&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;· Managed code is always JIT compiled&lt;/p&gt; &lt;/blockquote&gt;  &lt;blockquote&gt;   &lt;p&gt;· Generic co- and contra variance are new in .NET 4.0&lt;/p&gt; &lt;/blockquote&gt;  &lt;blockquote&gt;   &lt;p&gt;· Everything is an object&lt;/p&gt; &lt;/blockquote&gt;  &lt;blockquote&gt;   &lt;p&gt;· .NET only supports statically typed languages&lt;/p&gt; &lt;/blockquote&gt;  &lt;blockquote&gt;   &lt;p&gt;· Microsoft is not using Managed Code&lt;/p&gt; &lt;/blockquote&gt;  &lt;h3&gt;&lt;a name="_Toc241834250"&gt;Myth Five – Managed code is always JIT compiled&lt;/a&gt;&lt;/h3&gt;  &lt;p&gt;Having a JIT compiler has many advantages because a lot of things are becoming much easier when a JIT compiler is available:&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;1. On-the-fly code generation (System.Reflection.Emit) is much easier because you only have to target one virtual machine architecture (IL) instead all the processor architectures the runtime supports (such as x86 and x64).&lt;/p&gt; &lt;/blockquote&gt;  &lt;blockquote&gt;   &lt;p&gt;2. To some degree it solves the &lt;a href="http://en.wikipedia.org/wiki/Fragile_binary_interface_problem"&gt;fragile base class library problem&lt;/a&gt;. That means we can share class definitions across modules without having the problem that changes such as adding fields or adding virtual methods crashes dependent code.&lt;/p&gt; &lt;/blockquote&gt;  &lt;blockquote&gt;   &lt;p&gt;3. The &lt;a href="http://en.wikipedia.org/wiki/Working_set"&gt;working set&lt;/a&gt; can be improved because the JIT only compiles methods that are actually executed.&lt;/p&gt; &lt;/blockquote&gt;  &lt;blockquote&gt;   &lt;p&gt;4. Theoretically, you could take situational facts into consideration, such as which processor-architecture is actually used (e.g. is it SSE2 capable), the application usage patterns etc. and optimize differently for them.&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;However, JIT compilation also has downsides such as:&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;1. It takes time. That means JIT compilation always has to trade-off time vs. code quality.&lt;/p&gt; &lt;/blockquote&gt;  &lt;blockquote&gt;   &lt;p&gt;2. The code is stored on private pages so the compiled code is not shared across processes.&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;Therefore we created a tool called &lt;a href="http://msdn.microsoft.com/en-us/library/6t9t5wcf%28VS.100%29.aspx"&gt;NGEN&lt;/a&gt; that allows you to pre-create native images during the setup. You could call this ahead-of-time compilation (as opposed to just-in-time). Certain special conditions left aside (such as some hosting scenarios or profiling), the runtime will now pick up the native images instead of JIT-compiling the code.&lt;/p&gt;  &lt;p&gt;Why did we not allow you to pre-create the native images during build time and let you ship the native images directly? Well, because we then run into the &lt;a href="http://en.wikipedia.org/wiki/Fragile_binary_interface_problem"&gt;fragile base class library problem&lt;/a&gt; mentioned above. In that case, your native images would get invalid every time the .NET Framework is updated. Today we solve this problem by re-running NGEN on the customer’s machine when the framework is serviced. In .NET Framework 4 we ship a new feature called &lt;a href="http://channel9.msdn.com/posts/Charles/Surupa-Biswas-CLR-4-Resilient-NGen-and-Targeted-Patching/"&gt;targeted patching&lt;/a&gt;, that allows us for method-body only changes to minimize or to even to fully avoid recompilation. For more details about NGEN in general see &lt;a href="http://msdn.microsoft.com/en-us/magazine/cc163610.aspx"&gt;here&lt;/a&gt; and for more details about NGEN in .NET Framework 4 see &lt;a href="http://blogs.msdn.com/clrcodegeneration/archive/2009/05/03/Improvements-to-NGen-in-.NET-Framework-4.aspx"&gt;here&lt;/a&gt;.&lt;/p&gt;  &lt;p&gt;Even if you are not using NGEN for you application code: for desktop CLR applications all the assemblies that are part of the .NET Framework itself are not JIT compiled – instead the runtime will bind to the native images. So even in these cases only your application code will be JIT compiled and therefore both ahead-of-time as well as just-in-time technologies are used simultaneously. Thus, stating that all code is JITted is simply wrong.&lt;/p&gt;  &lt;h3&gt;Myth Four – Generic co- and contra variance are new in .NET 4.0&lt;/h3&gt;  &lt;p&gt;The short answer is ‘no’. The longer answer is ‘well, sort of’.&lt;/p&gt;  &lt;p&gt;But I am getting ahead of myself. Let’s first see what co- and contravariance actually means. Generic covariance allows you to call a method that takes an IEnumerable&amp;lt;Shape&amp;gt; with an IEnumerable&amp;lt;Circle&amp;gt; (if Circle is derived from Shape). This is useful if Shape contains, e.g. a method that allows you to compute the area. This way you can write a method that computes the area for any collection of shapes. Contravariance on the other hand allows you to call a method that takes an IComparer&amp;lt;Circle&amp;gt; with an IComparer&amp;lt;Shape&amp;gt;. This is handy if someone wants to compare circles and you already have created a general comparer for any shape (this works because if your comparer knows how to compare two instances of Shape it certainly is also able to compare two instances of Circle).&lt;/p&gt;  &lt;p&gt;The support for co- and contra variance has always been in the CLR since generics came up in the .NET Framework 2.0. However, as Rick Byers &lt;a href="http://blogs.msdn.com/rmbyers/archive/2005/02/16/375079.aspx"&gt;pointed out&lt;/a&gt; you would have to use ILASM for creating covariant and contravariant type definitions:&lt;/p&gt;  &lt;p&gt;&lt;i&gt;In IL, covariant type parameters are indicated by a ‘+’, and contravariant type parameters are indicated by a ‘-‘ (non-variant type parameters are the default, and can be used anywhere). &lt;/i&gt;&lt;/p&gt;  &lt;p&gt;What has been added in the .NET 4.0 release is language support for C# and Visual Basic. For example, the following uses the C# syntax (in and out modifiers for the generic type declaration) to create some covariant and contra variant types:&lt;/p&gt;  &lt;table border="5" cellspacing="0" cellpadding="5" width="400"&gt;&lt;tbody&gt;     &lt;tr&gt;       &lt;td valign="top" width="390"&gt;         &lt;p&gt;// Covariant parameters can be used as result types &lt;/p&gt;          &lt;p&gt;interface IEnumerator&amp;lt;out T&amp;gt; { &lt;/p&gt;          &lt;p&gt;T Current { get; } &lt;/p&gt;          &lt;p&gt;bool MoveNext(); &lt;/p&gt;          &lt;p&gt;} &lt;/p&gt;          &lt;p&gt;// Covariant parameters can be used in covariant result types &lt;/p&gt;          &lt;p&gt;interface IEnumerable&amp;lt;out T&amp;gt; { &lt;/p&gt;          &lt;p&gt;IEnumerator&amp;lt;T&amp;gt; GetEnumerator(); &lt;/p&gt;          &lt;p&gt;} &lt;/p&gt;          &lt;p&gt;// Contravariant parameters can be used as argument types &lt;/p&gt;          &lt;p&gt;interface IComparer&amp;lt;in T&amp;gt; { &lt;/p&gt;          &lt;p&gt;bool Compare(T x, T y); &lt;/p&gt;          &lt;p&gt;}&lt;/p&gt;       &lt;/td&gt;     &lt;/tr&gt;   &lt;/tbody&gt;&lt;/table&gt;  &lt;p&gt;&lt;a name="_Toc241834252"&gt;Myth&lt;/a&gt;&amp;#160;&lt;a name="_Toc241834251"&gt;Three – Everything is an object&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;“Wait a minute – this is the number one programming promise everyone was making about .NET!” you might say now. Yes, and yet it is false. Many .NET or C# books make this mistake in one form or the other. “Everything is an object”. Although we believe there is a lot of value in simplifying things for didactic reasons (and hence many authors just claim it that way) we would like to take this opportunity to tell you “sorry, it is not completely true”.&lt;/p&gt;  &lt;p&gt;Before we discuss this issue we should first define what the sentence “everything is an object” is supposed to mean. The interpretation we will use here is this:&lt;/p&gt;  &lt;p&gt;&lt;i&gt;Every type is derived from a single root (&lt;/i&gt;&lt;i&gt;System.Object&lt;/i&gt;&lt;i&gt;). This means, that every value can be implicitly casted to &lt;/i&gt;&lt;i&gt;System.Object&lt;/i&gt;&lt;i&gt;. More precisely, this means that every value is representable as an instance of &lt;/i&gt;&lt;i&gt;System.Object&lt;/i&gt;&lt;i&gt;.&lt;/i&gt;&lt;/p&gt;  &lt;p&gt;So why is this not true for the CLR? The counter example is a whole class of types that are not derived from System.Object: pointers (such as int*). So you cannot pass a pointer to a method that takes an object. In addition you cannot call the ToString or GetHashCode methods on a pointer.&lt;/p&gt;  &lt;p&gt;We could also use a different interpretation of “everything is an object” such as:&lt;/p&gt;  &lt;p&gt;&lt;i&gt;Every type is derived from a single root (&lt;/i&gt;&lt;i&gt;System.Object&lt;/i&gt;&lt;i&gt;). This means, that every value is an object at all times.&lt;/i&gt;&lt;/p&gt;  &lt;p&gt;Why is this different? Simple values (i.e.. values that have types derived from System.ValueType) are not objects by the &lt;a href="http://en.wikipedia.org/wiki/Object_%28computer_science%29"&gt;definition of an object&lt;/a&gt; (they lack identity). But every value can be casted implicitly to System.Object (because System.ValueType is derived from System.Object). However, in that case an object instance that contains the value is created. This process is called boxing. The resulting object instance (the “box”, not to be confused with &lt;a href="http://en.wikipedia.org/wiki/Don_Box"&gt;Don Box&lt;/a&gt;) has indeed a notion of identity (which is in particular also true for Don Box).&lt;/p&gt;  &lt;p&gt;As you can see, the CLR uses the first interpretation and yet it is still not completely true as pointers do not derive from System.Object.&lt;/p&gt;  &lt;h3&gt;&lt;a name="_Toc241834252"&gt;Myth Two – .NET only supports statically typed languages&lt;/a&gt;&lt;/h3&gt;  &lt;p&gt;It is true that the CLR uses a static type system. But this does not necessarily mean that it is only suited for programming languages that use a static type system. At the end, the programming language is &lt;i&gt;implemented&lt;/i&gt; using the CLR but it is not &lt;i&gt;identical&lt;/i&gt; with the CLR. So do not be fooled by the fact that the type system and mechanics of C# almost map directly to first class CLR-concepts. In fact, there are many concepts in C# that the CLR is not aware of:&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;1. &lt;a href="http://msdn.microsoft.com/en-us/library/z2kcy19k%28VS.100%29.aspx"&gt;Namespaces&lt;/a&gt;. As far as the CLR is concerned namespaces do not even exist. They are just implemented as type prefixes separated by dots (so instead of saying ‘the class Console is contained in the namespace System’ the CLR would just say ‘there is a class called System.Console’).&lt;/p&gt; &lt;/blockquote&gt;  &lt;blockquote&gt;   &lt;p&gt;2. &lt;a href="http://msdn.microsoft.com/en-us/library/dscyy5s0%28VS.100%29.aspx"&gt;Iterators&lt;/a&gt;. The CLR does not provide any support for it. All the magic is done by the compiler (if you want to know, the compiler turns your method into a new type that internally uses a state-machine to track the current point of execution. Details can be found &lt;a href="http://blogs.msdn.com/wesdyer/archive/2007/03/23/all-about-iterators.aspx"&gt;here&lt;/a&gt;). &lt;/p&gt; &lt;/blockquote&gt;  &lt;blockquote&gt;   &lt;p&gt;3. &lt;a href="http://msdn.microsoft.com/en-us/library/bb397687%28VS.100%29.aspx"&gt;Lambdas&lt;/a&gt;. They are just syntactic sugar. For the runtime these are just delegates, which in turn can also be considered syntactic sugar. In fact, a delegate is nothing more than a class derived from &lt;a href="http://msdn.microsoft.com/en-us/library/system.multicastdelegate%28VS.100%29.aspx"&gt;System.MulticastDelegate&lt;/a&gt; that provides an Invoke, BeginInvoke and EndInvoke method with the appropriate parameters.&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;Please note that this list is not complete. Instead it is only used to show you that even C# has to implement itself on top of the CLR and hence it is not a 1:1 mapping of the concepts the runtime provides. What does this have to do with static typing vs. dynamic typing? The answer is simply: you can implement a dynamically typed system on top of a statically typed system.&lt;/p&gt;  &lt;p&gt;If you know see a huge business opportunity here, we have to disappoint you. Some smart people already had the same idea. This effort is called the &lt;a href="http://www.codeplex.com/dlr"&gt;Dynamic Language Runtime&lt;/a&gt;, or DLR for short. If you are like me then you immediately think of native code when someone mentions the term ‘runtime’. However, the DLR is completely implemented in C# and is just a class library that can be used by programming languages to implement dynamic systems on top of the CLR. The DLR shares the fundamental design principle of the CLR, i.e. it provides a platform for more than one language. That means you can share &lt;a href="http://ironpython.codeplex.com"&gt;IronPython&lt;/a&gt; objects with &lt;a href="http://ironruby.net"&gt;IronRuby&lt;/a&gt; objects because they are implemented with the same underlying runtime (the DLR).&lt;/p&gt;  &lt;p&gt;With .NET 4.0 the DLR ships as part of the box. So while .NET has first-class support for statically typed languages through the CLR it also provides first-class support for dynamically typed languages through the DLR.&lt;/p&gt;  &lt;h3&gt;&lt;a name="_Toc241834253"&gt;Myth One – Microsoft is not using Managed Code&lt;/a&gt;&lt;/h3&gt;  &lt;p&gt;We often hear this (“Office and Windows are still not built on top of managed code!”) when customers ask about performance and future investments of Microsoft in managed code. The reasoning goes like this:&lt;/p&gt;  &lt;p&gt;&lt;i&gt;Since Microsoft is not implementing Windows and Office in managed code that means that it must be significantly flawed/runs much slower than native code and therefore their long term strategy will still be C++. This in turn means that we should not use managed code either.&lt;/i&gt;&lt;/p&gt;  &lt;p&gt;In fact Microsoft has a huge investment in managed code (although it is still true that Office and Windows are not implemented in managed code). However, there are a bunch of products that are significantly (if not completely) implemented in managed code:&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;1. Windows components, such as&lt;/p&gt;    &lt;p&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160; a. PowerShell&lt;/p&gt;    &lt;p&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160; b. System Center&lt;/p&gt; &lt;/blockquote&gt;  &lt;blockquote&gt;   &lt;p&gt;2. Office components, such as&lt;/p&gt;    &lt;p&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160; a. Exchange&lt;/p&gt;    &lt;p&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160; b. SharePoint/Office Server&lt;/p&gt; &lt;/blockquote&gt;  &lt;blockquote&gt;   &lt;p&gt;3. Developer Tools, such as&lt;/p&gt;    &lt;p&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160; a. Visual Studio and Visual Studio Team System&lt;/p&gt;    &lt;p&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160; b. Expression&lt;/p&gt; &lt;/blockquote&gt;  &lt;blockquote&gt;   &lt;p&gt;4. Dynamics&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;This list if by far not complete but it should be large enough to convince you that we are in fact &lt;a href="http://en.wikipedia.org/wiki/Dogfooding"&gt;‘eating our own dog food’&lt;/a&gt;.&lt;/p&gt;  &lt;p&gt;The reason that not all products are written in managed is not only related to performance. Sometimes the wins of re-implementing working native code in managed code do not outweigh its costs. On the other hand, there are still scenarios in which managed code simply cannot be used today (such as building the CLR itself or the debugger).&lt;/p&gt;  &lt;p&gt;However, we will not deny that there are scenarios in which we cannot compete with the performance of native code today. But this does not mean that we have given up on this. In fact, projects like &lt;a href="http://en.wikipedia.org/wiki/Singularity_%28operating_system%29"&gt;Singularity&lt;/a&gt; should show you that we are really very ambitious about redefining the limits of the managed world.&lt;/p&gt;  &lt;p&gt;The last thing to keep in mind is that manually optimized assembler code is also faster than plain C-code. But this does not mean that all operating systems are completely written in assembler.&lt;/p&gt;  &lt;p&gt;Thus our vision is more like this: native code where it makes sense, managed code where it makes sense with the bigger portion being managed.&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9902647" width="1" height="1"&gt;</description></item><item><title>IL Stub Diagnostic Tool</title><link>http://blogs.msdn.com/b/dotnet/archive/2009/08/26/il-stub-diagnostic-tool.aspx</link><pubDate>Thu, 27 Aug 2009 09:08:50 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9886577</guid><dc:creator>Abhishek_Mondal</dc:creator><slash:comments>3</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/dotnet/rsscomments.aspx?WeblogPostID=9886577</wfw:commentRss><comments>http://blogs.msdn.com/b/dotnet/archive/2009/08/26/il-stub-diagnostic-tool.aspx#comments</comments><description>&lt;p&gt;&amp;nbsp; &lt;p&gt;The IL Stub Diagnostic Tool enables real-time inspection of the contents of IL stubs. Developers now have a powerful tool to troubleshoot issues in interop marshalling, &lt;p&gt;&lt;b&gt;Introduction&lt;/b&gt; &lt;p&gt;Jesse posted a great &lt;a href="http://blogs.msdn.com/clrteam/archive/2009/08/10/improvements-to-interop-marshaling-in-v4-il-stubs-everywhere.aspx"&gt;blog&lt;/a&gt; talking about the concept, history, and improvements of Intermediate Language (IL) stubs for CLR v4. He mentions  &lt;p&gt;The remainder of this post continues the discussion that Jesse started in the “Easier Debugging” section of his blog. &lt;p&gt;&lt;b&gt;Get the tool&lt;/b&gt; &lt;p&gt;You are encouraged to download the tool from &lt;a href="http://clrinterop.codeplex.com/Release/ProjectReleases.aspx?ReleaseId=29745"&gt;CodePlex&lt;/a&gt;.  &lt;p&gt;&lt;b&gt;Usage of the IL Stubs Diagnostics Tool&lt;/b&gt; &lt;p&gt;To begin using the tool, follow these basic steps: &lt;p&gt;1) Launch the IL Stub Diagnostic tool. Note: you need to be an administrator of the machine because the tool utilizes the Event Tracing for Windows (ETW) feature to receive ETW events. &lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/clrteam/WindowsLiveWriter/ILStubDiagnosticTool_14572/clip_image002_2.jpg"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="clip_image002" border="0" alt="clip_image002" src="http://blogs.msdn.com/blogfiles/clrteam/WindowsLiveWriter/ILStubDiagnosticTool_14572/clip_image002_thumb.jpg" width="533" height="288"&gt;&lt;/a&gt; &lt;p&gt;There are three key features of the tool: &lt;p&gt;· &lt;b&gt;Starting and Controlling the IL stubs monitoring session&lt;/b&gt; &lt;p&gt;The upper-left button, &lt;b&gt;Start&lt;/b&gt;, is the most important aspect of starting a session. After clicking the &lt;b&gt;Start&lt;/b&gt; button, the tool begins monitoring all the stubs generated by CLR on the machine. It will keep monitoring the IL stubs until you click it again (i.e., &lt;b&gt;Start&lt;/b&gt; button will turn to &lt;b&gt;Stop&lt;/b&gt; after it is clicked).&lt;b&gt;&lt;/b&gt; &lt;p&gt;· &lt;b&gt;Filtering to find a specific IL Stub&lt;/b&gt; &lt;p&gt;The IL Stub List section shows all the IL stubs collected by the tool. Sometimes you will receive a huge number of stubs. In this case, you can set several filters using the &lt;b&gt;Filters&lt;/b&gt; feature to find the exact stub. &lt;p&gt;· &lt;b&gt;Navigating and Inspecting the contents of an IL Stub&lt;/b&gt; &lt;p&gt;Once you find the IL Stub, the contents of it (the IL code) will be shown in the IL Code section. We provide some features like navigation to help you read and understand the IL code. &lt;p&gt;2) Start monitoring IL stubs by clicking the &lt;b&gt;Start&lt;/b&gt; button. &lt;p&gt;3) Run a program involving interop. For example, the sample program &lt;i&gt;sample\pinvoke.exe,&lt;/i&gt; which is included with the tool on CodePlex, generates a p/invoke from managed code to native code. Running this sample from the command line will generate several entries in the IL Stub List section. We will use this for illustration purposes below.  &lt;p&gt;In this example, each item represents an IL Stub. Select an entry and notice its corresponding IL code shown in the IL Code Section. &lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/clrteam/WindowsLiveWriter/ILStubDiagnosticTool_14572/clip_image004_2.jpg"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="clip_image004" border="0" alt="clip_image004" src="http://blogs.msdn.com/blogfiles/clrteam/WindowsLiveWriter/ILStubDiagnosticTool_14572/clip_image004_thumb.jpg" width="572" height="366"&gt;&lt;/a&gt; &lt;p&gt;&lt;b&gt;Features which Enable Inspection and Navigation of IL Stubs&lt;/b&gt; &lt;p&gt;IL Stubs are generated on the fly by the CLR for Interop, and bridge the gap between managed and native methods. Since they are dynamically generated, it is difficult for developers to investigate or troubleshoot issues because the stubs are further JIT-compiled into machine code. The IL Stub Diagnostic tool eases the interop debugging experience by enabling the inspection of every stub. Let’s take a look at some of the key features which enable the inspection and navigation of IL stubs.  &lt;p&gt;&lt;b&gt;Detailed information of IL Stub&lt;/b&gt; &lt;p&gt;By default, the tool shows the following categories for each IL stub: MethodName, CreateTime, ProcessName, Category, ManagedSignature and NativeSignature. These categories are important for developers to identify an IL stub. In special cases (e.g., debugging with windbg), developers may also be interested in information like ModuleId and ManagedMethodToken. These are available by right clicking the table header of the IL Stub list. &lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/clrteam/WindowsLiveWriter/ILStubDiagnosticTool_14572/clip_image006_2.jpg"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="clip_image006" border="0" alt="clip_image006" src="http://blogs.msdn.com/blogfiles/clrteam/WindowsLiveWriter/ILStubDiagnosticTool_14572/clip_image006_thumb.jpg" width="583" height="199"&gt;&lt;/a&gt; &lt;p&gt;&lt;b&gt;&lt;/b&gt; &lt;p&gt;&lt;b&gt;IL Stub Filters&lt;/b&gt; &lt;p&gt;You may find that the CLR generates a lot of IL Stubs during the execution of a managed program. To quickly locate the stub we’re seeking, filters can be set to reduce the number of IL stub entries in the IL Stub list. Using the pinvoke.exe sample (included with the tool on CodePlex), you can use the following filter: &lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/clrteam/WindowsLiveWriter/ILStubDiagnosticTool_14572/clip_image008_2.jpg"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="clip_image008" border="0" alt="clip_image008" src="http://blogs.msdn.com/blogfiles/clrteam/WindowsLiveWriter/ILStubDiagnosticTool_14572/clip_image008_thumb.jpg" width="570" height="178"&gt;&lt;/a&gt; &lt;p&gt;Once the filter has been entered, click the &lt;b&gt;Refresh&lt;/b&gt; button to obtain the filtered list. &lt;p&gt;To remove a filter, you can right click on the row header of the first filter condition and select &lt;b&gt;Delete Filter&lt;/b&gt;. It will take effect after clicking &lt;b&gt;Refresh&lt;/b&gt; button. &lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/clrteam/WindowsLiveWriter/ILStubDiagnosticTool_14572/clip_image010_2.jpg"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="clip_image010" border="0" alt="clip_image010" src="http://blogs.msdn.com/blogfiles/clrteam/WindowsLiveWriter/ILStubDiagnosticTool_14572/clip_image010_thumb.jpg" width="366" height="76"&gt;&lt;/a&gt; &lt;p&gt;&lt;b&gt;&lt;/b&gt; &lt;p&gt;&lt;b&gt;Navigation buttons for IL Stub code&lt;/b&gt; &lt;p&gt;The code may not be well-formatted for first time display. To make the code more reader-friendly, the tool provides navigation buttons that allow you to view the code block by block. As you can see, each IL stub contains the following color-coded blocks: Initialize, Marshal, the calling method, and Unmarshal blocks. In the IL code, StubHelpers are used to do some complex work. Most of the functionality of each stub helper can be figured out by its name. The tool also provides a &lt;b&gt;Stub API&lt;/b&gt; button to look up its usage. &lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/clrteam/WindowsLiveWriter/ILStubDiagnosticTool_14572/clip_image012_2.jpg"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="clip_image012" border="0" alt="clip_image012" src="http://blogs.msdn.com/blogfiles/clrteam/WindowsLiveWriter/ILStubDiagnosticTool_14572/clip_image012_thumb.jpg" width="534" height="377"&gt;&lt;/a&gt; &lt;p&gt;Please note that stub helpers are internal to the runtime and their names/signatures/description should only be used for informational purposes. We may change any of these in the next version of the CLR so no one should establish any dependencies on them. &lt;p&gt;&lt;b&gt;Troubleshooting marshalling issues with IL Stub Diagnostic tool&lt;/b&gt; &lt;p&gt;As mentioned earlier, developers can use the tool to investigate and debug marshalling issues. Here is an example. &lt;p&gt;&lt;b&gt;Case description&lt;/b&gt; &lt;p&gt;There is an issue with the following p/invoke scenario. The signature of the native method is: &lt;p&gt;void DumpString(WCHAR *pStr) &lt;p&gt;{ &lt;p&gt;printf("%ws", pStr); &lt;p&gt;} &lt;p&gt;In managed code, we declare it as: &lt;p&gt;[DllImport("testNative.dll")] &lt;p&gt;public static extern void DumpString(string str); &lt;p&gt;When invoking from managed side with the following code, it shows nothing on the console. &lt;p&gt;DumpString("Hello World"); &lt;p&gt;Our job is to discover what happens during the p/invoke call. &lt;p&gt;&lt;b&gt;Troubleshooting&lt;/b&gt; &lt;p&gt;Since the native code simply dumps the string, the problem must be occuring during the marshaling phase. &lt;p&gt;First, locate the stub by following these steps: &lt;p&gt;1. Launch IL Stub Diagnostic tool. &lt;p&gt;2. Click Start Button. &lt;p&gt;3. Run the program again. &lt;p&gt;4. Set the following filter as shown below and click the Refresh button. &lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/clrteam/WindowsLiveWriter/ILStubDiagnosticTool_14572/clip_image014_2.jpg"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="clip_image014" border="0" alt="clip_image014" src="http://blogs.msdn.com/blogfiles/clrteam/WindowsLiveWriter/ILStubDiagnosticTool_14572/clip_image014_thumb.jpg" width="514" height="129"&gt;&lt;/a&gt; &lt;p&gt;Next, navigate to the block of code which handles the marshaling by following these steps: &lt;p&gt;1. Click the “IL Code” button to get a bigger view. &lt;p&gt;2. Click the “Next Block” and navigate to the Marshal block. &lt;p&gt;3. Usually, StubHelpers APIs are the most informational code here. Move the mouse over it to see the explanation of the method (shown in the green box below): &lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/clrteam/WindowsLiveWriter/ILStubDiagnosticTool_14572/clip_image016_2.jpg"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="clip_image016" border="0" alt="clip_image016" src="http://blogs.msdn.com/blogfiles/clrteam/WindowsLiveWriter/ILStubDiagnosticTool_14572/clip_image016_thumb.jpg" width="531" height="373"&gt;&lt;/a&gt; &lt;p&gt;4. The description tells us that the StubHelpers method is used to convert an &lt;b&gt;Ansi&lt;/b&gt; string. However, our native method expects a &lt;b&gt;WCHAR&lt;/b&gt; string, which results in the marshaling issue. The fix is to specify Unicode, as the highlighted code below. &lt;p&gt;[DllImport("testNative.dll", CharSet=CharSet.Unicode)] &lt;p&gt;public static extern void DumpString(string str); &lt;p&gt;&lt;b&gt;&lt;/b&gt; &lt;p&gt;&lt;b&gt;Summary&lt;/b&gt; &lt;p&gt;As you can see, the IL Stubs Diagnostic Tool provides a window into what used to be a black box, and allows you to look into the very core of interop marshaling – the IL Stub itself. &lt;p&gt;&lt;b&gt;&lt;/b&gt; &lt;p&gt;&lt;b&gt;Acknowledgements&lt;/b&gt; &lt;p&gt;We would like to specially thank Yifeng Fu for being one of the key developers of IL Stub Diagnostic tool during his internship with us. &lt;p&gt;&lt;b&gt;See Also&lt;/b&gt; &lt;p&gt;The MSDN topic “MSIL Stub Customization” contains detailed reference and usage information. &lt;p&gt;&amp;nbsp;&lt;/p&gt; &lt;p&gt;&amp;nbsp;&lt;/p&gt; &lt;p&gt;Yongtai Zhu,&lt;/p&gt; &lt;p&gt;Developer, CLR. &lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9886577" width="1" height="1"&gt;</description></item><item><title>The good and the bad of exception filters</title><link>http://blogs.msdn.com/b/dotnet/archive/2009/08/25/the-good-and-the-bad-of-exception-filters.aspx</link><pubDate>Wed, 26 Aug 2009 03:04:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9884336</guid><dc:creator>Abhishek_Mondal</dc:creator><slash:comments>15</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/dotnet/rsscomments.aspx?WeblogPostID=9884336</wfw:commentRss><comments>http://blogs.msdn.com/b/dotnet/archive/2009/08/25/the-good-and-the-bad-of-exception-filters.aspx#comments</comments><description>&lt;P&gt;Every so often we get asked questions about the CLR’s support for exception filters. Why do some languages support them and others do not? Is it a good idea to add them to my new language? When should I use a filter vs. catch/rethrow? Etc. I’ll try to answer some of these questions for you here, and while I won’t go into all of them hopefully you’ll walk away with enough info to form your own opinion on the rest. Like so many things there’s good things and bad things about exception filters… 
&lt;P&gt;&lt;B&gt;&lt;/B&gt;
&lt;P&gt;&lt;B&gt;So what’s a filter?&lt;/B&gt; 
&lt;P&gt;The CLR provides a number of exception handling primitives that higher level languages can build upon. Some are fairly obvious, and map readily to language constructs that most of us know and love: try/catch and try/finally, for instance. I’d hazard to guess that everyone knows what those do, but just in case, let’s consider a quick example in C#: 
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; try 
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; { 
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;try 
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; { 
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Console.Write(“1”); 
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;if (P) throw new ArgumentException(); 
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; } 
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; finally 
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; { 
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Console.Write(“2”); 
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;} 
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; } 
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; catch (ArgumentException e) 
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; { 
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Console.Write(“3”); 
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; } 
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Console.Write(“4”); 
&lt;P&gt;If P is true, then that will print out “1234”, of course. If P is false, then it will print “124”. Groovy. 
&lt;P&gt;But the CLR also provides two more EH primitives: fault and filter. A fault clause is much like a finally clause; it runs when an exception escapes its associated try block. The difference is that a finally clause also runs when control leaves the try block normally, whereas the fault clause will only run when control leaves the try block due to an exception. In the case above, if we replaced the “finally” with “fault” (there’s no C# syntax for that, but suspend your disbelief for a moment) then it would print “1234” if P is true, and “14” is P is false. See the difference? Most languages don’t expose this as a first-class language construct, but we do have a few that use fault clauses under the covers for specific scenarios. 
&lt;P&gt;So that leaves us with filters. I suppose the simplest definition of a filter is that it is a construct that allows one to build a conditional catch clause. In fact, that’s exactly what VB uses filters for. Let’s consider a more complicated example in VB: 
&lt;P&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;Function Foo() As Boolean 
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Console.Write("3") 
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Return True 
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; End Function 
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Sub Main() 
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim P As Boolean = True 
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Try 
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Try 
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Console.Write("1") 
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; If (P) Then 
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Throw New ArgumentNullException() 
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; End If 
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Console.Write(“P was False!”) 
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Finally 
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Console.Write("2") 
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; End Try 
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Catch ex As ArgumentNullException When Foo() 
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Console.Write("4") 
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Catch ex As ArgumentException 
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Console.Write("5") 
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; End Try 
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Console.Write("6") 
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; End Sub 
&lt;P&gt;Here you’ll note the “Catch ex As ArgumentNullException When Foo()” line is a conditional catch statement. The catch handler will only execute and print “4” when the exception is an ArgumentNullException and when Foo() returns true. If Foo() returns false, then the catch clause doesn’t execute, and the system continues to search for a catch clause that can handle the exception. In this case, the very next clause would handle the exception, and print “5”. 
&lt;P&gt;So, what do you think this program prints? Don’t cheat by attempting to compile and run it! Using what you know about exception handling and looking at the program structure and syntax, what would you imagine this program prints? I suspect most people would guess “12346”. I even gave you a clue with the numbering. 
&lt;P&gt;I think most of us would look at the example above and conclude that the result should be “12346” because when we look at the syntax above we, quite rightly, see lexically scoped language constructs. We expect that when the code in the inner finally clause starts executing that no more code anywhere in the associated try block will execute. For instance, in the example above, if P is true then when we enter the Finally we know that no more code will execute in the try block, and that we’ll never print “P was False!”. Likewise, when we evaluate one of the catch clauses, we expect that all the code in the associated try block is done executing. 
&lt;P&gt;&lt;B&gt;&lt;/B&gt;
&lt;P&gt;&lt;B&gt;And here comes the bad… &lt;/B&gt;
&lt;P&gt;It turns out that program actually prints “1&lt;B&gt;3&lt;/B&gt;246”. My clue with the numbering was an evil ruse. After the throw, Foo() is executed first as part of evaluating the first catch clause, and then the finally within the associated try block executes. And that’s just freaky… what happened to our lexically scoped language constructs?! 
&lt;P&gt;This is a surprising result for most. It breaks our intuitive reasoning about the language based on the lexically scope exception handling constructs provided. Here, when we evaluate the conditional catch clause, all the code in the associated try block has not, in fact, finished executing. 
&lt;P&gt;&lt;B&gt;&lt;/B&gt;
&lt;P&gt;&lt;B&gt;Why does this happen?&lt;/B&gt; 
&lt;P&gt;The reason we see “3” before “2” is subtle, and founded in the CLR’s implementation of exception handling. The CLR’s exception handling model is actually a “two pass” model. When an exception is thrown, the runtime searches the call stack for a handler for the exception. The goal of the first pass is to simply determine if a handler for the exception is present on the stack. If it sees finally (or fault) clauses, it ignores them for a moment. 
&lt;P&gt;The handler may be in the form of a typed catch clause, i.e., “Catch ex as ArgumentException)”. When the runtime sees a typed catch clause, it can determine itself if this clause will handle the exception by performing a simple check to determine if the exception object is of a type that inherits from (or is) the type in the clause. 
&lt;P&gt;But when the runtime sees a filter, it must execute the filter in order to determine if the associated handler will handle the exception. If the filter evaluates to true, then a handler has been found. If it evaluates to false, then the runtime will keep searching for a handler. 
&lt;P&gt;Once a handler has been found, the first pass is over and the second pass begins. On the second pass, the runtime again runs the call stack from the point of throw, but this time it executes all finally (or fault) clauses it finds on the way to the handler it identified on the first pass. When the handler is reached, it is executed, and the exception has finally been handled. 
&lt;P&gt;&lt;B&gt;&lt;/B&gt;
&lt;P&gt;&lt;B&gt;But why is that bad?&lt;/B&gt; 
&lt;P&gt;“Okay”, you say, “I get it. I understand that filters run during the first pass. I can deal with that… what’s the big deal?” Well, let’s first consider what a finally clause is for. We typically use finally clauses to ensure that our program state remains consistent when exiting a function even in the face of an exception. We put back temporarily broken invariants. Consider that the C# “using” statement is built using try/finally, and then consider all the things one might do with that. 
&lt;P&gt;But when your filter runs, none of those finally clauses have executed. If you called into a library within the associated try block, you may have not actually completed the call when your filter executes. Can you call back into the same library in that case? I don’t know. It might work. Or it might yield an assert, or an exception, or, well, your guess is as good as mine. The point is that you can’t tell. 
&lt;P&gt;&lt;B&gt;&lt;/B&gt;
&lt;P&gt;&lt;B&gt;Using filters wisely (or, “the good”)&lt;/B&gt; 
&lt;P&gt;But the notion of a conditional catch clause really is quite appealing, and there are ways to use these without getting caught by the problems of when the filter actually executes. The key is to only read information from either the exception object itself, or from immutable global state, and to not change any global state. If you limit your actions in a filter to just those, then it doesn’t matter when the filter runs, and no one will be able to tell that the filter ran out of order. 
&lt;P&gt;For instance, if you have a fairly general exception, like COMException, you typically only want to catch that when it represents a certain HRESULT. For instance, you want to let it go unhanded when it represents E_FAIL, but you want to catch it when it represents E_ACCESSDEINED because you have an alternative for that case. Here, this is a perfectly reasonable conditional catch clause: 
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Catch ex As System.Runtime.InteropServices.COMException When ex.ErrorCode() = &amp;amp;H80070005 
&lt;P&gt;The alternative is to place the condition within the catch block, and rethrow the exception if it doesn’t meet your criteria. For instance: 
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Catch ex As System.Runtime.InteropServices.COMException 
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; If (ex.ErrorCode != &amp;amp;H80070005) Then Throw 
&lt;P&gt;Logically, this “catch/rethrow” pattern does the same thing as the filter did, but there is a subtle and important difference. If the exception goes unhandled, then the program state is quite different between the two. In the catch/rethrow case, the unhandled exception will appear to come from the Throw statement within the catch block. There will be no call stack beyond that, and any finally blocks up to the catch clause will have been executed. Both make debugging more difficult. In the filter case, the exception goes unhandled from the point of the original throw, and no program state has been changed by finally clauses. 
&lt;P&gt;The problem is that we rely on programmer discipline in order to use filters correctly, but it’s easy to use them incorrectly and end up with infrequently executed code (exceptions, after all, are for exceptional circumstances) that has subtle and hard to diagnose bugs due to inconsistent program state that should have been cleaned up by finally clauses further down the stack. 
&lt;P&gt;&lt;B&gt;&lt;/B&gt;
&lt;P&gt;&lt;B&gt;Why does the CLR use a two-pass exception handling model?&lt;/B&gt; 
&lt;P&gt;The CLR implements a two-pass exception handling system in order to better interoperate with unmanaged exception handling systems, like Win32 Structured Exception Handling (SEH) or C++ Exception Handling. We must run finally (and fault) clauses on the second pass so they run in order with unmanaged equivalents. Likewise, we must not execute filters later (say, on the second pass) because one of those unmanaged systems may have remembered that it was supposed to be responsible for handling the exception. If we were to run a filter late on the second pass and decide that a managed clause really should catch the exception after previously having not declared that on the first pass, then we would violate our contract with those unmanaged mechanisms with unpredictable results. 
&lt;P&gt;So, in short, it’s for interop, and like many things involving interop, we have a compatibility burden that we can’t ignore. 
&lt;P&gt;&lt;B&gt;&lt;/B&gt;
&lt;P&gt;&lt;B&gt;Would a one-pass model be better?&lt;/B&gt; 
&lt;P&gt;Many have wondered over the years if perhaps the two-pass model in general is bad, and if a one-pass model would be better. Like so many things in the world, it’s just not that clear. A one-pass model would simplify the exception handling implementation, and it would make more sense in the cases shown above. However, there are advantages to the two-pass model that can’t be ignored. Perhaps the most important one is that if the search for a handler fails on the first-pass the exception goes unhandled and in general no program state has changed, even though filters are run since filters tend not to change things. The call stack is still intact, and all values that lead to the exception are still present on the stack and on the heap (assuming no race conditions.) This is frequently essential when debugging an unhandled exception. In a one-pass model, all of the finally clauses would have been run before the exception goes unhandled. 
&lt;P&gt;&lt;B&gt;&lt;/B&gt;
&lt;P&gt;&lt;B&gt;Wrapping up&lt;/B&gt; 
&lt;P&gt;Of the languages that MS ships, only VB and F# support filters, and both do so via conditional catch clauses. In F#, you have to really go out of your way to attempt to inspect mutable global state, or to actually have a side effect, so you’re fairly safe there. In VB, though, you can call a function from the “when” clause of their catch statement, and in there you have free reign to do whatever you please. You can, without a doubt, get yourself into trouble attempting to do too much complicated work within such a filter. To keep your world safe and simple try to limit yourself to expressions that only access the exception object, and don’t modify anything. If you go beyond that, you need to consider carefully all the code executed in the try block, and if your actions in the filter will work if the backout code below has not finished executing yet. 
&lt;P&gt;Mike Magruder, 
&lt;P&gt;Developer, CLR.&lt;/P&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9884336" width="1" height="1"&gt;</description></item><item><title>Improvements to Interop Marshaling in V4: IL Stubs Everywhere</title><link>http://blogs.msdn.com/b/dotnet/archive/2009/08/10/improvements-to-interop-marshaling-in-v4-il-stubs-everywhere.aspx</link><pubDate>Mon, 10 Aug 2009 23:27:15 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9863498</guid><dc:creator>Abhishek_Mondal</dc:creator><slash:comments>4</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/dotnet/rsscomments.aspx?WeblogPostID=9863498</wfw:commentRss><comments>http://blogs.msdn.com/b/dotnet/archive/2009/08/10/improvements-to-interop-marshaling-in-v4-il-stubs-everywhere.aspx#comments</comments><description>&lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;When the CLR needs to transition between managed and native code – usually because of P\Invoke or COM interop – we need to generate marshaling stubs (little chunks of code) to handle that specific call and transform the data from managed to native format and back again. . These stubs are little pieces of code that are usually generated at runtime to do their work behind the scenes and, hopefully, without making developers or users aware of their presence. In .Net 4 we’ve improved our marshaling infrastructure substantially with a feature we call “IL Stubs Everywhere.” For those who have a deep interest in interop marshaling we get into the details of this feature below. For everyone else, here are a few key benefits of this feature:&lt;/p&gt;  &lt;p&gt;· Faster interop marshaling: the more complex the signature the greater the speed-up&lt;/p&gt;  &lt;p&gt;· x86 and x64 behavior matches: we’ve updated the x64 marshaling to behave exactly as x86 always has and mostly without impact to x64&lt;/p&gt;  &lt;p&gt;· Better debugging: when something goes wrong in marshaling we now give you the ability, and specialized tools, to find the problem&lt;/p&gt;  &lt;p&gt;&lt;b&gt;&lt;/b&gt;&lt;/p&gt;  &lt;p&gt;&lt;b&gt;History&lt;/b&gt;&lt;/p&gt;  &lt;p&gt;The 1.0 and 1.1 versions of the CLR had several different techniques for creating and executing these stubs that were each designed for marshaling different types of signatures. These techniques ranged from directly generated x86 assembly instructions for simple signatures to generating specialized ML (an internal marshaling language)* and running them through an internal interpreter for the most complicated signatures. This system worked well enough – although not without difficulties – in 1.0 and 1.1 but presented us with a serious maintenance problem when 2.0, and its support for multiple processor architectures, came around. &lt;/p&gt;  &lt;p&gt;We realized early in the process of adding 64 bit support to 2.0 that this approach was not sustainable across multiple architectures. Had we continued with the same strategy we would have had to create parallel marshaling infrastructures for each new architecture we supported (remember in 2.0 we introduced support for both x64 and IA64) which would, in addition to the initial cost, at least triple the cost of every new marshaling feature or bug fix. We needed one marshaling stub technology that would work on multiple processor architectures and could be efficiently executed on each one: enter IL stubs. &lt;/p&gt;  &lt;p&gt;With x64 and IA64 bit support in v2 we introduced IL stubs to perform the marshaling on these platforms. With IL stubs we generate actual IL rather than assembly code or the specialized language in our ML stubs. On these platforms we only used the IL stubs and were thus able to have a single implementation, for all stubs, across both processor architectures. These IL stubs were much faster than the ML stubs but were also much slower than x86 stubs. Because of the performance regress and our resource constraints, we left the x86 platform with its original marshaling stubs implementation. &lt;/p&gt;  &lt;p&gt;&lt;b&gt;&lt;/b&gt;&lt;/p&gt;  &lt;p&gt;&lt;b&gt;New in V4: IL Stubs Everywhere &lt;/b&gt;&lt;/p&gt;  &lt;p&gt;One of the largest features the interop team worked on in the v4 product was the “IL Stubs Everywhere” feature. With this work we moved to uniformly using the same IL stubs infrastructure for all marshaling on all platforms. Sometimes when we spend a lot of time developing, or reworking, a feature there is a concern that it will be expensive for developers to start taking advantage of it: the good news with this one is that this will change will occur automatically and the majority of the benefits will happen just by running your app on v4.0. &lt;/p&gt;  &lt;p&gt;A few of the benefits you will see with this feature are:&lt;/p&gt;  &lt;p&gt;&lt;i&gt;&lt;strong&gt;Increased performance: &lt;/strong&gt;&lt;/i&gt;&lt;/p&gt;  &lt;p&gt;The original x86 stubs for the simplest signatures were pretty fast – often a simple copy operation -- but as soon as you needed marshaling for more complex signatures you were forced onto the slow path with the ML interpreter. We heavily optimized our IL stub infrastructure and now IL stubs are faster across the board (even compared to x86 stubs) and are orders of magnitude faster than the interpreted stubs you used to get for the more interesting signatures. Additionally, for those that use NGEN you’ll find that we include most of your IL stubs in the NGEN images to improve this scenario even further. &lt;/p&gt;  &lt;p&gt;&lt;i&gt;&lt;strong&gt;Consistent behavior: &lt;/strong&gt;&lt;/i&gt;&lt;/p&gt;  &lt;p&gt;One of the common problems people ran into in interop in the v2 days is that with different marshaling technologies used for 32 and 64 bit the behaviors didn’t line up exactly the same. There were a few places where the same code behaved differently based on platform. With every platform running off of IL stubs we now have the same behavior across all platforms. &lt;/p&gt;  &lt;p&gt;&lt;i&gt;Note: &lt;/i&gt;when we did this we had a choice between giving the 4.0 IL stubs the behavior of the v2.0 64 bit IL stubs or the v2.0 32 bit stubs. We chose to use the 2.0 32 bit behavior for the 4.0 because of the much larger percentage of interop apps that have been built on 32bit to date. &lt;/p&gt;  &lt;p&gt;This means that you should not see any behavioral differences moving a 32 bit app to the v4.0 NetFX but you may see some for 64 bit interop apps.&amp;#160; Because of the nature of these changes we expect the impact of them to 64 bit apps to be very minimal: most of the changes involve relaxing behavior that was stricter in 64 bit than 32 bit. The biggest change in reverting to 32 bit behavior was to stop clearing ‘out’ parameters during certain error conditions and should be completely non-breaking to 64 bit applications. &lt;/p&gt;  &lt;p&gt;&lt;i&gt;&lt;strong&gt;Easier Debugging:&lt;/strong&gt;&lt;/i&gt;&lt;/p&gt;  &lt;p&gt;One of the other problems with the old 32 bit marshaling infrastructure was that it worked essentially as a black box that was very difficult to debug if something went wrong. It was very difficult to figure out how/what the runtime was trying to marshal when something went wrong. By moving to IL stubs it is actually possible to see the IL instructions that we’re executing and determine where your problem is. &lt;/p&gt;  &lt;p&gt;Since Visual Studio does not support debugging IL, the move to IL stubs alone wouldn’t help debugging very much if that was all we did. Instead we updated our IL stubs infrastructure to fire an ETW event detailing each stub as they get generated and built a tool, which we recently released on codeplex, which lets you easily see all the stubs being generated and quickly search for the ones for the methods you are most interested in. In an upcoming post we will have more details and a walkthrough of the tool, but in the meantime you can find it here: &lt;a href="http://clrinterop.codeplex.com/Release/ProjectReleases.aspx?ReleaseId=29745"&gt;http://clrinterop.codeplex.com/Release/ProjectReleases.aspx?ReleaseId=29745&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;*ML Stubs: it is a little known fact that up until v4 the CLR, at runtime, converted complex signatures into an internal CLR language called ML (marshaling language) which it then ran through the CLR’s internal ML interpreter each time the method was invoked. This little interpreter is almost another separate runtime just for interop marshaling. You can imagine how replacing this with IL and thus getting all the advantages of the perf work that goes into NGEN and the JIT allowed us to massively speed up these scenarios. There was much rejoicing on our team when we removed this interpreter in v4. &lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;Jesse Kaplan,&lt;/p&gt;  &lt;p&gt;PM, CLR&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9863498" width="1" height="1"&gt;</description></item></channel></rss>
