<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:atom="https://www.w3.org/2005/Atom" xmlns:sy="https://purl.org/rss/1.0/modules/syndication/" xmlns:dc="https://purl.org/dc/elements/1.1/" xmlns:content="https://purl.org/rss/1.0/modules/content/" xmlns:wfw="https://wellformedweb.org/CommentAPI/" xmlns:slash="https://purl.org/rss/1.0/modules/slash/"
  version="2.0">
  <channel>
    <title>Community Goodies</title>
    <atom:link
      href="https://docs.microsoft.com/archive/blogs/msdnforum/feed.xml"
      rel="self"
      type="application/rss+xml" />
    <link>https://docs.microsoft.com/archive/blogs/msdnforum/feed.xml</link>
    <description>Collecting the Power of Community Resources
  
            Home
			Visual Stdio
			WPF
			SilverLight
			Windows Azure
			Entity Framework
			C#
			VB.NET
			C++
			More Goodies</description>
    <lastBuildDate>Wed, 17 Apr 2019 03:24:27 GMT</lastBuildDate>
    <language>en-US</language>
    <sy:updatePeriod>hourly</sy:updatePeriod>
    <sy:updateFrequency>1</sy:updateFrequency>
    <item>
      <title>Community Goodies: Silverlight for PC</title>
      <link>https://docs.microsoft.com/archive/blogs/msdnforum/community-goodies-silverlight-for-pc</link>
      <pubDate>Tue, 20 Jul 2010 03:36:00 GMT</pubDate>
      <dc:creator><![CDATA[msdntwt]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/msdnforum/2010/07/20/community-goodies-silverlight-for-pc/</guid>
      <description><![CDATA[&nbsp;




Tools and Enviroment


Enviroment
Visual Studio 2008 
Visual Studio 2008 SP1...]]></description>
      <content:encoded><![CDATA[<p>&nbsp;</p>
<table cellpadding="2" cellspacing="0" border="2" style="width: 550px;">
<tbody>
<tr>
<td width="130" valign="top">
<h3>Tools and Enviroment</h3>
</td>
<td width="480" valign="top">
<p><strong>Enviroment</strong></p>
<p><a href="https://msdn.microsoft.com/hi-in/vstudio/default.aspx">Visual Studio 2008</a> </p>
<p><strong></strong><a href="https://www.microsoft.com/downloads/details.aspx?FamilyId=FBEE1648-7106-44A7-9649-6D9F6D58056E&amp;displaylang=en">Visual Studio 2008 SP1</a> </p>
<p><a href="https://www.microsoft.com/visualstudio/en-us/download">Visual Studio 2010</a> </p>
<p><strong></strong><a href="https://www.microsoft.com/expression/try-it/Default.aspx#PageTop">Expression Studio 3</a> </p>
<p><strong></strong><a href="https://www.microsoft.com/downloads/details.aspx?FamilyID=88484825-1b3c-4e8c-8b14-b05d025e1541&amp;displaylang=en">Expression Blend 4 RC</a></p>
<p><strong>Tools</strong></p>
<p><a href="https://silverlight.codeplex.com/releases/view/36060">Silverlight Toolkit</a> </p>
<p><a href="https://www.microsoft.com/downloads/details.aspx?familyid=9442b0f2-7465-417a-88f3-5e7b5409e9dd&amp;displaylang=en">Silverlight3 Tools for Visual Studio 2008 SP1</a> </p>
<p><a href="https://www.microsoft.com/downloads/details.aspx?FamilyID=bf5ab940-c011-4bd1-ad98-da671e491009&amp;displaylang=en">Silverlight4 Tools RC2 for Visual Studio 2010</a> </p>
<p><a href="https://www.microsoft.com/downloads/details.aspx?FamilyID=7b43bab5-a8ff-40ed-9c84-11abb9cda559&amp;displaylang=en">WCF RIA RC2</a> </p>
<p><a href="https://www.microsoft.com/downloads/details.aspx?FamilyID=7b43bab5-a8ff-40ed-9c84-11abb9cda559&amp;displaylang=en">WCF RIA Services Toolkit</a> </p>
<p><a href="https://code.msdn.microsoft.com/KB971030/Release/ProjectReleases.aspx?ReleaseId=3167">WCF RIA Hotfix</a>(For WCF RIA Beta)</p>
</td>
</tr>
<tr>
<td width="130" valign="top">
<h3>Features</h3>
</td>
<td width="480" valign="top">
<p><a href="https://msdn.microsoft.com/en-us/library/cc903934(VS.95).aspx"><span style="color: #0066dd;">Application and Programming Models</span></a></p>
<p><a href="https://msdn.microsoft.com/en-us/library/cc903953(VS.95).aspx"><span style="color: #0066dd;">Managed API for Silverlight</span></a></p>
<p><a href="https://msdn.microsoft.com/en-us/library/cc189024(VS.95).aspx"><span style="color: #0066dd;">Dynamic Languages in Silverlight</span></a></p>
<p><a href="https://msdn.microsoft.com/en-us/library/dd833063(VS.95).aspx"><span style="color: #0066dd;">Communication Between Local Silverlight-Based Applications</span></a></p>
<p><a href="https://msdn.microsoft.com/en-us/library/dd550721(VS.95).aspx"><span style="color: #0066dd;">Out-of-Browser Support</span></a><span style="color: #0066dd;"><img src="https://i.msdn.microsoft.com/Global/Images/clear.gif" /></span><a href="https://msdn.microsoft.com/en-us/library/dd550717(VS.95).aspx"><span style="color: #0066dd;">Alternative Hosting</span></a></p>
<p><a href="https://msdn.microsoft.com/en-us/library/cc189050(VS.95).aspx"><span style="color: #0066dd;">Layout, Text, and Input</span></a></p>
<p><a href="https://msdn.microsoft.com/en-us/library/cc189048(VS.95).aspx"><span style="color: #0066dd;">Controls</span></a></p>
<p><a href="https://msdn.microsoft.com/en-us/library/dd793659(VS.95).aspx"><span style="color: #0066dd;">Graphics, Animation, and Media</span></a></p>
<p><a href="https://msdn.microsoft.com/en-us/library/cc189054(VS.95).aspx"><span style="color: #0066dd;">XAML</span></a></p>
<p><a href="https://msdn.microsoft.com/en-us/library/cc838145(VS.95).aspx"><span style="color: #0066dd;">Integrating Silverlight with a Web Page</span></a></p>
<p><a href="https://msdn.microsoft.com/en-us/library/cc221412(VS.95).aspx"><span style="color: #0066dd;">Types, Properties, Methods, and Events</span></a> </p>
<p><br /><a href="https://msdn.microsoft.com/en-us/library/cc838124(VS.95).aspx"><span style="color: #0066dd;">Data Access and Data Structures</span></a> <br /><a href="https://msdn.microsoft.com/en-us/library/cc645029(VS.95).aspx"><span style="color: #0066dd;">Networking and Communication</span></a> <br /><a href="https://msdn.microsoft.com/en-us/library/cc838261(VS.95).aspx"><span style="color: #0066dd;">Debugging, Error Handling, and Exceptions</span></a></p>
<p><a href="https://msdn.microsoft.com/en-us/library/cc189057(VS.95).aspx"><span style="color: #0066dd;">Deployment and Localization</span></a> <br /><a href="https://msdn.microsoft.com/en-us/library/cc221411(VS.95).aspx"><span style="color: #0066dd;">Performance</span></a> <br /><a href="https://msdn.microsoft.com/en-us/library/cc972657(VS.95).aspx"><span style="color: #0066dd;">Security</span></a></p>
</td>
</tr>
<tr>
<td width="130" valign="top">
<h3>Hot Blogs</h3>
</td>
<td width="480" valign="top">
<p><a href="https://weblogs.asp.net/lduveau/default.aspx"><span style="color: #0066dd;">Laurent Duveau</span></a></p>
<p><strong>Description</strong>: Microsoft MVP(Silverlight), Professional Web Developer and .Net Trainer</p>
<p><a href="https://www.wintellect.com/CS/blogs/jprosise/default.aspx"><span style="color: #0066dd;">Jeff Prosise</span></a></p>
<p><strong>Description</strong>: He makes is living programming Microsoft .Net and teaching others how to do the same.</p>
<p><a href="https://mtaulty.com/CommunityServer/blogs/mike_taultys_blog/default.aspx"><span style="color: #0066dd;">Mike Taulty</span></a></p>
<p><strong>Description</strong>: He works in the Developer and Platform Group at Microsoft in UK&nbsp;&nbsp; </p>
<p><a href="https://blog.thekieners.com/"><span style="color: #0066dd;">Beat Kiener</span></a></p>
<p><strong>Description</strong>: Microsoft Certificated Technology Specialist.&nbsp;&nbsp;&nbsp;&nbsp; Innovation Award from Microsoft for the Silverlight Client called &ldquo;<strong>evidence</strong> <strong>nova</strong>&ldquo; which he involves</p>
<p><a href="https://www.justinangel.net/"><span style="color: #0066dd;">Justin Angel</span></a></p>
<p><strong>Description</strong>: Former Microsoft Silverlight Toolkit Program Manager</p>
<p><a href="https://blogs.objectsharp.com/CS/blogs/dan/default.aspx"><span style="color: #0066dd;">Dan</span></a></p>
<p><strong>Description</strong>: Member of ObjectSharp, Silverlight Community Active Member</p>
<p><a href="https://www.nikhilk.net/Category.All.aspx"><span style="color: #0066dd;">Nikhil Kothari</span></a></p>
<p><strong>Description</strong>: A famous Software Architect at Microsoft, working on the .NET Developer Platform (Silverlight, ASP.NET, RIA Services and more...)</p>
<p><a href="https://blogs.msdn.com/b/saurabh/"><span style="color: #0066dd;">Saurabh Pant</span></a></p>
<p><strong>Description</strong>: Microsoft PROGRAM MANAGER for WCF RIA Services</p>
<p><a href="https://blogs.msdn.com/b/scmorris/"><span style="color: #0066dd;">Scott Morrsion</span></a></p>
<p><strong>Description</strong>: Microsoft Program Manager</p>
<p><a href="https://weblogs.asp.net/scottgu/"><span style="color: #0066dd;">Scott Guthrie</span></a></p>
<p><strong>Description</strong>: Microsoft Coperate VP</p>
<p><a href="https://blogs.msdn.com/b/devdave/"><span style="color: #0066dd;">Dave Relyea</span></a></p>
<p><strong>Description</strong>: Microsoft Senior Development Lead</p>
<p><a href="https://wildermuth.com/"><span style="color: #0066dd;">Shawn Wildermuth</span></a></p>
<p><strong>Description</strong>: A Microsoft MVP(c#) and the founder of Wildermuth Consulting Services, also the author of several books and articles.</p>
<p><a href="https://jeffhandley.com/Default.aspx"><span style="color: #0066dd;">Jeff Handley</span></a></p>
<p><strong>Description</strong>: A Senior Develop Engineer, focus on WCF RIA.</p>
<p><a href="https://blogs.msdn.com/b/greg_schechter/"><span style="color: #0066dd;">Greg Schechter</span></a></p>
<p><strong>Descritpion</strong>: A famous Architect, focus on Bing Maps, WPF and Silverlight</p>
<p><a href="https://www.riaservicesblog.net/Blog/"><span style="color: #0066dd;">Colin Blair</span></a></p>
<p><strong>Description</strong>: Microsoft MVP(Silverilght), a specialist at WCF RIA</p>
<p><a href="https://www.jeff.wilcox.name/"><span style="color: #0066dd;">Jeff Wilcox</span></a></p>
<p><strong>Description</strong>: A Senior Software Development Engineer at Microsoft, on the Silverlight team.</p>
<p><a href="https://blogs.msdn.com/b/brada/"><span style="color: #0066dd;">Brab Abrams</span></a></p>
<p><strong>Description</strong>: Former Program Manager at Microsoft. </p>
</td>
</tr>
</tbody>
</table>]]></content:encoded>
    </item>
    <item>
      <title>MFC Getting started</title>
      <link>https://docs.microsoft.com/archive/blogs/msdnforum/mfc-getting-started</link>
      <pubDate>Mon, 19 Jul 2010 03:27:00 GMT</pubDate>
      <dc:creator><![CDATA[msdntwt]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/msdnforum/2010/07/19/mfc-getting-started/</guid>
      <description><![CDATA[Prerequisites


Prerequisites for Learning MFC...]]></description>
      <content:encoded><![CDATA[<table cellpadding="2" cellspacing="0" border="2" style="width: 738px;">
<tbody>
<tr>
<td width="200" valign="top">
<h3><strong>Prerequisites</strong></h3>
</td>
<td width="534" valign="top">
<p>Prerequisites for Learning MFC <br /><a href="https://msdn.microsoft.com/en-us/library/e4y1ezf5.aspx">https://msdn.microsoft.com/en-us/library/e4y1ezf5.aspx</a></p>
<p>Among the important assumptions made by the MFC documentation are that: </p>
<blockquote>
<p>&middot; You already know a little about programming for Windows.</p>
<p>&middot; You know the basics of programming in C++.</p>
<p>&middot; You understand the fundamentals of object-oriented programming.</p>
</blockquote>
</td>
</tr>
<tr>
<td width="200" valign="top">
<h3><strong>Introduction</strong></h3>
</td>
<td width="534" valign="top">
<p>MFC is a SDK interface (wrapper) only, consisting in a set of classes that act as wrappers around the Win32 API, so that C++ programmers may program Windows using some concepts of the object-oriented programming (OOP) paradigm and the C++ language (the Win32 API is based on C). One should learn the Win32 API or at least have some ideas since some of the SDK functions are absent form the MFC and remember would help you better to understand the MFC. <br /><a href="https://en.wikipedia.org/wiki/Microsoft_Foundation_Class_Library">https://en.wikipedia.org/wiki/Microsoft_Foundation_Class_Library</a> <br /><a href="https://en.wikibooks.org/wiki/Windows_Programming/Introduction_to_MFC">https://en.wikibooks.org/wiki/Windows_Programming/Introduction_to_MFC</a></p>
</td>
</tr>
<tr>
<td width="200" valign="top">
<h3><strong>Overview</strong></h3>
</td>
<td width="534" valign="top">
<p>Key MFC Programming Areas <br /><a href="https://msdn.microsoft.com/en-us/library/cys3kd51.aspx">https://msdn.microsoft.com/en-us/library/cys3kd51.aspx</a></p>
<p>Hierarchy Chart <br /><a href="https://msdn.microsoft.com/en-us/library/ws8s10w4.aspx">https://msdn.microsoft.com/en-us/library/ws8s10w4.aspx</a></p>
</td>
</tr>
<tr>
<td width="200" valign="top">
<h3><strong>Learning Links</strong></h3>
</td>
<td width="534" valign="top">
<p>Creating an MFC Application <br /><a href="https://msdn.microsoft.com/en-us/library/9es9d1k4.aspx">https://msdn.microsoft.com/en-us/library/9es9d1k4.aspx</a></p>
<p>Creating an MFC DLL Project <br /><a href="https://msdn.microsoft.com/en-us/library/wd5f0z40.aspx">https://msdn.microsoft.com/en-us/library/wd5f0z40.aspx</a></p>
<p>Creating an MFC ActiveX Control <br /><a href="https://msdn.microsoft.com/en-us/library/yc13as7d.aspx">https://msdn.microsoft.com/en-us/library/yc13as7d.aspx</a></p>
<p>Walkthroughs (MFC Feature Pack) <br /><a href="https://msdn.microsoft.com/en-us/library/bb982451(VS.90).aspx">https://msdn.microsoft.com/en-us/library/bb982451(VS.90).aspx</a></p>
</td>
</tr>
<tr>
<td width="200" valign="top">
<h3><strong>How do I videos</strong></h3>
</td>
<td width="534" valign="top">
<p>MFC Classes: <br /><a href="https://msdn.microsoft.com/en-us/visualc/bb496952.aspx#mfcclasses">https://msdn.microsoft.com/en-us/visualc/bb496952.aspx#mfcclasses</a></p>
<p>MFC Feature Pack <br /><a href="https://msdn.microsoft.com/en-us/visualc/bb496952.aspx#mfcfeaturepack">https://msdn.microsoft.com/en-us/visualc/bb496952.aspx#mfcfeaturepack</a></p>
</td>
</tr>
<tr>
<td width="200" valign="top">
<h3><strong>MFC Samples</strong></h3>
</td>
<td width="534" valign="top">
<p>MSDN Samples: <br /><a href="https://msdn.microsoft.com/en-us/library/482ck6x8.aspx">https://msdn.microsoft.com/en-us/library/482ck6x8.aspx</a></p>
<p>FunctionX samples: <br /><a href="https://www.functionx.com/visualc/index.htm">https://www.functionx.com/visualc/index.htm</a></p>
</td>
</tr>
<tr>
<td width="200" valign="top">
<h3><strong>FAQ</strong></h3>
</td>
<td width="534" valign="top">
<p>THE MFC FAQ version 1.3 <br /><a href="https://ai.kaist.ac.kr/~ymkim/Program/mfc_faq.html">https://ai.kaist.ac.kr/~ymkim/Program/mfc_faq.html</a></p>
<p>MSDN MVP: <br /><a href="https://vcfaq.mvps.org/mfc/index.htm">https://vcfaq.mvps.org/mfc/index.htm</a></p>
</td>
</tr>
<tr>
<td width="200" valign="top">
<h3><strong>Walkthrough</strong></h3>
</td>
<td width="534" valign="top">
<p>Walkthroughs (MFC) <br /><a href="https://msdn.microsoft.com/en-us/library/bb982451.aspx">https://msdn.microsoft.com/en-us/library/bb982451.aspx</a></p>
</td>
</tr>
<tr>
<td width="200" valign="top">
<h3><strong>Forum</strong></h3>
</td>
<td width="534" valign="top">
<p>Visual C++ <br /><a href="https://social.msdn.microsoft.com/Forums/en-US/category/visualc">https://social.msdn.microsoft.com/Forums/en-US/category/visualc</a></p>
</td>
</tr>
<tr>
<td width="200" valign="top">
<h3><strong>VS 2010 New Feature</strong></h3>
</td>
<td width="534" valign="top">
<p>MFC Restart Manager Support in VS2010 <br /><a href="https://blogs.msdn.com/vcblog/archive/2009/02/18/mfc-restart-manager.aspx">https://blogs.msdn.com/vcblog/archive/2009/02/18/mfc-restart-manager.aspx</a></p>
<p>MFC applications now default to being DPI-aware <br /><a href="https://blogs.msdn.com/vcblog/archive/2010/03/11/mfc-applications-now-default-to-being-dpi-aware.aspx">https://blogs.msdn.com/vcblog/archive/2010/03/11/mfc-applications-now-default-to-being-dpi-aware.aspx</a></p>
<p>CTaskDialog: an alternative to the simple message box! <br />https://blogs.msdn.com/vcblog/archive/2008/12/04/ctaskdialog-an-alternative-to-the-simple-message-box.aspx</p>
</td>
</tr>
</tbody>
</table>]]></content:encoded>
    </item>
    <item>
      <title>Visual Studio Setup and Installation</title>
      <link>https://docs.microsoft.com/archive/blogs/msdnforum/visual-studio-setup-and-installation</link>
      <pubDate>Fri, 16 Jul 2010 03:57:00 GMT</pubDate>
      <dc:creator><![CDATA[msdntwt]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/msdnforum/2010/07/16/visual-studio-setup-and-installation/</guid>
      <description><![CDATA[System Requirement


.NET Framework
.NET Framework System...]]></description>
      <content:encoded><![CDATA[<table cellpadding="2" cellspacing="0" border="2" style="width: 550px;">
<tbody>
<tr>
<td width="160" valign="top">
<h3>System Requirement</h3>
</td>
<td width="527" valign="top">
<p><span style="text-decoration: underline;">.NET Framework</span></p>
<p>.NET Framework System Requirements</p>
<p><a href="https://msdn.microsoft.com/en-us/library/8z6watww.aspx">https://msdn.microsoft.com/en-us/library/8z6watww.aspx</a></p>
<p><span style="text-decoration: underline;">Visual Studio .NET</span></p>
<p>Visual Studio .NET System Requirements</p>
<p><a href="https://msdn.microsoft.com/en-us/library/4c26cc39(VS.71).aspx">https://msdn.microsoft.com/en-us/library/4c26cc39(VS.71).aspx</a></p>
<p><span style="text-decoration: underline;">Visual Studio 2005</span></p>
<p>Visual Studio 2005 System Requirements</p>
<p><a href="https://msdn.microsoft.com/en-us/library/4c26cc39(VS.80).aspx">https://msdn.microsoft.com/en-us/library/4c26cc39(VS.80).aspx</a></p>
<p>Visual Studio 2005 Team System Requirements</p>
<p><a href="https://msdn.microsoft.com/en-us/library/ms252568(VS.80).aspx">https://msdn.microsoft.com/en-us/library/ms252568(VS.80).aspx</a></p>
<p><span style="text-decoration: underline;">Visual Studio 2008</span></p>
<p>Visual Studio 2008 System Requirements</p>
<p><a href="https://msdn.microsoft.com/en-us/library/4c26cc39.aspx">https://msdn.microsoft.com/en-us/library/4c26cc39.aspx</a></p>
<p>See the readme file in the root directory of the Visual Studio 2008 installation media, or on the Internet at <a href="https://go.microsoft.com/fwlink/?LinkId=102508">Readme: Visual Studio 2008</a>.</p>
<p>Visual Studio 2008 Team System Requirements</p>
<p><a href="https://msdn.microsoft.com/en-us/library/ms252568.aspx">https://msdn.microsoft.com/en-us/library/ms252568.aspx</a></p>
<p><span style="text-decoration: underline;">Visual Studi</span><span style="text-decoration: underline;">o 2010 System Requirements</span></p>
<p>Visual Studio 2010 Beta 1 Readme:</p>
<p><a href="https://download.microsoft.com/download/7/A/0/7A023209-096F-4F7D-B2BC-831ECC68FF5B/VS2010Beta1Readme.htm">https://download.microsoft.com/download/7/A/0/7A023209-096F-4F7D-B2BC-831ECC68FF5B/VS2010Beta1Readme.htm</a></p>
<p>Visual Studio 2010 Beta 2 Readme:</p>
<p><a href="https://download.microsoft.com/download/B/5/3/B5379D88-51D7-4240-9423-CE1427502784/VS2010Beta2Readme.htm">https://download.microsoft.com/download/B/5/3/B5379D88-51D7-4240-9423-CE1427502784/VS2010Beta2Readme.htm</a></p>
<p>Visual Studio 2010 RC Readme:</p>
<p><a href="https://download.microsoft.com/download/A/F/F/AFFE9A0D-E43C-4402-99C1-DD4E0E58AB60/VS2010RCReadme.htm">https://download.microsoft.com/download/A/F/F/AFFE9A0D-E43C-4402-99C1-DD4E0E58AB60/VS2010RCReadme.htm</a></p>
</td>
</tr>
<tr>
<td width="160" valign="top">
<h3>Best Practice to install Visual Studio</h3>
</td>
<td>
<p><a href="https://social.msdn.microsoft.com/forums/en-US/vssetup/thread/60f71a54-506e-4c70-be98-e993ce6d1ddf/">https://social.msdn.microsoft.com/forums/en-US/vssetup/thread/60f71a54-506e-4c70-be98-e993ce6d1ddf/</a></p>
</td>
</tr>
<tr>
<td width="160" valign="top">
<h3>How to Troubleshoot</h3>
</td>
<td>
<p><span style="text-decoration: underline;">.NET Framework Troubleshooting</span></p>
<p>Unified .NET Framework Troubleshooting Guide</p>
<p><a href="https://blogs.msdn.com/astebner/articles/454956.aspx">https://blogs.msdn.com/astebner/articles/454956.aspx</a></p>
<p>How to verify .NET Framework installation</p>
<p><a href="https://social.msdn.microsoft.com/forums/en-US/netfxsetup/thread/f3f4a75b-9b7d-444d-aa4f-6c01d6f62f72#NET_Framework_verification">https://social.msdn.microsoft.com/forums/en-US/netfxsetup/thread/f3f4a75b-9b7d-444d-aa4f-6c01d6f62f72#NET_Framework_verification</a></p>
<p><span style="text-decoration: underline;">Visual Studio 2005 Troubleshooting</span></p>
<p>Visual Studio 2005 and .NET Framework 2.0 Setup Troubleshooting Guide</p>
<p><a href="https://blogs.msdn.com/astebner/articles/492809.aspx">https://blogs.msdn.com/astebner/articles/492809.aspx</a></p>
<p>How to troubleshoot the installation of Visual Studio 2005</p>
<p><a href="https://social.msdn.microsoft.com/forums/en-US/vssetup/thread/0376db8f-4761-4ae5-9af2-98c53216318a#How_to_troubleshoot_the_installation">https://social.msdn.microsoft.com/forums/en-US/vssetup/thread/0376db8f-4761-4ae5-9af2-98c53216318a#How_to_troubleshoot_the_installation</a></p>
<p><span style="text-decoration: underline;">Visual Studio 2008 Troubleshooting</span></p>
<p>What are the tips for troubleshooting Visual Studio 2008 setup problems?</p>
<p><a href="https://social.msdn.microsoft.com/forums/en-US/vssetup/thread/0376db8f-4761-4ae5-9af2-98c53216318a#How_to_overcome_Visual_Studio_2008___">https://social.msdn.microsoft.com/forums/en-US/vssetup/thread/0376db8f-4761-4ae5-9af2-98c53216318a#How_to_overcome_Visual_Studio_2008___</a></p>
<p>How to diagnose Visual Studio 2008 and .NET Framework 3.5 setup issues with setup Logs</p>
<p><a href="https://social.msdn.microsoft.com/forums/en-US/vssetup/thread/0376db8f-4761-4ae5-9af2-98c53216318a#How_to_diagnoseVS2008_NETFramework_logs">https://social.msdn.microsoft.com/forums/en-US/vssetup/thread/0376db8f-4761-4ae5-9af2-98c53216318a#How_to_diagnoseVS2008_NETFramework_logs</a></p>
<p>Visual Studio 2008 Setup Troubleshooting Guide</p>
<p><a href="https://blogs.msdn.com/varungupta/archive/2007/12/04/visual-studio-2008-setup-troubleshooting-guide.aspx">https://blogs.msdn.com/varungupta/archive/2007/12/04/visual-studio-2008-setup-troubleshooting-guide.aspx</a></p>
<p>Visual Studio and .NET Framework Installation Tips</p>
<p><a href="https://blogs.msdn.com/msdnforum/archive/2010/03/06/visual-studio-and-net-framework-installation-tips.aspx">https://blogs.msdn.com/msdnforum/archive/2010/03/06/visual-studio-and-net-framework-installation-tips.aspx</a></p>
</td>
</tr>
<tr>
<td width="160" valign="top">
<h3>Troubleshooting Tools</h3>
</td>
<td>
<p>Collection Tool</p>
<p><a href="https://blogs.msdn.com/heaths/archive/2008/05/09/visual-studio-and-net-log-collection-utility.aspx">https://blogs.msdn.com/heaths/archive/2008/05/09/visual-studio-and-net-log-collection-utility.aspx</a></p>
<p>.NET Framework Verification Tool</p>
<p><a href="https://blogs.msdn.com/astebner/pages/8999004.aspx">https://blogs.msdn.com/astebner/pages/8999004.aspx</a></p>
<p>.NET Framework Cleanup Tool</p>
<p><a href="https://blogs.msdn.com/astebner/pages/8904493.aspx">https://blogs.msdn.com/astebner/pages/8904493.aspx</a></p>
<p>Windows Installer CleanUp Utility</p>
<p><a href="https://support.microsoft.com/kb/290301/en-us">https://support.microsoft.com/kb/290301/en-us</a></p>
<p>Process Monitor</p>
<p><a href="https://technet.microsoft.com/en-us/sysinternals/bb896645.aspx">https://technet.microsoft.com/en-us/sysinternals/bb896645.aspx</a></p>
</td>
</tr>
<tr>
<td width="160" valign="top">
<h3>How to troubleshoot</h3>
</td>
<td>
<p>How to locate the cause of error code 1603 in a verbose MSI log file</p>
<p><a href="https://blogs.msdn.com/astebner/archive/2005/08/01/446328.aspx">https://blogs.msdn.com/astebner/archive/2005/08/01/446328.aspx</a></p>
<p>How to Interpret Windows Installer Logs</p>
<p><a href="https://blogs.technet.com/richard_macdonald/archive/2007/04/02/How-to-Interpret-Windows-Installer-Logs.aspx">https://blogs.technet.com/richard_macdonald/archive/2007/04/02/How-to-Interpret-Windows-Installer-Logs.aspx</a></p>
</td>
</tr>
<tr>
<td width="160" valign="top">
<h3>Common error code</h3>
</td>
<td>
<p>Composite Installer is reporting 0x80070663</p>
<p><a href="https://social.msdn.microsoft.com/Forums/en-US/netfxsetup/thread/15ad04e8-1749-4eb4-bd09-4b5fd9f77d5f/">https://social.msdn.microsoft.com/Forums/en-US/netfxsetup/thread/15ad04e8-1749-4eb4-bd09-4b5fd9f77d5f/</a></p>
<p>Error 5</p>
<p><a href="https://social.msdn.microsoft.com/Forums/en-US/vssetup/thread/ec14eb28-670d-446a-a83c-ad939025b15a">https://social.msdn.microsoft.com/Forums/en-US/vssetup/thread/ec14eb28-670d-446a-a83c-ad939025b15a</a></p>
<p>Error 87</p>
<p><a href="https://social.msdn.microsoft.com/Forums/en-US/netfxsetup/thread/c9d57fea-801b-4046-a626-89544dd3d190/?prof=required">https://social.msdn.microsoft.com/Forums/en-US/netfxsetup/thread/c9d57fea-801b-4046-a626-89544dd3d190/?prof=required</a></p>
<p>Error 1304</p>
<p><a href="https://social.msdn.microsoft.com/Forums/en-US/netfxsetup/thread/c72e50cb-67b8-4e0f-8409-bdf472b43e22/">https://social.msdn.microsoft.com/Forums/en-US/netfxsetup/thread/c72e50cb-67b8-4e0f-8409-bdf472b43e22/</a></p>
<p>Error 1321</p>
<p><a href="https://social.msdn.microsoft.com/Forums/en-US/netfxsetup/thread/a2b272a7-ea99-4fef-ab33-929fd31e14d1/">https://social.msdn.microsoft.com/Forums/en-US/netfxsetup/thread/a2b272a7-ea99-4fef-ab33-929fd31e14d1/</a></p>
<p><a href="https://social.msdn.microsoft.com/Forums/en-US/netfxsetup/thread/69bf89a1-cd62-48d9-afd2-cac51cae480b/">https://social.msdn.microsoft.com/Forums/en-US/netfxsetup/thread/69bf89a1-cd62-48d9-afd2-cac51cae480b/</a></p>
<p>Error 1330</p>
<p><a href="https://social.msdn.microsoft.com/Forums/en-US/vssetup/thread/9828a0cf-07db-47ff-8a72-998c2a0f31c2">https://social.msdn.microsoft.com/Forums/en-US/vssetup/thread/9828a0cf-07db-47ff-8a72-998c2a0f31c2</a></p>
<p>Error 1402</p>
<p><a href="https://social.msdn.microsoft.com/Forums/en-US/netfxsetup/thread/9dcef871-1700-43c9-a168-4a52e60dfdcf/">https://social.msdn.microsoft.com/Forums/en-US/netfxsetup/thread/9dcef871-1700-43c9-a168-4a52e60dfdcf/</a></p>
<p>Error 1601</p>
<p><a href="https://social.msdn.microsoft.com/Forums/en-US/netfxsetup/thread/e227dcb4-ebe5-4076-8957-6dd0807e7bdf">https://social.msdn.microsoft.com/Forums/en-US/netfxsetup/thread/e227dcb4-ebe5-4076-8957-6dd0807e7bdf</a></p>
<p>Error 1612</p>
<p><a href="https://social.msdn.microsoft.com/Forums/en-SG/Vsexpressinstall/thread/b6ef62f7-adec-4b15-bf67-40697d09d660">https://social.msdn.microsoft.com/Forums/en-SG/Vsexpressinstall/thread/b6ef62f7-adec-4b15-bf67-40697d09d660</a></p>
<p>Error 1714</p>
<p><a href="https://social.msdn.microsoft.com/Forums/en-US/netfxsetup/thread/a4a42d9c-80d3-4edb-9a4a-c352c5788cda">https://social.msdn.microsoft.com/Forums/en-US/netfxsetup/thread/a4a42d9c-80d3-4edb-9a4a-c352c5788cda</a></p>
<p>Error 1719</p>
<p><a href="https://social.msdn.microsoft.com/Forums/en-US/netfxsetup/thread/47985137-8766-4fc3-a42d-e0d8c4f2b4d5">https://social.msdn.microsoft.com/Forums/en-US/netfxsetup/thread/47985137-8766-4fc3-a42d-e0d8c4f2b4d5</a></p>
<p>Error 1935</p>
<p><a href="https://blogs.msdn.com/astebner/archive/2004/11/10/255346.aspx">https://blogs.msdn.com/astebner/archive/2004/11/10/255346.aspx</a></p>
<p>HRESULT 0x800736B3</p>
<p><a href="https://social.msdn.microsoft.com/Forums/en-US/vssetup/thread/b67f7676-99f8-4ca2-bcbc-9fbb4b5e2e46">https://social.msdn.microsoft.com/Forums/en-US/vssetup/thread/b67f7676-99f8-4ca2-bcbc-9fbb4b5e2e46</a></p>
<p>HRESULT 0x8002802F</p>
<p><a href="https://social.msdn.microsoft.com/Forums/en-US/netfxsetup/thread/48d600f7-70a0-4976-b7c6-31d28d44670b">https://social.msdn.microsoft.com/Forums/en-US/netfxsetup/thread/48d600f7-70a0-4976-b7c6-31d28d44670b</a></p>
<p>HRESULT 0x80070002</p>
<p><a href="https://blogs.msdn.com/astebner/archive/2005/02/01/364375.aspx">https://blogs.msdn.com/astebner/archive/2005/02/01/364375.aspx</a></p>
<p>HRESULT 0x80070424</p>
<p><a href="https://social.msdn.microsoft.com/Forums/en-US/vssetup/thread/8dec5541-54ea-4d12-8a5c-37dba4db90f5">https://social.msdn.microsoft.com/Forums/en-US/vssetup/thread/8dec5541-54ea-4d12-8a5c-37dba4db90f5</a></p>
<p>HRESULT 0x80070424</p>
<p>Error 2908</p>
<p><a href="https://blogs.msdn.com/astebner/archive/2004/11/10/255346.aspx">https://blogs.msdn.com/astebner/archive/2004/11/10/255346.aspx</a></p>
</td>
</tr>
<tr>
<td width="160" valign="top">
<h3>Some Visual Studio command</h3>
</td>
<td><a href="https://msdn.microsoft.com/en-us/library/xee0c8y7.aspx">https://msdn.microsoft.com/en-us/library/xee0c8y7.aspx</a></td>
</tr>
<tr>
<td>
<h3 valign="top">How to remove Visual Studio</h3>
</td>
<td>
<p>Remove .NET Framework</p>
<p><a href="https://social.msdn.microsoft.com/forums/en-US/netfxsetup/thread/f3f4a75b-9b7d-444d-aa4f-6c01d6f62f72#How_to_remove_NET_framework">https://social.msdn.microsoft.com/forums/en-US/netfxsetup/thread/f3f4a75b-9b7d-444d-aa4f-6c01d6f62f72#How_to_remove_NET_framework</a></p>
<p>Remove Visual Studio 2005</p>
<p><a href="https://support.microsoft.com/kb/907965/en-us">https://support.microsoft.com/kb/907965/en-us</a></p>
<p><a href="https://msdn.microsoft.com/en-us/library/ms246604(VS.80).aspx">https://msdn.microsoft.com/en-us/library/ms246604(VS.80).aspx</a></p>
<p>Remove Visual Studio 2008</p>
<p><a href="https://msdn.microsoft.com/en-us/library/ms246604.aspx">https://msdn.microsoft.com/en-us/library/ms246604.aspx</a></p>
<p><a href="https://social.msdn.microsoft.com/Forums/en/vssetup/thread/0f8f41aa-a835-4f69-bc65-d9c563ff83a9">https://social.msdn.microsoft.com/Forums/en/vssetup/thread/0f8f41aa-a835-4f69-bc65-d9c563ff83a9</a></p>
</td>
</tr>
<tr>
<td width="200" valign="top">
<h3 valign="top">Hot Topics</h3>
</td>
<td width="527" valign="top">
<p><b><a href="https://sharepoint/sites/communitygoodies/wiki/Pages/Visual Studio 2010 Installation.aspx">Visual Studio 2010 Installation</a></b></p>
<p><strong>Install VS in Windows 7</strong></p>
</td>
</tr>
<tr>
<td width="160" valign="top">
<h3>FAQ</h3>
</td>
<td width="527" valign="top">
<p>Visual Studio Setup FAQ</p>
<p><a href="https://social.msdn.microsoft.com/forums/en-US/vssetup/thread/0376db8f-4761-4ae5-9af2-98c53216318a">https://social.msdn.microsoft.com/forums/en-US/vssetup/thread/0376db8f-4761-4ae5-9af2-98c53216318a</a></p>
<p>.NET Framework Setup FAQ</p>
<p><a href="https://social.msdn.microsoft.com/forums/en-US/netfxsetup/thread/f3f4a75b-9b7d-444d-aa4f-6c01d6f62f72">https://social.msdn.microsoft.com/forums/en-US/netfxsetup/thread/f3f4a75b-9b7d-444d-aa4f-6c01d6f62f72</a></p>
</td>
</tr>
<tr>
<td width="160" valign="top">
<h3>Blog</h3>
</td>
<td width="527" valign="top">
<p>Aaron Ruckman</p>
<p><a href="https://blogs.msdn.com/aaronru/">https://blogs.msdn.com/aaronru/</a></p>
<p>Aaron Stebner</p>
<p><a href="https://blogs.msdn.com/astebner/">https://blogs.msdn.com/astebner/</a></p>
<p>Heath Stewart</p>
<p><a href="https://blogs.msdn.com/heaths/">https://blogs.msdn.com/heaths/</a></p>
</td>
</tr>
</tbody>
</table>
<h3><strong></strong></h3>]]></content:encoded>
    </item>
    <item>
      <title>Three ways to debug CLR Stored Procedures</title>
      <link>https://docs.microsoft.com/archive/blogs/msdnforum/three-ways-to-debug-clr-stored-procedures</link>
      <pubDate>Thu, 15 Jul 2010 03:38:00 GMT</pubDate>
      <dc:creator><![CDATA[msdntwt]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/msdnforum/2010/07/15/three-ways-to-debug-clr-stored-procedures/</guid>
      <description><![CDATA[According to the different format of you stored procedures, generally, there are three ways to debug...]]></description>
      <content:encoded><![CDATA[<p>According to the different format of you stored procedures, generally, there are three ways to debug a stored procedure. Here is an example of how to implement that. Before debugging a stored procedure, you need to establish a connection&nbsp;&nbsp; to database in Visual Studio Server Explorer:</p>
<ol>
<li>Right click Data Connection and select Add connection.</li>
<li>Input a Server name and select a database (you may need to wait for a few seconds when refreshing)</li>
</ol>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <img src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/32/94/1884.Three_Way_To_Debug_CLR_1.png" original-url="https://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-32-94/1884.Three_5F00_Way_5F00_To_5F00_Debug_5F00_CLR_5F00_1.png" border="0" /></p>
<p>&nbsp;</p>
<p>&nbsp;&nbsp;&nbsp; &nbsp;3.&nbsp;&nbsp;&nbsp;&nbsp;Open your Server Explorer, you&rsquo;ll find you connection to the database.</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <img src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/32/94/2500.Three_Way_To_Debug_CLR_2.png" original-url="https://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-32-94/2500.Three_5F00_Way_5F00_To_5F00_Debug_5F00_CLR_5F00_2.png" border="0" /></p>
<p>Method one: Direct Database Debugging</p>
<ol>
<li>Navigate to a Stored procedure in Server Explorer</li>
<li>Right click the stored procedure and select Step into Procedure</li>
</ol>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <img src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/32/94/2746.Three_Way_To_Debug_CLR_3.png" original-url="https://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-32-94/2746.Three_5F00_Way_5F00_To_5F00_Debug_5F00_CLR_5F00_3.png" border="0" /></p>
<p>Method Two: Debug from SQL Server Project</p>
<ol>
<li>Please first open Microsoft SQL Server Management Studio to make your database CLR Enabled. You need Open Database Query editor and execute the following statements:</li>
</ol>
<pre style="background-color: #ffff80; min-height: 40px; width: 602px; height: 223px; overflow: auto; border: #cecece 1px solid; padding: 5px;"><pre style="background-color: #ffff80; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">  1: <a href="https://search.microsoft.com/default.asp?so=RECCNT&amp;siteid=us%2Fdev&amp;p=1&amp;nq=NEW&amp;qu=sp_configure&amp;IntlSearch=&amp;boolean=PHRASE&amp;ig=01&amp;i=09&amp;i=99" style="color: #ffa500">sp_configure</a> '<span style="color: #8b0000">show advanced options</span>', 1;
</pre>
<pre style="background-color: #ffff80; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">  2: <a href="https://search.microsoft.com/default.asp?so=RECCNT&amp;siteid=us%2Fdev&amp;p=1&amp;nq=NEW&amp;qu=GO&amp;IntlSearch=&amp;boolean=PHRASE&amp;ig=01&amp;i=09&amp;i=99" style="color: #0000ff">GO</a>
</pre>
<pre style="background-color: #ffff80; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">  3: <a href="https://search.microsoft.com/default.asp?so=RECCNT&amp;siteid=us%2Fdev&amp;p=1&amp;nq=NEW&amp;qu=reconfigure&amp;IntlSearch=&amp;boolean=PHRASE&amp;ig=01&amp;i=09&amp;i=99" style="color: #0000ff">reconfigure</a>;
</pre>
<pre style="background-color: #ffff80; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">  4: <a href="https://search.microsoft.com/default.asp?so=RECCNT&amp;siteid=us%2Fdev&amp;p=1&amp;nq=NEW&amp;qu=GO&amp;IntlSearch=&amp;boolean=PHRASE&amp;ig=01&amp;i=09&amp;i=99" style="color: #0000ff">GO</a>
</pre>
<pre style="background-color: #ffff80; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">  5: <a href="https://search.microsoft.com/default.asp?so=RECCNT&amp;siteid=us%2Fdev&amp;p=1&amp;nq=NEW&amp;qu=sp_configure&amp;IntlSearch=&amp;boolean=PHRASE&amp;ig=01&amp;i=09&amp;i=99" style="color: #ffa500">sp_configure</a> '<span style="color: #8b0000">clr enabled</span>', 1;
</pre>
<pre style="background-color: #ffff80; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">  6: <a href="https://search.microsoft.com/default.asp?so=RECCNT&amp;siteid=us%2Fdev&amp;p=1&amp;nq=NEW&amp;qu=Go&amp;IntlSearch=&amp;boolean=PHRASE&amp;ig=01&amp;i=09&amp;i=99" style="color: #0000ff">Go</a>
</pre>
<pre style="background-color: #ffff80; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">  7: <a href="https://search.microsoft.com/default.asp?so=RECCNT&amp;siteid=us%2Fdev&amp;p=1&amp;nq=NEW&amp;qu=reconfigure&amp;IntlSearch=&amp;boolean=PHRASE&amp;ig=01&amp;i=09&amp;i=99" style="color: #0000ff">reconfigure</a>;</pre>
</pre>
<p>&nbsp;&nbsp;&nbsp; 2.&nbsp;&nbsp; Open your stored procedure. There is a Test Scripts folder, you could execute your stored procedure in script file&nbsp; and then right click the script file and select Debug Script. There are two options here: You could set a breakpoint in Script file or in your .CS file. No matter where the breakpoint located, it will get hit. <br />NOTE: It is not support in VSTS2010 currently. You need to change that target .Net framework in project properties page. Also, you may encounter that deploy failed and require CLR Enable message in Output window, please make sure you run the script code in Step 1.</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <img src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/32/94/3835.Three_Way_To_Debug_CLR_4.png" original-url="https://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-32-94/3835.Three_5F00_Way_5F00_To_5F00_Debug_5F00_CLR_5F00_4.png" border="0" /></p>
<p>Method three: Debug by attaching to other processes</p>
<p>This is not much like attaching to other processes, one thing may be taken into account is to select the T-SQL code type in the Attach to Processes dialog box</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <img src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/32/94/1200.Three_Way_To_Debug_CLR_5.png" original-url="https://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-32-94/1200.Three_5F00_Way_5F00_To_5F00_Debug_5F00_CLR_5F00_5.png" border="0" /></p>
<p>The SQL CLR Integration team has an excellent blog introducing these three ways briefly <a href="https://blogs.msdn.com/sqlclr/archive/2006/06/29/651644.aspx">here</a>.</p>]]></content:encoded>
    </item>
    <item>
      <title>Interop with Native C++</title>
      <link>https://docs.microsoft.com/archive/blogs/msdnforum/interop-with-native-c</link>
      <pubDate>Wed, 14 Jul 2010 03:30:00 GMT</pubDate>
      <dc:creator><![CDATA[msdntwt]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/msdnforum/2010/07/14/interop-with-native-c/</guid>
      <description><![CDATA[&nbsp;
Introduction
While you can write applications entirely in either managed or native code, it...]]></description>
      <content:encoded><![CDATA[<p>&nbsp;</p>
<p><strong><span style="font-size: medium;">Introduction</span></strong></p>
<p>While you can write applications entirely in either managed or native code, it is possible to mix managed and native projects in the same solution. So this article lists the methods about interop with native C++.</p>
<p>Invoke .NET Assembly from Native C++ Code</p>
<p>1. <b>Hosting API</b>. Native VC++ module calls <a href="https://msdn.microsoft.com/en-us/magazine/cc163567.aspx">CLR Hosting APIs</a> to host CLR, load and call the .NET assembly. </p>
<p>2. <b>COM interop</b> . If the .NET assembly can be exposed as a COM component, native VC++ module can call into the .NET assembly through .NET .</p>
<p>3. <b>Reverse PInvoke</b>. The managed code call native passing a delegate the native code can call back. </p>
<p>4. <b>IJW</b>. If the module containing native VC++ code is allowed to <a href="https://msdn.microsoft.com/en-us/library/ms173265.aspx">enable CLR</a>, the native VC++ code can call .NET assembly directly through the &ldquo;It Just Works&rdquo;, or &ldquo;IJW&rdquo;, mechanism. </p>
<p>&nbsp;</p>
<p><strong><span style="font-size: medium;">Invoke Native C++ DLL from .NET code</span></strong></p>
<p>1. <b>IJW or It Just Works</b>. This is one of the greatest features that .NET Framework has provided to developers. You just recompile the old code on the new .NET platform. No or little changes are necessary. Don't forget though; it works in the C++ language only.</p>
<p>2. <b>COM</b>. The COM model works on both the unmanaged and managed environments. It's straightforward to perform a COM Invoke on .NET. But, if your unmanaged classes are not COM-ready, you probably won't rewrite all the old code to support COM.</p>
<p>3. <b>P/Invoke or Platform Invoke</b>. This mechanism allows you to import a class as functions at the attribute level. Basically, you import class methods one by one as individual functions, as you do with Win32 APIs. </p>
<p>&nbsp;</p>
<p><strong><span style="font-size: medium;">Samples:</span></strong></p>
<p>Microsoft <a href="https://cfx.codeplex.com/">All-In-One Code Framework</a> has working examples that demonstrate the methods. </p>
<p>Invoke Native C++ DLL from .NET Code</p>
<p><a href="https://1code.codeplex.com/wikipage?title=Invoke Native C%2b%2b DLL from .NET&amp;referringTitle=Documentation">https://1code.codeplex.com/wikipage?title=Invoke%20Native%20C%2b%2b%20DLL%20from%20.NET&amp;referringTitle=Documentation</a></p>
<p>Invoke .NET Assembly from Native C++ Code</p>
<p><a href="https://1code.codeplex.com/wikipage?title=Invoke%20.NET%20Assembly%20from%20Native%20C%2b%2b&amp;referringTitle=Documentation">https://1code.codeplex.com/wikipage?title=Invoke%20.NET%20Assembly%20from%20Native%20C%2b%2b&amp;referringTitle=Documentation</a></p>
<p>&nbsp;</p>
<p><strong><span style="font-size: medium;">Learning Links:</span></strong></p>
<p>Interop (How Do I in Visual C++)</p>
<p><a href="https://msdn.microsoft.com/en-us/library/ms177552(VS.90).aspx">https://msdn.microsoft.com/en-us/library/ms177552%28VS.90%29.aspx</a></p>
<p>Best Practices For Managed And Native Code Interoperability</p>
<p><a href="https://msdn.microsoft.com/en-us/magazine/dd315414.aspx">https://msdn.microsoft.com/en-us/magazine/dd315414.aspx</a></p>
<p>Using Unmanaged C++ Libraries (DLLs) in .NET Applications</p>
<p><a href="https://www.codeproject.com/KB/mcpp/usingcppdll.aspx">https://www.codeproject.com/KB/mcpp/usingcppdll.aspx</a></p>
<p>Managed/Native Code Interoperability</p>
<p><a href="https://msdn.microsoft.com/en-us/library/bb677136.aspx">https://msdn.microsoft.com/en-us/library/bb677136.aspx</a></p>
<menu></menu>]]></content:encoded>
    </item>
    <item>
      <title>Community Goodies: N-Tier Application Patterns in Entity Framework</title>
      <link>https://docs.microsoft.com/archive/blogs/msdnforum/community-goodies-n-tier-application-patterns-in-entity-framework</link>
      <pubDate>Tue, 13 Jul 2010 03:23:00 GMT</pubDate>
      <dc:creator><![CDATA[msdntwt]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/msdnforum/2010/07/13/community-goodies-n-tier-application-patterns-in-entity-framework/</guid>
      <description><![CDATA[&nbsp;




MSDN Magazine articles:


The Entity Framework In Layered Architectures...]]></description>
      <content:encoded><![CDATA[<p>&nbsp;</p>
<table border="2">
<tbody>
<tr>
<td width="160" valign="top">
<h3>MSDN Magazine articles:</h3>
</td>
<td width="400">
<p sizset="0" sizcache="12">The Entity Framework In Layered Architectures <br /><a href="https://msdn.microsoft.com/en-us/magazine/cc700340.aspx">https://msdn.microsoft.com/en-us/magazine/cc700340.aspx</a></p>
<p>Anti-Patterns To Avoid In N-Tier Applications <br /><a href="https://msdn.microsoft.com/en-us/magazine/dd882522.aspx">https://msdn.microsoft.com/en-us/magazine/dd882522.aspx</a></p>
<p>Entity Framework: N-Tier Application Patterns <br /><a href="https://msdn.microsoft.com/en-us/magazine/ee321569.aspx">https://msdn.microsoft.com/en-us/magazine/ee321569.aspx</a></p>
<p>Building N-Tier Apps with EF4 <br /><a href="https://msdn.microsoft.com/en-us/magazine/ee335715.aspx">https://msdn.microsoft.com/en-us/magazine/ee335715.aspx</a></p>
<p>Entity Framework 4.0 and WCF Data Services 4.0 in Visual Studio 2010 <br /><a href="https://msdn.microsoft.com/en-us/magazine/ee336128.aspx">https://msdn.microsoft.com/en-us/magazine/ee336128.aspx</a></p>
</td>
</tr>
<tr>
<td width="160" valign="top">
<h3>Entity Framework Design blog:</h3>
</td>
<td width="400">
<p>Self-Tracking Entities in the Entity Framework <br /><a href="https://blogs.msdn.com/b/efdesign/archive/2009/03/24/self-tracking-entities-in-the-entity-framework.aspx">https://blogs.msdn.com/b/efdesign/archive/2009/03/24/self-tracking-entities-in-the-entity-framework.aspx</a></p>
<p>N-Tier Improvements for Entity Framework <br /><a href="https://blogs.msdn.com/b/efdesign/archive/2008/11/20/n-tier-improvements-for-entity-framework.aspx">https://blogs.msdn.com/b/efdesign/archive/2008/11/20/n-tier-improvements-for-entity-framework.aspx</a></p>
</td>
</tr>
<tr>
<td width="160" valign="top">
<h3>Sample codes:</h3>
</td>
<td width="400">
<p>Building N-Tier Apps with EF4 <br /><a href="https://code.msdn.microsoft.com/mag200911EF4">https://code.msdn.microsoft.com/mag200911EF4</a></p>
<p>Entity Framework 4.0 and WCF Data Services 4.0 in Visual Studio 2010 <br /><a href="https://code.msdn.microsoft.com/mag201004VSData">https://code.msdn.microsoft.com/mag201004VSData</a></p>
</td>
</tr>
<tr>
<td width="160" valign="top">
<h3>Other helpful blogs:</h3>
</td>
<td width="400">
<p>Updating data using Entity Framework in N-Tier and N-Layer Applications (short lived EF contexts) &ndash; (Part 1) (<a href="https://blogs.msdn.com/b/cesardelatorre/">Cesar de la Torre</a>) <br /><a href="https://blogs.msdn.com/b/cesardelatorre/archive/2008/09/04/updating-data-using-entity-framework-in-n-tier-and-n-layer-applications-short-lived-ef-contexts.aspx">https://blogs.msdn.com/b/cesardelatorre/archive/2008/09/04/updating-data-using-entity-framework-in-n-tier-and-n-layer-applications-short-lived-ef-contexts.aspx</a></p>
<p>Optimistic Concurrency Updates using Entity Framework in N-Tier and N-Layer Applications (Part 2) (<a href="https://blogs.msdn.com/b/cesardelatorre/">Cesar de la Torre</a>) <br /><a href="https://blogs.msdn.com/b/cesardelatorre/archive/2008/09/05/optimistic-concurrency-updates-using-entity-framework-in-n-tier-and-n-layer-applications-part-2.aspx">https://blogs.msdn.com/b/cesardelatorre/archive/2008/09/05/optimistic-concurrency-updates-using-entity-framework-in-n-tier-and-n-layer-applications-part-2.aspx</a></p>
<p>N-Tier Methods in Entity Framework 4 &ndash; Use with Care (<a href="https://thedatafarm.com/blog/">Julie Lermain</a>) <br /><a href="https://thedatafarm.com/blog/data-access/n-tier-methods-in-entity-framework-4-ndash-use-with-care/">https://thedatafarm.com/blog/data-access/n-tier-methods-in-entity-framework-4-ndash-use-with-care/</a></p>
</td>
</tr>
</tbody>
</table>]]></content:encoded>
    </item>
    <item>
      <title>Lazy Loading in Entity Framework 4</title>
      <link>https://docs.microsoft.com/archive/blogs/msdnforum/lazy-loading-in-entity-framework-4</link>
      <pubDate>Mon, 12 Jul 2010 03:26:00 GMT</pubDate>
      <dc:creator><![CDATA[msdntwt]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/msdnforum/2010/07/12/lazy-loading-in-entity-framework-4/</guid>
      <description><![CDATA[Like the debate for FK Association, many customers persist that Lazy Loading should be a necessity...]]></description>
      <content:encoded><![CDATA[<p>Like the debate for FK Association, many customers persist that Lazy Loading should be a necessity for an ORM like EF, while others believe it is evil. Also in EFv1, Lazy Loading is not available. Fortunately, thanks to EF team&rsquo;s effort again, Lazy Loading becomes the default option in EF4, as we already have in LINQ to SQL. Of course, we can still use Eager Loading and Explicit Loading as our wish. Let&rsquo;s see how they work in EF4. </p>
<p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/32/94/metablogapi/2335.image_6D475D9B.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-32-94-metablogapi/2335.image_5F00_6D475D9B.png"><img height="197" width="339" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/32/94/metablogapi/3225.image_thumb_40224B00.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-32-94-metablogapi/3225.image_5F00_thumb_5F00_40224B00.png" alt="image" border="0" title="image" style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" /></a> </p>
<p>We first create an EDM with two entities: Department and Course. </p>
<p><strong>Lazy Loading</strong> </p>
<p>Right click any blank area of the EDM designer, we see the ConceptualEntityModel properties of the EDM. Among the properties, there is one property named Lazy Loading Enabled which is by default set to <strong>True</strong>. </p>
<p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/32/94/metablogapi/7041.image_7239757D.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-32-94-metablogapi/7041.image_5F00_7239757D.png"><img height="257" width="307" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/32/94/metablogapi/3731.image_thumb_098479EF.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-32-94-metablogapi/3731.image_5F00_thumb_5F00_098479EF.png" alt="image" border="0" title="image" style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" /></a> </p>
<p>With Lazy Loading Enabled, the constructors of our ObjecConntext look like: </p>
<pre style="background-color: #ffffff; min-height: 40px; width: 500px; overflow: auto; border: #ffffff 1px solid; padding: 5px;"><pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">  1:     <span style="color: #808080">/// &lt;summary&gt;</span>
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">  2:     <span style="color: #808080">/// Initializes a new LazyLoadingEntities object using </span>
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">  3:     <span style="color: #808080">/// the connection string found in the 'LazyLoadingEntities'</span>
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">  4:     <span style="color: #808080">///  section of the application configuration file.</span>
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">  5:     <span style="color: #808080">/// &lt;/summary&gt;</span>
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">  6:     <span style="color: #0000ff">public</span> LazyLoadingEntities() : 
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">  7:     <span style="color: #0000ff">base</span>("<span style="color: #8b0000">name=LazyLoadingEntities</span>", "<span style="color: #8b0000">LazyLoadingEntities</span>")
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">  8:     {
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">  9:         <span style="background-color: #ffff00;"><span style="color: #0000ff;">this</span>.ContextOptions.LazyLoadingEnabled = <span style="color: #0000ff;">true</span>;</span></pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;"> 10:         OnContextCreated();
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;"> 11:     }
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;"> 12: </pre>
</pre>
<p>Let&rsquo;s see how Lazy Loading works. </p>
<pre style="background-color: #ffffff; min-height: 40px; width: 500px; overflow: auto; border: #ffffff 1px solid; padding: 5px;"><pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">  1:     <span style="color: #0000ff">using</span> (LazyLoadingEntities context = <span style="color: #0000ff">new</span> LazyLoadingEntities())
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">  2:     {
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">  3:     <span style="color: #008000">// Lazy loading is enabled dy default in EF4, so turn it off </span>
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">  4:     <span style="color: #008000">// to use eager loading later</span>
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">  5:         context.ContextOptions.LazyLoadingEnabled = <span style="color: #0000ff">false</span>;
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">  7:     <span style="color: #008000">// Query the department entities which Budget is not NULL</span>
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">  8:     <span style="color: #008000">// Here we use the .Include() method to eager load the related</span>
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">  9:     <span style="color: #008000">// course entities</span>
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;"> 10:         var departments = from d <span style="color: #0000ff">in</span> context.Departments.Include("<span style="color: #8b0000">Courses</span>")
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;"> 11:         where d.Budget != <span style="color: #0000ff">null</span>
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;"> 12:         select d;
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;"> 13:         <span style="color: #0000ff">foreach</span> (var department <span style="color: #0000ff">in</span> departments)
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;"> 14:         {
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;"> 15:             Console.WriteLine("<span style="color: #8b0000">Department: {0}</span>", department.Name);
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;"> 16:             Console.WriteLine("<span style="color: #8b0000">Courses:</span>");
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;"> 17:     <span style="color: #008000">// The related course entities has been already loaded</span>
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;"> 18:     <span style="color: #008000">// Note: for eager loading, there will be only one</span>
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;"> 19:     <span style="color: #008000">// database call to load the department and corresponding </span>
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;"> 20:     <span style="color: #008000">// course entities</span>
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;"> 21:             <span style="color: #0000ff">foreach</span> (var course <span style="color: #0000ff">in</span> department.Courses)
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;"> 22:             {
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;"> 23:                 Console.WriteLine(course.Title);
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;"> 24:             }
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;"> 26:             Console.WriteLine();
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;"> 27:         }
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;"> 28:     }
</pre>
</pre>
<p>For the sake of this example, assume that we have 5 departments and 10 courses for 4 departments among the 5 departments. From the query results in the SQL Server Profiler, there is 1 query to retrieve the Departments and 4 individual queries for each of the 4 Departments. </p>
<p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/32/94/metablogapi/0284.image_5FC0FEFB.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-32-94-metablogapi/0284.image_5F00_5FC0FEFB.png"><img height="315" width="448" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/32/94/metablogapi/4401.image_thumb_35915113.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-32-94-metablogapi/4401.image_5F00_thumb_5F00_35915113.png" alt="image" border="0" title="image" style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" /></a> </p>
<p>Last week, I heard that IntelliTrace in VS2010 Ultimate can also trace the SQL execution of our application, like the following image indicates. </p>
<p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/32/94/metablogapi/6472.image_79850F5D.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-32-94-metablogapi/6472.image_5F00_79850F5D.png"><img height="271" width="318" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/32/94/metablogapi/3240.image_thumb_17831D52.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-32-94-metablogapi/3240.image_5F00_thumb_5F00_17831D52.png" alt="image" border="0" title="image" style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" /></a> </p>
<p><strong>Eager Loading</strong> </p>
<p>Eager Loading is implemented by the Include method which specifies the related objects to include in the query results. To use Eager Loading in EF4, we need to turn of the default Lazy Loading by setting the Lazy Loading Enabled property to False or programmatically set the ObjectContextOptions.LazyLoadingEnabled = false. </p>
<p>Let&rsquo;s see how Eager Loading works. </p>
<pre style="background-color: #ffffff; min-height: 40px; width: 500px; overflow: auto; border: #ffffff 1px solid; padding: 5px;"><pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">  1:     <span style="color: #0000ff">using</span> (LazyLoadingEntities context = <span style="color: #0000ff">new</span> LazyLoadingEntities())
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">  2:     {
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">  3:     <span style="color: #008000">// Lazy loading is enabled dy default in EF4, so turn it off </span>
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">  4:     <span style="color: #008000">// to use eager loading later</span>
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">  5:         <span style="background-color: #ffff00;">context.ContextOptions.LazyLoadingEnabled = <span style="color: #0000ff;">false</span></span>;
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">  6: 
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">  7:     <span style="color: #008000">// Query the department entities which Budget is not NULL</span>
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">  8:     <span style="color: #008000">// Here we use the .Include() method to eager load the related</span>
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">  9:     <span style="color: #008000">// course entities</span>
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;"> 10:         var departments = from d <span style="color: #0000ff">in</span> context.Departments.<span style="background-color: #ffff00;">Include("<span style="color: #8b0000;">Courses</span>")</span>
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;"> 11:         where d.Budget != <span style="color: #0000ff">null</span>
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;"> 12:         select d;
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;"> 13:         <span style="color: #0000ff">foreach</span> (var department <span style="color: #0000ff">in</span> departments)
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;"> 14:         {
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;"> 15:             Console.WriteLine("<span style="color: #8b0000">Department: {0}</span>", department.Name);
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;"> 16:             Console.WriteLine("<span style="color: #8b0000">Courses:</span>");
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;"> 17:     <span style="color: #008000">// The related course entities has been already loaded</span>
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;"> 18:     <span style="color: #008000">// Note: for eager loading, there will be only one</span>
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;"> 19:     <span style="color: #008000">// database call to load the department and corresponding</span>
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;"> 20:     <span style="color: #008000">// course entities</span>
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;"> 21:             <span style="color: #0000ff">foreach</span> (var course <span style="color: #0000ff">in</span> department.Courses)
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;"> 22:             {
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;"> 23:                 Console.WriteLine(course.Title);
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;"> 24:             }
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;"> 25:             Console.WriteLine();
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;"> 26:         }
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;"> 27:     }
</pre>
</pre>
<p>From the SQL commands tracked in SQL Server Profiler, only 1 query is executed to retrieve all the related Departments and Courses. </p>
<p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/32/94/metablogapi/4426.image_74DEDED6.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-32-94-metablogapi/4426.image_5F00_74DEDED6.png"><img height="359" width="393" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/32/94/metablogapi/8055.image_thumb_052A30C3.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-32-94-metablogapi/8055.image_5F00_thumb_5F00_052A30C3.png" alt="image" border="0" title="image" style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" /></a> </p>
<p>Trace result in IntelliTrace: </p>
<p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/32/94/metablogapi/3364.image_25EDF3AA.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-32-94-metablogapi/3364.image_5F00_25EDF3AA.png"><img height="350" width="287" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/32/94/metablogapi/6011.image_thumb_228C5C02.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-32-94-metablogapi/6011.image_5F00_thumb_5F00_228C5C02.png" alt="image" border="0" title="image" style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" /></a> </p>
<p>Explicit Loading Explicit Loading is implemented by calling EntityCollection.Load or EntityReference.Load to retrieve the related entities. Similar with the Eager Loading, we need to turn off the default Lazy Loading in EF4. </p>
<pre style="background-color: #ffffff; min-height: 40px; width: 500px; overflow: auto; border: #ffffff 1px solid; padding: 5px;"><pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">  1:     <span style="color: #0000ff">using</span> (LazyLoadingEntities context = <span style="color: #0000ff">new</span> LazyLoadingEntities())
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">  2:     {
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">  3:     <span style="color: #008000">// Lazy loading is enabled dy default in EF4, so turn it off </span>
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">  4:     <span style="color: #008000">// to use explicit loading later</span>
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">  5:         <span style="background-color: #ffff00;">context.ContextOptions.LazyLoadingEnabled = <span style="color: #0000ff;">false</span>;</span>
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">  6:     <span style="color: #008000">// Query the department entities which Budget is not NULL</span>
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">  7:         var departments = from d <span style="color: #0000ff">in</span> context.Departments
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">  8:                           where d.Budget != <span style="color: #0000ff">null</span>
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">  9:         select d;
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;"> 10:         <span style="color: #0000ff">foreach</span> (var department <span style="color: #0000ff">in</span> departments)
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;"> 11:         {
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;"> 12:             Console.WriteLine("<span style="color: #8b0000">Department: {0}</span>", department.Name);
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;"> 13:             Console.WriteLine("<span style="color: #8b0000">Courses:</span>");
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;"> 14:     <span style="color: #008000">// Explicit load the related courses entities if they</span>
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;"> 15:     <span style="color: #008000">// are not loaded yet</span>
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;"> 16:     <span style="color: #008000">// Note: here for each department, there will be a </span>
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;"> 17:     <span style="color: #008000">// seperate database call to load the course entities</span>
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;"> 18:             <span style="background-color: #ffff00;"><span style="color: #0000ff;">if</span> (!department.Courses.IsLoaded)
</span></pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;"> 19:             <span style="background-color: #ffff00;">{</span>
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;"> 20:                <span style="background-color: #ffff00;"> department.Courses.Load();</span>
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;"> 21:             <span style="background-color: #ffff00;">}
</span></pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;"> 22:             <span style="color: #0000ff">foreach</span> (var course <span style="color: #0000ff">in</span> department.Courses)
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;"> 23:             {
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;"> 24:                 Console.WriteLine(course.Title);
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;"> 25:             }
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;"> 26:             Console.WriteLine();
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;"> 27:         }
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;"> 28:     }
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;"> 29: </pre>
</pre>
<p>The SQL commands that are executed here are similar with what we saw in the Lazy Loading test. </p>
<p><strong>Discussion</strong> </p>
<p>Actually, I think Lazy Loading, Eager Loading and Explicit Loading are for different scenarios. Lazy Loading and Explicit Loading are in one kind while Eager Loading is the opposite. EF4 helps us to implement the Explicit Loading logic to retrieve the related entities if necessary, which becomes Lazy Loading. So I believe Lazy Loading and Explicit Loading offer the same performance benefits and challenges. For the Eager Loading, the benefit is that we only use one query to get all the related entities, which means only one database connection and one network trip are needed here. However, the single resultset can be really large and the single query structure can be very complicated and expensive (with many JOINs). </p>
<p>Like the folks who support Lazy Loading, I second that it should be a feature of an ORM. I am very glad to see that Lazy Loading is now implemented in EF4, because it makes the entity world more flexible. J </p>
<p>All the sample codes in this post can be found in the samples CSEFLazyLoading (C#) and VBEFLazyLoading (VB.NET) in All-In-One Code Framework which is an open-source project delineating the framework and skeleton of Microsoft development techniques. </p>
<p><strong>Additional references</strong> </p>
<p>Loading Related Objects (Entity Framework) <a href="https://msdn.microsoft.com/en-us/library/bb896272.aspx">https://msdn.microsoft.com/en-us/library/bb896272.aspx</a> </p>
<p>How to: Use Lazy Loading to Load Related Objects (Entity Framework) <a href="https://msdn.microsoft.com/en-us/library/dd456846.aspx">https://msdn.microsoft.com/en-us/library/dd456846.aspx</a> </p>
<p>How to: Use Query Paths to Shape Results (Entity Framework) <a href="https://msdn.microsoft.com/en-us/library/bb738449.aspx ">https://msdn.microsoft.com/en-us/library/bb738449.aspx</a> </p>
<p>How to: Explicitly Load Related Objects (Entity Framework) <a href="https://msdn.microsoft.com/en-us/library/bb896249.aspx">https://msdn.microsoft.com/en-us/library/bb896249.aspx</a></p>]]></content:encoded>
    </item>
    <item>
      <title>Use CLR4 Hosting API to invoke .NET assembly from native C++</title>
      <link>https://docs.microsoft.com/archive/blogs/msdnforum/use-clr4-hosting-api-to-invoke-net-assembly-from-native-c</link>
      <pubDate>Fri, 09 Jul 2010 03:10:00 GMT</pubDate>
      <dc:creator><![CDATA[msdntwt]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/msdnforum/2010/07/09/use-clr4-hosting-api-to-invoke-net-assembly-from-native-c/</guid>
      <description><![CDATA[&nbsp;
The Common Language Runtime (CLR) allows a level of integration between itself and a host....]]></description>
      <content:encoded><![CDATA[<p>&nbsp;</p>
<p>The Common Language Runtime (CLR) allows a level of integration between itself and a host. This article is about a C++ code sample that demonstrates using the Hosting Interfaces of .NET Framework 4.0 to host a specific version of CLR in the process, load a .NET assembly, and invoke the types in the assembly. The code sample also demonstrates the new In-Process Side-by-Side feature in .NET Framework 4. The .NET Framework 4 runtime, and all future runtimes, are able to run in-process with one another. .NET Framework 4 runtime and beyond are also able to run in-process with any single older runtime. In ther words, you will be able to load 4, 5 and 2.0 in the same process, but you will not be able to load 1.1 and 2.0 in the same process. The code sample hosts .NET runtime 4.0 and 2.0 side by side, and loads a .NET 2.0 assembly into the two runtimes.</p>
<p>The code sample in this article (CppHostCLR) can be downloaded from Microsoft <a href="https://1code.codeplex.com/">All-In-One Code Framework</a>, which is a centralized code sample library.</p>
<p><strong>The following steps walk through a demonstration of the CLR Hosting sample. </strong></p>
<p>Step1. After you successfully build the sample project, and the dependent .NET class library projects (CSClassLibrary and CSNET2ClassLibrary) in Visual Studio 2010, you will get an application and two libraries: CppHostCLR.exe, CSClassLibrary.dll, and CSNET2ClassLibrary.dll. Make sure that the files are in the same folder.</p>
<p>Step2. Run the application in a command prompt. The application demonstrates the CLR In-Process Side-by-Side feature that is new in .NET 4 first. It hosts the .NET runtime 4.0 first and loads a .NET 2.0 assembly into the runtime to invoke its types. Then the application hosts the .NET runtime 2.0 side by side with the .NET runtime 4.0 and loads the same .NET 2.0 assembly into the .NET 4.0 runtime. If the operations succeed, the application prints the <br />following content in the console.</p>
<p>&nbsp;&nbsp;&nbsp; Load and start the .NET runtime v4.0.30319 <br />&nbsp;&nbsp;&nbsp; Load the assembly CSNET2ClassLibrary <br />&nbsp;&nbsp;&nbsp; Call CSNET2ClassLibrary.CSSimpleObject.GetStringLength("HelloWorld") =&gt; 10 <br />&nbsp;&nbsp;&nbsp; Call CSNET2ClassLibrary.CSSimpleObject.ToString() =&gt; 0.00</p>
<p>&nbsp;&nbsp;&nbsp; Load and start the .NET runtime v2.0.50727 <br />&nbsp;&nbsp;&nbsp; Load the assembly CSNET2ClassLibrary <br />&nbsp;&nbsp;&nbsp; Call CSNET2ClassLibrary.CSSimpleObject.GetStringLength("HelloWorld") =&gt; 10 <br />&nbsp;&nbsp;&nbsp; Call CSNET2ClassLibrary.CSSimpleObject.ToString() =&gt; 0.00</p>
<p>&nbsp;&nbsp;&nbsp; Presss ENTER to continue ...</p>
<p>You can verify that both .NET 2.0 and .NET 4.0 runtimes are loaded by using Process Explorer (<a href="https://technet.microsoft.com/en-us/sysinternals/bb896653.aspx">https://technet.microsoft.com/en-us/sysinternals/bb896653.aspx</a>). In Lower Pane View / DLLs of the tool, you can see all modules loaded in the process. If clr.dll (the .NET 4 runtime module) and mscorwks.dll (the .NET 2 runtime module) are in the list, both .NET 2.0 and .NET 4.0 runtimes are loaded.</p>
<p>Step3. Press ENTER to continue. The application will host the .NET runtime 4.0 and use the ICLRRuntimeHost interface that was provided in .NET v2.0 to <br />load a .NET 4.0 assembly and invoke its type.</p>
<p>&nbsp;&nbsp;&nbsp; Load and start the .NET runtime v4.0.30319 <br />&nbsp;&nbsp;&nbsp; Load the assembly CSClassLibrary.dll <br />&nbsp;&nbsp;&nbsp; Call CSClassLibrary.CSSimpleObject.GetStringLength("HelloWorld") =&gt; 10</p>
<p><strong>The key code in the code sample is attached below. </strong></p>
<pre style="background-color: #ffffff; min-height: 40px; width: 513px; height: 5505px; overflow: auto; border: #ffffff 1px solid; padding: 5px;"><pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">  1: <span style="color: #008000">//</span>
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">  2: <span style="color: #008000">//   FUNCTION: RuntimeHostV4Demo1(PCWSTR, PCWSTR)</span>
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">  3: <span style="color: #008000">//</span>
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">  4: <span style="color: #008000">//   PURPOSE: The function demonstrates using .NET Framework 4.0 Hosting </span>
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">  5: <span style="color: #008000">//   Interfaces to host a .NET runtime, and use the ICorRuntimeHost interface</span>
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">  6: <span style="color: #008000">//   that was provided in .NET v1.x to load a .NET assembly and invoke its </span>
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">  7: <span style="color: #008000">//   type. </span>
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">  8: <span style="color: #008000">//   </span>
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">  9: <span style="color: #008000">//   If the .NET runtime specified by the pszVersion parameter cannot be </span>
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;"> 10: <span style="color: #008000">//   loaded into the current process, the function prints ".NET runtime &lt;the </span>
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;"> 11: <span style="color: #008000">//   runtime version&gt; cannot be loaded", and return.</span>
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;"> 12: <span style="color: #008000">//   </span>
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;"> 13: <span style="color: #008000">//   If the .NET runtime is successfully loaded, the function loads the </span>
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;"> 14: <span style="color: #008000">//   assembly identified by the pszAssemblyName parameter. Next, the function </span>
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;"> 15: <span style="color: #008000">//   instantiates the class (pszClassName) in the assembly, calls its </span>
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;"> 16: <span style="color: #008000">//   ToString() member method, and print the result. Last, the demo invokes </span>
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;"> 17: <span style="color: #008000">//   the public static function 'int GetStringLength(string str)' of the class </span>
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;"> 18: <span style="color: #008000">//   and print the result too.</span>
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;"> 19: <span style="color: #008000">//</span>
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;"> 20: <span style="color: #008000">//   PARAMETERS:</span>
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;"> 21: <span style="color: #008000">//   * pszVersion - The desired DOTNETFX version, in the format &ldquo;vX.X.XXXXX&rdquo;. </span>
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;"> 22: <span style="color: #008000">//     The parameter must not be NULL. It&rsquo;s important to note that this </span>
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;"> 23: <span style="color: #008000">//     parameter should match exactly the directory names for each version of</span>
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;"> 24: <span style="color: #008000">//     the framework, under C:\Windows\Microsoft.NET\Framework[64]. The </span>
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;"> 25: <span style="color: #008000">//     current possible values are "v1.0.3705", "v1.1.4322", "v2.0.50727" and </span>
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;"> 26: <span style="color: #008000">//     "v4.0.30319". Also, note that the &ldquo;v&rdquo; prefix is mandatory.</span>
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;"> 27: <span style="color: #008000">//   * pszAssemblyName - The display name of the assembly to be loaded, such </span>
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;"> 28: <span style="color: #008000">//     as "CSClassLibrary". The ".DLL" file extension is not appended.</span>
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;"> 29: <span style="color: #008000">//   * pszClassName - The name of the Type that defines the method to invoke.</span>
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;"> 30: <span style="color: #008000">//</span>
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;"> 31: <span style="color: #008000">//   RETURN VALUE: HRESULT of the demo.</span>
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;"> 32: <span style="color: #008000">//</span>
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;"> 33: HRESULT RuntimeHostV4Demo1(PCWSTR pszVersion, PCWSTR pszAssemblyName, 
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;"> 34:     PCWSTR pszClassName)
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;"> 35: {
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;"> 36:     HRESULT hr;
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;"> 37:     ICLRMetaHost *pMetaHost = NULL;
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;"> 38:     ICLRRuntimeInfo *pRuntimeInfo = NULL;
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;"> 39:     <span style="color: #008000">// ICorRuntimeHost and ICLRRuntimeHost are the two CLR hosting interfaces</span>
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;"> 40:     <span style="color: #008000">// supported by CLR 4.0. Here we demo the ICorRuntimeHost interface that </span>
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;"> 41:     <span style="color: #008000">// was provided in .NET v1.x, and is compatible with all .NET Frameworks. </span>
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;"> 42:     ICorRuntimeHost *pCorRuntimeHost = NULL;
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;"> 43:     IUnknownPtr spAppDomainThunk = NULL;
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;"> 44:     _AppDomainPtr spDefaultAppDomain = NULL;
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;"> 45:     <span style="color: #008000">// The .NET assembly to load.</span>
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;"> 46:     bstr_t bstrAssemblyName(pszAssemblyName);
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;"> 47:     _AssemblyPtr spAssembly = NULL;
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;"> 48:     <span style="color: #008000">// The .NET class to instantiate.</span>
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;"> 49:     bstr_t bstrClassName(pszClassName);
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;"> 50:     _TypePtr spType = NULL;
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;"> 51:     variant_t vtObject;
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;"> 52:     variant_t vtEmpty;
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;"> 53:     <span style="color: #008000">// The static method in the .NET class to invoke.</span>
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;"> 54:     bstr_t bstrStaticMethodName(L"<span style="color: #8b0000">GetStringLength</span>");
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;"> 55:     SAFEARRAY *psaStaticMethodArgs = NULL;
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;"> 56:     variant_t vtStringArg(L"<span style="color: #8b0000">HelloWorld</span>");
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;"> 57:     variant_t vtLengthRet;
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;"> 58:     <span style="color: #008000">// The instance method in the .NET class to invoke.</span>
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;"> 59:     bstr_t bstrMethodName(L"<span style="color: #8b0000">ToString</span>");
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;"> 60:     SAFEARRAY *psaMethodArgs = NULL;
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;"> 61:     variant_t vtStringRet;
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;"> 62:     <span style="color: #008000">// </span>
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;"> 63:     <span style="color: #008000">// Load and start the .NET runtime.</span>
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;"> 64:     <span style="color: #008000">// </span>
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;"> 65:     wprintf(L"<span style="color: #8b0000">Load and start the .NET runtime %s \n</span>", pszVersion);
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;"> 66:     hr = CLRCreateInstance(CLSID_CLRMetaHost, IID_PPV_ARGS(&amp;pMetaHost));
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;"> 67:     <span style="color: #0000ff">if</span> (FAILED(hr))
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;"> 68:     {
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;"> 69:         wprintf(L"<span style="color: #8b0000">CLRCreateInstance failed w/hr 0x%08lx\n</span>", hr);
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;"> 70:         <span style="color: #0000ff">goto</span> Cleanup;
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;"> 71:     }
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;"> 72:     <span style="color: #008000">// Get the ICLRRuntimeInfo corresponding to a particular CLR version. It </span>
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;"> 73:     <span style="color: #008000">// supersedes CorBindToRuntimeEx with STARTUP_LOADER_SAFEMODE.</span>
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;"> 74:     hr = pMetaHost-&gt;GetRuntime(pszVersion, IID_PPV_ARGS(&amp;pRuntimeInfo));
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;"> 75:     <span style="color: #0000ff">if</span> (FAILED(hr))
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;"> 76:     {
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;"> 77:         wprintf(L"<span style="color: #8b0000">ICLRMetaHost::GetRuntime failed w/hr 0x%08lx\n</span>", hr);
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;"> 78:         <span style="color: #0000ff">goto</span> Cleanup;
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;"> 79:     }
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;"> 80:     <span style="color: #008000">// Check if the specified runtime can be loaded into the process. This </span>
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;"> 81:     <span style="color: #008000">// method will take into account other runtimes that may already be </span>
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;"> 82:     <span style="color: #008000">// loaded into the process and set pbLoadable to TRUE if this runtime can </span>
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;"> 83:     <span style="color: #008000">// be loaded in an in-process side-by-side fashion. </span>
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;"> 84:     BOOL fLoadable;
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;"> 85:     hr = pRuntimeInfo-&gt;IsLoadable(&amp;fLoadable);
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;"> 86:     <span style="color: #0000ff">if</span> (FAILED(hr))
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;"> 87:     {
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;"> 88:         wprintf(L"<span style="color: #8b0000">ICLRRuntimeInfo::IsLoadable failed w/hr 0x%08lx\n</span>", hr);
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;"> 89:         <span style="color: #0000ff">goto</span> Cleanup;
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;"> 90:     }
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;"> 91:     <span style="color: #0000ff">if</span> (!fLoadable)
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;"> 92:     {
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;"> 93:         wprintf(L"<span style="color: #8b0000">.NET runtime %s cannot be loaded\n</span>", pszVersion);
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;"> 94:         <span style="color: #0000ff">goto</span> Cleanup;
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;"> 95:     }
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;"> 96:     <span style="color: #008000">// Load the CLR into the current process and return a runtime interface </span>
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;"> 97:     <span style="color: #008000">// pointer. ICorRuntimeHost and ICLRRuntimeHost are the two CLR hosting  </span>
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;"> 98:     <span style="color: #008000">// interfaces supported by CLR 4.0. Here we demo the ICorRuntimeHost </span>
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;"> 99:     <span style="color: #008000">// interface that was provided in .NET v1.x, and is compatible with all </span>
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">100:     <span style="color: #008000">// .NET Frameworks. </span>
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">101:     hr = pRuntimeInfo-&gt;GetInterface(CLSID_CorRuntimeHost,
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">102:          IID_PPV_ARGS(&amp;pCorRuntimeHost));
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">103:     <span style="color: #0000ff">if</span> (FAILED(hr))
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">104:     {
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">105:         wprintf(L"<span style="color: #8b0000">ICLRRuntimeInfo::GetInterface failed w/hr 0x%08lx\n</span>", hr);
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">106:         <span style="color: #0000ff">goto</span> Cleanup;
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">107:     }
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">108:     <span style="color: #008000">// Start the CLR.</span>
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">109:     hr = pCorRuntimeHost-&gt;Start();
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">110:     <span style="color: #0000ff">if</span> (FAILED(hr))
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">111:     {
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">112:         wprintf(L"<span style="color: #8b0000">CLR failed to start w/hr 0x%08lx\n</span>", hr);
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">113:         <span style="color: #0000ff">goto</span> Cleanup;
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">114:     }
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">115:     <span style="color: #008000">// </span>
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">116:     <span style="color: #008000">// Load the NET assembly. Call the static method GetStringLength of the </span>
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">117:     <span style="color: #008000">// class CSSimpleObject. Instantiate the class CSSimpleObject and call </span>
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">118:     <span style="color: #008000">// its instance method ToString.</span>
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">119:     <span style="color: #008000">// </span>
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">120:     <span style="color: #008000">// The following C++ code does the same thing as this C# code:</span>
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">121:     <span style="color: #008000">// </span>
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">122:     <span style="color: #008000">//   Assembly assembly = AppDomain.CurrentDomain.Load(pszAssemblyName);</span>
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">123:     <span style="color: #008000">//   object length = type.InvokeMember("GetStringLength", </span>
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">124:     <span style="color: #008000">//       BindingFlags.InvokeMethod | BindingFlags.Static | </span>
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">125:     <span style="color: #008000">//       BindingFlags.Public, null, null, new object[] { "HelloWorld" });</span>
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">126:     <span style="color: #008000">//   object obj = assembly.CreateInstance("CSClassLibrary.CSSimpleObject");</span>
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">127:     <span style="color: #008000">//   object str = type.InvokeMember("ToString", </span>
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">128:     <span style="color: #008000">//       BindingFlags.InvokeMethod | BindingFlags.Instance | </span>
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">129:     <span style="color: #008000">//       BindingFlags.Public, null, obj, new object[] { });</span>
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">130:     <span style="color: #008000">// Get a pointer to the default AppDomain in the CLR.</span>
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">131:     hr = pCorRuntimeHost-&gt;GetDefaultDomain(&amp;spAppDomainThunk);
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">132:     <span style="color: #0000ff">if</span> (FAILED(hr))
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">133:     {
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">134:         wprintf(L"<span style="color: #8b0000">ICorRuntimeHost::GetDefaultDomain failed w/hr 0x%08lx\n</span>", hr);
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">135:         <span style="color: #0000ff">goto</span> Cleanup;
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">136:     }
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">137:     hr = spAppDomainThunk-&gt;QueryInterface(IID_PPV_ARGS(&amp;spDefaultAppDomain));
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">138:     <span style="color: #0000ff">if</span> (FAILED(hr))
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">139:     {
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">140:         wprintf(L"<span style="color: #8b0000">Failed to get default AppDomain w/hr 0x%08lx\n</span>", hr);
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">141:         <span style="color: #0000ff">goto</span> Cleanup;
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">142:     }
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">143:     <span style="color: #008000">// Load the .NET assembly.</span>
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">144:     wprintf(L"<span style="color: #8b0000">Load the assembly %s\n</span>", pszAssemblyName);
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">145:     hr = spDefaultAppDomain-&gt;Load_2(bstrAssemblyName, &amp;spAssembly);
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">146:     <span style="color: #0000ff">if</span> (FAILED(hr))
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">147:     {
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">148:         wprintf(L"<span style="color: #8b0000">Failed to load the assembly w/hr 0x%08lx\n</span>", hr);
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">149:         <span style="color: #0000ff">goto</span> Cleanup;
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">150:     }
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">151:     <span style="color: #008000">// Get the Type of CSSimpleObject.</span>
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">152:     hr = spAssembly-&gt;GetType_2(bstrClassName, &amp;spType);
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">153:     <span style="color: #0000ff">if</span> (FAILED(hr))
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">154:     {
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">155:         wprintf(L"<span style="color: #8b0000">Failed to get the Type interface w/hr 0x%08lx\n</span>", hr);
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">156:         <span style="color: #0000ff">goto</span> Cleanup;
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">157:     }
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">158:     <span style="color: #008000">// Call the static method of the class: </span>
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">159:     <span style="color: #008000">//   public static int GetStringLength(string str);</span>
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">160:     <span style="color: #008000">// Create a safe array to contain the arguments of the method. The safe </span>
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">161:     <span style="color: #008000">// array must be created with vt = VT_VARIANT because .NET reflection </span>
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">162:     <span style="color: #008000">// expects an array of Object - VT_VARIANT. There is only one argument, </span>
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">163:     <span style="color: #008000">// so cElements = 1.</span>
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">164:     psaStaticMethodArgs = SafeArrayCreateVector(VT_VARIANT, 0, 1);
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">165:     LONG index = 0;
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">166:     hr = SafeArrayPutElement(psaStaticMethodArgs, &amp;index, &amp;vtStringArg);
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">167:     <span style="color: #0000ff">if</span> (FAILED(hr))
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">168:     {
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">169:         wprintf(L"<span style="color: #8b0000">SafeArrayPutElement failed w/hr 0x%08lx\n</span>", hr);
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">170:         <span style="color: #0000ff">goto</span> Cleanup;
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">171:     }
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">172:     <span style="color: #008000">// Invoke the "GetStringLength" method from the Type interface.</span>
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">173:     hr = spType-&gt;InvokeMember_3(bstrStaticMethodName, <span style="color: #0000ff">static_cast</span>&lt;BindingFlags&gt;(
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">174:         BindingFlags_InvokeMethod | BindingFlags_Static | BindingFlags_Public), 
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">175:         NULL, vtEmpty, psaStaticMethodArgs, &amp;vtLengthRet);
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">176:     <span style="color: #0000ff">if</span> (FAILED(hr))
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">177:     {
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">178:         wprintf(L"<span style="color: #8b0000">Failed to invoke GetStringLength w/hr 0x%08lx\n</span>", hr);
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">179:         <span style="color: #0000ff">goto</span> Cleanup;
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">180:     }
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">181:     <span style="color: #008000">// Print the call result of the static method.</span>
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">182:     wprintf(L"<span style="color: #8b0000">Call %s.%s(\"%s\") =&gt; %d\n</span>", 
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">183:         <span style="color: #0000ff">static_cast</span>&lt;PCWSTR&gt;(bstrClassName), 
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">184:         <span style="color: #0000ff">static_cast</span>&lt;PCWSTR&gt;(bstrStaticMethodName), 
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">185:         <span style="color: #0000ff">static_cast</span>&lt;PCWSTR&gt;(vtStringArg.bstrVal), 
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">186:         vtLengthRet.lVal);
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">187:     <span style="color: #008000">// Instantiate the class.</span>
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">188:     hr = spAssembly-&gt;CreateInstance(bstrClassName, &amp;vtObject);
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">189:     <span style="color: #0000ff">if</span> (FAILED(hr))
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">190:     {
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">191:         wprintf(L"<span style="color: #8b0000">Assembly::CreateInstance failed w/hr 0x%08lx\n</span>", hr);
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">192:         <span style="color: #0000ff">goto</span> Cleanup;
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">193:     }
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">194:     <span style="color: #008000">// Call the instance method of the class.</span>
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">195:     <span style="color: #008000">//   public string ToString();</span>
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">196:     <span style="color: #008000">// Create a safe array to contain the arguments of the method.</span>
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">197:     psaMethodArgs = SafeArrayCreateVector(VT_VARIANT, 0, 0);
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">198:     <span style="color: #008000">// Invoke the "ToString" method from the Type interface.</span>
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">199:     hr = spType-&gt;InvokeMember_3(bstrMethodName, <span style="color: #0000ff">static_cast</span>&lt;BindingFlags&gt;(
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">200:         BindingFlags_InvokeMethod | BindingFlags_Instance | BindingFlags_Public),
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">201:         NULL, vtObject, psaMethodArgs, &amp;vtStringRet);
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">202:     <span style="color: #0000ff">if</span> (FAILED(hr))
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">203:     {
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">204:         wprintf(L"<span style="color: #8b0000">Failed to invoke ToString w/hr 0x%08lx\n</span>", hr);
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">205:         <span style="color: #0000ff">goto</span> Cleanup;
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">206:     }
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">207:     <span style="color: #008000">// Print the call result of the method.</span>
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">208:     wprintf(L"<span style="color: #8b0000">Call %s.%s() =&gt; %s\n</span>", 
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">209:         <span style="color: #0000ff">static_cast</span>&lt;PCWSTR&gt;(bstrClassName), 
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">210:         <span style="color: #0000ff">static_cast</span>&lt;PCWSTR&gt;(bstrMethodName), 
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">211:         <span style="color: #0000ff">static_cast</span>&lt;PCWSTR&gt;(vtStringRet.bstrVal));
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">212: Cleanup:
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">213:     <span style="color: #0000ff">if</span> (pMetaHost)
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">214:     {
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">215:         pMetaHost-&gt;Release();
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">216:         pMetaHost = NULL;
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">217:     }
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">218:     <span style="color: #0000ff">if</span> (pRuntimeInfo)
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">219:     {
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">220:         pRuntimeInfo-&gt;Release();
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">221:         pRuntimeInfo = NULL;
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">222:     }
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">223:     <span style="color: #0000ff">if</span> (pCorRuntimeHost)
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">224:     {
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">225:         <span style="color: #008000">// Please note that after a call to Stop, the CLR cannot be </span>
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">226:         <span style="color: #008000">// reinitialized into the same process. This step is usually not </span>
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">227:         <span style="color: #008000">// necessary. You can leave the .NET runtime loaded in your process.</span>
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">228:         <span style="color: #008000">//wprintf(L"Stop the .NET runtime\n");</span>
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">229:         <span style="color: #008000">//pCorRuntimeHost-&gt;Stop();</span>
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">230:         pCorRuntimeHost-&gt;Release();
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">231:         pCorRuntimeHost = NULL;
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">232:     }
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">233:     <span style="color: #0000ff">if</span> (psaStaticMethodArgs)
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">234:     {
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">235:         SafeArrayDestroy(psaStaticMethodArgs);
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">236:         psaStaticMethodArgs = NULL;
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">237:     }
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">238:     <span style="color: #0000ff">if</span> (psaMethodArgs)
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">239:     {
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">240:         SafeArrayDestroy(psaMethodArgs);
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">241:         psaMethodArgs = NULL;
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">242:     }
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">243:     <span style="color: #0000ff">return</span> hr;
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">244: }
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">245: 
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">246: <span style="color: #008000">//</span>
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">247: <span style="color: #008000">//   FUNCTION: RuntimeHostV4Demo2(PCWSTR, PCWSTR)</span>
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">248: <span style="color: #008000">//</span>
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">249: <span style="color: #008000">//   PURPOSE: The function demonstrates using .NET Framework 4.0 Hosting </span>
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">250: <span style="color: #008000">//   Interfaces to host a .NET runtime, and use the ICLRRuntimeHost interface</span>
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">251: <span style="color: #008000">//   that was provided in .NET v2.0 to load a .NET assembly and invoke its </span>
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">252: <span style="color: #008000">//   type. Because ICLRRuntimeHost is not compatible with .NET runtime v1.x, </span>
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">253: <span style="color: #008000">//   the requested runtime must not be v1.x.</span>
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">254: <span style="color: #008000">//   </span>
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">255: <span style="color: #008000">//   If the .NET runtime specified by the pszVersion parameter cannot be </span>
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">256: <span style="color: #008000">//   loaded into the current process, the function prints ".NET runtime &lt;the </span>
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">257: <span style="color: #008000">//   runtime version&gt; cannot be loaded", and return.</span>
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">258: <span style="color: #008000">//   </span>
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">259: <span style="color: #008000">//   If the .NET runtime is successfully loaded, the function loads the </span>
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">260: <span style="color: #008000">//   assembly identified by the pszAssemblyName parameter. Next, the function </span>
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">261: <span style="color: #008000">//   invokes the public static function 'int GetStringLength(string str)' of </span>
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">262: <span style="color: #008000">//   the class and print the result.</span>
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">263: <span style="color: #008000">//</span>
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">264: <span style="color: #008000">//   PARAMETERS:</span>
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">265: <span style="color: #008000">//   * pszVersion - The desired DOTNETFX version, in the format &ldquo;vX.X.XXXXX&rdquo;. </span>
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">266: <span style="color: #008000">//     The parameter must not be NULL. It&rsquo;s important to note that this </span>
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">267: <span style="color: #008000">//     parameter should match exactly the directory names for each version of</span>
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">268: <span style="color: #008000">//     the framework, under C:\Windows\Microsoft.NET\Framework[64]. Because </span>
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">269: <span style="color: #008000">//     the ICLRRuntimeHost interface does not support the .NET v1.x runtimes, </span>
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">270: <span style="color: #008000">//     the current possible values of the parameter are "v2.0.50727" and </span>
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">271: <span style="color: #008000">//     "v4.0.30319". Also, note that the &ldquo;v&rdquo; prefix is mandatory.</span>
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">272: <span style="color: #008000">//   * pszAssemblyPath - The path to the Assembly to be loaded.</span>
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">273: <span style="color: #008000">//   * pszClassName - The name of the Type that defines the method to invoke.</span>
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">274: <span style="color: #008000">//</span>
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">275: <span style="color: #008000">//   RETURN VALUE: HRESULT of the demo.</span>
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">276: <span style="color: #008000">//</span>
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">277: HRESULT RuntimeHostV4Demo2(PCWSTR pszVersion, PCWSTR pszAssemblyPath, 
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">278:     PCWSTR pszClassName)
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">279: {
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">280:     HRESULT hr;
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">281:     ICLRMetaHost *pMetaHost = NULL;
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">282:     ICLRRuntimeInfo *pRuntimeInfo = NULL;
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">283:     <span style="color: #008000">// ICorRuntimeHost and ICLRRuntimeHost are the two CLR hosting interfaces</span>
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">284:     <span style="color: #008000">// supported by CLR 4.0. Here we demo the ICLRRuntimeHost interface that </span>
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">285:     <span style="color: #008000">// was provided in .NET v2.0 to support CLR 2.0 new features. </span>
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">286:     <span style="color: #008000">// ICLRRuntimeHost does not support loading the .NET v1.x runtimes.</span>
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">287:     ICLRRuntimeHost *pClrRuntimeHost = NULL;
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">288:     <span style="color: #008000">// The static method in the .NET class to invoke.</span>
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">289:     PCWSTR pszStaticMethodName = L"<span style="color: #8b0000">GetStringLength</span>";
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">290:     PCWSTR pszStringArg = L"<span style="color: #8b0000">HelloWorld</span>";
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">291:     DWORD dwLengthRet;
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">292:     <span style="color: #008000">// </span>
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">293:     <span style="color: #008000">// Load and start the .NET runtime.</span>
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">294:     <span style="color: #008000">// </span>
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">295:     wprintf(L"<span style="color: #8b0000">Load and start the .NET runtime %s \n</span>", pszVersion);
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">296:     hr = CLRCreateInstance(CLSID_CLRMetaHost, IID_PPV_ARGS(&amp;pMetaHost));
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">297:     <span style="color: #0000ff">if</span> (FAILED(hr))
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">298:     {
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">299:         wprintf(L"<span style="color: #8b0000">CLRCreateInstance failed w/hr 0x%08lx\n</span>", hr);
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">300:         <span style="color: #0000ff">goto</span> Cleanup;
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">301:     }
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">302:     <span style="color: #008000">// Get the ICLRRuntimeInfo corresponding to a particular CLR version. It </span>
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">303:     <span style="color: #008000">// supersedes CorBindToRuntimeEx with STARTUP_LOADER_SAFEMODE.</span>
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">304:     hr = pMetaHost-&gt;GetRuntime(pszVersion, IID_PPV_ARGS(&amp;pRuntimeInfo));
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">305:     <span style="color: #0000ff">if</span> (FAILED(hr))
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">306:     {
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">307:         wprintf(L"<span style="color: #8b0000">ICLRMetaHost::GetRuntime failed w/hr 0x%08lx\n</span>", hr);
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">308:         <span style="color: #0000ff">goto</span> Cleanup;
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">309:     }
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">310:     <span style="color: #008000">// Check if the specified runtime can be loaded into the process. This </span>
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">311:     <span style="color: #008000">// method will take into account other runtimes that may already be </span>
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">312:     <span style="color: #008000">// loaded into the process and set pbLoadable to TRUE if this runtime can </span>
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">313:     <span style="color: #008000">// be loaded in an in-process side-by-side fashion. </span>
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">314:     BOOL fLoadable;
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">315:     hr = pRuntimeInfo-&gt;IsLoadable(&amp;fLoadable);
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">316:     <span style="color: #0000ff">if</span> (FAILED(hr))
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">317:     {
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">318:         wprintf(L"<span style="color: #8b0000">ICLRRuntimeInfo::IsLoadable failed w/hr 0x%08lx\n</span>", hr);
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">319:         <span style="color: #0000ff">goto</span> Cleanup;
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">320:     }
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">321:     <span style="color: #0000ff">if</span> (!fLoadable)
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">322:     {
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">323:         wprintf(L"<span style="color: #8b0000">.NET runtime %s cannot be loaded\n</span>", pszVersion);
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">324:         <span style="color: #0000ff">goto</span> Cleanup;
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">325:     }
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">326:     <span style="color: #008000">// Load the CLR into the current process and return a runtime interface </span>
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">327:     <span style="color: #008000">// pointer. ICorRuntimeHost and ICLRRuntimeHost are the two CLR hosting  </span>
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">328:     <span style="color: #008000">// interfaces supported by CLR 4.0. Here we demo the ICLRRuntimeHost </span>
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">329:     <span style="color: #008000">// interface that was provided in .NET v2.0 to support CLR 2.0 new </span>
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">330:     <span style="color: #008000">// features. ICLRRuntimeHost does not support loading the .NET v1.x </span>
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">331:     <span style="color: #008000">// runtimes.</span>
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">332:     hr = pRuntimeInfo-&gt;GetInterface(CLSID_CLRRuntimeHost, 
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">333:         IID_PPV_ARGS(&amp;pClrRuntimeHost));
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">334:     <span style="color: #0000ff">if</span> (FAILED(hr))
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">335:     {
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">336:         wprintf(L"<span style="color: #8b0000">ICLRRuntimeInfo::GetInterface failed w/hr 0x%08lx\n</span>", hr);
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">337:         <span style="color: #0000ff">goto</span> Cleanup;
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">338:     }
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">339:     <span style="color: #008000">// Start the CLR.</span>
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">340:     hr = pClrRuntimeHost-&gt;Start();
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">341:     <span style="color: #0000ff">if</span> (FAILED(hr))
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">342:     {
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">343:         wprintf(L"<span style="color: #8b0000">CLR failed to start w/hr 0x%08lx\n</span>", hr);
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">344:         <span style="color: #0000ff">goto</span> Cleanup;
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">345:     }
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">346:     <span style="color: #008000">// </span>
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">347:     <span style="color: #008000">// Load the NET assembly and call the static method GetStringLength of </span>
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">348:     <span style="color: #008000">// the type CSSimpleObject in the assembly.</span>
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">349:     <span style="color: #008000">// </span>
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">350:     wprintf(L"<span style="color: #8b0000">Load the assembly %s\n</span>", pszAssemblyPath);
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">351:     <span style="color: #008000">// The invoked method of ExecuteInDefaultAppDomain must have the </span>
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">352:     <span style="color: #008000">// following signature: static int pwzMethodName (String pwzArgument)</span>
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">353:     <span style="color: #008000">// where pwzMethodName represents the name of the invoked method, and </span>
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">354:     <span style="color: #008000">// pwzArgument represents the string value passed as a parameter to that </span>
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">355:     <span style="color: #008000">// method. If the HRESULT return value of ExecuteInDefaultAppDomain is </span>
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">356:     <span style="color: #008000">// set to S_OK, pReturnValue is set to the integer value returned by the </span>
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">357:     <span style="color: #008000">// invoked method. Otherwise, pReturnValue is not set.</span>
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">358:     hr = pClrRuntimeHost-&gt;ExecuteInDefaultAppDomain(pszAssemblyPath, 
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">359:         pszClassName, pszStaticMethodName, pszStringArg, &amp;dwLengthRet);
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">360:     <span style="color: #0000ff">if</span> (FAILED(hr))
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">361:     {
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">362:         wprintf(L"<span style="color: #8b0000">Failed to call GetStringLength w/hr 0x%08lx\n</span>", hr);
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">363:         <span style="color: #0000ff">goto</span> Cleanup;
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">364:     }
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">365:     <span style="color: #008000">// Print the call result of the static method.</span>
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">366:     wprintf(L"<span style="color: #8b0000">Call %s.%s(\"%s\") =&gt; %d\n</span>", pszClassName, pszStaticMethodName, 
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">367:         pszStringArg, dwLengthRet);
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">368: Cleanup:
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">369:     <span style="color: #0000ff">if</span> (pMetaHost)
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">370:     {
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">371:         pMetaHost-&gt;Release();
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">372:         pMetaHost = NULL;
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">373:     }
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">374:     <span style="color: #0000ff">if</span> (pRuntimeInfo)
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">375:     {
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">376:         pRuntimeInfo-&gt;Release();
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">377:         pRuntimeInfo = NULL;
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">378:     }
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">379:     <span style="color: #0000ff">if</span> (pClrRuntimeHost)
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">380:     {
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">381:         <span style="color: #008000">// Please note that after a call to Stop, the CLR cannot be </span>
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">382:         <span style="color: #008000">// reinitialized into the same process. This step is usually not </span>
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">383:         <span style="color: #008000">// necessary. You can leave the .NET runtime loaded in your process.</span>
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">384:         <span style="color: #008000">//wprintf(L"Stop the .NET runtime\n");</span>
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">385:         <span style="color: #008000">//pClrRuntimeHost-&gt;Stop();</span>
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">386:         pClrRuntimeHost-&gt;Release();
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">387:         pClrRuntimeHost = NULL;
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">388:     }
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">389:     <span style="color: #0000ff">return</span> hr;
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">390: }</pre>
</pre>]]></content:encoded>
    </item>
    <item>
      <title>How to use TraceListeners in our program</title>
      <link>https://docs.microsoft.com/archive/blogs/msdnforum/how-to-use-tracelisteners-in-our-program</link>
      <pubDate>Thu, 08 Jul 2010 03:25:00 GMT</pubDate>
      <dc:creator><![CDATA[msdntwt]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/msdnforum/2010/07/08/how-to-use-tracelisteners-in-our-program/</guid>
      <description><![CDATA[In proactive programming, you need to configure your TraceListeners in your App.Config file or...]]></description>
      <content:encoded><![CDATA[<p>In proactive programming, you need to configure your TraceListeners in your App.Config file or Web.Config file. By default, Microsoft .NET provides several listeners containing DefaultTraceListener, TextWriterTraceListener, EventLogTraceListener, XmlTraceListener , ConsoleTraceListener, and DelimitedListTraceListener. However, we could create our own custom listeners because those listeners from BCL are not sealed. Before we do that, I wanted to talk more about proactive programming.</p>
<p>We mainly use two classes in proactive programming: System.Diagnostics.Debug and System.Diagnostics.Trace. You could open your reflector and find it in System.Diagnostics namespace. You&rsquo;ll discover that almost all the methods of Trace and Debug class finally call TraceIntelnal&rsquo;s methods which will retrieve listeners there. I introduce this, because you now understand why Debug and Trace could share some listeners.</p>
<p>Now, let&rsquo;s get started by using the DefaultTraceListener provided by Microsoft .NET Framework. Please create a C# console application and add:</p>
<p>System.Diagnostics.Debug.Assert(1!=1, &ldquo;1!=1&rdquo;); // (C# version) <br />in Main function. Build the project and then press F5 to start debugging, you&rsquo;ll receive a dialogbox like below:</p>
<p><img src="https://sharepoint/sites/communitygoodies/blog/Lists/Photos/assert.png" alt="assert.png" /></p>
<p>&nbsp;</p>
<p>At the mean time, the assert message was displayed in Output window in Visual Studio: <br />==========================================================</p>
<p>---- DEBUG ASSERTION FAILED ----</p>
<p>---- Assert Short Message ----</p>
<p>1!=1</p>
<p>---- Assert Long Message ----</p>
<p>at Program.Main(String[] args) C:\Projects\Debug\ConsoleApplication1\Program.cs(12)</p>
<p>at AppDomain._nExecuteAssembly(Assembly assembly, String[] args)</p>
<p>at AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)</p>
<p>at HostProc.RunUsersAssembly()</p>
<p>========================================================</p>
<p>Usually, developers wanted to disable the alert box and store the output information in a separate log file. To achieve that, you need to use TextWriterTraceListener and configure it in App.Config file like below:</p>
<pre style="background-color: #ffff80; min-height: 40px; width: 600px; height: 244px; overflow: auto; border: #cecece 1px solid; padding: 5px;"><pre style="background-color: #ffff80; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">  1: <span style="color: #0000ff">&lt;</span><span style="color: #800000">system.diagnostics</span><span style="color: #0000ff">&gt;</span> 
</pre>
<pre style="background-color: #ffff80; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">  2:        <span style="color: #0000ff">&lt;</span><span style="color: #800000">assert</span> <span style="color: #ff0000">assertuienabled</span>=<span style="color: #0000ff">"false"</span> <span style="color: #ff0000">logfilename</span>=<span style="color: #0000ff">"TraceLog.txt"</span><span style="color: #0000ff">/&gt;</span>
</pre>
<pre style="background-color: #ffff80; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">  3:        <span style="color: #0000ff">&lt;</span><span style="color: #800000">listeners</span><span style="color: #0000ff">&gt;</span>
</pre>
<pre style="background-color: #ffff80; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">  4:         <span style="color: #0000ff">&lt;</span><span style="color: #800000">remove</span> <span style="color: #ff0000">name</span>=<span style="color: #0000ff">"Default"</span><span style="color: #0000ff">/&gt;</span>
</pre>
<pre style="background-color: #ffff80; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">  5:         <span style="color: #0000ff">&lt;</span><span style="color: #800000">add</span> <span style="color: #ff0000">initializeData</span>=<span style="color: #0000ff">"TraceLog.txt"</span> <span style="color: #ff0000">name</span>=<span style="color: #0000ff">"MyListener"</span> <span style="color: #ff0000">type</span>=<span style="color: #0000ff">"System.Diagnostics.TextWriterTraceListener, 
</span><span style="color: #0000ff">/&gt;</span>
</pre>
<pre style="background-color: #ffff80; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">  6:         System, 
</pre>
<pre style="background-color: #ffff80; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">  7:         Version=2.0.0.0, 
</pre>
<pre style="background-color: #ffff80; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">  8:         Culture=neutral,
</pre>
<pre style="background-color: #ffff80; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">  9:         PublicKeyToken=b77a5c561934e089"</pre>
<pre style="background-color: #ffff80; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;"> 10: 
</pre>
<pre style="background-color: #ffff80; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;"> 11:       <span style="color: #0000ff">&lt;/</span><span style="color: #800000">listeners</span><span style="color: #0000ff">&gt;</span>
</pre>
<pre style="background-color: #ffff80; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;"> 12:     <span style="color: #0000ff">&lt;/</span><span style="color: #800000">system.diagnostics</span><span style="color: #0000ff">&gt;</span>
</pre>
<pre style="background-color: #ffff80; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;"> 13: </pre>
</pre>
<p>Please note here:</p>
<pre style="background-color: #ffff80; min-height: 40px; width: 599px; height: 136px; overflow: auto; border: #cecece 1px solid; padding: 5px;"><pre style="background-color: #ffff80; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">  1: type="System.Diagnostics.TextWriterTraceListener, 
</pre>
<pre style="background-color: #ffff80; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">  2:       System, 
</pre>
<pre style="background-color: #ffff80; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">  3:        Version=2.0.0.0, 
</pre>
<pre style="background-color: #ffff80; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">  4:        Culture=neutral,     PublicKeyToken=b77a5c561934e089"/&gt;</pre>
</pre>
<p>The order is: full type name, assembly name, assembly version number, culture and then the PublicKeyToken. Since this listener is already installed in GAC, you need to provide all those information for VS to locate the assembly. If you place your assembly in the Output path of your project, those information is not needed (just full type name and assembly name is OK). I&rsquo;ll demonstrate that in the following custom TraceListener.</p>
<p>This time, if you press F5 to debug your application, you could find a TraceLog.txt file in your output folder. Most probablely, its content is:</p>
<p>Fail: 1!=1 <br />As you can see, information here does not contain all the details but only a fail note. How to make it write all the details to this log file? One solution is to create a custom TextTraceListener and let it do works we want.</p>
<p>To implement a custom TraceListener, you could create a Class Library project and add a CustomTraceListener class which is inherited from TraceListener class. For example:</p>
<pre style="background-color: #ffff80; min-height: 40px; width: 598px; height: 241px; overflow: auto; border: #cecece 1px solid; padding: 5px;"><pre style="background-color: #ffff80; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">  1: 
</pre>
<pre style="background-color: #ffff80; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">  2:             Writer.WriteLine("<span style="color: #8b0000">Debug assert failed</span>");
</pre>
<pre style="background-color: #ffff80; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">  3:             Writer.WriteLine("<span style="color: #8b0000">The message is:</span>");
</pre>
<pre style="background-color: #ffff80; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">  4:             <span style="color: #0000ff">if</span> (<span style="color: #0000ff">null</span> != message)
</pre>
<pre style="background-color: #ffff80; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">  5:             {
</pre>
<pre style="background-color: #ffff80; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">  6:                 Writer.WriteLine(message);
</pre>
<pre style="background-color: #ffff80; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">  7:             }
</pre>
<pre style="background-color: #ffff80; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">  8:             Writer.WriteLine("<span style="color: #8b0000">The detail message is:</span>");
</pre>
<pre style="background-color: #ffff80; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">  9:             <span style="color: #0000ff">if</span> (<span style="color: #0000ff">null</span> != detailMessage)
</pre>
<pre style="background-color: #ffff80; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;"> 10:             {
</pre>
<pre style="background-color: #ffff80; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;"> 11:                 Writer.WriteLine(detailMessage);
</pre>
<pre style="background-color: #ffff80; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;"> 12:             }
</pre>
<pre style="background-color: #ffff80; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;"> 13:  
</pre>
<pre style="background-color: #ffff80; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;"> 14:             <span style="color: #008000">// There's four levels of stack between here and the user's code.</span>
</pre>
<pre style="background-color: #ffff80; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;"> 15:             StackTrace st = <span style="color: #0000ff">new</span> StackTrace(3, <span style="color: #0000ff">true</span>);
</pre>
<pre style="background-color: #ffff80; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;"> 16:             Writer.WriteLine(st.ToString());
</pre>
<pre style="background-color: #ffff80; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;"> 17:         }
</pre>
<pre style="background-color: #ffff80; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;"> 18:         #endregion
</pre>
<pre style="background-color: #ffff80; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;"> 19:     }
</pre>
<pre style="background-color: #ffff80; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;"> 20: }</pre>
</pre>
<p>Build the project and copy the dll file to the output of your test application. Make your App.Config have the following section:</p>
<pre style="background-color: #ffff80; min-height: 40px; width: 600px; height: 177px; overflow: auto; border: #cecece 1px solid; padding: 5px;"><pre style="background-color: #ffff80; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">  1:  <span style="color: #0000ff">&lt;</span><span style="color: #800000">system.diagnostics</span><span style="color: #0000ff">&gt;</span>
</pre>
<pre style="background-color: #ffff80; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">  2:     <span style="color: #0000ff">&lt;</span><span style="color: #800000">trace</span> <span style="color: #ff0000">autoflush</span>=<span style="color: #0000ff">"true"</span> <span style="color: #ff0000">indentsize</span>=<span style="color: #0000ff">"0"</span><span style="color: #0000ff">&gt;</span>
</pre>
<pre style="background-color: #ffff80; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">  3:       <span style="color: #0000ff">&lt;</span><span style="color: #800000">listeners</span><span style="color: #0000ff">&gt;</span>
</pre>
<pre style="background-color: #ffff80; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">  4:         <span style="color: #0000ff">&lt;</span><span style="color: #800000">add</span> <span style="color: #ff0000">name</span>=<span style="color: #0000ff">"CustomTraceListener"</span> <span style="color: #ff0000">initializeData</span>=<span style="color: #0000ff">"TraceLog.log"</span> 
</pre>
<pre style="background-color: #ffff80; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">  5:              <span style="color: #ff0000">type</span>=<span style="color: #0000ff">"CustomTraceListenerSample.CustomTraceListener, CustomTraceListenerSample"</span><span style="color: #0000ff">/&gt;</span>
</pre>
<pre style="background-color: #ffff80; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">  6:       <span style="color: #0000ff">&lt;/</span><span style="color: #800000">listeners</span><span style="color: #0000ff">&gt;</span>
</pre>
<pre style="background-color: #ffff80; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">  7:     <span style="color: #0000ff">&lt;/</span><span style="color: #800000">trace</span><span style="color: #0000ff">&gt;</span>
</pre>
<pre style="background-color: #ffff80; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">  8:   <span style="color: #0000ff">&lt;/</span><span style="color: #800000">system.diagnostics</span><span style="color: #0000ff">&gt;</span></pre>
</pre>
<p>All the information that Debug and Trace detected will be written to TraceLog.log file. Well, happy proactive programming!​</p>]]></content:encoded>
    </item>
    <item>
      <title>Weekly Useful Links 6/27/2010</title>
      <link>https://docs.microsoft.com/archive/blogs/msdnforum/weekly-useful-links-6272010</link>
      <pubDate>Sun, 27 Jun 2010 12:55:00 GMT</pubDate>
      <dc:creator><![CDATA[msdntwt]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/msdnforum/2010/06/27/weekly-useful-links-6272010/</guid>
      <description><![CDATA[We share useful links in Twitter. 
 
Vivian Chen Focus in Visual Studio Setup &nbsp;, &nbsp;5 Star...]]></description>
      <content:encoded><![CDATA[<p><a href="https://twitter.com/MSDN_Forum" style="text-decoration:none;"><span style="FONT-FAMILY: ; FONT-SIZE: x-large">We share useful links in Twitter. </span></a></p>
<p><a href="https://twitter.com/MSDN_Forum" style="text-decoration:none;"><img src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Components.PostAttachments/00/10/00/37/52/Twitter.png" original-url="https://blogs.msdn.com/photos/msdnforum/images/10003752/original.aspx" /></a> </p>
<p><a href="https://twitter.com/search?q=from%3Amsdn_forum%20%5EYC"><span style="font-size: small;">Vivian Chen</span></a><span style="font-size: small;"> Focus in Visual Studio Setup &nbsp;, &nbsp;</span><a href="https://social.msdn.microsoft.com/Profile/en-US/?user=YiChun%20Chen"><span style="font-size: small;">5 Star Contributor at forum</span></a><span style="FONT-FAMILY: ; FONT-SIZE: small"></span>
<p><span style="FONT-FAMILY: ; FONT-SIZE: small">
<p><span class="entry-content"><span style="font-size: x-small;">&nbsp;&nbsp;&bull;&nbsp;<span class="entry-content">Video: Sara Ford's 101 Visual Studio Tips in 55 minutes! <a target="_blank" rel="nofollow" href="https://bit.ly/aNNeOa" class="tweet-url web"><span style="color: #09096e;">https://bit.ly/aNNeOa</span></a> <a rel="nofollow" href="https://twitter.com/search?q=%23VS" title="VS" class="tweet-url hashtag"><span style="color: #09096e;">#VS</span></a> <a rel="nofollow" href="https://twitter.com/search?q=%23IDE" title="IDE" class="tweet-url hashtag"><span style="color: #09096e;">#IDE</span></a> <a rel="nofollow" href="https://twitter.com/search?q=%23Tip" title="Tip" class="tweet-url hashtag"><span style="color: #09096e;">#Tip</span></a> <a rel="nofollow" href="https://twitter.com/search?q=%23SaraFord" title="SaraFord" class="tweet-url hashtag"><span style="color: #09096e;">#SaraFord</span></a> ^YC</span> </span></span></p>
</span><span style="FONT-FAMILY: ; FONT-SIZE: small">
<p><span class="entry-content"><span style="font-size: x-small;">&nbsp;&nbsp;&bull;&nbsp;<span class="entry-content">KB: List of error codes and error messages for Windows Installer processes <a target="_blank" rel="nofollow" href="https://bit.ly/dDhhUs" class="tweet-url web"><span style="color: #09096e;">https://bit.ly/dDhhUs</span></a> <a rel="nofollow" href="https://twitter.com/search?q=%23WindowsInstaller" title="WindowsInstaller" class="tweet-url hashtag"><span style="color: #09096e;">#WindowsInstaller</span></a> <a rel="nofollow" href="https://twitter.com/search?q=%23ErrorCode" title="ErrorCode" class="tweet-url hashtag"><span style="color: #09096e;">#ErrorCode</span></a> ^YC</span> </span></span></p>
</span><span style="FONT-FAMILY: ; FONT-SIZE: small">
<p><span class="entry-content"><span style="font-size: x-small;">&nbsp;&nbsp;&bull;&nbsp;<span class="entry-content">Blog: Getting started using Custom Work Item Controls <a target="_blank" rel="nofollow" href="https://bit.ly/arMgVy" class="tweet-url web"><span style="color: #09096e;">https://bit.ly/arMgVy</span></a> <a rel="nofollow" href="https://twitter.com/search?q=%23TFS" title="TFS" class="tweet-url hashtag"><span style="color: #09096e;">#TFS</span></a> <a rel="nofollow" href="https://twitter.com/search?q=%23WorkItem" title="WorkItem" class="tweet-url hashtag"><span style="color: #09096e;">#WorkItem</span></a> <a rel="nofollow" href="https://twitter.com/search?q=%23CustomControl" title="CustomControl" class="tweet-url hashtag"><span style="color: #09096e;">#CustomControl</span></a> ^YC</span> </span></span></p>
</span><span style="FONT-FAMILY: ; FONT-SIZE: small">
<p><span class="entry-content"><span style="font-size: x-small;">&nbsp;&nbsp;&bull;&nbsp;<span class="entry-content">Blog: How To Get TFS Power Tool Check-in Policies for VS2005 to Work with VS2008 <a target="_blank" rel="nofollow" href="https://bit.ly/dayVZo" class="tweet-url web"><span style="color: #09096e;">https://bit.ly/dayVZo</span></a> <a rel="nofollow" href="https://twitter.com/search?q=%23TFS" title="TFS" class="tweet-url hashtag"><span style="color: #09096e;">#TFS</span></a> <a rel="nofollow" href="https://twitter.com/search?q=%23CheckinPolicy" title="CheckinPolicy" class="tweet-url hashtag"><span style="color: #09096e;">#CheckinPolicy</span></a> <a rel="nofollow" href="https://twitter.com/search?q=%23VS2005" title="VS2005" class="tweet-url hashtag"><span style="color: #09096e;">#VS2005</span></a> <a rel="nofollow" href="https://twitter.com/search?q=%23VS2008" title="VS2008" class="tweet-url hashtag"><span style="color: #09096e;">#VS2008</span></a> ^Y</span> </span></span></p>
</span><span style="FONT-FAMILY: ; FONT-SIZE: small">
<p><span class="entry-content"><span style="font-size: x-small;">&nbsp;&nbsp;&bull;&nbsp;<span class="entry-content">Blog: TFS 2008 &amp; How to Uninstall &amp; Reinstall WSS 3.0 <a target="_blank" rel="nofollow" href="https://bit.ly/cP7TOR" class="tweet-url web"><span style="color: #09096e;">https://bit.ly/cP7TOR</span></a> <a rel="nofollow" href="https://twitter.com/search?q=%23TFS2008" title="TFS2008" class="tweet-url hashtag"><span style="color: #09096e;">#TFS2008</span></a> <a rel="nofollow" href="https://twitter.com/search?q=%23Remove" title="Remove" class="tweet-url hashtag"><span style="color: #09096e;">#Remove</span></a> <a rel="nofollow" href="https://twitter.com/search?q=%23Reinstall" title="Reinstall" class="tweet-url hashtag"><span style="color: #09096e;">#Reinstall</span></a> <a rel="nofollow" href="https://twitter.com/search?q=%23WSS3.0" title="WSS3.0" class="tweet-url hashtag"><span style="color: #09096e;">#WSS3.0</span></a> ^YC</span> </span></span></p>
</span><a href="https://twitter.com/search?q=from%3Amsdn_forum%20%5EAL"><span style="font-size: small;">Alex Liang</span></a><span style="font-size: small;"> &nbsp;, &nbsp;</span><a href="https://social.msdn.microsoft.com/Profile/en-US/?user="><span style="FONT-FAMILY: ; FONT-SIZE: large"></span></a><span style="FONT-FAMILY: ; FONT-SIZE: small">
<p><span class="entry-content"><span style="font-size: x-small;">&nbsp;&nbsp;&bull;&nbsp;<span class="entry-content">TableAdapter Connection Strings <a target="_blank" rel="nofollow" href="https://bit.ly/d8i9Ap" class="tweet-url web"><span style="color: #09096e;">https://bit.ly/d8i9Ap</span></a> <a rel="nofollow" href="https://twitter.com/search?q=%23ConnectionString" title="ConnectionString" class="tweet-url hashtag"><span style="color: #09096e;">#ConnectionString</span></a> <a rel="nofollow" href="https://twitter.com/search?q=%23TableAdapter" title="TableAdapter" class="tweet-url hashtag"><span style="color: #09096e;">#TableAdapter</span></a> ^AL</span> </span></span></p>
</span><a href="https://twitter.com/search?q=from%3Amsdn_forum%20%5EAC"><span style="font-size: small;">Allen Chen</span></a><span style="font-size: small;"> &nbsp;, &nbsp;</span><a href="https://social.msdn.microsoft.com/Profile/en-US/?user="><span style="FONT-FAMILY: ; FONT-SIZE: large"></span></a><span style="FONT-FAMILY: ; FONT-SIZE: small">
<p><span class="entry-content"><span style="font-size: x-small;">&nbsp;&nbsp;&bull;&nbsp;<span class="entry-content">Using WCF Tracing for Debugging <a target="_blank" rel="nofollow" href="https://bit.ly/9S5hRN" class="tweet-url web"><span style="color: #09096e;">https://bit.ly/9S5hRN</span></a> WCF ^AC</span> </span></span></p>
</span><span style="FONT-FAMILY: ; FONT-SIZE: small">
<p><span class="entry-content"><span style="font-size: x-small;">&nbsp;&nbsp;&bull;&nbsp;<span class="entry-content">Comparing the Performance of .NET Serializers <a target="_blank" rel="nofollow" href="https://bit.ly/bxEGlS" class="tweet-url web"><span style="color: #09096e;">https://bit.ly/bxEGlS</span></a> DotNet ^AC</span> </span></span></p>
</span><span style="FONT-FAMILY: ; FONT-SIZE: small">
<p><span class="entry-content"><span style="font-size: x-small;">&nbsp;&nbsp;&bull;&nbsp;<span class="entry-content">Windows Azure Hosted Web Core Worker Role - Home <a target="_blank" rel="nofollow" href="https://bit.ly/aNZYLD" class="tweet-url web"><span style="color: #09096e;">https://bit.ly/aNZYLD</span></a> WindowsAzure ^AC</span> </span></span></p>
</span><span style="FONT-FAMILY: ; FONT-SIZE: small">
<p><span class="entry-content"><span style="font-size: x-small;">&nbsp;&nbsp;&bull;&nbsp;<span class="entry-content">(Intentionally) Generating a Dr. Watson MiniDump file from managed code <a target="_blank" rel="nofollow" href="https://bit.ly/cJ3beD" class="tweet-url web"><span style="color: #09096e;">https://bit.ly/cJ3beD</span></a> Dump ^AC</span> </span></span></p>
</span><a href="https://twitter.com/search?q=from%3Amsdn_forum%20%5EMH"><span style="font-size: small;">Min-Hong Tang</span></a><span style="font-size: small;"> &nbsp;, &nbsp;</span><a href="https://social.msdn.microsoft.com/Profile/en-US/?user="><span style="FONT-FAMILY: ; FONT-SIZE: large"></span></a><span style="FONT-FAMILY: ; FONT-SIZE: small">
<p><span class="entry-content"><span style="font-size: x-small;">&nbsp;&nbsp;&bull;&nbsp;<span class="entry-content">WCF RIA and concurrency <a target="_blank" rel="nofollow" href="https://bit.ly/actrZS" class="tweet-url web"><span style="color: #09096e;">https://bit.ly/actrZS</span></a> <a rel="nofollow" href="https://twitter.com/search?q=%23WCFRIA" title="WCFRIA" class="tweet-url hashtag"><span style="color: #09096e;">#WCFRIA</span></a> <a rel="nofollow" href="https://twitter.com/search?q=%23Silverlight" title="Silverlight" class="tweet-url hashtag"><span style="color: #09096e;">#Silverlight</span></a> ^MH</span> </span></span></p>
</span><span style="FONT-FAMILY: ; FONT-SIZE: small">
<p><span class="entry-content"><span style="font-size: x-small;">&nbsp;&nbsp;&bull;&nbsp;<span class="entry-content">Making printing easier in Silverlight 4 <a target="_blank" rel="nofollow" href="https://bit.ly/cWnvXP" class="tweet-url web"><span style="color: #09096e;">https://bit.ly/cWnvXP</span></a> <a rel="nofollow" href="https://twitter.com/search?q=%23Silverlight" title="Silverlight" class="tweet-url hashtag"><span style="color: #09096e;">#Silverlight</span></a> ^MH</span> </span></span></p>
</span><span style="FONT-FAMILY: ; FONT-SIZE: small">
<p><span class="entry-content"><span style="font-size: x-small;">&nbsp;&nbsp;&bull;&nbsp;<span class="entry-content"> Silverlight Performance Tips <a target="_blank" rel="nofollow" href="https://bit.ly/afe8la" class="tweet-url web"><span style="color: #09096e;">https://bit.ly/afe8la</span></a> <a rel="nofollow" href="https://twitter.com/search?q=%23Silverlight" title="Silverlight" class="tweet-url hashtag"><span style="color: #09096e;">#Silverlight</span></a> ^MH</span> </span></span></p>
</span><span style="FONT-FAMILY: ; FONT-SIZE: small">
<p><span class="entry-content"><span style="font-size: x-small;">&nbsp;&nbsp;&bull;&nbsp;<span class="entry-content">ComboBox Sample for RIA Services <a target="_blank" rel="nofollow" href="https://bit.ly/a1J86A" class="tweet-url web"><span style="color: #09096e;">https://bit.ly/a1J86A</span></a> <a rel="nofollow" href="https://twitter.com/search?q=%23Silverlight" title="Silverlight" class="tweet-url hashtag"><span style="color: #09096e;">#Silverlight</span></a> <a rel="nofollow" href="https://twitter.com/search?q=%23WCFRIA" title="WCFRIA" class="tweet-url hashtag"><span style="color: #09096e;">#WCFRIA</span></a> ^MH</span> </span></span></p>
</span><span style="FONT-FAMILY: ; FONT-SIZE: small">
<p><span class="entry-content"><span style="font-size: x-small;">&nbsp;&nbsp;&bull;&nbsp;<span class="entry-content">Add/Remove with DataForm and RIA Services <a target="_blank" rel="nofollow" href="https://bit.ly/aAarGq" class="tweet-url web"><span style="color: #09096e;">https://bit.ly/aAarGq</span></a> <a rel="nofollow" href="https://twitter.com/search?q=%23Silverlight" title="Silverlight" class="tweet-url hashtag"><span style="color: #09096e;">#Silverlight</span></a> <a rel="nofollow" href="https://twitter.com/search?q=%23WCFRIA" title="WCFRIA" class="tweet-url hashtag"><span style="color: #09096e;">#WCFRIA</span></a> ^MH</span> </span></span></p>
</span><span style="FONT-FAMILY: ; FONT-SIZE: small">
<p><span class="entry-content"><span style="font-size: x-small;">&nbsp;&nbsp;&bull;&nbsp;<span class="entry-content">Routed Events in Silverlight <a target="_blank" rel="nofollow" href="https://bit.ly/cfKzOG" class="tweet-url web"><span style="color: #09096e;">https://bit.ly/cfKzOG</span></a> <a rel="nofollow" href="https://twitter.com/search?q=%23Silverlight" title="Silverlight" class="tweet-url hashtag"><span style="color: #09096e;">#Silverlight</span></a> ^MH</span> </span></span></p>
</span><span style="FONT-FAMILY: ; FONT-SIZE: small">
<p><span class="entry-content"><span style="font-size: x-small;">&nbsp;&nbsp;&bull;&nbsp;<span class="entry-content">TemplatePanel (aka MasterPage) for Silverlight <a target="_blank" rel="nofollow" href="https://bit.ly/9T1IV3" class="tweet-url web"><span style="color: #09096e;">https://bit.ly/9T1IV3</span></a> <a rel="nofollow" href="https://twitter.com/search?q=%23Silverilght" title="Silverilght" class="tweet-url hashtag"><span style="color: #09096e;">#Silverilght</span></a> ^MH</span> </span></span></p>
</span><a href="https://twitter.com/search?q=from%3Amsdn_forum%20%5ERL"><span style="font-size: small;">Roahn Luo</span></a><span style="font-size: small;"> &nbsp;, &nbsp;</span><a href="https://social.msdn.microsoft.com/Profile/en-US/?user="><span style="FONT-FAMILY: ; FONT-SIZE: large"></span></a><span style="FONT-FAMILY: ; FONT-SIZE: small">
<p><span class="entry-content"><span style="font-size: x-small;">&nbsp;&nbsp;&bull;&nbsp;<span class="entry-content"><a target="_blank" rel="nofollow" href="https://msdn.microsoft.com/en-us/magazine/cc337887.aspx?pr=blog" class="tweet-url web"><span style="color: #09096e;">https://msdn.microsoft.com/en-us/magazine/cc337887.aspx?pr=blog</span></a> <a target="_blank" rel="nofollow" href="https://bit.ly/al5k4G" class="tweet-url web"><span style="color: #09096e;">https://bit.ly/al5k4G</span></a> <a rel="nofollow" href="https://twitter.com/search?q=%23Profiler" title="Profiler" class="tweet-url hashtag"><span style="color: #09096e;">#Profiler</span></a> ^RL</span> </span></span></p>
</span><span style="FONT-FAMILY: ; FONT-SIZE: small">
<p><span class="entry-content"><span style="font-size: x-small;">&nbsp;&nbsp;&bull;&nbsp;<span class="entry-content">Sample Profiling And Stdin - Visual Studio Profiler Team Blog <a target="_blank" rel="nofollow" href="https://bit.ly/bZj5ls" class="tweet-url web"><span style="color: #09096e;">https://bit.ly/bZj5ls</span></a> <a rel="nofollow" href="https://twitter.com/search?q=%23Profile" title="Profile" class="tweet-url hashtag"><span style="color: #09096e;">#Profile</span></a> ^RL</span> </span></span></p>
</span><a href="https://twitter.com/search?q=from%3Amsdn_forum%20%5EYL"><span style="font-size: small;">Yi-Lun Luo</span></a><span style="font-size: small;"> &nbsp;, &nbsp;</span><a href="https://social.msdn.microsoft.com/Profile/en-US/?user="><span style="FONT-FAMILY: ; FONT-SIZE: large"></span></a><span style="FONT-FAMILY: ; FONT-SIZE: small">
<p><span class="entry-content"><span style="font-size: x-small;">&nbsp;&nbsp;&bull;&nbsp;<span class="entry-content">CoApp: Do EPIC Schtuff! (Connected Show Podcast) <a target="_blank" rel="nofollow" href="https://bit.ly/bBp7ng" class="tweet-url web"><span style="color: #09096e;">https://bit.ly/bBp7ng</span></a> <a rel="nofollow" href="https://twitter.com/search?q=%23WindowsPhone" title="WindowsPhone" class="tweet-url hashtag"><span style="color: #09096e;">#WindowsPhone</span></a> ^YL</span> </span></span></p>
</span><span style="FONT-FAMILY: ; FONT-SIZE: small">
<p><span class="entry-content"><span style="font-size: x-small;">&nbsp;&nbsp;&bull;&nbsp;<span class="entry-content">ComboBox Sample for RIA Services <a target="_blank" rel="nofollow" href="https://bit.ly/a1J86A" class="tweet-url web"><span style="color: #09096e;">https://bit.ly/a1J86A</span></a> <a rel="nofollow" href="https://twitter.com/search?q=%23Silverlight" title="Silverlight" class="tweet-url hashtag"><span style="color: #09096e;">#Silverlight</span></a> <a rel="nofollow" href="https://twitter.com/search?q=%23WCF" title="WCF" class="tweet-url hashtag"><span style="color: #09096e;">#WCF</span></a> ^YL</span> </span></span></p>
</span></p>
<p>&nbsp;</p>
</p>
<p><span class="entry-content"><span style="font-size: x-small;">&nbsp;&nbsp;&bull;&nbsp;<span class="entry-content">Why .NET 4.0 are not supported on Windows Server 2008 R2 (Server Core)? <a target="_blank" rel="nofollow" href="https://bit.ly/9atpA9" class="tweet-url web"><span style="color: #09096e;">https://bit.ly/9atpA9</span></a> <a rel="nofollow" href="https://twitter.com/search?q=%23NET4" title="NET4" class="tweet-url hashtag"><span style="color: #09096e;">#NET4</span></a> <a rel="nofollow" href="https://twitter.com/search?q=%23WindowsServer2008" title="WindowsServer2008" class="tweet-url hashtag"><span style="color: #09096e;">#WindowsServer2008</span></a> <a rel="nofollow" href="https://twitter.com/search?q=%23Server" title="Server" class="tweet-url hashtag"><span style="color: #09096e;">#Server</span></a> Core <a rel="nofollow" href="https://twitter.com/search?q=%23Support" title="Support" class="tweet-url hashtag"><span style="color: #09096e;">#Support</span></a></span> </span></span></p>
<p><span style="font-size: x-small;"></span></p>]]></content:encoded>
    </item>
  </channel>
</rss>