<?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 Community 5.6.583.19199 (Build: 5.6.583.19199)</generator><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>0</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/03/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>14</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/03/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></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>12</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>7</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>1</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>4</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>1</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></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>17</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>4</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>2</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>5</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>11</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>2</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>14</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><item><title>CLR 4: Making the AssemblyResolve event more useful</title><link>http://blogs.msdn.com/b/dotnet/archive/2009/07/15/clr-4-making-the-assemblyresolve-event-more-useful.aspx</link><pubDate>Thu, 16 Jul 2009 01:04:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9834716</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=9834716</wfw:commentRss><comments>http://blogs.msdn.com/b/dotnet/archive/2009/07/15/clr-4-making-the-assemblyresolve-event-more-useful.aspx#comments</comments><description>&lt;P style="MARGIN: 0in 0in 10pt" class=MsoNormal&gt;&lt;?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /&gt;&lt;o:p&gt;&lt;FONT size=3 face=Calibri&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 10pt" class=MsoNormal&gt;&lt;FONT size=3 face=Calibri&gt;In the introductory post on CLR Binder (‘&lt;/FONT&gt;&lt;A href="http://blogs.msdn.com/clrteam/archive/2009/01/29/understanding-the-binder-part-1.aspx" mce_href="http://blogs.msdn.com/clrteam/archive/2009/01/29/understanding-the-binder-part-1.aspx"&gt;&lt;FONT size=3 face=Calibri&gt;Understanding the Binder – Part 1&lt;/FONT&gt;&lt;/A&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;’), we listed the set of steps that the CLR Binder follows, in order to locate an assembly and bind to it. On reading this, an obvious question comes to mind. What happens when all of these steps fail to locate the assembly? Does the binder simply quit looking? &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;It eventually does, but not before firing the &lt;/FONT&gt;&lt;A href="http://msdn.microsoft.com/en-us/library/system.appdomain.assemblyresolve.aspx" mce_href="http://msdn.microsoft.com/en-us/library/system.appdomain.assemblyresolve.aspx"&gt;&lt;FONT size=3 face=Calibri&gt;AssemblyResolve&lt;/FONT&gt;&lt;/A&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt; event. The user can register an event handler for the AssemblyResolve event and then load the assembly that was intended to be loaded in the first place (or execute some other code appropriately). &lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&lt;/SPAN&gt;&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;The AssemblyResolve event itself has been around for a while now. So what’s changed in CLR 4? Prior to CLR 4, if an assembly A has a reference to another assembly B, and an AssemblyResolve event occurs for the referenced assembly (in this case, B), there is no means to know the identity of the parent assembly (or the referencing assembly, or A). &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;Why is this problematic? Let’s take this example. Let’s assume that an assembly FirstParent.dll references Child.dll. Let’s also assume SecondParent.dll also references Child.dll. On failing to load Child.dll, AssemblyResolve event is fired. &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;Now, while loading FirstParent.dll and SecondParent.dll using LoadFile(), an AssemblyResolve event is fired for Child.dll. Looking at the AssemblyResolve event, it is unclear as to which parent assembly actually triggered loading Child.dll. This is not helpful if the user wants to execute different code as a part of the ResolveEventHandler, depending on the parent assembly that caused attempting to load Child.dll. &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 face=Calibri&gt;In CLR 4, the AssemblyResolve event provides richer information that includes the parent assembly’s identity. &lt;/FONT&gt;&lt;A href="http://msdn.microsoft.com/en-us/library/system.resolveeventargs_members(VS.100).aspx" mce_href="http://msdn.microsoft.com/en-us/library/system.resolveeventargs_members(VS.100).aspx"&gt;&lt;FONT size=3 face=Calibri&gt;System.ResolveEventArgs&lt;/FONT&gt;&lt;/A&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt; now has a property called &lt;B style="mso-bidi-font-weight: normal"&gt;RequestingAssembly&lt;/B&gt;, which is the assembly which requested the (unsuccessful) load of the child assembly, triggering an AssemblyResolve event. &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;With this new property, when AssemblyResolve event is fired, apart from the current assembly (which could not be located by the Binder), the parent assembly is also provided. &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;Thus, using this property,&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;(a) The user&amp;nbsp;now knows&amp;nbsp;which assembly caused the load event &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;(b) The event handler can now make use of the parent assembly that is passed.&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;You can read more about this new property &lt;/FONT&gt;&lt;A href="http://msdn.microsoft.com/en-us/library/system.resolveeventargs.requestingassembly(VS.100).aspx" mce_href="http://msdn.microsoft.com/en-us/library/system.resolveeventargs.requestingassembly(VS.100).aspx"&gt;&lt;FONT size=3 face=Calibri&gt;here&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;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;o:p&gt;&lt;FONT size=3 face=Calibri&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 10pt" class=MsoNormal&gt;&lt;o:p&gt;&lt;FONT size=3 face=Calibri&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9834716" width="1" height="1"&gt;</description></item><item><title>Enabling CAS Policy Compatibility Mode for a Project</title><link>http://blogs.msdn.com/b/dotnet/archive/2009/06/24/enabling-cas-policy-compatibility-mode-for-a-project.aspx</link><pubDate>Wed, 24 Jun 2009 21:48:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9801880</guid><dc:creator>Abhishek_Mondal</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/dotnet/rsscomments.aspx?WeblogPostID=9801880</wfw:commentRss><comments>http://blogs.msdn.com/b/dotnet/archive/2009/06/24/enabling-cas-policy-compatibility-mode-for-a-project.aspx#comments</comments><description>&lt;P&gt;If you’re migrating a VS project over to VS 2010 Beta1 and you are calling code that is passing Evidence objects to the runtime expecting security policy resolution, or if you’re &lt;A href="http://msdn.microsoft.com/en-us/library/system.security.codeaccesspermission.deny(VS.100).aspx" mce_href="http://msdn.microsoft.com/en-us/library/system.security.codeaccesspermission.deny(VS.100).aspx"&gt;using a permission Deny&lt;/A&gt;, you may run into the following exception:&lt;/P&gt;
&lt;P&gt;NotSupportedException: This method uses CAS policy, which has been obsoleted by the .NET Framework. In order to enable CAS policy for compatibility reasons, please use the legacyCasPolicy configuration switch. Please see http://go2.microsoft.com/fwlink/?LinkId=131738 for more information.&lt;/P&gt;
&lt;P&gt;What does this mean? In earlier versions of the .NET Framework, Code Access Security (CAS) Policy was the primary mechanism for defining whether or not certain classes of managed applications were able to perform security sensitive operations or not. While powerful, CAS Policy was extremely difficult to use and manage – developers and administrators would have to set up and analyze complicated policy trees to determine what their code would be granted. Furthermore, these restrictions could be circumvented by simply using unmanaged code!&lt;/P&gt;
&lt;P&gt;We’ve provided cleaner, more appropriate mechanisms for managed code security in .NET Framework 4; those will be described in detail in future posts. CAS Policy has been rendered obsolete as a result of this, hence the exception messages. It is, however, still there for those migrating apps and projects that still require CAS policy in the meantime. &lt;/P&gt;
&lt;P&gt;Note that by enabling CAS for your project, you’re subjecting yourself to the CAS security policy decisions of the runtime. If you made any changes (via caspol.exe, etc) to CAS policy in previous versions of the runtime, &lt;I&gt;these will not be reflected in .NET Framework 4 even with CAS policy turned on&lt;/I&gt;. Your custom policy will have to be reconfigured with the .NET Framework 4 caspol.exe.&lt;/P&gt;
&lt;P&gt;If you’re using CAS policy &lt;A href="http://blogs.msdn.com/shawnfa/archive/2009/05/27/coding-with-security-policy-in-net-4-0-implicit-uses-of-cas-policy.aspx" mce_href="http://blogs.msdn.com/shawnfa/archive/2009/05/27/coding-with-security-policy-in-net-4-0-implicit-uses-of-cas-policy.aspx"&gt;implicitly&lt;/A&gt; (for example, an Assembly.Load with Evidence) or &lt;A href="http://blogs.msdn.com/shawnfa/archive/2009/06/09/coding-with-security-policy-in-net-4-part-2-explicit-uses-of-cas-policy.aspx" mce_href="http://blogs.msdn.com/shawnfa/archive/2009/06/09/coding-with-security-policy-in-net-4-part-2-explicit-uses-of-cas-policy.aspx"&gt;explicitly&lt;/A&gt; (SecurityManager.PolicyHiearchy), check out &lt;A href="http://blogs.msdn.com/shawnfa/" mce_href="http://blogs.msdn.com/shawnfa/"&gt;Shawn Farkas’ blog&lt;/A&gt; for guidance on the new, supported mechanisms for sandboxing and running partial trust code.&lt;/P&gt;
&lt;P&gt;Follow these steps to enable CAS Policy for your project:&lt;/P&gt;
&lt;P&gt;1. Go to “Project” in the menu bar, then “Add New Item…”&lt;/P&gt;
&lt;P&gt;&lt;A href="http://blogs.msdn.com/blogfiles/clrteam/WindowsLiveWriter/EnablingCASPolicyCompatibilityModeforaPr_A5EF/clip_image002_2.jpg" mce_href="http://blogs.msdn.com/blogfiles/clrteam/WindowsLiveWriter/EnablingCASPolicyCompatibilityModeforaPr_A5EF/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/EnablingCASPolicyCompatibilityModeforaPr_A5EF/clip_image002_thumb.jpg" width=488 height=379 mce_src="http://blogs.msdn.com/blogfiles/clrteam/WindowsLiveWriter/EnablingCASPolicyCompatibilityModeforaPr_A5EF/clip_image002_thumb.jpg"&gt;&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;2. Select “Application Configuration File” from the list of items available.&lt;/P&gt;
&lt;P&gt;&lt;A href="http://blogs.msdn.com/blogfiles/clrteam/WindowsLiveWriter/EnablingCASPolicyCompatibilityModeforaPr_A5EF/clip_image004_2.jpg" mce_href="http://blogs.msdn.com/blogfiles/clrteam/WindowsLiveWriter/EnablingCASPolicyCompatibilityModeforaPr_A5EF/clip_image004_2.jpg"&gt;&lt;IMG style="BORDER-BOTTOM: 0px; BORDER-LEFT: 0px; WIDTH: 476px; DISPLAY: inline; HEIGHT: 311px; BORDER-TOP: 0px; BORDER-RIGHT: 0px" title=clip_image004 border=0 alt=clip_image004 src="http://blogs.msdn.com/blogfiles/clrteam/WindowsLiveWriter/EnablingCASPolicyCompatibilityModeforaPr_A5EF/clip_image004_thumb.jpg" width=614 height=450 mce_src="http://blogs.msdn.com/blogfiles/clrteam/WindowsLiveWriter/EnablingCASPolicyCompatibilityModeforaPr_A5EF/clip_image004_thumb.jpg"&gt;&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;3. Enable CAS Policy via the following switch:&lt;/P&gt;
&lt;P&gt;&amp;lt;configuration&amp;gt;&lt;/P&gt;
&lt;P&gt;&amp;lt;runtime&amp;gt;&lt;/P&gt;
&lt;P&gt;&amp;lt;legacyCasPolicy enabled="true" /&amp;gt;&lt;/P&gt;
&lt;P&gt;&amp;lt;/runtime&amp;gt;&lt;/P&gt;
&lt;P&gt;&amp;lt;/configuration&amp;gt;&lt;/P&gt;
&lt;P&gt;&lt;A href="http://blogs.msdn.com/blogfiles/clrteam/WindowsLiveWriter/EnablingCASPolicyCompatibilityModeforaPr_A5EF/clip_image006_2.jpg" mce_href="http://blogs.msdn.com/blogfiles/clrteam/WindowsLiveWriter/EnablingCASPolicyCompatibilityModeforaPr_A5EF/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/EnablingCASPolicyCompatibilityModeforaPr_A5EF/clip_image006_thumb.jpg" width=583 height=446 mce_src="http://blogs.msdn.com/blogfiles/clrteam/WindowsLiveWriter/EnablingCASPolicyCompatibilityModeforaPr_A5EF/clip_image006_thumb.jpg"&gt;&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;4. CAS Policy is now enabled and enforced for this project. &lt;/P&gt;
&lt;P&gt;If you’re simply trying to get loads from remote sources (i.e. Assembly.LoadFrom(@"http://...")) to work, you don’t need to enable CAS Policy to do this – replace &lt;B&gt;legacyCasPolicy&lt;/B&gt; with &lt;B&gt;loadFromRemoteSources&lt;/B&gt; in the example above and you’ll be able to load from any location. Please do note that &lt;U&gt;these assemblies will be loaded as fully trusted&lt;/U&gt;! You can find more information on this switch &lt;A href="http://blogs.msdn.com/shawnfa/archive/2009/06/08/more-implicit-uses-of-cas-policy-loadfromremotesources.aspx" mce_href="http://blogs.msdn.com/shawnfa/archive/2009/06/08/more-implicit-uses-of-cas-policy-loadfromremotesources.aspx"&gt;here&lt;/A&gt;.&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9801880" width="1" height="1"&gt;</description></item><item><title>Getting more information than the exception class provides</title><link>http://blogs.msdn.com/b/dotnet/archive/2009/06/19/getting-more-information-than-the-exception-class-provides.aspx</link><pubDate>Sat, 20 Jun 2009 07:59:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9792897</guid><dc:creator>Abhishek_Mondal</dc:creator><slash:comments>9</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/dotnet/rsscomments.aspx?WeblogPostID=9792897</wfw:commentRss><comments>http://blogs.msdn.com/b/dotnet/archive/2009/06/19/getting-more-information-than-the-exception-class-provides.aspx#comments</comments><description>&lt;P style="MARGIN: 0in 0in 10pt" class=MsoNormal&gt;&lt;FONT size=3 face=Calibri&gt;We recently had a question about how to get more information than an exception’s type provides. The developer was trying to copy a file and didn’t know why the copy was failing. File copies can fail for many reasons, almost all of them what &lt;/FONT&gt;&lt;A href="http://blogs.msdn.com/ericlippert/archive/2008/09/10/vexing-exceptions.aspxhttp:/blogs.msdn.com/ericlippert/archive/2008/09/10/vexing-exceptions.aspx" mce_href="http://blogs.msdn.com/ericlippert/archive/2008/09/10/vexing-exceptions.aspxhttp:/blogs.msdn.com/ericlippert/archive/2008/09/10/vexing-exceptions.aspx"&gt;&lt;FONT color=#0000ff size=3 face=Calibri&gt;Eric Lippert calls “exogenous conditions”&lt;/FONT&gt;&lt;/A&gt;&lt;FONT face=Calibri&gt;&lt;FONT size=3&gt;. The developer was catching System.IOException and parsing the error message. It worked on his machine, but failed during test passes.&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 face=Calibri&gt;Unfortunately, the .NET Framework doesn’t always directly provide the reason that the file copy failed. If an error results from an IO operation the .NET Framework will call &lt;/FONT&gt;&lt;A href="http://msdn.microsoft.com/en-us/library/ms679360.aspx" mce_href="http://msdn.microsoft.com/en-us/library/ms679360.aspx"&gt;&lt;FONT size=3 face=Calibri&gt;GetLastError&lt;/FONT&gt;&lt;/A&gt;&lt;FONT face=Calibri&gt;&lt;FONT size=3&gt; to find out why the operation failed, then throw an IOException with a message explaining the problem: sharing violation, path too long, etc. The error message is formatted in such a way that you can expose it directly to your user: it clearly states the problem and gets translated into the user’s OS language. &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 face=Calibri&gt;&lt;FONT size=3&gt;This is a little annoying if you’re trying to programmatically respond to the error. For example, if there’s a sharing violation you might want to wait for a few seconds then try again. How do you tell that this IOException comes from a sharing violation as opposed to a disconnected USB drive or a network failure? &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 face=Calibri&gt;&lt;FONT size=3&gt;You do NOT want to parse the exception message because exception messages get translated into the user’s OS language. You can’t programmatically parse a localized string without doing a lot of unnecessary work. Moreover, the exception message could change slightly between different versions of the .NET Framework. While we don’t rewrite exception messages just for fun, one day someone could complain that the error is slightly misleading and we’d fix it, breaking your parsing code. So what can you do if you want a more robust way to get more information than the exception code gives you?&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;The answer is pretty simple: call Marshal.GetLastWin32Error yourself in your catch block and look up the &lt;/FONT&gt;&lt;A href="http://msdn.microsoft.com/en-us/library/ms681381(VS.85).aspx" mce_href="http://msdn.microsoft.com/en-us/library/ms681381(VS.85).aspx"&gt;&lt;FONT color=#0000ff size=3 face=Calibri&gt;system error code&lt;/FONT&gt;&lt;/A&gt;&lt;FONT face=Calibri&gt;&lt;FONT size=3&gt; on MSDN. Reading the error doesn’t clear it so you can call GetLastWin32Error even after the Framwork API does. &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 face=Calibri&gt;&lt;FONT size=3&gt;Here’s some sample code that illustrates how to use GetLastWin32Error. It relies on the fact that the default file handle on Windows is an exclusive handle so you can’t call File.Open twice on the same file without having closed it between the two calls. &lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt 0.5in; mso-layout-grid-align: none" class=MsoNormal&gt;&lt;FONT size=3&gt;&lt;SPAN style="FONT-FAMILY: Consolas; COLOR: blue; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"&gt;using&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: Consolas; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"&gt; System;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt 0.5in; mso-layout-grid-align: none" class=MsoNormal&gt;&lt;FONT size=3&gt;&lt;SPAN style="FONT-FAMILY: Consolas; COLOR: blue; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"&gt;using&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: Consolas; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"&gt; System.IO;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt 0.5in; mso-layout-grid-align: none" class=MsoNormal&gt;&lt;FONT size=3&gt;&lt;SPAN style="FONT-FAMILY: Consolas; COLOR: blue; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"&gt;using&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: Consolas; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"&gt; System.Runtime.InteropServices;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt 0.5in; mso-layout-grid-align: none" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: Consolas; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"&gt;&lt;o:p&gt;&lt;FONT size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt 0.5in; mso-layout-grid-align: none" class=MsoNormal&gt;&lt;FONT size=3&gt;&lt;SPAN style="FONT-FAMILY: Consolas; COLOR: blue; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"&gt;class&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: Consolas; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"&gt; &lt;SPAN style="COLOR: #2b91af"&gt;Program&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt 0.5in; mso-layout-grid-align: none" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: Consolas; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"&gt;&lt;FONT size=3&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt 0.5in; mso-layout-grid-align: none" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: Consolas; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"&gt;&lt;FONT size=3&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;static&lt;/SPAN&gt; &lt;SPAN style="COLOR: blue"&gt;void&lt;/SPAN&gt; Main()&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt 0.5in; mso-layout-grid-align: none" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: Consolas; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"&gt;&lt;FONT size=3&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt 0.5in; mso-layout-grid-align: none" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: Consolas; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"&gt;&lt;FONT size=3&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #2b91af"&gt;File&lt;/SPAN&gt;.Open(&lt;SPAN style="COLOR: #a31515"&gt;"foo.txt"&lt;/SPAN&gt;, &lt;SPAN style="COLOR: #2b91af"&gt;FileMode&lt;/SPAN&gt;.OpenOrCreate);&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt 0.5in; mso-layout-grid-align: none" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: Consolas; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"&gt;&lt;o:p&gt;&lt;FONT size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt 0.5in; mso-layout-grid-align: none" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: Consolas; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"&gt;&lt;FONT size=3&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;try&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt 0.5in; mso-layout-grid-align: none" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: Consolas; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"&gt;&lt;FONT size=3&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt 0.5in; mso-layout-grid-align: none" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: Consolas; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"&gt;&lt;FONT size=3&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&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;&lt;SPAN style="COLOR: green"&gt;// This call will fail due to a sharing violation.&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt 0.5in; mso-layout-grid-align: none" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: Consolas; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"&gt;&lt;FONT size=3&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&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;&lt;SPAN style="COLOR: #2b91af"&gt;File&lt;/SPAN&gt;.Open(&lt;SPAN style="COLOR: #a31515"&gt;"foo.txt"&lt;/SPAN&gt;, &lt;SPAN style="COLOR: #2b91af"&gt;FileMode&lt;/SPAN&gt;.Open);&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt 0.5in; mso-layout-grid-align: none" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: Consolas; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"&gt;&lt;FONT size=3&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt 0.5in; mso-layout-grid-align: none" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: Consolas; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"&gt;&lt;FONT size=3&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;catch&lt;/SPAN&gt; (&lt;SPAN style="COLOR: #2b91af"&gt;IOException&lt;/SPAN&gt; e)&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt 0.5in; mso-layout-grid-align: none" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: Consolas; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"&gt;&lt;FONT size=3&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt 0.5in; mso-layout-grid-align: none" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: Consolas; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"&gt;&lt;FONT size=3&gt;&lt;SPAN style="mso-tab-count: 2"&gt;&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;&lt;SPAN style="COLOR: green"&gt;// A P/Invoke here would overwrite last the error.&lt;/SPAN&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt 0.5in; mso-layout-grid-align: none" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: Consolas; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"&gt;&lt;FONT size=3&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&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;&lt;SPAN style="COLOR: blue"&gt;int&lt;/SPAN&gt; error = &lt;SPAN style="COLOR: #2b91af"&gt;Marshal&lt;/SPAN&gt;.GetLastWin32Error();&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt 0.5in; mso-layout-grid-align: none" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: Consolas; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"&gt;&lt;FONT size=3&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&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;&lt;SPAN style="COLOR: #2b91af"&gt;Console&lt;/SPAN&gt;.WriteLine(&lt;SPAN style="COLOR: #a31515"&gt;"Exception message is: "&lt;/SPAN&gt; + e.Message);&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt 0.5in; mso-layout-grid-align: none" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: Consolas; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"&gt;&lt;FONT size=3&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&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;&lt;SPAN style="COLOR: #2b91af"&gt;Console&lt;/SPAN&gt;.WriteLine(&lt;SPAN style="COLOR: #a31515"&gt;"Win32 system error code is "&lt;/SPAN&gt; + error);&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt 0.5in; mso-layout-grid-align: none" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: Consolas; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"&gt;&lt;FONT size=3&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt 0.5in; mso-layout-grid-align: none" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: Consolas; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"&gt;&lt;FONT size=3&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 10pt 0.5in" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: Consolas; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"&gt;&lt;FONT size=3&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 10pt" class=MsoNormal&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;This code prints out two pieces of information: first, that the process cannot access the file “foo.txt” because it is being used by another process, and second, that the Win32 error code is 32. Looking it up online, 32 means ERROR_SHARING_VIOLATION. If you’re passing this information on to your end user, the exception error message is already formatted for you. If you need to know the error programmatically, you can switch on the error code. (Note to the nitpickers: yes, the file’s being used by the &lt;I style="mso-bidi-font-style: normal"&gt;same&lt;/I&gt; process, not &lt;I style="mso-bidi-font-style: normal"&gt;another&lt;/I&gt; process as the error code says. The BCL team believes that you’re smart enough not to try to open the same file twice in your own code so they’re giving you the benefit of the doubt and blaming some other process.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;But this is a fantastic example of why you shouldn’t parse error codes: maybe we’ll fix this one to say that “this process or another process” has the file open already.)&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;This is a simple answer, but it’s also a bit too simple. GetLastWin32Error returns the error code of the last native function executed on the thread. (Technically, the last native function that sets the error code, but let’s assume they all do.) If the call to File.Open was the most recent native function call on this thread, then everything is cool. If you P/Invoke—or if a library function that you call P/Invokes—then you won’t get the error code from the File.Open call. &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;The code I showed above will work fine because it is so simple. But because exceptions can propagate far out of the context from where they were raised you can easily run into problems. For example, say that instead of calling File.Open yourself, you call a function that will open the file’s directory before opening the file—call it OpenFileInDirectory. When the exception is raised, OpenFileInDirectory’s finally clause executes and closes the directory. Now the finally clause has reset the Win32 error code so when you call GetLastWin32Error in your catch clause it returns success—the error value of closing the directory.&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;So what should you do to get more information from an exception than its type tells you? Parsing the exception message is definitely the wrong thing to do. We’ve had suggestions on &lt;/FONT&gt;&lt;A href="http://connect.microsoft.com/" mce_href="http://connect.microsoft.com/"&gt;&lt;FONT size=3 face=Calibri&gt;Connect&lt;/FONT&gt;&lt;/A&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt; that we provide exception subtypes that add more information to an exception. Essentially, when we call GetLastError, we’d pass that error on to the programmer through something like Exception.SubType or Exception.Win32Error. This is a great suggestion, and it's something the BCL team is considering for a future release.&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 find an exception code that doesn’t give you all the information you need, enter a suggestion on Connect. If there’s one there already, vote it up. The BCL team reads all Connect issues and tries hard to get the top-rated suggestions into future releases. There's always more work to do than there is time available so we try to prioritize the things that matter most. If this issue matters to you, let the team know!&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;Andrew Pardoe&lt;/FONT&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 10pt" class=MsoNormal&gt;&lt;FONT size=3 face=Calibri&gt;Program Manager, CLR EH team&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=9792897" width="1" height="1"&gt;</description></item><item><title>Tail Call Improvements in .Net Framework 4</title><link>http://blogs.msdn.com/b/dotnet/archive/2009/06/19/tail-call-improvements-in-net-framework-4.aspx</link><pubDate>Sat, 20 Jun 2009 00:42:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9792208</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=9792208</wfw:commentRss><comments>http://blogs.msdn.com/b/dotnet/archive/2009/06/19/tail-call-improvements-in-net-framework-4.aspx#comments</comments><description>Grant Richins has a post on the CLR &lt;A href="http://blogs.msdn.com/clrcodegeneration" mce_href="http://blogs.msdn.com/clrcodegeneration"&gt;Code Generation team blog&lt;/A&gt; that covers the work done to improve the x64 JIT to honor the "tail." instruction prefix, thereby making functional languages like F#&amp;nbsp;more viable. You can find the full post &lt;A href="http://blogs.msdn.com/clrcodegeneration/archive/2009/05/11/tail-call-improvements-in-net-framework-4.aspx" mce_href="http://blogs.msdn.com/clrcodegeneration/archive/2009/05/11/tail-call-improvements-in-net-framework-4.aspx"&gt;here&lt;/A&gt;. &lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9792208" width="1" height="1"&gt;</description></item><item><title>What's New for .Net Framework Security</title><link>http://blogs.msdn.com/b/dotnet/archive/2009/06/11/what-s-new-for-net-framework-security.aspx</link><pubDate>Thu, 11 Jun 2009 22:16:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9727459</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=9727459</wfw:commentRss><comments>http://blogs.msdn.com/b/dotnet/archive/2009/06/11/what-s-new-for-net-framework-security.aspx#comments</comments><description>&lt;H2 style="MARGIN: 10pt 0in 0pt"&gt;&lt;FONT color=#4f81bd size=4 face=Cambria&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/H2&gt;
&lt;P style="MARGIN: 0in 0in 10pt" class=MsoNormal&gt;&lt;FONT size=3 face=Calibri&gt;Shawn Farkas, CLR security developer, has started a cool series of posts on what’s new in .NET Framework 4 security. If you’re doing any work with or have scenarios involving partially trusted code, you’ll want to take a look. Topics include sandboxing, Code Access Security (CAS) Policy, and a nifty Channel 9 video. &lt;SPAN style="LINE-HEIGHT: 115%; FONT-FAMILY: 'Calibri','sans-serif'; FONT-SIZE: 11pt; mso-ascii-theme-font: minor-latin; mso-hansi-theme-font: minor-latin; mso-bidi-theme-font: minor-bidi; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin; mso-bidi-font-family: 'Times New Roman'; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA"&gt;&lt;A href="http://blogs.msdn.com/shawnfa/default.aspx"&gt;&lt;FONT color=#0000ff&gt;Check it out!&lt;/FONT&gt;&lt;/A&gt;&lt;/SPAN&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=9727459" width="1" height="1"&gt;</description></item><item><title>New Security Model: Moving to a Better Sandbox</title><link>http://blogs.msdn.com/b/dotnet/archive/2009/06/10/new-security-model-moving-to-a-better-sandbox.aspx</link><pubDate>Thu, 11 Jun 2009 04:56:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9725545</guid><dc:creator>Abhishek_Mondal</dc:creator><slash:comments>8</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/dotnet/rsscomments.aspx?WeblogPostID=9725545</wfw:commentRss><comments>http://blogs.msdn.com/b/dotnet/archive/2009/06/10/new-security-model-moving-to-a-better-sandbox.aspx#comments</comments><description>&lt;P style="MARGIN: 0in 0in 10pt" class=MsoNormal&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;&lt;/FONT&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 10pt" class=MsoNormal&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;For .Net Framework 4, we decided to remove the dependency on caspol and the policy levels and&amp;nbsp;make things simpler. &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;With this change, the default grant-set for assemblies is now FullTrust&lt;SPAN style="LINE-HEIGHT: 115%; FONT-SIZE: 12pt"&gt; unless the host (such as&amp;nbsp;InternetExplorer) decides to load them in a sanbox. We also made CodeAccessPermission.Deny obsolete. This &lt;/SPAN&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;A href="http://go.microsoft.com/fwlink/?LinkId=151964" mce_href="http://go.microsoft.com/fwlink/?LinkId=151964"&gt;&lt;SPAN style="LINE-HEIGHT: 115%; FONT-SIZE: 12pt"&gt;&lt;FONT color=#0000ff face=Calibri&gt;MSDN article&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/A&gt;&lt;SPAN style="LINE-HEIGHT: 115%; FONT-SIZE: 12pt"&gt;&lt;FONT face=Calibri&gt; describes the changes we made in the security namespace for .Net Framework 4 in detail. &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;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 10pt" class=MsoNormal&gt;&lt;SPAN style="LINE-HEIGHT: 115%; FONT-SIZE: 12pt"&gt;&lt;FONT face=Calibri&gt;For most people, this change in policy will be unnoticeable, their program probably was already running in full-trust and the world is the same. For some others, things will be a lot easier: launching their tool from the companies’ intranet share is now possible without the need to change the .Net Framework policy. For an even smaller set of users, there will be some issues that they will encounter, they were probably expecting assemblies to be loaded as partial trust and now they are full-trust. &lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 10pt" class=MsoNormal&gt;&lt;SPAN style="LINE-HEIGHT: 115%; FONT-SIZE: 12pt"&gt;&lt;FONT face=Calibri&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 10pt" class=MsoNormal&gt;&lt;SPAN style="LINE-HEIGHT: 115%; FONT-SIZE: 12pt"&gt;&lt;FONT face=Calibri&gt;In this post, we will cover how programs can be migrated to the newer security model and still work in the way they were intended to work.&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 10pt" class=MsoNormal&gt;&lt;SPAN style="LINE-HEIGHT: 115%; FONT-SIZE: 12pt"&gt;&lt;FONT face=Calibri&gt;In versions of .Net Framework before v4, we had many ways to restrict the permissions of an assembly or even certain code path within the assembly:&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 10pt" class=MsoNormal&gt;&lt;SPAN style="LINE-HEIGHT: 115%; FONT-SIZE: 12pt"&gt;&lt;FONT face=Calibri&gt;1.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;Stack-walk modifiers: Deny, PermitOnly&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 10pt" class=MsoNormal&gt;&lt;SPAN style="LINE-HEIGHT: 115%; FONT-SIZE: 12pt"&gt;&lt;FONT face=Calibri&gt;2.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;Assembly-level requests: RequestOptional, RequestRefuse, RequestMinimum&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 10pt" class=MsoNormal&gt;&lt;SPAN style="LINE-HEIGHT: 115%; FONT-SIZE: 12pt"&gt;&lt;FONT face=Calibri&gt;3.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;Policy changes: caspol, and AppDomain.SetPolicyLevel&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 10pt" class=MsoNormal&gt;&lt;SPAN style="LINE-HEIGHT: 115%; FONT-SIZE: 12pt"&gt;&lt;FONT face=Calibri&gt;4.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;Loading an assembly with a Zone other than MyComputer &lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 10pt" class=MsoNormal&gt;&lt;SPAN style="LINE-HEIGHT: 115%; FONT-SIZE: 12pt"&gt;&lt;FONT face=Calibri&gt;In the past, these APIs have been a source of confusion for host and application writers. In .Net Framework 4, these methods of restricting permissions are marked obsolete and we hope to remove them at a point in the future. The .Net Framework 4 throws NotSupportedException when encountering calls to functions allowing any of these sandboxing methods. Applications that used these sandboxing APIs will now see an exception similar to this:&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 10pt" class=MsoNormal&gt;&lt;B style="mso-bidi-font-weight: normal"&gt;&lt;SPAN style="LINE-HEIGHT: 115%; FONT-SIZE: 12pt"&gt;&lt;FONT face=Calibri&gt;System.NotSupportedException: The Deny stack modifier has been obsoleted by the .NET Framework.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;Please see &lt;/FONT&gt;&lt;A href="http://go2.microsoft.com/fwlink/?LinkId=131738" mce_href="http://go2.microsoft.com/fwlink/?LinkId=131738"&gt;&lt;FONT color=#0000ff face=Calibri&gt;http://go2.microsoft.com/fwlink/?LinkId=131738&lt;/FONT&gt;&lt;/A&gt;&lt;FONT face=Calibri&gt; for more information.&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/B&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 10pt" class=MsoNormal&gt;&lt;SPAN style="LINE-HEIGHT: 115%; FONT-SIZE: 12pt"&gt;&lt;FONT face=Calibri&gt;Here is what you can do, after identifying that your code uses one of the previously described sandboxing methods:&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: 115%; TEXT-INDENT: -0.25in; MARGIN: auto 0in auto 0.25in; mso-list: l0 level1 lfo1" class=MsoListParagraph&gt;&lt;SPAN style="LINE-HEIGHT: 115%; FONT-FAMILY: 'Calibri','sans-serif'; FONT-SIZE: 11pt; mso-ascii-theme-font: minor-latin; mso-hansi-theme-font: minor-latin; mso-bidi-theme-font: minor-latin; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin"&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;&lt;SPAN style="LINE-HEIGHT: 115%; FONT-FAMILY: 'Calibri','sans-serif'; FONT-SIZE: 11pt; mso-ascii-theme-font: minor-latin; mso-hansi-theme-font: minor-latin; mso-bidi-theme-font: minor-latin; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin"&gt;Execute the partial trust code inside a partial-trust AppDomains. This approach might appear difficult because it asks you to figure out what trust levels your application needs. Having part of your application running in another AppDomain also requires some consideration about how to do the communication with the objects residing in the new AppDomain. This model might be more complex than just a command that changes the machine policy, but we think it is a better one. This &lt;/SPAN&gt;&lt;SPAN style="LINE-HEIGHT: 115%; FONT-FAMILY: 'Calibri','sans-serif'; FONT-SIZE: 11pt; mso-ascii-theme-font: minor-latin; mso-hansi-theme-font: minor-latin; mso-bidi-theme-font: minor-latin"&gt;&lt;A href="http://blogs.msdn.com/shawnfa/archive/2006/04/19/579066.aspx" mce_href="http://blogs.msdn.com/shawnfa/archive/2006/04/19/579066.aspx"&gt;&lt;SPAN style="mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin"&gt;&lt;FONT color=#0000ff&gt;article&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/A&gt;&lt;/SPAN&gt;&lt;SPAN style="LINE-HEIGHT: 115%; FONT-FAMILY: 'Calibri','sans-serif'; FONT-SIZE: 11pt; mso-ascii-theme-font: minor-latin; mso-hansi-theme-font: minor-latin; mso-bidi-theme-font: minor-latin; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin"&gt; provides more information about why this sandboxing strategy is better.&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: auto 0in auto 0.25in" class=MsoListParagraph&gt;&lt;SPAN style="mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin"&gt;&lt;FONT size=3&gt;&lt;FONT face="Times New Roman"&gt;Here are the steps for creating a new sandboxing AppDomain:&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="TEXT-INDENT: -0.3in; MARGIN: auto 0in auto 0.55in; mso-list: l0 level2 lfo1" class=MsoListParagraph&gt;&lt;FONT face="Times New Roman"&gt;&lt;SPAN style="mso-list: Ignore"&gt;&lt;FONT size=3&gt;1.1.&lt;/FONT&gt;&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin"&gt;&lt;FONT size=3&gt;Remove the Deny, assembly level requests or the caspol command from your application.&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P style="TEXT-INDENT: -0.3in; MARGIN: auto 0in auto 0.55in; mso-list: l0 level2 lfo1" class=MsoListParagraph&gt;&lt;FONT face="Times New Roman"&gt;&lt;SPAN style="mso-list: Ignore"&gt;&lt;FONT size=3&gt;1.2.&lt;/FONT&gt;&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin"&gt;&lt;FONT size=3&gt;Create a new partial-trust AppDomain with a partial-trust grant set. This is done by calling the override for AppDomain.CreateDomain that receives a grant-set and a full-trust StrongName list:&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 10pt 0.5in" class=MsoNormal&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;&lt;SPAN style="COLOR: #1000a0"&gt;public&lt;/SPAN&gt; &lt;SPAN style="COLOR: #1000a0"&gt;static&lt;/SPAN&gt; &lt;/FONT&gt;&lt;/FONT&gt;&lt;A title=System.AppDomain href="http://www.aisto.com/roeder/dotnet/Default.aspx?Target=code://mscorlib:4.0.0.0:b77a5c561934e089/System.AppDomain" mce_href="http://www.aisto.com/roeder/dotnet/Default.aspx?Target=code://mscorlib:4.0.0.0:b77a5c561934e089/System.AppDomain"&gt;&lt;FONT color=#0000ff size=3 face=Calibri&gt;AppDomain&lt;/FONT&gt;&lt;/A&gt;&lt;FONT size=3 face=Calibri&gt; &lt;/FONT&gt;&lt;A href="http://www.aisto.com/roeder/dotnet/Default.aspx?Target=code://mscorlib:4.0.0.0:b77a5c561934e089/System.AppDomain/CreateDomain(String,System.Security.Policy.Evidence,System.AppDomainSetup,System.Security.PermissionSet,System.Security.Policy.StrongName%5b%5d):System.AppDomain" mce_href="http://www.aisto.com/roeder/dotnet/Default.aspx?Target=code://mscorlib:4.0.0.0:b77a5c561934e089/System.AppDomain/CreateDomain(String,System.Security.Policy.Evidence,System.AppDomainSetup,System.Security.PermissionSet,System.Security.Policy.StrongName%5b%5d):System.AppDomain"&gt;&lt;B&gt;&lt;FONT color=#0000ff size=3 face=Calibri&gt;CreateDomain&lt;/FONT&gt;&lt;/B&gt;&lt;/A&gt;&lt;FONT size=3 face=Calibri&gt;(&lt;/FONT&gt;&lt;A title=System.String href="http://www.aisto.com/roeder/dotnet/Default.aspx?Target=code://mscorlib:4.0.0.0:b77a5c561934e089/System.String" mce_href="http://www.aisto.com/roeder/dotnet/Default.aspx?Target=code://mscorlib:4.0.0.0:b77a5c561934e089/System.String"&gt;&lt;FONT color=#0000ff size=3 face=Calibri&gt;string&lt;/FONT&gt;&lt;/A&gt;&lt;FONT size=3 face=Calibri&gt; friendlyName, &lt;/FONT&gt;&lt;A title=System.Security.Policy.Evidence href="http://www.aisto.com/roeder/dotnet/Default.aspx?Target=code://mscorlib:4.0.0.0:b77a5c561934e089/System.Security.Policy.Evidence" mce_href="http://www.aisto.com/roeder/dotnet/Default.aspx?Target=code://mscorlib:4.0.0.0:b77a5c561934e089/System.Security.Policy.Evidence"&gt;&lt;FONT color=#0000ff size=3 face=Calibri&gt;Evidence&lt;/FONT&gt;&lt;/A&gt;&lt;FONT size=3 face=Calibri&gt; securityInfo, &lt;/FONT&gt;&lt;A title=System.AppDomainSetup href="http://www.aisto.com/roeder/dotnet/Default.aspx?Target=code://mscorlib:4.0.0.0:b77a5c561934e089/System.AppDomainSetup" mce_href="http://www.aisto.com/roeder/dotnet/Default.aspx?Target=code://mscorlib:4.0.0.0:b77a5c561934e089/System.AppDomainSetup"&gt;&lt;FONT color=#0000ff size=3 face=Calibri&gt;AppDomainSetup&lt;/FONT&gt;&lt;/A&gt;&lt;FONT size=3 face=Calibri&gt; info, &lt;/FONT&gt;&lt;A title=System.Security.PermissionSet href="http://www.aisto.com/roeder/dotnet/Default.aspx?Target=code://mscorlib:4.0.0.0:b77a5c561934e089/System.Security.PermissionSet" mce_href="http://www.aisto.com/roeder/dotnet/Default.aspx?Target=code://mscorlib:4.0.0.0:b77a5c561934e089/System.Security.PermissionSet"&gt;&lt;FONT color=#0000ff size=3 face=Calibri&gt;PermissionSet&lt;/FONT&gt;&lt;/A&gt;&lt;FONT size=3 face=Calibri&gt; grantSet, &lt;SPAN style="COLOR: #1000a0"&gt;params&lt;/SPAN&gt; &lt;/FONT&gt;&lt;A title=System.Security.Policy.StrongName href="http://www.aisto.com/roeder/dotnet/Default.aspx?Target=code://mscorlib:4.0.0.0:b77a5c561934e089/System.Security.Policy.StrongName" mce_href="http://www.aisto.com/roeder/dotnet/Default.aspx?Target=code://mscorlib:4.0.0.0:b77a5c561934e089/System.Security.Policy.StrongName"&gt;&lt;FONT color=#0000ff size=3 face=Calibri&gt;StrongName&lt;/FONT&gt;&lt;/A&gt;&lt;FONT size=3 face=Calibri&gt;[] fullTrustAssemblies)&lt;/FONT&gt;&lt;/P&gt;
&lt;P style="TEXT-INDENT: 0.5in; MARGIN: 0in 0in 10pt" class=MsoNormal&gt;&lt;FONT size=3 face=Calibri&gt;The MSDN article talking about this specific override is located &lt;/FONT&gt;&lt;A href="http://msdn.microsoft.com/en-us/library/ms130766.aspx" mce_href="http://msdn.microsoft.com/en-us/library/ms130766.aspx"&gt;&lt;FONT color=#0000ff size=3 face=Calibri&gt;here&lt;/FONT&gt;&lt;/A&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 10pt 0.5in" class=MsoNormal&gt;&lt;FONT size=3 face=Calibri&gt;This would create a new AppDomain which would give assemblies by default the PermissionSet given as a parameter. Assemblies that have their StrongName present in the fullTrustAssemblies parameter, will receive FullTrust as the grant-set.&lt;/FONT&gt;&lt;/P&gt;
&lt;P style="TEXT-INDENT: -0.3in; MARGIN: auto 0in auto 0.55in; mso-list: l0 level2 lfo1" class=MsoListParagraph&gt;&lt;FONT face="Times New Roman"&gt;&lt;SPAN style="mso-list: Ignore"&gt;&lt;FONT size=3&gt;1.3.&lt;/FONT&gt;&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin"&gt;&lt;FONT size=3&gt;Create an instance of one of your classes inside the new AppDomain. Your class would have to inherit from MarshalByRefObject. The API to use is this: &lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P style="TEXT-INDENT: 0.5in; MARGIN: 0in 0in 10pt" class=MsoNormal&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;&lt;SPAN style="COLOR: #1000a0"&gt;public&lt;/SPAN&gt; &lt;/FONT&gt;&lt;/FONT&gt;&lt;A title=System.Object href="http://www.aisto.com/roeder/dotnet/Default.aspx?Target=code://mscorlib:4.0.0.0:b77a5c561934e089/System.Object" mce_href="http://www.aisto.com/roeder/dotnet/Default.aspx?Target=code://mscorlib:4.0.0.0:b77a5c561934e089/System.Object"&gt;&lt;FONT color=#0000ff size=3 face=Calibri&gt;object&lt;/FONT&gt;&lt;/A&gt;&lt;FONT size=3 face=Calibri&gt; &lt;/FONT&gt;&lt;A href="http://www.aisto.com/roeder/dotnet/Default.aspx?Target=code://mscorlib:4.0.0.0:b77a5c561934e089/System.AppDomain/CreateInstanceAndUnwrap(String,String):Object" mce_href="http://www.aisto.com/roeder/dotnet/Default.aspx?Target=code://mscorlib:4.0.0.0:b77a5c561934e089/System.AppDomain/CreateInstanceAndUnwrap(String,String):Object"&gt;&lt;B&gt;&lt;FONT color=#0000ff size=3 face=Calibri&gt;CreateInstanceAndUnwrap&lt;/FONT&gt;&lt;/B&gt;&lt;/A&gt;&lt;FONT size=3 face=Calibri&gt;(&lt;/FONT&gt;&lt;A title=System.String href="http://www.aisto.com/roeder/dotnet/Default.aspx?Target=code://mscorlib:4.0.0.0:b77a5c561934e089/System.String" mce_href="http://www.aisto.com/roeder/dotnet/Default.aspx?Target=code://mscorlib:4.0.0.0:b77a5c561934e089/System.String"&gt;&lt;FONT color=#0000ff size=3 face=Calibri&gt;string&lt;/FONT&gt;&lt;/A&gt;&lt;FONT size=3 face=Calibri&gt; assemblyName, &lt;/FONT&gt;&lt;A title=System.String href="http://www.aisto.com/roeder/dotnet/Default.aspx?Target=code://mscorlib:4.0.0.0:b77a5c561934e089/System.String" mce_href="http://www.aisto.com/roeder/dotnet/Default.aspx?Target=code://mscorlib:4.0.0.0:b77a5c561934e089/System.String"&gt;&lt;FONT color=#0000ff size=3 face=Calibri&gt;string&lt;/FONT&gt;&lt;/A&gt;&lt;FONT size=3 face=Calibri&gt; typeName)&lt;/FONT&gt;&lt;/P&gt;
&lt;P style="TEXT-INDENT: 0.5in; MARGIN: 0in 0in 10pt" class=MsoNormal&gt;&lt;SPAN style="LINE-HEIGHT: 115%; FONT-SIZE: 12pt"&gt;&lt;FONT face=Calibri&gt;The MSDN article talking about this specific override is located &lt;/FONT&gt;&lt;/SPAN&gt;&lt;A href="http://msdn.microsoft.com/en-us/library/system.appdomain.createinstanceandunwrap.aspx" mce_href="http://msdn.microsoft.com/en-us/library/system.appdomain.createinstanceandunwrap.aspx"&gt;&lt;SPAN style="LINE-HEIGHT: 115%; FONT-SIZE: 12pt"&gt;&lt;FONT color=#0000ff face=Calibri&gt;here&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/A&gt;&lt;SPAN style="LINE-HEIGHT: 115%; FONT-SIZE: 12pt"&gt;&lt;FONT face=Calibri&gt;.&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 10pt 0.5in" class=MsoNormal&gt;&lt;SPAN style="LINE-HEIGHT: 115%; FONT-SIZE: 12pt"&gt;&lt;FONT face=Calibri&gt;This API will return you a reference of type object to an instance of a class inside the new AppDomain. You would have to convert that instance to your specific type, so you would be able to call functions present in your class on it.&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="TEXT-INDENT: -0.3in; MARGIN: auto 0in auto 0.55in; mso-list: l0 level2 lfo1" class=MsoListParagraph&gt;&lt;FONT face="Times New Roman"&gt;&lt;SPAN style="mso-list: Ignore"&gt;&lt;FONT size=3&gt;1.4.&lt;/FONT&gt;&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin"&gt;&lt;FONT size=3&gt;Call a function on your newly created instance. This function call would be marshaled across AppDomain boundaries and will be executing in the new AppDomain, thus in partial trust. &lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 10pt" class=MsoNormal&gt;&lt;SPAN style="LINE-HEIGHT: 115%; FONT-SIZE: 12pt"&gt;&lt;FONT face=Calibri&gt;Example:&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; COLOR: #2b91af; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;PermissionSet&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt; ps = &lt;SPAN style="COLOR: blue"&gt;new&lt;/SPAN&gt; &lt;SPAN style="COLOR: #2b91af"&gt;PermissionSet&lt;/SPAN&gt;(&lt;SPAN style="COLOR: #2b91af"&gt;PermissionState&lt;/SPAN&gt;.None);&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;ps.AddPermission(&lt;SPAN style="COLOR: blue"&gt;new&lt;/SPAN&gt; &lt;SPAN style="COLOR: #2b91af"&gt;SecurityPermission&lt;/SPAN&gt;(&lt;SPAN style="COLOR: #2b91af"&gt;SecurityPermissionFlag&lt;/SPAN&gt;.Execution));&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;//Create a new sandboxed domain &lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; COLOR: #2b91af; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;AppDomainSetup&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt; setup = &lt;SPAN style="COLOR: #2b91af"&gt;AppDomain&lt;/SPAN&gt;.CurrentDomain.SetupInformation;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; COLOR: #2b91af; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;AppDomain&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt; newDomain = &lt;SPAN style="COLOR: #2b91af"&gt;AppDomain&lt;/SPAN&gt;.CreateDomain(&lt;SPAN style="COLOR: #a31515"&gt;"test domain"&lt;/SPAN&gt;, &lt;SPAN style="COLOR: blue"&gt;null&lt;/SPAN&gt;, setup, ps);&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;//Create an instance in the new domain. &lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;//The class has to derive from MarshalByRefObject. We consider &lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;//PartialTrustTest to be such a class&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;PartialTrustTest remoteTest = newDomain.CreateInstanceAndUnwrap(&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;typeof&lt;/SPAN&gt;(PartialTrustTest).Assembly.FullName, &lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;typeof&lt;/SPAN&gt;(PartialTrustTest).FullName) &lt;SPAN style="COLOR: blue"&gt;as&lt;/SPAN&gt; PartialTrustTest;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;remoteTest.EntryPoint();&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 10pt" class=MsoNormal&gt;&lt;SPAN style="LINE-HEIGHT: 115%; FONT-SIZE: 12pt"&gt;&lt;o:p&gt;&lt;FONT face=Calibri&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 10pt 0.5in" class=MsoNormal&gt;&lt;SPAN style="LINE-HEIGHT: 115%; FONT-SIZE: 12pt"&gt;&lt;FONT face=Calibri&gt;This will get slightly more complicated if you would have 2 assemblies, where one needs to be run in FullTrust and one in PartialTrust. The way to do this is to sign with a key (obtained by caling sn –k) the FullTrust assembly, and pass it’s strong name as the last parameter to AppDomain.CreateDomain.&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 10pt" class=MsoNormal&gt;&lt;SPAN style="LINE-HEIGHT: 115%; FONT-SIZE: 12pt"&gt;&lt;FONT face=Calibri&gt;Example:&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 10pt" class=MsoNormal&gt;&lt;SPAN style="LINE-HEIGHT: 115%; FONT-SIZE: 12pt"&gt;&lt;FONT face=Calibri&gt;…&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;//We consider FullTrustAssm to be the name of the assembly that needs to be&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;//executed as a full-trust assembly&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; COLOR: #2b91af; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;AppDomain&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt; newDomain = &lt;SPAN style="COLOR: #2b91af"&gt;AppDomain&lt;/SPAN&gt;.CreateDomain(&lt;SPAN style="COLOR: #a31515"&gt;"test domain"&lt;/SPAN&gt;, &lt;SPAN style="COLOR: blue"&gt;null&lt;/SPAN&gt;, setup, ps, &lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt 0.5in; mso-layout-grid-align: none" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; COLOR: #2b91af; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;Assembly&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;.Load(&lt;SPAN style="COLOR: #a31515"&gt;"FullTrustAssm"&lt;/SPAN&gt;).Evidence.GetHostEvidence&amp;lt;&lt;SPAN style="COLOR: #2b91af"&gt;StrongName&lt;/SPAN&gt;&amp;gt;());&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 10pt" class=MsoNormal&gt;&lt;SPAN style="LINE-HEIGHT: 115%; FONT-SIZE: 12pt"&gt;&lt;FONT face=Calibri&gt;…&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="TEXT-INDENT: -0.25in; MARGIN: auto 0in auto 0.25in; mso-list: l0 level1 lfo1" class=MsoListParagraph&gt;&lt;FONT face="Times New Roman"&gt;&lt;SPAN style="mso-list: Ignore"&gt;&lt;FONT size=3&gt;2.&lt;/FONT&gt;&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 style="mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin"&gt;&lt;FONT size=3&gt;Sandboxing AppDomains might seem complicated and daunting, especially if all you need is to launch an entire executable in PartialTrust and you don’t want to know all the details of AppDomain creation and communication.&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P style="MARGIN: auto 0in auto 0.25in" class=MsoListParagraph&gt;&lt;FONT size=3&gt;&lt;FONT face="Times New Roman"&gt;&lt;SPAN style="mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin"&gt;If this is the case, we recommend the &lt;/SPAN&gt;PTRunner&lt;SPAN style="mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin"&gt; tool. If you are going to take this route, you still need to remove the Deny, assembly level requests or the caspol command. In order to be able to use this tool, your application has to be launched from the command prompt. The tool is present in the CLR Security codeplex site at project &lt;/SPAN&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;A href="http://clrsecurity.codeplex.com/Release/ProjectReleases.aspx?ReleaseId=28359" mce_href="http://clrsecurity.codeplex.com/Release/ProjectReleases.aspx?ReleaseId=28359"&gt;&lt;SPAN style="mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin"&gt;&lt;FONT color=#0000ff size=3 face="Times New Roman"&gt;PTRunner&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/A&gt;&lt;SPAN style="mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin"&gt;&lt;FONT size=3&gt;&lt;FONT face="Times New Roman"&gt;. &lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: auto 0in auto 0.25in" class=MsoListParagraph&gt;&lt;FONT size=3&gt;&lt;FONT face="Times New Roman"&gt;&lt;SPAN style="mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin"&gt;So let’s say your test is located in one assembly called “partialTrustAssembly.exe” that used to have Deny. You remove the deny and call &lt;/SPAN&gt;PTRunner&lt;SPAN style="mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin"&gt;. Under the covers the &lt;/SPAN&gt;PTRunner &lt;SPAN style="mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin"&gt;tool sets a sandbox AppDomain for you and launches your application in it.&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 10pt" class=MsoNormal&gt;&lt;SPAN style="LINE-HEIGHT: 115%; FONT-SIZE: 12pt"&gt;&lt;FONT face=Calibri&gt;Example: &lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="TEXT-INDENT: 0.5in; MARGIN: 0in 0in 10pt" class=MsoNormal&gt;&lt;SPAN style="LINE-HEIGHT: 115%; FONT-SIZE: 12pt"&gt;&lt;FONT face=Calibri&gt;PTRunner partialTrustAssembly.exe&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 10pt 0.5in" class=MsoNormal&gt;&lt;SPAN style="LINE-HEIGHT: 115%; FONT-SIZE: 12pt"&gt;&lt;FONT face=Calibri&gt;Now let’s say, you want one of the assemblies your executable references to be full trust. You would do something like this:&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="TEXT-INDENT: 0.5in; MARGIN: 0in 0in 10pt" class=MsoNormal&gt;&lt;SPAN style="LINE-HEIGHT: 115%; FONT-SIZE: 12pt"&gt;&lt;FONT face=Calibri&gt;PTRunner –af fullTrustAssembly.dll partialTrustAssembly.exe&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="TEXT-INDENT: 0.5in; MARGIN: 0in 0in 10pt" class=MsoNormal&gt;&lt;SPAN style="LINE-HEIGHT: 115%; FONT-SIZE: 12pt"&gt;&lt;FONT face=Calibri&gt;You could also do something like this.&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="TEXT-INDENT: 0.5in; MARGIN: 0in 0in 10pt" class=MsoNormal&gt;&lt;SPAN style="LINE-HEIGHT: 115%; FONT-SIZE: 12pt"&gt;&lt;FONT face=Calibri&gt;PTRunner –af FullTrustAssembly.exe FullTrustAssembly.exe . &lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 10pt 0.5in" class=MsoNormal&gt;&lt;SPAN style="LINE-HEIGHT: 115%; FONT-SIZE: 12pt"&gt;&lt;FONT face=Calibri&gt;This is rather fancy but it runs your assembly as full trust in a partial trust AppDomain. This would allow you to do operations allowed only to full-trust code, like assert, but at the same time run in a partiual-trust AppDomain so demands would still fail.&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 10pt 0.5in" class=MsoNormal&gt;&lt;SPAN style="LINE-HEIGHT: 115%; FONT-SIZE: 12pt"&gt;&lt;FONT face=Calibri&gt;Or perhaps you don’t like the minimum execution permission that your assembly is run under. You could do something like this:&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="TEXT-INDENT: 0.5in; MARGIN: 0in 0in 10pt" class=MsoNormal&gt;&lt;SPAN style="LINE-HEIGHT: 115%; FONT-SIZE: 12pt"&gt;&lt;FONT face=Calibri&gt;PTRunner –ps Internet partialTrustAssembly.exe&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 10pt 0.5in" class=MsoNormal&gt;&lt;SPAN style="LINE-HEIGHT: 115%; FONT-SIZE: 12pt"&gt;&lt;FONT face=Calibri&gt;Or perhaps you want your very own permission set that is non-standard. You would write the permission in XML and call PTRunner like this:&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="TEXT-INDENT: 0.5in; MARGIN: 0in 0in 10pt" class=MsoNormal&gt;&lt;SPAN style="LINE-HEIGHT: 115%; FONT-SIZE: 12pt"&gt;&lt;FONT face=Calibri&gt;PTRunner –xml Permission.xml partialTrustAssembly.exe&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 10pt 0.5in" class=MsoNormal&gt;&lt;SPAN style="LINE-HEIGHT: 115%; FONT-SIZE: 12pt"&gt;&lt;FONT face=Calibri&gt;The xml file contains the serialization to XML of a permission set.&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="TEXT-INDENT: -0.25in; MARGIN: auto 0in auto 0.25in; mso-list: l0 level1 lfo1" class=MsoListParagraph&gt;&lt;FONT face="Times New Roman"&gt;&lt;SPAN style="mso-list: Ignore"&gt;&lt;FONT size=3&gt;3.&lt;/FONT&gt;&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 style="mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin"&gt;&lt;FONT size=3&gt;If you don’t have the luxury to launch a runner that, in turn, launches your test, another way to launch code in partial-trust is to use the SandboxActivator. This is located in the &lt;/FONT&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;A href="http://clrsecurity.codeplex.com/" mce_href="http://clrsecurity.codeplex.com/"&gt;&lt;SPAN style="mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin"&gt;&lt;FONT color=#0000ff size=3 face="Times New Roman"&gt;CLR Security codeplex site&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/A&gt;&lt;SPAN style="mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin"&gt;&lt;FONT size=3 face="Times New Roman"&gt; in the &lt;/FONT&gt;&lt;/SPAN&gt;&lt;A href="http://clrsecurity.codeplex.com/Release/ProjectReleases.aspx?ReleaseId=28364" mce_href="http://clrsecurity.codeplex.com/Release/ProjectReleases.aspx?ReleaseId=28364"&gt;&lt;SPAN style="mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin"&gt;&lt;FONT color=#0000ff size=3 face="Times New Roman"&gt;Security 1.1&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/A&gt;&lt;SPAN style="mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin"&gt;&lt;FONT size=3&gt;&lt;FONT face="Times New Roman"&gt; library and will help you set up a new AppDomain in an easier way. This is basically a wrap around ApDomain.CreateDomain and AppDomain. CreateInstanceAndUnwrap from the example above about sandboxed domains and it returns you just an instance of your type in the new AppDomain. &lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: auto 0in auto 0.25in" class=MsoListParagraph&gt;&lt;SPAN style="mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin"&gt;&lt;FONT size=3&gt;&lt;FONT face="Times New Roman"&gt;You still need to remove the Deny, assembly level requests or the caspol command from your application and make one of the existing classes derive from MarshalByRefObject. Then you call the SandboxActivator.GetPartialTrustInstance which will return a new instance of your type in a partial-trust AppDomain. Calling a method on this new instance will be executed in a partial-trust sandbox.&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 10pt 0.25in" class=MsoNormal&gt;&lt;SPAN style="LINE-HEIGHT: 115%; FONT-SIZE: 12pt"&gt;&lt;FONT face=Calibri&gt;Example:&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;//This will create a sandboxed AppDomain with the Execution permission set &lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;MainClass m = SandboxActivator.GetPartialTrustInstance&amp;lt;MainClass&amp;gt;();&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;m.DoPartialTrustCall();&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 10pt" class=MsoNormal&gt;&lt;SPAN style="LINE-HEIGHT: 115%; FONT-SIZE: 12pt"&gt;&lt;FONT face=Calibri&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="mso-tab-count: 1"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 10pt" class=MsoNormal&gt;&lt;SPAN style="LINE-HEIGHT: 115%; FONT-SIZE: 12pt"&gt;&lt;FONT face=Calibri&gt;These are the public APIs available through the SandboxActivator interface:&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;public&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt; &lt;SPAN style="COLOR: blue"&gt;static&lt;/SPAN&gt; &lt;SPAN style="COLOR: #2b91af"&gt;AppDomain&lt;/SPAN&gt; CreateSandboxedDomain(PermissionSet ps, &lt;SPAN style="COLOR: blue"&gt;params&lt;/SPAN&gt; &lt;SPAN style="COLOR: #2b91af"&gt;Assembly&lt;/SPAN&gt;[] fullTrustList)&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;public&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt; &lt;SPAN style="COLOR: blue"&gt;static&lt;/SPAN&gt; T GetPartialTrustInstance&amp;lt;T&amp;gt;(&lt;SPAN style="COLOR: #2b91af"&gt;PermissionSet&lt;/SPAN&gt; ps, &lt;SPAN style="COLOR: blue"&gt;params&lt;/SPAN&gt; &lt;SPAN style="COLOR: #2b91af"&gt;Assembly&lt;/SPAN&gt;[] fullTrustList) where T : &lt;SPAN style="COLOR: #2b91af"&gt;MarshalByRefObject&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; COLOR: #2b91af; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;public&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt; &lt;SPAN style="COLOR: blue"&gt;static&lt;/SPAN&gt; T GetPartialTrustInstance&amp;lt;T&amp;gt;(&lt;SPAN style="COLOR: blue"&gt;params&lt;/SPAN&gt; &lt;SPAN style="COLOR: #2b91af"&gt;Assembly&lt;/SPAN&gt;[] fullTrustList) where T : &lt;SPAN style="COLOR: #2b91af"&gt;MarshalByRefObject&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 10pt" class=MsoNormal&gt;&lt;SPAN style="LINE-HEIGHT: 115%; FONT-SIZE: 12pt"&gt;&lt;o:p&gt;&lt;FONT face=Calibri&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="TEXT-INDENT: -0.25in; MARGIN: auto 0in auto 0.25in; mso-list: l0 level1 lfo1" class=MsoListParagraph&gt;&lt;FONT face="Times New Roman"&gt;&lt;SPAN style="mso-list: Ignore"&gt;&lt;FONT size=3&gt;4.&lt;/FONT&gt;&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;FONT size=3&gt;The last method to make your application work is not typically recommended by us. We have a way to set your process to run in legacy mode that is according to the pre-v4.0 security model. We prefer users of.Net Framework to fully migrate to the new security model; we introduced this only for exception situations. This legacy mode will be available only in v4 and in future versions would be removed. We also believe the new security model does a better job at setting up a sandbox for your application to run.&lt;SPAN style="mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P style="MARGIN: auto 0in auto 0.25in" class=MsoListParagraph&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&amp;nbsp;&lt;FONT size=3&gt;&lt;FONT face="Times New Roman"&gt;So there, you have been warned to not use this method. To follow this migration path, you keep the code as it is, and add a config file for your executable that will look like this: &lt;SPAN style="mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; TEXT-INDENT: 0.5in; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&amp;lt;configuration&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; TEXT-INDENT: 0.25in; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="mso-tab-count: 1"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&amp;lt;runtime&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="mso-tab-count: 2"&gt;&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;&amp;lt;NetFx40_LegacySecurityPolicy enabled=&lt;SPAN style="COLOR: #a31515"&gt;"true"&lt;/SPAN&gt; /&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; TEXT-INDENT: 0.5in; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="mso-tab-count: 1"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&amp;lt;/runtime&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; TEXT-INDENT: 0.5in; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&amp;lt;/configuration&amp;gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; TEXT-INDENT: 0.5in; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;/SPAN&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; TEXT-INDENT: 0.5in; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;/SPAN&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; TEXT-INDENT: 0.5in; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;/SPAN&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; TEXT-INDENT: 0.5in; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;/SPAN&gt;&amp;nbsp;&lt;/P&gt;&lt;/SPAN&gt;
&lt;P style="MARGIN: auto 0in auto 0.25in" class=MsoListParagraph&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;Cristian Eigel,&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: auto 0in auto 0.25in" class=MsoListParagraph&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;SDET, CLR&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: auto 0in auto 0.25in" class=MsoListParagraph&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;/SPAN&gt;&amp;nbsp;&lt;/P&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9725545" width="1" height="1"&gt;</description></item><item><title>In-Process Side by Side Part 2 - Common in-proc SxS scenarios</title><link>http://blogs.msdn.com/b/dotnet/archive/2009/06/07/in-process-side-by-side-part-2-common-in-proc-sxs-scenarios.aspx</link><pubDate>Sun, 07 Jun 2009 20:36:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9704950</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=9704950</wfw:commentRss><comments>http://blogs.msdn.com/b/dotnet/archive/2009/06/07/in-process-side-by-side-part-2-common-in-proc-sxs-scenarios.aspx#comments</comments><description>&lt;P mce_keep="true"&gt;&lt;FONT color=red&gt;&lt;B&gt;Update: The information in this blog post applies to pre beta-1 behavior and is not applicable to beta 2 and RTM. We will have more posts and documentation on this subject as we get closer to RTM. &lt;/B&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P mce_keep="true"&gt;&lt;FONT color=red&gt;&lt;STRONG&gt;&lt;/STRONG&gt;&amp;nbsp;&lt;/P&gt;&lt;/FONT&gt;
&lt;P mce_keep="true"&gt;This section covers the most common&amp;nbsp;in-process side by side scenarios. The scenarios cover which CLR is used to run the specific code, given a particular machine configuration.&amp;nbsp;&lt;/P&gt;
&lt;H3 style="MARGIN: 10pt 0in 0pt"&gt;&lt;FONT color=#4f81bd&gt;&lt;FONT face=Cambria&gt;&lt;FONT size=3&gt;Native Application calling Managed COM Components&lt;SPAN style="LINE-HEIGHT: 115%; FONT-FAMILY: 'Verdana','sans-serif'; COLOR: #333333; FONT-SIZE: 8.5pt"&gt;&lt;?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/H3&gt;
&lt;P style="MARGIN: 6pt 0in" class=MsoBodyText&gt;&lt;FONT size=3&gt;&lt;STRONG&gt;&lt;SPAN style="FONT-FAMILY: 'Calibri','sans-serif'; COLOR: black; mso-bidi-font-family: 'Times New Roman'"&gt;Machine Configuration&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;FONT face=Calibri&gt;:&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;Both CLR 2.0 (.NET v2.0, v3.5 or v3.5) and CLR 4 installed&lt;SPAN style="FONT-FAMILY: 'Verdana','sans-serif'; COLOR: #333333; FONT-SIZE: 8.5pt"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P style="MARGIN: 6pt 0in" class=MsoBodyText&gt;&lt;FONT face=Calibri&gt;&lt;FONT size=3&gt;In this scenario, all Legacy Managed COM Components will execute against CLR 2.0 and any call to the Global Hosting APIs, in the whole process (in the application or any assembly activated through COM or legacy &lt;?xml:namespace prefix = st1 ns = "urn:schemas-microsoft-com:office:smarttags" /&gt;&lt;st1:stockticker w:st="on"&gt;API&lt;/st1:stockticker&gt;), will return CLR 2.0 results.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;Also, any activated Managed COM Components compiled against CLR 4 will execute against CLR 4, in-process side by side&amp;nbsp;with others, compiled against CLR 2.0 (executed against CLR 2.0).&lt;SPAN style="mso-bidi-font-size: 12.0pt"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;H3 style="MARGIN: 10pt 0in 0pt"&gt;&lt;FONT color=#4f81bd&gt;&lt;FONT face=Cambria&gt;&lt;FONT size=3&gt;Native Application calling the legacy Global Hosting APIs&lt;SPAN style="LINE-HEIGHT: 115%; COLOR: #3366ff; FONT-SIZE: 12pt"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/H3&gt;
&lt;P style="MARGIN: 6pt 0in" class=MsoBodyText&gt;&lt;FONT size=3&gt;&lt;STRONG&gt;&lt;SPAN style="FONT-FAMILY: 'Calibri','sans-serif'; COLOR: black; mso-bidi-font-family: 'Times New Roman'"&gt;Machine Configuration&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;FONT face=Calibri&gt;:&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;Both CLR 2.0 (.NET v2.0, v3.5 or v3.5)&amp;nbsp; and CLR 4 installed&lt;SPAN style="FONT-FAMILY: 'Verdana','sans-serif'; COLOR: #333333; FONT-SIZE: 8.5pt"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P style="MARGIN: 6pt 0in" class=MsoBodyText&gt;&lt;FONT size=3 face=Calibri&gt;In this scenario, any call to these functions, in the whole process (in the application or any assembly activated through COM or legacy &lt;st1:stockticker w:st="on"&gt;API&lt;/st1:stockticker&gt;), will return CLR 2.0 results.&lt;/FONT&gt;&lt;/P&gt;
&lt;H3 style="MARGIN: 10pt 0in 0pt"&gt;&lt;FONT color=#4f81bd&gt;&lt;FONT face=Cambria&gt;&lt;FONT size=3&gt;Managed Application compiled against v4 calling Managed COM components&lt;SPAN style="COLOR: black"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/H3&gt;
&lt;P style="MARGIN: 6pt 0in" class=MsoBodyText&gt;&lt;FONT size=3&gt;&lt;STRONG&gt;&lt;SPAN style="FONT-FAMILY: 'Calibri','sans-serif'; COLOR: black; mso-bidi-font-family: 'Times New Roman'"&gt;Machine Configuration&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;FONT face=Calibri&gt;:&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;Both CLR 2.0 (.NET v2.0, v3.5 or v3.5)&amp;nbsp; and CLR 4 installed&lt;SPAN style="FONT-FAMILY: 'Verdana','sans-serif'; COLOR: #333333; FONT-SIZE: 8.5pt"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P style="MARGIN: 6pt 0in" class=MsoBodyText&gt;&lt;FONT size=3 face=Calibri&gt;In this scenario, a managed application compiled against CLR 4 calls a managed COM component compiled against CLR v1.x, CLR v2.0 or CLR 4.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;In this situation, any call to the Global Hosting APIs, in the whole process (in the application or any assembly activated through COM or legacy &lt;st1:stockticker w:st="on"&gt;API&lt;/st1:stockticker&gt;), will return CLR 4 results. &lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&lt;/SPAN&gt;Also, any activated legacy Managed COM Components will execute against CLR 4.&lt;/FONT&gt;&lt;/P&gt;
&lt;H3 style="MARGIN: 10pt 0in 0pt"&gt;&lt;FONT color=#4f81bd&gt;&lt;FONT face=Cambria&gt;&lt;FONT size=3&gt;Managed Application compiled against v4 using P/Invokes to call the legacy Global Hosting APIs&lt;SPAN style="COLOR: black"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/H3&gt;
&lt;P style="MARGIN: 6pt 0in" class=MsoBodyText&gt;&lt;FONT size=3&gt;&lt;STRONG&gt;&lt;SPAN style="FONT-FAMILY: 'Calibri','sans-serif'; COLOR: black; mso-bidi-font-family: 'Times New Roman'"&gt;Machine Configuration&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;FONT face=Calibri&gt;:&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;Both CLR 2.0 (.NET v2.0, v3 or v3.5) and CLR 4 installed&lt;SPAN style="FONT-FAMILY: 'Verdana','sans-serif'; COLOR: #333333; FONT-SIZE: 8.5pt"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P style="MARGIN: 6pt 0in" class=MsoBodyText&gt;&lt;FONT size=3 face=Calibri&gt;In this scenario, a managed application compiled against v4 uses P/Invoke to call the existing legacy Global Hosting APIs.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;In this situation, any call to these functions, in the whole process (in the application or any assembly activated through COM or legacy &lt;st1:stockticker w:st="on"&gt;API&lt;/st1:stockticker&gt;), will return CLR 4 results.&lt;/FONT&gt;&lt;/P&gt;
&lt;H3 style="MARGIN: 10pt 0in 0pt"&gt;&lt;FONT color=#4f81bd size=3 face=Cambria&gt;Managed Application compiled against v2 calling Managed COM components compiled against CLR 4&lt;/FONT&gt;&lt;/H3&gt;
&lt;P style="MARGIN: 6pt 0in" class=MsoBodyText&gt;&lt;FONT size=3&gt;&lt;STRONG&gt;&lt;SPAN style="FONT-FAMILY: 'Calibri','sans-serif'; COLOR: black; mso-bidi-font-family: 'Times New Roman'"&gt;Machine Configuration&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;FONT face=Calibri&gt;:&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;Both CLR 2.0 (.NET v2.0, v3.0 or v3.5) and CLR 4 installed&lt;SPAN style="FONT-FAMILY: 'Verdana','sans-serif'; COLOR: #333333; FONT-SIZE: 8.5pt"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P style="MARGIN: 6pt 0in" class=MsoBodyText&gt;&lt;FONT size=3 face=Calibri&gt;In this scenario, a managed application compiled against CLR 2.0 calls a managed COM component compiled against CLR 4. &lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&lt;/SPAN&gt;In this scenario, any activated Managed COM Components will execute against CLR 4 in-process side by side with CLR 2.0.&lt;/FONT&gt;&lt;/P&gt;
&lt;H2 style="MARGIN: 10pt 0in 0pt"&gt;&lt;FONT color=#4f81bd size=4 face=Cambria&gt;What are the most common non-default scenarios?&lt;/FONT&gt;&lt;/H2&gt;
&lt;P style="MARGIN: 6pt 0in" class=MsoBodyText&gt;&lt;FONT face=Calibri&gt;&lt;FONT size=3&gt;&lt;SPAN style="COLOR: #333333; mso-ascii-font-family: Calibri; mso-hansi-font-family: Calibri"&gt;This section illustrates some common scenarios and the corresponding configuration file entries in order to get the right results.&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: 'Verdana','sans-serif'; COLOR: #333333; FONT-SIZE: 8.5pt"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;H3 style="MARGIN: 10pt 0in 0pt"&gt;&lt;FONT color=#4f81bd&gt;&lt;FONT face=Cambria&gt;&lt;FONT size=3&gt;Native Application rolling forward all its Managed COM Components to CLR 4&lt;SPAN style="LINE-HEIGHT: 115%; FONT-FAMILY: 'Verdana','sans-serif'; COLOR: #333333; FONT-SIZE: 8.5pt"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/H3&gt;
&lt;P style="MARGIN: 6pt 0in" class=MsoBodyText&gt;&lt;FONT size=3&gt;&lt;STRONG&gt;&lt;SPAN style="FONT-FAMILY: 'Calibri','sans-serif'; COLOR: black; mso-bidi-font-family: 'Times New Roman'"&gt;Machine Configuration&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;FONT face=Calibri&gt;&lt;SPAN style="COLOR: black; mso-ascii-font-family: Calibri; mso-hansi-font-family: Calibri"&gt;:&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;CLR 4 installed (other CLRs can be installed also, but in this case, this is irrelevant)&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: 'Verdana','sans-serif'; COLOR: #333333; FONT-SIZE: 8.5pt"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P style="MARGIN: 6pt 0in" class=MsoBodyText&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;In this scenario, a native application needs to activate all its managed COM components (independently of the CLR version they were compiled against) using CLR 4. &lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&lt;/SPAN&gt;In this situation, an APP.CONFIG file needs to be included in the same directory of the native application (&lt;st1:stockticker w:st="on"&gt;EXE&lt;/st1:stockticker&gt;) with the following entry:&lt;SPAN style="mso-bidi-font-size: 12.0pt"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 0pt 1.5in" class=MsoBodyText&gt;&lt;SPAN style="FONT-SIZE: 8pt; mso-no-proof: yes"&gt;&lt;FONT face=Calibri&gt;&amp;lt;startup&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 0pt 2in" class=MsoBodyText&gt;&lt;SPAN style="FONT-SIZE: 8pt; mso-no-proof: yes"&gt;&lt;FONT face=Calibri&gt;&amp;lt;process&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 0pt 2.5in" class=MsoBodyText&gt;&lt;SPAN style="FONT-SIZE: 8pt; mso-no-proof: yes"&gt;&lt;FONT face=Calibri&gt;&amp;lt;rollForward enabled="true" /&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 0pt 2in" class=MsoBodyText&gt;&lt;SPAN style="FONT-SIZE: 8pt; mso-no-proof: yes"&gt;&lt;FONT face=Calibri&gt;&amp;lt;/process&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 6pt 1.5in" class=MsoBodyText&gt;&lt;SPAN style="FONT-SIZE: 8pt; mso-no-proof: yes"&gt;&lt;FONT face=Calibri&gt;&amp;lt;/startup&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 6pt 0in" class=MsoBodyText&gt;&lt;FONT size=3 face=Calibri&gt;This configuration will force all Managed COM Components to execute against CLR 4.&lt;/FONT&gt;&lt;/P&gt;
&lt;H3 style="MARGIN: 10pt 0in 0pt"&gt;&lt;FONT color=#4f81bd&gt;&lt;FONT face=Cambria&gt;&lt;FONT size=3&gt;Native Application using legacy Global Hosting APIs to return CLR 4 results&lt;SPAN style="LINE-HEIGHT: 115%; COLOR: #3366ff; FONT-SIZE: 12pt"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/H3&gt;
&lt;P style="MARGIN: 6pt 0in" class=MsoBodyText&gt;&lt;FONT size=3&gt;&lt;STRONG&gt;&lt;SPAN style="FONT-FAMILY: 'Calibri','sans-serif'; mso-bidi-font-family: 'Times New Roman'; mso-ascii-theme-font: minor-latin; mso-hansi-theme-font: minor-latin"&gt;Machine Configuration&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;FONT face=Calibri&gt;: &lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&lt;/SPAN&gt;.NET 4 installed (other CLRs can be installed also, but in this case, this is irrelevant)&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P style="MARGIN: 6pt 0in" class=MsoBodyText&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;&lt;SPAN style="COLOR: black; mso-ascii-font-family: Calibri; mso-hansi-font-family: Calibri"&gt;In this scenario, a native application uses the existing Global Hosting APIs to return CLR 4 results.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;To accomplish that, an APP.CONFIG file needs to be included in the same directory of the native application with the following entry:&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: 'Verdana','sans-serif'; COLOR: #333333; FONT-SIZE: 8.5pt"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P style="MARGIN: 6pt 0in 0pt 1.5in" class=MsoBodyText&gt;&lt;SPAN style="FONT-SIZE: 8pt; mso-no-proof: yes"&gt;&lt;FONT face=Calibri&gt;&amp;lt;startup&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 0pt 2in" class=MsoBodyText&gt;&lt;SPAN style="FONT-SIZE: 8pt; mso-no-proof: yes"&gt;&lt;FONT face=Calibri&gt;&amp;lt;process&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 0pt 2.5in" class=MsoBodyText&gt;&lt;SPAN style="FONT-SIZE: 8pt; mso-no-proof: yes"&gt;&lt;FONT face=Calibri&gt;&amp;lt;rollForward enabled="true" /&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 0pt 2in" class=MsoBodyText&gt;&lt;SPAN style="FONT-SIZE: 8pt; mso-no-proof: yes"&gt;&lt;FONT face=Calibri&gt;&amp;lt;/process&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 6pt 1.5in" class=MsoBodyText&gt;&lt;SPAN style="FONT-SIZE: 8pt; mso-no-proof: yes"&gt;&lt;FONT face=Calibri&gt;&amp;lt;/startup&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 6pt 0in" class=MsoBodyText&gt;&lt;FONT face=Calibri&gt;&lt;FONT size=3&gt;This configuration will force all Managed COM Components to execute against CLR 4.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;It's important to note that some Global Hosting APIs may not be affected by the APP.CONFIG file above.&lt;SPAN style="COLOR: black; mso-ascii-font-family: Calibri; mso-hansi-font-family: Calibri"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;H3 style="MARGIN: 10pt 0in 0pt"&gt;&lt;FONT color=#4f81bd size=3 face=Cambria&gt;Managed Application compiled against v2 rolling forward to execute against CLR 4&lt;/FONT&gt;&lt;/H3&gt;
&lt;P style="MARGIN: 6pt 0in" class=MsoBodyText&gt;&lt;FONT size=3&gt;&lt;STRONG&gt;&lt;SPAN style="FONT-FAMILY: 'Calibri','sans-serif'; mso-bidi-font-family: 'Times New Roman'; mso-ascii-theme-font: minor-latin; mso-hansi-theme-font: minor-latin"&gt;Machine Configuration&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;FONT face=Calibri&gt;: &lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&lt;/SPAN&gt;.NET 4 installed (other CLRs can be installed also, but in this case, this is irrelevant)&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P style="MARGIN: 6pt 0in" class=MsoBodyText&gt;&lt;FONT size=3 face=Calibri&gt;In this scenario, a managed application compiled against v2.0 needs to execute against CLR 4.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;In this situation, an APP.CONFIG file needs to be included in the same directory of the managed application (&lt;st1:stockticker w:st="on"&gt;EXE&lt;/st1:stockticker&gt;) with the following entry.&lt;/FONT&gt;&lt;/P&gt;
&lt;P style="MARGIN: 6pt 0in 0pt 1.5in" class=MsoBodyText&gt;&lt;SPAN style="FONT-SIZE: 8pt; mso-no-proof: yes"&gt;&lt;FONT face=Calibri&gt;&amp;lt;startup&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 6pt 0in 0pt 2in" class=MsoBodyText&gt;&lt;SPAN style="FONT-SIZE: 8pt; mso-no-proof: yes"&gt;&lt;FONT face=Calibri&gt;&amp;lt;supportedRuntime version="v4.0.XXXX" /&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 6pt 0in 0pt 1.5in" class=MsoBodyText&gt;&lt;SPAN style="FONT-SIZE: 8pt; mso-no-proof: yes"&gt;&lt;FONT face=Calibri&gt;&amp;lt;/startup&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 6pt 0in" class=MsoBodyText&gt;&lt;FONT size=3 face=Calibri&gt;Where XXXXX is the CLR build number. &lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&lt;/SPAN&gt;In this situation, any Managed COM Component activated by this application will also roll forward to CLR 4. &lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&lt;/SPAN&gt;Also, any Global Hosting &lt;st1:stockticker w:st="on"&gt;API&lt;/st1:stockticker&gt; call in the whole process (in the application or in any of the Managed COM components) will return CLR 4 results (for example, &lt;B style="mso-bidi-font-weight: normal"&gt;&lt;SPAN style="mso-no-proof: yes"&gt;CorBindToRuntime(pwszVersion=NULL)&lt;/SPAN&gt;&lt;/B&gt;&lt;SPAN style="mso-no-proof: yes"&gt; or &lt;B style="mso-bidi-font-weight: normal"&gt;GetCORSystemDirectory&lt;/B&gt;&lt;/SPAN&gt;).&lt;/FONT&gt;&lt;/P&gt;
&lt;H3 style="MARGIN: 10pt 0in 0pt"&gt;&lt;FONT color=#4f81bd size=3 face=Cambria&gt;Managed Application compiled against v4 turning on In-process Side By Side&lt;/FONT&gt;&lt;/H3&gt;
&lt;P style="MARGIN: 6pt 0in" class=MsoBodyText&gt;&lt;FONT size=3&gt;&lt;STRONG&gt;&lt;SPAN style="FONT-FAMILY: 'Calibri','sans-serif'; mso-bidi-font-family: 'Times New Roman'; mso-ascii-theme-font: minor-latin; mso-hansi-theme-font: minor-latin"&gt;Machine Configuration&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;FONT face=Calibri&gt;:&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;Both CLR 2.0 (.NET v2.0, v3.0 or v3.5) and CLR 4 installed&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P style="MARGIN: 6pt 0in" class=MsoBodyText&gt;&lt;FONT size=3 face=Calibri&gt;In this scenario, a managed application compiled against CLR 4 needs to activate Managed COM Components compiled against CLR 4 side by side with Managed COM Components compiled against CLR 2.0 (or previous version).&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;In this situation, an APP.CONFIG file needs to be included in the same directory of the managed application (&lt;st1:stockticker w:st="on"&gt;EXE&lt;/st1:stockticker&gt;) with the following entry.&lt;/FONT&gt;&lt;/P&gt;
&lt;P style="MARGIN: 6pt 0in 0pt 1.5in" class=MsoBodyText&gt;&lt;SPAN style="FONT-SIZE: 8pt; mso-no-proof: yes"&gt;&lt;FONT face=Calibri&gt;&amp;lt;startup&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 6pt 0in 0pt 2in" class=MsoBodyText&gt;&lt;SPAN style="FONT-SIZE: 8pt; mso-no-proof: yes"&gt;&lt;FONT face=Calibri&gt;&amp;lt;process&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 6pt 0in 0pt 2.5in" class=MsoBodyText&gt;&lt;SPAN style="FONT-SIZE: 8pt; mso-no-proof: yes"&gt;&lt;FONT face=Calibri&gt;&amp;lt;rollForward enabled="false" /&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 6pt 0in 0pt 2in" class=MsoBodyText&gt;&lt;SPAN style="FONT-SIZE: 8pt; mso-no-proof: yes"&gt;&lt;FONT face=Calibri&gt;&amp;lt;/process&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 6pt 0in 0pt 1.5in" class=MsoBodyText&gt;&lt;SPAN style="FONT-SIZE: 8pt; mso-no-proof: yes"&gt;&lt;FONT face=Calibri&gt;&amp;lt;/startup&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;H3 style="MARGIN: 10pt 0in 0pt"&gt;&lt;FONT color=#4f81bd&gt;&lt;FONT face=Cambria&gt;&lt;FONT size=3&gt;Managed Application compiled against v2 running against v4 and turning on In-process Side By Side&lt;SPAN style="FONT-FAMILY: 'System','sans-serif'; COLOR: black"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/H3&gt;
&lt;P style="MARGIN: 6pt 0in" class=MsoBodyText&gt;&lt;FONT size=3&gt;&lt;STRONG&gt;&lt;SPAN style="FONT-FAMILY: 'Calibri','sans-serif'; mso-bidi-font-family: 'Times New Roman'; mso-ascii-theme-font: minor-latin; mso-hansi-theme-font: minor-latin"&gt;Machine Configuration&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;FONT face=Calibri&gt;: &lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&lt;/SPAN&gt;Both CLR 2.0 (.NET v2.0, v3.5 or v3.5) and CLR 4 installed&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P style="MARGIN: 6pt 0in" class=MsoBodyText&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;&lt;SPAN style="COLOR: black; mso-ascii-font-family: Calibri; mso-hansi-font-family: Calibri"&gt;In this scenario, a managed application compiled against CLR 2.0 needs to run against CLR 4 and also needs to activate Managed COM Components compiled against CLR 4 side by side with Managed COM Components compiled against CLR 2.0 (or previous version).&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;In this situation, an APP.CONFIG file needs to be included in the same directory of the managed application (&lt;st1:stockticker w:st="on"&gt;EXE&lt;/st1:stockticker&gt;) with the following entry.&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: 'System','sans-serif'; COLOR: black"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P style="MARGIN: 6pt 0in 0pt 1.5in" class=MsoBodyText&gt;&lt;SPAN style="FONT-SIZE: 8pt; mso-no-proof: yes"&gt;&lt;FONT face=Calibri&gt;&amp;lt;startup&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 6pt 0in 0pt 2in" class=MsoBodyText&gt;&lt;SPAN style="FONT-SIZE: 8pt; mso-no-proof: yes"&gt;&lt;FONT face=Calibri&gt;&amp;lt;supportedRuntime version="v4.0.XXXXX" /&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 6pt 0in 0pt 2in" class=MsoBodyText&gt;&lt;SPAN style="FONT-SIZE: 8pt; mso-no-proof: yes"&gt;&lt;FONT face=Calibri&gt;&amp;lt;supportedRuntime version="v2.0.50727" /&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 6pt 0in 0pt 2in" class=MsoBodyText&gt;&lt;SPAN style="FONT-SIZE: 8pt; mso-no-proof: yes"&gt;&lt;FONT face=Calibri&gt;&amp;lt;process&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 6pt 0in 0pt 2.5in" class=MsoBodyText&gt;&lt;SPAN style="FONT-SIZE: 8pt; mso-no-proof: yes"&gt;&lt;FONT face=Calibri&gt;&amp;lt;rollForward enabled="false" /&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 6pt 0in 0pt 2in" class=MsoBodyText&gt;&lt;SPAN style="FONT-SIZE: 8pt; mso-no-proof: yes"&gt;&lt;FONT face=Calibri&gt;&amp;lt;/process&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 6pt 0in 0pt 1.5in" class=MsoBodyText&gt;&lt;SPAN style="FONT-SIZE: 8pt; mso-no-proof: yes"&gt;&lt;FONT face=Calibri&gt;&amp;lt;/startup&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 10pt" class=MsoNormal&gt;&lt;o:p&gt;&lt;FONT size=3 face=Calibri&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P mce_keep="true"&gt;&lt;STRIKE&gt;&lt;/STRIKE&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Luiz Fernando Santos,&lt;/P&gt;
&lt;P&gt;PM, CLR&lt;/P&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9704950" width="1" height="1"&gt;</description></item></channel></rss>
