<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.msdn.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Practical Development</title><link>http://blogs.msdn.com/b/cclayton/</link><description /><dc:language>en-US</dc:language><generator>Telligent Evolution Platform Developer Build (Build: 5.6.50428.7875)</generator><item><title>Understanding Application Domains</title><link>http://blogs.msdn.com/b/cclayton/archive/2013/05/21/understanding-application-domains.aspx</link><pubDate>Tue, 21 May 2013 16:57:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10420363</guid><dc:creator>Chris Clayton1</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/cclayton/rsscomments.aspx?WeblogPostID=10420363</wfw:commentRss><comments>http://blogs.msdn.com/b/cclayton/archive/2013/05/21/understanding-application-domains.aspx#comments</comments><description>&lt;div class="WordSection1"&gt;
&lt;p class="MsoNormal"&gt;&lt;span lang="EN-US"&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span lang="EN-US"&gt;When talking to long time .NET developers about application domains (&lt;span class="SpellE"&gt;AppDomains&lt;/span&gt;) they often understand the high level concepts but not necessarily how or why they would use them.&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp; &lt;/span&gt;My goal of this article is to help clarify some of the scenarios where &lt;span class="SpellE"&gt;AppDomains&lt;/span&gt; offer value and describe how to go about using them.&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp; &lt;/span&gt;In order to provide this information to readers of various levels of knowledge and interest I will flag certain areas as &amp;ldquo;In Memory&amp;rdquo;.&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp; &lt;/span&gt;By reading these sections they will provide you a greater understanding of what is happening behind the scenes for those of us that love detail but you will still understand the what, why and how if you skip these.&lt;/span&gt;&lt;/p&gt;
&lt;br /&gt;
&lt;p class="MsoNormal"&gt;&amp;nbsp;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span lang="EN-US"&gt;So what is an &lt;span class="SpellE"&gt;AppDomain&lt;/span&gt;?&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp; &lt;/span&gt;Simply put an &lt;span class="SpellE"&gt;AppDomain&lt;/span&gt; is a unit of isolation in the .NET CLI used to control the scope of execution and resource ownership.&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;br /&gt;
&lt;p class="MsoNormal"&gt;&lt;span lang="EN-US"&gt;When we look at threads it is important to understand that several threads can belong to a single &lt;span class="SpellE"&gt;AppDomain&lt;/span&gt;.&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp; &lt;/span&gt;This however does not mean that a thread is confined to that one &lt;span class="SpellE"&gt;AppDomain&lt;/span&gt;, rather it can only execute within a single &lt;span class="SpellE"&gt;AppDomain&lt;/span&gt; at any given time.&lt;/span&gt;&lt;/p&gt;
&lt;br /&gt;
&lt;p class="MsoNormal"&gt;&lt;span lang="EN-US"&gt;So why is this important?&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp; &lt;/span&gt;Suppose your &amp;ldquo;full trust&amp;rdquo; application needs to use an assembly that was dynamically generated, received from a less credible source or simply put has a significant level of risk associated with its execution?&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp; &lt;/span&gt;Would you not prefer to run it with a reduced set of &amp;ldquo;permissions&amp;rdquo;?&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp; &lt;/span&gt;Through the use of &lt;span class="SpellE"&gt;AppDomains&lt;/span&gt; you have the ability to do just that, execute the majority of your code in full trust while isolating the questionable assembly to another partially trusted &lt;span class="SpellE"&gt;AppDomain&lt;/span&gt;.&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp; &lt;/span&gt;In fact you can select from a set of well-known permissions or customize them as appropriate.&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp; &lt;/span&gt;Sometimes you will hear this approach referred to as sandboxing.&lt;/span&gt;&lt;/p&gt;
&lt;br /&gt;
&lt;p class="MsoNormal"&gt;&lt;span lang="EN-US"&gt;From another vantage point you will note that .NET draws a large number of framework elements and assemblies into the executing code as well as holding static and rooted objects until the &lt;span class="SpellE"&gt;AppDomain&lt;/span&gt; is unloaded.&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp; &lt;/span&gt;By executing these assemblies that consume large amounts of memory in another &lt;span class="SpellE"&gt;AppDomain&lt;/span&gt; you can release the memory when you are done with them by unloading the specific &lt;span class="SpellE"&gt;AppDomain&lt;/span&gt; without impacting the rest of your application.&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp; &lt;/span&gt;Obviously if you have objects in memory that you are holding with security sensitive contents the ability to clean them up sooner is often a great advantage.&lt;/span&gt;&lt;/p&gt;
&lt;br /&gt;
&lt;p class="MsoNormal"&gt;&lt;span lang="EN-US"&gt;What if my application has a requirement for a high degree of auditing?&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp; &lt;/span&gt;&lt;span class="SpellE"&gt;AppDomains&lt;/span&gt; expose some additional events that provide the ability to log the occurrence of or react to First Chance and Second Chance exceptions.&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span lang="EN-US"&gt;In short, I tend to look at introducing secondary &lt;span class="SpellE"&gt;AppDomains&lt;/span&gt; into my application when security, auditing or memory consumption concerns exist.&lt;/span&gt;&lt;/p&gt;
&lt;br /&gt;
&lt;p class="MsoNormal"&gt;&lt;span lang="EN-US"&gt;So this is great right?&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp; &lt;/span&gt;Why wouldn&amp;rsquo;t I always use &lt;span class="SpellE"&gt;AppDomains&lt;/span&gt;, in fact why does the .NET framework not &lt;span class="GramE"&gt;automatically&lt;/span&gt; put the &lt;span class="SpellE"&gt;AppDomain&lt;/span&gt; structure around all of my calls to external resources?&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp; &lt;/span&gt;Well like all good things there is a down side.&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp; &lt;/span&gt;Simply put the creation and unloading of an &lt;span class="SpellE"&gt;AppDomain&lt;/span&gt; has a performance cost and is not something you want to do constantly.&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp; &lt;/span&gt;To control the performance impact it is often better to create the &lt;span class="SpellE"&gt;AppDomain&lt;/span&gt;, run the iterations of your code in that &lt;span class="SpellE"&gt;AppDomain&lt;/span&gt; and when appropriate unload the &lt;span class="SpellE"&gt;AppDomain&lt;/span&gt;.&lt;/span&gt;&lt;/p&gt;
&lt;br /&gt;
&lt;p class="MsoNormal"&gt;&lt;span lang="EN-US"&gt;Anyone that has knowledge of Win32 development or operating system principals may be saying &amp;ldquo;wait a minute, isn&amp;rsquo;t the process the unit resource ownership?&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp; &lt;/span&gt;Well this is correct from an operating system point of view, but the operating system has no knowledge of the Common Language Runtime (CLR), in fact it is just another COM server to it.&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp; &lt;/span&gt;When the CLR is initialized it will create the Default &lt;span class="SpellE"&gt;AppDomain&lt;/span&gt; (named the same as the entry point assembly) used to hold all of the resources and scope code execution to that unless the code explicitly makes use of secondary &lt;span class="SpellE"&gt;AppDomains&lt;/span&gt;. &lt;/span&gt;&lt;/p&gt;
&lt;br /&gt;
&lt;p class="MsoNormal"&gt;&lt;span lang="EN-US"&gt;Considerations when making use of &lt;span class="SpellE"&gt;AppDomains&lt;/span&gt; for security are:&lt;/span&gt;&lt;/p&gt;
&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p class="MsoListParagraphCxSpFirst" style="text-indent: -18pt; mso-list: l3 level1 lfo3;"&gt;&lt;span style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;" lang="EN-US"&gt;&lt;span style="mso-list: Ignore;"&gt;&lt;span style="font: 7pt/normal 'Times New Roman'; font-size-adjust: none; font-stretch: normal;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span lang="EN-US"&gt;Set the application base to an appropriate directory, typically not the same as the host &lt;span class="SpellE"&gt;AppDomain&lt;/span&gt;.&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp; &lt;/span&gt;The &lt;span class="SpellE"&gt;AppDomain&amp;rsquo;s&lt;/span&gt; application base is the directory that will be used as the root when resolving assembly references.&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp; &lt;/span&gt;Due to this use there may be scenarios where permissions are implied based on its location (ex. Internet, intranet etc.)&lt;/span&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p class="MsoListParagraphCxSpMiddle" style="text-indent: -18pt; mso-list: l3 level1 lfo3;"&gt;&lt;span style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;" lang="EN-US"&gt;&lt;span style="mso-list: Ignore;"&gt;&lt;span style="font: 7pt/normal 'Times New Roman'; font-size-adjust: none; font-stretch: normal;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span lang="EN-US"&gt;You have the ability to pass in a list of strong named assemblies that can be loaded by the &lt;span class="SpellE"&gt;AppDomain&lt;/span&gt; as full trust.&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp; &lt;/span&gt;Consider using this list verses putting them in the GAC.&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp; &lt;/span&gt;Placing an assembly in the GAC allows all &lt;span class="SpellE"&gt;AppDomains&lt;/span&gt; to execute it as &amp;ldquo;Full Trust&amp;rdquo;.&lt;/span&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p class="MsoListParagraphCxSpMiddle" style="text-indent: -18pt; mso-list: l3 level1 lfo3;"&gt;&lt;span style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;" lang="EN-US"&gt;&lt;span style="mso-list: Ignore;"&gt;&lt;span style="font: 7pt/normal 'Times New Roman'; font-size-adjust: none; font-stretch: normal;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span lang="EN-US"&gt;Grant the minimum permissions possible that still allow the assembly to execute.&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p class="MsoListParagraphCxSpMiddle" style="text-indent: -18pt; mso-list: l3 level1 lfo3;"&gt;&lt;span style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;" lang="EN-US"&gt;&lt;span style="mso-list: Ignore;"&gt;&lt;span style="font: 7pt/normal 'Times New Roman'; font-size-adjust: none; font-stretch: normal;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span lang="EN-US"&gt;If there is a set of standard permissions that match your requirements of your executing assembly leverage them instead of defining your own (ex. &lt;span class="SpellE"&gt;SecurityManager.GetStandardSandbox&lt;/span&gt;).&lt;/span&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p class="MsoListParagraphCxSpLast" style="text-indent: -18pt; mso-list: l3 level1 lfo3;"&gt;&lt;span style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;" lang="EN-US"&gt;&lt;span style="mso-list: Ignore;"&gt;&lt;span style="font: 7pt/normal 'Times New Roman'; font-size-adjust: none; font-stretch: normal;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span lang="EN-US"&gt;Variations in Type resolution can be setup in different &lt;span class="SpellE"&gt;AppDomains&lt;/span&gt; by implementing the &lt;span class="SpellE"&gt;TypeResolve&lt;/span&gt; event handler.&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp; &lt;/span&gt;This event is fired when the CLR cannot determine the assembly that contains the specified Type.&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp; &lt;/span&gt;Using this event handler you can return the Assembly from the location of your choice. &lt;/span&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p class="MsoNormal"&gt;&lt;span lang="EN-US"&gt;Considerations when making use of &lt;span class="SpellE"&gt;AppDomains&lt;/span&gt; for Memory Usage:&lt;/span&gt;&lt;/p&gt;
&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p class="MsoListParagraphCxSpFirst" style="text-indent: -18pt; mso-list: l1 level1 lfo4;"&gt;&lt;span style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;" lang="EN-US"&gt;&lt;span style="mso-list: Ignore;"&gt;&lt;span style="font: 7pt/normal 'Times New Roman'; font-size-adjust: none; font-stretch: normal;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span lang="EN-US"&gt;Multiple &lt;span class="SpellE"&gt;AppDomains&lt;/span&gt; in the same process that leverage the same DLLs (assemblies) will map to the same code space in the processes memory.&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp; &lt;/span&gt;This often eases the concern of some developers about base image footprints.&lt;/span&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p class="MsoListParagraphCxSpLast" style="text-indent: -18pt; mso-list: l1 level1 lfo4;"&gt;&lt;span style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;" lang="EN-US"&gt;&lt;span style="mso-list: Ignore;"&gt;&lt;span style="font: 7pt/normal 'Times New Roman'; font-size-adjust: none; font-stretch: normal;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span lang="EN-US"&gt;If the assembly being loaded into the &lt;span class="SpellE"&gt;AppDomain&lt;/span&gt; contains many or large static objects or properties it may inflate the size of your process when you create it and or impact performance.&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp; &lt;/span&gt;The reason for this ties back to the fact that static elements are associated with the &lt;span class="SpellE"&gt;AppDomain&lt;/span&gt; not the process and multiple &lt;span class="SpellE"&gt;AppDomains&lt;/span&gt; with the same assembly will hold multiple static versions of static objects.&lt;/span&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p class="MsoNormal"&gt;&lt;span lang="EN-US"&gt;Considerations when making use of &lt;span class="SpellE"&gt;AppDomains&lt;/span&gt; for Auditing:&lt;/span&gt;&lt;/p&gt;
&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p class="MsoListParagraphCxSpFirst" style="text-indent: -18pt; mso-list: l2 level1 lfo5;"&gt;&lt;span style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;" lang="EN-US"&gt;&lt;span style="mso-list: Ignore;"&gt;&lt;span style="font: 7pt/normal 'Times New Roman'; font-size-adjust: none; font-stretch: normal;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span lang="EN-US"&gt;There are times when an application will terminate unexpectedly as a result of an unhandled exception.&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp; &lt;/span&gt;This type of exception is known as an Unhandled Exception and can occur due to code defects and environmental changes.&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp; &lt;/span&gt;In building an application that must strictly audit all system events and activities it may be desirable to log what has happened to cause the termination.&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp; &lt;/span&gt;Through the implementation of the &lt;span class="SpellE"&gt;UnhandledException&lt;/span&gt; event handler you are notified prior to the application terminating in this situation.&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp; &lt;/span&gt;In the event handler you can audit and or take corrective action such as storing state or firing out additional diagnostics structures.&lt;/span&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p class="MsoListParagraphCxSpLast" style="text-indent: -18pt; mso-list: l2 level1 lfo5;"&gt;&lt;span style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;" lang="EN-US"&gt;&lt;span style="mso-list: Ignore;"&gt;&lt;span style="font: 7pt/normal 'Times New Roman'; font-size-adjust: none; font-stretch: normal;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span lang="EN-US"&gt;Implementation of the &lt;span class="SpellE"&gt;ProcessExit&lt;/span&gt; event handler will provide the consumer with up to two seconds to take the appropriate actions including state persistence and logging when the process is requested to shut down.&lt;/span&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p class="MsoNormal"&gt;&lt;span lang="EN-US"&gt;Now that we understand the why and when of &lt;span class="SpellE"&gt;AppDomains&lt;/span&gt; let&amp;rsquo;s look at them in a little more detail.&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp; &lt;/span&gt;In my first example we will assume that I have decided to leverage an existing DLL that one of my colleagues built for another system.&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp; &lt;/span&gt;I have been made painfully aware that it has a built in caching algorithm which seems to consume a lot of memory.&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp; &lt;/span&gt;In my particular scenario I need to call a single method in the library many times in a row over the period of 15 minutes to support my batch processing.&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp; &lt;/span&gt;After the batch processing is complete I do not need it again until the next evening.&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp; &lt;/span&gt;So let&amp;rsquo;s look at a simulation of this scenario.&lt;/span&gt;&lt;/p&gt;
&lt;br /&gt;
&lt;p class="MsoNormal"&gt;&lt;span lang="EN-US"&gt;The library that I am using is comprised of two classes:&lt;br style="mso-special-character: line-break;" /&gt; &lt;br style="mso-special-character: line-break;" /&gt; &lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span lang="EN-US"&gt;The cached object holds the state of the transaction etc.&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp; &lt;/span&gt;The payload size of the state information is large for demonstration reasons but in a typical scenario would be smaller with higher object volumes.&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;br /&gt;
&lt;p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none;"&gt;&lt;span class="GramE"&gt;&lt;span style="background: white; color: blue; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;namespace&lt;/span&gt;&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt; &lt;span class="SpellE"&gt;DemoLibrary&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;{&lt;br /&gt;&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;span class="GramE"&gt;&lt;span style="background: white; color: blue; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;using&lt;/span&gt;&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt; System;&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none;"&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;span class="GramE"&gt;&lt;span style="background: white; color: blue; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;internal &lt;/span&gt;&lt;/span&gt;&lt;span style="background: white; color: blue; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;sealed &lt;/span&gt;&lt;span style="background: white; color: blue; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;class &lt;/span&gt;&lt;span class="SpellE"&gt;&lt;span style="background: white; color: #2b91af; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;MyCachedObject&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;{&lt;br /&gt;&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;span class="GramE"&gt;&lt;span style="background: white; color: blue; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;private &lt;/span&gt;&lt;/span&gt;&lt;span style="background: white; color: blue; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;static &lt;/span&gt;&lt;span style="background: white; color: #2b91af; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;Random&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt; generator = &lt;/span&gt;&lt;span style="background: white; color: blue; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;new &lt;/span&gt;&lt;span style="background: white; color: #2b91af; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;Random&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;();&lt;br /&gt;&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;span class="GramE"&gt;&lt;span style="background: white; color: blue; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;private &lt;/span&gt;&lt;/span&gt;&lt;span style="background: white; color: blue; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;byte&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;[] &lt;span class="SpellE"&gt;processedData&lt;/span&gt;;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none;"&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;span class="GramE"&gt;&lt;span style="background: white; color: blue; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;public&lt;/span&gt;&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt; &lt;span class="SpellE"&gt;MyCachedObject&lt;/span&gt;()&lt;br /&gt;&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;{&lt;br /&gt;&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span class="SpellE"&gt;&lt;span class="GramE"&gt;processedData&lt;/span&gt;&lt;/span&gt; = &lt;/span&gt;&lt;span style="background: white; color: blue; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;new&lt;/span&gt;&lt;span style="background: white; color: blue; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;byte&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;[&lt;span class="SpellE"&gt;generator.Next&lt;/span&gt;(25, 70) * 1024];&lt;br /&gt;&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;}&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none;"&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;span class="GramE"&gt;&lt;span style="background: white; color: blue; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;public &lt;/span&gt;&lt;/span&gt;&lt;span class="SpellE"&gt;&lt;span style="background: white; color: blue; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;int&lt;/span&gt;&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt; Execute(&lt;/span&gt;&lt;span class="SpellE"&gt;&lt;span style="background: white; color: blue; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;int&lt;/span&gt;&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt; id)&lt;br /&gt;&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;{&lt;br /&gt;&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;span class="GramE"&gt;&lt;span style="background: white; color: blue; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;return&lt;/span&gt;&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt; &lt;span class="SpellE"&gt;processedData.Length&lt;/span&gt;;&lt;br /&gt;&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;}&lt;br /&gt;&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;}&lt;br /&gt;&lt;/span&gt;&lt;span style="background: white; color: black; line-height: 107%; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;}&lt;/span&gt;&lt;/p&gt;
&lt;br /&gt;
&lt;p class="MsoNormal"&gt;&lt;span lang="EN-US"&gt;There is a central class called the Processor that manages the cached objects, holding existing instances to maximize reuse and reduce both start-up and processing time.&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp; &lt;/span&gt;This is a simple cache handled by the id of the object.&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp; &lt;/span&gt;In the output message it will return the application domain name.&lt;/span&gt;&lt;/p&gt;
&lt;br /&gt;
&lt;p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none;"&gt;&lt;span class="GramE"&gt;&lt;span style="background: white; color: blue; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;namespace&lt;/span&gt;&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt; &lt;span class="SpellE"&gt;DemoLibrary&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;{&lt;br /&gt;&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;span class="GramE"&gt;&lt;span style="background: white; color: blue; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;using&lt;/span&gt;&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt; System;&lt;br /&gt;&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;span class="GramE"&gt;&lt;span style="background: white; color: blue; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;using&lt;/span&gt;&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt; &lt;span class="SpellE"&gt;System.Collections.Generic&lt;/span&gt;;&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none;"&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;span class="GramE"&gt;&lt;span style="background: white; color: blue; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;public &lt;/span&gt;&lt;/span&gt;&lt;span style="background: white; color: blue; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;class &lt;/span&gt;&lt;span style="background: white; color: #2b91af; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;Processor&lt;br /&gt;&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;{&lt;br /&gt;&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;span class="GramE"&gt;&lt;span style="background: white; color: blue; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;private &lt;/span&gt;&lt;/span&gt;&lt;span style="background: white; color: blue; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;static &lt;/span&gt;&lt;span class="SpellE"&gt;&lt;span style="background: white; color: blue; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;readonly &lt;/span&gt;&lt;/span&gt;&lt;span style="background: white; color: #2b91af; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;Dictionary&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;&amp;lt;&lt;/span&gt;&lt;span class="SpellE"&gt;&lt;span style="background: white; color: blue; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;int&lt;/span&gt;&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;, &lt;/span&gt;&lt;span class="SpellE"&gt;&lt;span style="background: white; color: #2b91af; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;MyCachedObject&lt;/span&gt;&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;&amp;gt; &lt;span class="SpellE"&gt;myCache&lt;/span&gt; = &lt;/span&gt;&lt;span style="background: white; color: blue; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;new &lt;/span&gt;&lt;span style="background: white; color: #2b91af; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;Dictionary&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;&amp;lt;&lt;/span&gt;&lt;span class="SpellE"&gt;&lt;span style="background: white; color: blue; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;int&lt;/span&gt;&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;, &lt;/span&gt;&lt;span class="SpellE"&gt;&lt;span style="background: white; color: #2b91af; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;MyCachedObject&lt;/span&gt;&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;&amp;gt;();&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none;"&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;span class="GramE"&gt;&lt;span style="background: white; color: blue; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;public &lt;/span&gt;&lt;/span&gt;&lt;span style="background: white; color: blue; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;string&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt; &lt;span class="SpellE"&gt;ProcessRequest&lt;/span&gt;(&lt;/span&gt;&lt;span class="SpellE"&gt;&lt;span style="background: white; color: blue; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;int&lt;/span&gt;&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt; id)&lt;br /&gt;&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;{&lt;br /&gt;&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;span class="GramE"&gt;&lt;span style="background: white; color: blue; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;if&lt;/span&gt;&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt; (!&lt;span class="SpellE"&gt;myCache.ContainsKey&lt;/span&gt;(id))&lt;br /&gt;&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;{&lt;br /&gt;&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span class="SpellE"&gt;&lt;span class="GramE"&gt;myCache.Add&lt;/span&gt;&lt;/span&gt;&lt;span class="GramE"&gt;(&lt;/span&gt;id, &lt;/span&gt;&lt;span style="background: white; color: blue; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;new&lt;/span&gt;&lt;span class="SpellE"&gt;&lt;span style="background: white; color: #2b91af; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;MyCachedObject&lt;/span&gt;&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;());&lt;br /&gt;&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;}&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none;"&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;span class="SpellE"&gt;&lt;span class="GramE"&gt;&lt;span style="background: white; color: blue; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;int&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt; &lt;span class="SpellE"&gt;cacheSize&lt;/span&gt; = &lt;span class="SpellE"&gt;myCache&lt;/span&gt;[id].Execute(id);&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none;"&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;span class="GramE"&gt;&lt;span style="background: white; color: blue; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;return &lt;/span&gt;&lt;/span&gt;&lt;span class="SpellE"&gt;&lt;span style="background: white; color: blue; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;string&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;.Format&lt;/span&gt;&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;(&lt;/span&gt;&lt;span style="background: white; color: #a31515; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;"This is a response message from id &lt;/span&gt;&lt;span style="background: white; color: mediumseagreen; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;{0}&lt;/span&gt;&lt;span style="background: white; color: #a31515; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt; with a cache size of &lt;/span&gt;&lt;span style="background: white; color: mediumseagreen; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;{1}&lt;/span&gt;&lt;span style="background: white; color: #a31515; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt; in the &lt;span class="SpellE"&gt;AppDomain&lt;/span&gt; named: &lt;/span&gt;&lt;span style="background: white; color: mediumseagreen; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;{2}&lt;/span&gt;&lt;span style="background: white; color: #a31515; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;"&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;, id, &lt;span class="SpellE"&gt;cacheSize&lt;/span&gt;, &lt;/span&gt;&lt;span class="SpellE"&gt;&lt;span style="background: white; color: #2b91af; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;AppDomain&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;.CurrentDomain.FriendlyName&lt;/span&gt;&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;);&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none;"&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;}&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none;"&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;}&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="background: white; color: black; line-height: 107%; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;}&lt;/span&gt;&lt;/p&gt;
&lt;br /&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="background: white; color: black; mso-bidi-font-family: Consolas; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;For future examples the library above will not change, only the console application.&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp; &lt;/span&gt;When referring to the library it implies the two classes outlined above.&lt;/span&gt;&lt;/p&gt;
&lt;br /&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="background: white; color: black; mso-bidi-font-family: Consolas; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;To simulate the application that is consuming the memory I will use a console application that waits after the processing is complete so I can inspect the memory.&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;br /&gt;
&lt;p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none;"&gt;&lt;a name="OLE_LINK2"&gt;&lt;/a&gt;&lt;a name="OLE_LINK1"&gt;&lt;/a&gt;&lt;span class="GramE"&gt;&lt;span style="mso-bookmark: OLE_LINK1;"&gt;&lt;span style="mso-bookmark: OLE_LINK2;"&gt;&lt;span style="background: white; color: blue; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;namespace&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="mso-bookmark: OLE_LINK1;"&gt;&lt;span style="mso-bookmark: OLE_LINK2;"&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt; &lt;span class="SpellE"&gt;AppDomainDemo&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="mso-bookmark: OLE_LINK1;"&gt;&lt;span style="mso-bookmark: OLE_LINK2;"&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;{&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="mso-bookmark: OLE_LINK1;"&gt;&lt;span style="mso-bookmark: OLE_LINK2;"&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="mso-bookmark: OLE_LINK1;"&gt;&lt;span style="mso-bookmark: OLE_LINK2;"&gt;&lt;span class="GramE"&gt;&lt;span style="background: white; color: blue; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;using&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="mso-bookmark: OLE_LINK1;"&gt;&lt;span style="mso-bookmark: OLE_LINK2;"&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt; System;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="mso-bookmark: OLE_LINK1;"&gt;&lt;span style="mso-bookmark: OLE_LINK2;"&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="mso-bookmark: OLE_LINK1;"&gt;&lt;span style="mso-bookmark: OLE_LINK2;"&gt;&lt;span class="GramE"&gt;&lt;span style="background: white; color: blue; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;using&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="mso-bookmark: OLE_LINK1;"&gt;&lt;span style="mso-bookmark: OLE_LINK2;"&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt; &lt;span class="SpellE"&gt;System.Diagnostics&lt;/span&gt;;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="mso-bookmark: OLE_LINK1;"&gt;&lt;span style="mso-bookmark: OLE_LINK2;"&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="mso-bookmark: OLE_LINK1;"&gt;&lt;span style="mso-bookmark: OLE_LINK2;"&gt;&lt;span class="GramE"&gt;&lt;span style="background: white; color: blue; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;using&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="mso-bookmark: OLE_LINK1;"&gt;&lt;span style="mso-bookmark: OLE_LINK2;"&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt; &lt;span class="SpellE"&gt;DemoLibrary&lt;/span&gt;;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="mso-bookmark: OLE_LINK1;"&gt;&lt;span style="mso-bookmark: OLE_LINK2;"&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none;"&gt;&lt;span style="mso-bookmark: OLE_LINK1;"&gt;&lt;span style="mso-bookmark: OLE_LINK2;"&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="mso-bookmark: OLE_LINK1;"&gt;&lt;span style="mso-bookmark: OLE_LINK2;"&gt;&lt;span class="GramE"&gt;&lt;span style="background: white; color: blue; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;class &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="mso-bookmark: OLE_LINK1;"&gt;&lt;span style="mso-bookmark: OLE_LINK2;"&gt;&lt;span style="background: white; color: #2b91af; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;Program&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="mso-bookmark: OLE_LINK1;"&gt;&lt;span style="mso-bookmark: OLE_LINK2;"&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;{&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="mso-bookmark: OLE_LINK1;"&gt;&lt;span style="mso-bookmark: OLE_LINK2;"&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="mso-bookmark: OLE_LINK1;"&gt;&lt;span style="mso-bookmark: OLE_LINK2;"&gt;&lt;span class="GramE"&gt;&lt;span style="background: white; color: blue; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;static&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="mso-bookmark: OLE_LINK1;"&gt;&lt;span style="mso-bookmark: OLE_LINK2;"&gt;&lt;span style="background: white; color: blue; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;void&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="mso-bookmark: OLE_LINK1;"&gt;&lt;span style="mso-bookmark: OLE_LINK2;"&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt; Main(&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="mso-bookmark: OLE_LINK1;"&gt;&lt;span style="mso-bookmark: OLE_LINK2;"&gt;&lt;span style="background: white; color: blue; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;string&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="mso-bookmark: OLE_LINK1;"&gt;&lt;span style="mso-bookmark: OLE_LINK2;"&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;[] &lt;span class="SpellE"&gt;args&lt;/span&gt;)&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="mso-bookmark: OLE_LINK1;"&gt;&lt;span style="mso-bookmark: OLE_LINK2;"&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;{&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="mso-bookmark: OLE_LINK1;"&gt;&lt;span style="mso-bookmark: OLE_LINK2;"&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span class="SpellE"&gt;&lt;span class="GramE"&gt;ProcessRequestBatch&lt;/span&gt;&lt;/span&gt;&lt;span class="GramE"&gt;(&lt;/span&gt;);&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="mso-bookmark: OLE_LINK1;"&gt;&lt;span style="mso-bookmark: OLE_LINK2;"&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none;"&gt;&lt;span style="mso-bookmark: OLE_LINK1;"&gt;&lt;span style="mso-bookmark: OLE_LINK2;"&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="mso-bookmark: OLE_LINK1;"&gt;&lt;span style="mso-bookmark: OLE_LINK2;"&gt;&lt;span style="background: white; color: green; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;// &lt;span class="GramE"&gt;Only&lt;/span&gt; added to force a collection for demonstration purposes, please do not do this in production&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="mso-bookmark: OLE_LINK1;"&gt;&lt;span style="mso-bookmark: OLE_LINK2;"&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="mso-bookmark: OLE_LINK1;"&gt;&lt;span style="mso-bookmark: OLE_LINK2;"&gt;&lt;span style="background: white; color: green; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;// inducing a GC is typically not good a good practice&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0cm 0cm 0pt 36pt; line-height: normal; mso-layout-grid-align: none;"&gt;&lt;span style="mso-bookmark: OLE_LINK1;"&gt;&lt;span style="mso-bookmark: OLE_LINK2;"&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="mso-bookmark: OLE_LINK1;"&gt;&lt;span style="mso-bookmark: OLE_LINK2;"&gt;&lt;span class="SpellE"&gt;&lt;span class="GramE"&gt;&lt;span style="background: white; color: #2b91af; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;GC&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;.Collect&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="mso-bookmark: OLE_LINK1;"&gt;&lt;span style="mso-bookmark: OLE_LINK2;"&gt;&lt;span class="GramE"&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;(&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="mso-bookmark: OLE_LINK1;"&gt;&lt;span style="mso-bookmark: OLE_LINK2;"&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;);&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height: normal; text-indent: 36pt; margin-bottom: 0pt; mso-layout-grid-align: none;"&gt;&lt;span style="mso-bookmark: OLE_LINK1;"&gt;&lt;span style="mso-bookmark: OLE_LINK2;"&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="mso-bookmark: OLE_LINK1;"&gt;&lt;span style="mso-bookmark: OLE_LINK2;"&gt;&lt;span class="SpellE"&gt;&lt;span class="GramE"&gt;&lt;span style="background: white; color: #2b91af; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;Console&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;.WriteLine&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="mso-bookmark: OLE_LINK1;"&gt;&lt;span style="mso-bookmark: OLE_LINK2;"&gt;&lt;span class="GramE"&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;(&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="mso-bookmark: OLE_LINK1;"&gt;&lt;span style="mso-bookmark: OLE_LINK2;"&gt;&lt;span style="background: white; color: #a31515; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;"Completed the batch press enter to continue"&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="mso-bookmark: OLE_LINK1;"&gt;&lt;span style="mso-bookmark: OLE_LINK2;"&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;);&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="mso-bookmark: OLE_LINK1;"&gt;&lt;span style="mso-bookmark: OLE_LINK2;"&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="mso-bookmark: OLE_LINK1;"&gt;&lt;span style="mso-bookmark: OLE_LINK2;"&gt;&lt;span class="SpellE"&gt;&lt;span class="GramE"&gt;&lt;span style="background: white; color: #2b91af; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;Console&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;.ReadLine&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="mso-bookmark: OLE_LINK1;"&gt;&lt;span style="mso-bookmark: OLE_LINK2;"&gt;&lt;span class="GramE"&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;(&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="mso-bookmark: OLE_LINK1;"&gt;&lt;span style="mso-bookmark: OLE_LINK2;"&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;);&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="mso-bookmark: OLE_LINK1;"&gt;&lt;span style="mso-bookmark: OLE_LINK2;"&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="mso-bookmark: OLE_LINK1;"&gt;&lt;span style="mso-bookmark: OLE_LINK2;"&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none;"&gt;&lt;span style="mso-bookmark: OLE_LINK1;"&gt;&lt;span style="mso-bookmark: OLE_LINK2;"&gt;&lt;span style="mso-bookmark: OLE_LINK6;"&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;a name="OLE_LINK4"&gt;&lt;/a&gt;&lt;a name="OLE_LINK3"&gt;&lt;/a&gt;&lt;span class="GramE"&gt;&lt;span style="mso-bookmark: OLE_LINK3;"&gt;&lt;span style="mso-bookmark: OLE_LINK4;"&gt;&lt;span style="mso-bookmark: OLE_LINK6;"&gt;&lt;span style="mso-bookmark: OLE_LINK5;"&gt;&lt;span style="mso-bookmark: OLE_LINK2;"&gt;&lt;span style="mso-bookmark: OLE_LINK1;"&gt;&lt;span style="background: white; color: blue; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;private &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="mso-bookmark: OLE_LINK3;"&gt;&lt;span style="mso-bookmark: OLE_LINK4;"&gt;&lt;span style="mso-bookmark: OLE_LINK6;"&gt;&lt;span style="mso-bookmark: OLE_LINK5;"&gt;&lt;span style="mso-bookmark: OLE_LINK2;"&gt;&lt;span style="mso-bookmark: OLE_LINK1;"&gt;&lt;span style="background: white; color: blue; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;static &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="mso-bookmark: OLE_LINK3;"&gt;&lt;span style="mso-bookmark: OLE_LINK4;"&gt;&lt;span style="mso-bookmark: OLE_LINK6;"&gt;&lt;span style="mso-bookmark: OLE_LINK5;"&gt;&lt;span style="mso-bookmark: OLE_LINK2;"&gt;&lt;span style="mso-bookmark: OLE_LINK1;"&gt;&lt;span style="background: white; color: blue; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;void&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="mso-bookmark: OLE_LINK3;"&gt;&lt;span style="mso-bookmark: OLE_LINK4;"&gt;&lt;span style="mso-bookmark: OLE_LINK6;"&gt;&lt;span style="mso-bookmark: OLE_LINK5;"&gt;&lt;span style="mso-bookmark: OLE_LINK2;"&gt;&lt;span style="mso-bookmark: OLE_LINK1;"&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt; &lt;span class="SpellE"&gt;ProcessRequestBatch&lt;/span&gt;()&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="mso-bookmark: OLE_LINK3;"&gt;&lt;span style="mso-bookmark: OLE_LINK4;"&gt;&lt;span style="mso-bookmark: OLE_LINK6;"&gt;&lt;span style="mso-bookmark: OLE_LINK5;"&gt;&lt;span style="mso-bookmark: OLE_LINK2;"&gt;&lt;span style="mso-bookmark: OLE_LINK1;"&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;{&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="mso-bookmark: OLE_LINK3;"&gt;&lt;span style="mso-bookmark: OLE_LINK4;"&gt;&lt;span style="mso-bookmark: OLE_LINK6;"&gt;&lt;span style="mso-bookmark: OLE_LINK5;"&gt;&lt;span style="mso-bookmark: OLE_LINK2;"&gt;&lt;span style="mso-bookmark: OLE_LINK1;"&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="mso-bookmark: OLE_LINK3;"&gt;&lt;span style="mso-bookmark: OLE_LINK4;"&gt;&lt;span style="mso-bookmark: OLE_LINK6;"&gt;&lt;span style="mso-bookmark: OLE_LINK5;"&gt;&lt;span style="mso-bookmark: OLE_LINK2;"&gt;&lt;span style="mso-bookmark: OLE_LINK1;"&gt;&lt;span style="background: white; color: #2b91af; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;Stopwatch&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="mso-bookmark: OLE_LINK3;"&gt;&lt;span style="mso-bookmark: OLE_LINK4;"&gt;&lt;span style="mso-bookmark: OLE_LINK6;"&gt;&lt;span style="mso-bookmark: OLE_LINK5;"&gt;&lt;span style="mso-bookmark: OLE_LINK2;"&gt;&lt;span style="mso-bookmark: OLE_LINK1;"&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt; watch = &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="mso-bookmark: OLE_LINK3;"&gt;&lt;span style="mso-bookmark: OLE_LINK4;"&gt;&lt;span style="mso-bookmark: OLE_LINK6;"&gt;&lt;span style="mso-bookmark: OLE_LINK5;"&gt;&lt;span style="mso-bookmark: OLE_LINK2;"&gt;&lt;span style="mso-bookmark: OLE_LINK1;"&gt;&lt;span style="background: white; color: blue; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;new &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="mso-bookmark: OLE_LINK3;"&gt;&lt;span style="mso-bookmark: OLE_LINK4;"&gt;&lt;span style="mso-bookmark: OLE_LINK6;"&gt;&lt;span style="mso-bookmark: OLE_LINK5;"&gt;&lt;span style="mso-bookmark: OLE_LINK2;"&gt;&lt;span style="mso-bookmark: OLE_LINK1;"&gt;&lt;span class="GramE"&gt;&lt;span style="background: white; color: #2b91af; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;Stopwatch&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;(&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="mso-bookmark: OLE_LINK3;"&gt;&lt;span style="mso-bookmark: OLE_LINK4;"&gt;&lt;span style="mso-bookmark: OLE_LINK6;"&gt;&lt;span style="mso-bookmark: OLE_LINK5;"&gt;&lt;span style="mso-bookmark: OLE_LINK2;"&gt;&lt;span style="mso-bookmark: OLE_LINK1;"&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;);&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="mso-bookmark: OLE_LINK3;"&gt;&lt;span style="mso-bookmark: OLE_LINK4;"&gt;&lt;span style="mso-bookmark: OLE_LINK6;"&gt;&lt;span style="mso-bookmark: OLE_LINK5;"&gt;&lt;span style="mso-bookmark: OLE_LINK2;"&gt;&lt;span style="mso-bookmark: OLE_LINK1;"&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="mso-bookmark: OLE_LINK3;"&gt;&lt;span style="mso-bookmark: OLE_LINK4;"&gt;&lt;span style="mso-bookmark: OLE_LINK6;"&gt;&lt;span style="mso-bookmark: OLE_LINK5;"&gt;&lt;span style="mso-bookmark: OLE_LINK2;"&gt;&lt;span style="mso-bookmark: OLE_LINK1;"&gt;&lt;span style="background: white; color: #2b91af; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;Processor&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="mso-bookmark: OLE_LINK3;"&gt;&lt;span style="mso-bookmark: OLE_LINK4;"&gt;&lt;span style="mso-bookmark: OLE_LINK6;"&gt;&lt;span style="mso-bookmark: OLE_LINK5;"&gt;&lt;span style="mso-bookmark: OLE_LINK2;"&gt;&lt;span style="mso-bookmark: OLE_LINK1;"&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt; &lt;span class="SpellE"&gt;demoProcessor&lt;/span&gt; = &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="mso-bookmark: OLE_LINK3;"&gt;&lt;span style="mso-bookmark: OLE_LINK4;"&gt;&lt;span style="mso-bookmark: OLE_LINK6;"&gt;&lt;span style="mso-bookmark: OLE_LINK5;"&gt;&lt;span style="mso-bookmark: OLE_LINK2;"&gt;&lt;span style="mso-bookmark: OLE_LINK1;"&gt;&lt;span style="background: white; color: blue; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;new &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="mso-bookmark: OLE_LINK3;"&gt;&lt;span style="mso-bookmark: OLE_LINK4;"&gt;&lt;span style="mso-bookmark: OLE_LINK6;"&gt;&lt;span style="mso-bookmark: OLE_LINK5;"&gt;&lt;span style="mso-bookmark: OLE_LINK2;"&gt;&lt;span style="mso-bookmark: OLE_LINK1;"&gt;&lt;span class="GramE"&gt;&lt;span style="background: white; color: #2b91af; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;Processor&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;(&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="mso-bookmark: OLE_LINK3;"&gt;&lt;span style="mso-bookmark: OLE_LINK4;"&gt;&lt;span style="mso-bookmark: OLE_LINK6;"&gt;&lt;span style="mso-bookmark: OLE_LINK5;"&gt;&lt;span style="mso-bookmark: OLE_LINK2;"&gt;&lt;span style="mso-bookmark: OLE_LINK1;"&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;);&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none;"&gt;&lt;span style="mso-bookmark: OLE_LINK3;"&gt;&lt;span style="mso-bookmark: OLE_LINK4;"&gt;&lt;span style="mso-bookmark: OLE_LINK6;"&gt;&lt;span style="mso-bookmark: OLE_LINK5;"&gt;&lt;span style="mso-bookmark: OLE_LINK2;"&gt;&lt;span style="mso-bookmark: OLE_LINK1;"&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span class="SpellE"&gt;&lt;span class="GramE"&gt;watch.Start&lt;/span&gt;&lt;/span&gt;&lt;span class="GramE"&gt;(&lt;/span&gt;);&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="mso-bookmark: OLE_LINK3;"&gt;&lt;span style="mso-bookmark: OLE_LINK4;"&gt;&lt;span style="mso-bookmark: OLE_LINK6;"&gt;&lt;span style="mso-bookmark: OLE_LINK5;"&gt;&lt;span style="mso-bookmark: OLE_LINK2;"&gt;&lt;span style="mso-bookmark: OLE_LINK1;"&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none;"&gt;&lt;span style="mso-bookmark: OLE_LINK3;"&gt;&lt;span style="mso-bookmark: OLE_LINK4;"&gt;&lt;span style="mso-bookmark: OLE_LINK6;"&gt;&lt;span style="mso-bookmark: OLE_LINK5;"&gt;&lt;span style="mso-bookmark: OLE_LINK2;"&gt;&lt;span style="mso-bookmark: OLE_LINK1;"&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="mso-bookmark: OLE_LINK3;"&gt;&lt;span style="mso-bookmark: OLE_LINK4;"&gt;&lt;span style="mso-bookmark: OLE_LINK6;"&gt;&lt;span style="mso-bookmark: OLE_LINK5;"&gt;&lt;span style="mso-bookmark: OLE_LINK2;"&gt;&lt;span style="mso-bookmark: OLE_LINK1;"&gt;&lt;span class="GramE"&gt;&lt;span style="background: white; color: blue; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;for&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="mso-bookmark: OLE_LINK3;"&gt;&lt;span style="mso-bookmark: OLE_LINK4;"&gt;&lt;span style="mso-bookmark: OLE_LINK6;"&gt;&lt;span style="mso-bookmark: OLE_LINK5;"&gt;&lt;span style="mso-bookmark: OLE_LINK2;"&gt;&lt;span style="mso-bookmark: OLE_LINK1;"&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt; (&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="mso-bookmark: OLE_LINK3;"&gt;&lt;span style="mso-bookmark: OLE_LINK4;"&gt;&lt;span style="mso-bookmark: OLE_LINK6;"&gt;&lt;span style="mso-bookmark: OLE_LINK5;"&gt;&lt;span style="mso-bookmark: OLE_LINK2;"&gt;&lt;span style="mso-bookmark: OLE_LINK1;"&gt;&lt;span class="SpellE"&gt;&lt;span style="background: white; color: blue; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;int&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="mso-bookmark: OLE_LINK3;"&gt;&lt;span style="mso-bookmark: OLE_LINK4;"&gt;&lt;span style="mso-bookmark: OLE_LINK6;"&gt;&lt;span style="mso-bookmark: OLE_LINK5;"&gt;&lt;span style="mso-bookmark: OLE_LINK2;"&gt;&lt;span style="mso-bookmark: OLE_LINK1;"&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt; index = 0; index &amp;lt; 10000; index++)&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="mso-bookmark: OLE_LINK3;"&gt;&lt;span style="mso-bookmark: OLE_LINK4;"&gt;&lt;span style="mso-bookmark: OLE_LINK6;"&gt;&lt;span style="mso-bookmark: OLE_LINK5;"&gt;&lt;span style="mso-bookmark: OLE_LINK2;"&gt;&lt;span style="mso-bookmark: OLE_LINK1;"&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;{&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="mso-bookmark: OLE_LINK3;"&gt;&lt;span style="mso-bookmark: OLE_LINK4;"&gt;&lt;span style="mso-bookmark: OLE_LINK6;"&gt;&lt;span style="mso-bookmark: OLE_LINK5;"&gt;&lt;span style="mso-bookmark: OLE_LINK2;"&gt;&lt;span style="mso-bookmark: OLE_LINK1;"&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="mso-bookmark: OLE_LINK3;"&gt;&lt;span style="mso-bookmark: OLE_LINK4;"&gt;&lt;span style="mso-bookmark: OLE_LINK6;"&gt;&lt;span style="mso-bookmark: OLE_LINK5;"&gt;&lt;span style="mso-bookmark: OLE_LINK2;"&gt;&lt;span style="mso-bookmark: OLE_LINK1;"&gt;&lt;span class="SpellE"&gt;&lt;span class="GramE"&gt;&lt;span style="background: white; color: blue; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;int&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="mso-bookmark: OLE_LINK3;"&gt;&lt;span style="mso-bookmark: OLE_LINK4;"&gt;&lt;span style="mso-bookmark: OLE_LINK6;"&gt;&lt;span style="mso-bookmark: OLE_LINK5;"&gt;&lt;span style="mso-bookmark: OLE_LINK2;"&gt;&lt;span style="mso-bookmark: OLE_LINK1;"&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt; id = index % 5000;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="mso-bookmark: OLE_LINK3;"&gt;&lt;span style="mso-bookmark: OLE_LINK4;"&gt;&lt;span style="mso-bookmark: OLE_LINK6;"&gt;&lt;span style="mso-bookmark: OLE_LINK5;"&gt;&lt;span style="mso-bookmark: OLE_LINK2;"&gt;&lt;span style="mso-bookmark: OLE_LINK1;"&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none;"&gt;&lt;span style="mso-bookmark: OLE_LINK3;"&gt;&lt;span style="mso-bookmark: OLE_LINK4;"&gt;&lt;span style="mso-bookmark: OLE_LINK6;"&gt;&lt;span style="mso-bookmark: OLE_LINK5;"&gt;&lt;span style="mso-bookmark: OLE_LINK2;"&gt;&lt;span style="mso-bookmark: OLE_LINK1;"&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="mso-bookmark: OLE_LINK3;"&gt;&lt;span style="mso-bookmark: OLE_LINK4;"&gt;&lt;span style="mso-bookmark: OLE_LINK6;"&gt;&lt;span style="mso-bookmark: OLE_LINK5;"&gt;&lt;span style="mso-bookmark: OLE_LINK2;"&gt;&lt;span style="mso-bookmark: OLE_LINK1;"&gt;&lt;span class="SpellE"&gt;&lt;span class="GramE"&gt;&lt;span style="background: white; color: #2b91af; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;Console&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;.WriteLine&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="mso-bookmark: OLE_LINK3;"&gt;&lt;span style="mso-bookmark: OLE_LINK4;"&gt;&lt;span style="mso-bookmark: OLE_LINK6;"&gt;&lt;span style="mso-bookmark: OLE_LINK5;"&gt;&lt;span style="mso-bookmark: OLE_LINK2;"&gt;&lt;span style="mso-bookmark: OLE_LINK1;"&gt;&lt;span class="GramE"&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;(&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="mso-bookmark: OLE_LINK3;"&gt;&lt;span style="mso-bookmark: OLE_LINK4;"&gt;&lt;span style="mso-bookmark: OLE_LINK6;"&gt;&lt;span style="mso-bookmark: OLE_LINK5;"&gt;&lt;span style="mso-bookmark: OLE_LINK2;"&gt;&lt;span style="mso-bookmark: OLE_LINK1;"&gt;&lt;span class="SpellE"&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;demoProcessor.ProcessRequest&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="mso-bookmark: OLE_LINK3;"&gt;&lt;span style="mso-bookmark: OLE_LINK4;"&gt;&lt;span style="mso-bookmark: OLE_LINK6;"&gt;&lt;span style="mso-bookmark: OLE_LINK5;"&gt;&lt;span style="mso-bookmark: OLE_LINK2;"&gt;&lt;span style="mso-bookmark: OLE_LINK1;"&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;(id));&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="mso-bookmark: OLE_LINK3;"&gt;&lt;span style="mso-bookmark: OLE_LINK4;"&gt;&lt;span style="mso-bookmark: OLE_LINK6;"&gt;&lt;span style="mso-bookmark: OLE_LINK5;"&gt;&lt;span style="mso-bookmark: OLE_LINK2;"&gt;&lt;span style="mso-bookmark: OLE_LINK1;"&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="mso-bookmark: OLE_LINK3;"&gt;&lt;span style="mso-bookmark: OLE_LINK4;"&gt;&lt;span style="mso-bookmark: OLE_LINK6;"&gt;&lt;span style="mso-bookmark: OLE_LINK5;"&gt;&lt;span style="mso-bookmark: OLE_LINK2;"&gt;&lt;span style="mso-bookmark: OLE_LINK1;"&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none;"&gt;&lt;span style="mso-bookmark: OLE_LINK3;"&gt;&lt;span style="mso-bookmark: OLE_LINK4;"&gt;&lt;span style="mso-bookmark: OLE_LINK6;"&gt;&lt;span style="mso-bookmark: OLE_LINK5;"&gt;&lt;span style="mso-bookmark: OLE_LINK2;"&gt;&lt;span style="mso-bookmark: OLE_LINK1;"&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span class="SpellE"&gt;&lt;span class="GramE"&gt;watch.Stop&lt;/span&gt;&lt;/span&gt;&lt;span class="GramE"&gt;(&lt;/span&gt;);&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none;"&gt;&lt;span style="mso-bookmark: OLE_LINK3;"&gt;&lt;span style="mso-bookmark: OLE_LINK4;"&gt;&lt;span style="mso-bookmark: OLE_LINK6;"&gt;&lt;span style="mso-bookmark: OLE_LINK5;"&gt;&lt;span style="mso-bookmark: OLE_LINK2;"&gt;&lt;span style="mso-bookmark: OLE_LINK1;"&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="mso-bookmark: OLE_LINK3;"&gt;&lt;span style="mso-bookmark: OLE_LINK4;"&gt;&lt;span style="mso-bookmark: OLE_LINK6;"&gt;&lt;span style="mso-bookmark: OLE_LINK5;"&gt;&lt;span style="mso-bookmark: OLE_LINK2;"&gt;&lt;span style="mso-bookmark: OLE_LINK1;"&gt;&lt;span class="SpellE"&gt;&lt;span class="GramE"&gt;&lt;span style="background: white; color: #2b91af; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;Console&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;.WriteLine&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="mso-bookmark: OLE_LINK3;"&gt;&lt;span style="mso-bookmark: OLE_LINK4;"&gt;&lt;span style="mso-bookmark: OLE_LINK6;"&gt;&lt;span style="mso-bookmark: OLE_LINK5;"&gt;&lt;span style="mso-bookmark: OLE_LINK2;"&gt;&lt;span style="mso-bookmark: OLE_LINK1;"&gt;&lt;span class="GramE"&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;(&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="mso-bookmark: OLE_LINK3;"&gt;&lt;span style="mso-bookmark: OLE_LINK4;"&gt;&lt;span style="mso-bookmark: OLE_LINK6;"&gt;&lt;span style="mso-bookmark: OLE_LINK5;"&gt;&lt;span style="mso-bookmark: OLE_LINK2;"&gt;&lt;span style="mso-bookmark: OLE_LINK1;"&gt;&lt;span style="background: white; color: #a31515; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;"The processing took &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="mso-bookmark: OLE_LINK3;"&gt;&lt;span style="mso-bookmark: OLE_LINK4;"&gt;&lt;span style="mso-bookmark: OLE_LINK6;"&gt;&lt;span style="mso-bookmark: OLE_LINK5;"&gt;&lt;span style="mso-bookmark: OLE_LINK2;"&gt;&lt;span style="mso-bookmark: OLE_LINK1;"&gt;&lt;span style="background: white; color: mediumseagreen; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;{0}&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="mso-bookmark: OLE_LINK3;"&gt;&lt;span style="mso-bookmark: OLE_LINK4;"&gt;&lt;span style="mso-bookmark: OLE_LINK6;"&gt;&lt;span style="mso-bookmark: OLE_LINK5;"&gt;&lt;span style="mso-bookmark: OLE_LINK2;"&gt;&lt;span style="mso-bookmark: OLE_LINK1;"&gt;&lt;span style="background: white; color: #a31515; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt; &lt;span class="SpellE"&gt;ms&lt;/span&gt; to complete."&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="mso-bookmark: OLE_LINK3;"&gt;&lt;span style="mso-bookmark: OLE_LINK4;"&gt;&lt;span style="mso-bookmark: OLE_LINK6;"&gt;&lt;span style="mso-bookmark: OLE_LINK5;"&gt;&lt;span style="mso-bookmark: OLE_LINK2;"&gt;&lt;span style="mso-bookmark: OLE_LINK1;"&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;, &lt;span class="SpellE"&gt;watch.ElapsedMilliseconds&lt;/span&gt;);&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="mso-bookmark: OLE_LINK3;"&gt;&lt;span style="mso-bookmark: OLE_LINK4;"&gt;&lt;span style="mso-bookmark: OLE_LINK6;"&gt;&lt;span style="mso-bookmark: OLE_LINK5;"&gt;&lt;span style="mso-bookmark: OLE_LINK2;"&gt;&lt;span style="mso-bookmark: OLE_LINK1;"&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;}&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="mso-bookmark: OLE_LINK2;"&gt;&lt;span style="mso-bookmark: OLE_LINK1;"&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;}&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="mso-bookmark: OLE_LINK2;"&gt;&lt;span style="mso-bookmark: OLE_LINK1;"&gt;&lt;span style="background: white; color: black; line-height: 107%; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;br /&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="background: white; color: black; mso-bidi-font-family: Consolas; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;Now that we have setup the simulation and the code has been explained we will look at the results and memory footprint to understand what is happening behind the scenes.&lt;/span&gt;&lt;/p&gt;
&lt;br /&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="background: white; color: black; mso-bidi-font-family: Consolas; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;Reviewing the console output we can see that the job took 2156ms to complete all of the iterations.&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp; &lt;/span&gt;Also note that all of the responses came from the AppDomainDemo.exe, this is the default &lt;span class="SpellE"&gt;AppDomain&lt;/span&gt; associated with my application which is named AppDomainDemo.exe.&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp; &lt;/span&gt;Typically this is referred to as the default &lt;span class="SpellE"&gt;AppDomain&lt;/span&gt;.&lt;/span&gt;&lt;/p&gt;
&lt;br /&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="background: white; color: black; mso-bidi-font-family: Consolas; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;&amp;nbsp;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-34-77-20130521/2330.AppDomainImage1.png"&gt;&lt;img src="http://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-01-34-77-20130521/2330.AppDomainImage1.png" alt="" border="0" /&gt;&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="background: white; color: black; line-height: 107%; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="background: white; color: black; mso-bidi-font-family: Consolas; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;By reviewing the Task Manager we can see that the process has increased in memory consumption and is holding onto 240.4MB of memory.&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp; &lt;/span&gt;A significant portion of this memory consumption can be attributed to the cached objects (we only know this because we know the code at this point) even though the instance of the Processor has dropped out of scope.&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="background: white; color: black; mso-bidi-font-family: Consolas; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;strong style="mso-bidi-font-weight: normal;"&gt;&lt;span style="background: white; color: red; mso-bidi-font-family: Consolas; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-34-77-20130521/1273.AppDomainImage2.png"&gt;&lt;img src="http://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-01-34-77-20130521/1273.AppDomainImage2.png" alt="" border="0" /&gt;&lt;/a&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="background: white; color: black; line-height: 107%; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="background: white; color: black; mso-bidi-font-family: Consolas; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="background: white; color: black; mso-bidi-font-family: Consolas; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;So why is it holding this memory, the library dropped out of scope did it not?&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp; &lt;/span&gt;We are not using it anymore, are we?&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp; &lt;/span&gt;In order to answer this we will turn to &lt;span class="SpellE"&gt;WinDBG&lt;/span&gt; (&lt;/span&gt;&lt;span lang="EN-US"&gt;&lt;a href="http://msdn.microsoft.com/en-us/windows/hardware/gg463009.aspx"&gt;&lt;span style="mso-bidi-font-family: Consolas; mso-ansi-language: EN-CA;" lang="EN-CA"&gt;http://msdn.microsoft.com/en-us/windows/hardware/gg463009.aspx&lt;/span&gt;&lt;/a&gt;&lt;/span&gt;&lt;span style="color: black; mso-bidi-font-family: Consolas; mso-ansi-language: EN-CA;"&gt;)&lt;span style="background: white; mso-highlight: white;"&gt;.&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp; &lt;/span&gt;The contents of the &lt;span class="SpellE"&gt;WinDBG&lt;/span&gt; logs have been shorted and you will notice &amp;lsquo;&amp;hellip;&amp;rsquo; in places where I have removed unnecessary information.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;br /&gt; &lt;span style="color: #333399; font-size: medium;"&gt;&lt;strong&gt;&lt;span style="background: white; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;In Memory&lt;/span&gt;&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;
&lt;p&gt;&lt;em style="mso-bidi-font-style: normal;"&gt;&lt;span style="color: black; line-height: 107%; font-family: 'Calibri','sans-serif'; font-size: 11pt; mso-ascii-theme-font: minor-latin; mso-hansi-theme-font: minor-latin; mso-bidi-font-family: Consolas; mso-ansi-language: EN-CA;"&gt;Review the statistics of the heap so we can understand what objects are consuming space:&lt;/span&gt;&lt;/em&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="mso-ansi-language: EN-CA;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="color: black; line-height: 107%; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA;"&gt;0:003&lt;span class="GramE"&gt;&amp;gt; !&lt;span class="SpellE"&gt;DumpHeap&lt;/span&gt;&lt;/span&gt; -stat&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="color: black; line-height: 107%; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA;"&gt;Statistics:&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="color: black; line-height: 107%; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;MT&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;Count&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span class="SpellE"&gt;TotalSize&lt;/span&gt; Class Name&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="color: black; line-height: 107%; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA;"&gt;000007ff491113d8&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;1&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;24 System.Int64&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="color: black; line-height: 107%; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA;"&gt;...&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="color: black; line-height: 107%; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA;"&gt;000007ff490ff0a8&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;11&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;50748 &lt;span class="GramE"&gt;System.Int32[]&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="background: yellow; color: black; line-height: 107%; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: yellow;"&gt;000007feea935070&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;5000&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;120000 &lt;span class="SpellE"&gt;DemoLibrary.MyCachedObject&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="color: black; line-height: 107%; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA;"&gt;000007ff490ff108&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;7088&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;170112 System.Int32&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="color: black; line-height: 107%; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA;"&gt;000007ff490e0630&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;3569&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;234560 &lt;span class="SpellE"&gt;&lt;span class="GramE"&gt;System.Object&lt;/span&gt;&lt;/span&gt;&lt;span class="GramE"&gt;[]&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="color: black; line-height: 107%; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA;"&gt;000007feea936168&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;2&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;299280 System.Collections.Generic.Dictionary`2+&lt;span class="GramE"&gt;Entry[&lt;/span&gt;[System.Int32, &lt;span class="SpellE"&gt;mscorlib&lt;/span&gt;],[&lt;span class="SpellE"&gt;DemoLibrary.MyCachedObject&lt;/span&gt;, &lt;span class="SpellE"&gt;DemoLibrary&lt;/span&gt;]][]&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="color: black; line-height: 107%; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA;"&gt;000007ff490fd5e0&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;3551&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;866340 &lt;span class="SpellE"&gt;&lt;span class="GramE"&gt;System.Char&lt;/span&gt;&lt;/span&gt;&lt;span class="GramE"&gt;[]&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="color: black; line-height: 107%; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA;"&gt;000007ff490fc358&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;14348&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;1326108 &lt;span class="SpellE"&gt;System.String&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="color: black; line-height: 107%; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA;"&gt;00000010a61ab330&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&lt;/span&gt;5059&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;3818824&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;Free&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="color: black; line-height: 107%; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA;"&gt;000007ff491004d0&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;5003&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;241150729 &lt;span class="SpellE"&gt;&lt;span class="GramE"&gt;System.Byte&lt;/span&gt;&lt;/span&gt;&lt;span class="GramE"&gt;[]&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="color: black; line-height: 107%; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA;"&gt;Total 43727 objects&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="color: black; line-height: 107%; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;em style="mso-bidi-font-style: normal;"&gt;&lt;span style="color: black; mso-bidi-font-family: Consolas; mso-ansi-language: EN-CA;"&gt;Now that we noticed our object &lt;span class="SpellE"&gt;DemoLibrary.MyCachedObject&lt;/span&gt; is consuming a lot of space (120MB) with a count of 5000 instances we can look at why this is. &lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&lt;/span&gt;We will dump out the heap entries for these objects and see each individual object&amp;rsquo;s address.&lt;/span&gt;&lt;/em&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="color: black; line-height: 107%; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="color: black; line-height: 107%; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA;"&gt;0:003&lt;span class="GramE"&gt;&amp;gt; !&lt;span class="SpellE"&gt;DumpHeap&lt;/span&gt;&lt;/span&gt; -type &lt;span class="SpellE"&gt;DemoLibrary.MyCachedObject&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="color: black; line-height: 107%; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;Address&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;MT&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;Size&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="color: black; line-height: 107%; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA;"&gt;00000010a83c3130 000007feea935110&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;80&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="color: black; line-height: 107%; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA;"&gt;...&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="color: black; line-height: 107%; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA;"&gt;00000010b6d68958 000007feea935070&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;24&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="color: black; line-height: 107%; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA;"&gt;00000010b6d77c70 000007feea935070&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;24&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="color: black; line-height: 107%; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: ES-US;" lang="ES-US"&gt;00000010b6d84f88 000007feea935070&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;24&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="color: black; line-height: 107%; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: ES-US;" lang="ES-US"&gt;00000010b83c9638 000007feea936168&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;97200&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="background: yellow; color: black; line-height: 107%; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: ES-US; mso-highlight: yellow;" lang="ES-US"&gt;00000010b83e11e8 000007feea936168&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;202080&lt;/span&gt;&lt;span style="color: black; line-height: 107%; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: ES-US;" lang="ES-US"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="color: black; line-height: 107%; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: ES-US;" lang="ES-US"&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="color: black; line-height: 107%; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA;"&gt;Statistics:&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="color: black; line-height: 107%; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;MT&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;Count&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span class="SpellE"&gt;TotalSize&lt;/span&gt; Class Name&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="color: black; line-height: 107%; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA;"&gt;000007feea935110&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;1&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;80 System.Collections.Generic.Dictionary`2[[System.Int32, &lt;span class="SpellE"&gt;mscorlib&lt;/span&gt;]&lt;span class="GramE"&gt;,[&lt;/span&gt;&lt;span class="SpellE"&gt;DemoLibrary.MyCachedObject&lt;/span&gt;, &lt;span class="SpellE"&gt;DemoLibrary&lt;/span&gt;]]&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="color: black; line-height: 107%; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA;"&gt;000007feea935070&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;5000&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;120000 &lt;span class="SpellE"&gt;DemoLibrary.MyCachedObject&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="color: black; line-height: 107%; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA;"&gt;000007feea936168&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;2&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;299280 System.Collections.Generic.Dictionary`2+&lt;span class="GramE"&gt;Entry[&lt;/span&gt;[System.Int32, &lt;span class="SpellE"&gt;mscorlib&lt;/span&gt;],[&lt;span class="SpellE"&gt;DemoLibrary.MyCachedObject&lt;/span&gt;, &lt;span class="SpellE"&gt;DemoLibrary&lt;/span&gt;]][]&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="color: black; line-height: 107%; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA;"&gt;Total 5003 objects&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="color: black; line-height: 107%; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;em style="mso-bidi-font-style: normal;"&gt;&lt;span style="color: black; mso-bidi-font-family: Consolas; mso-ansi-language: EN-CA;"&gt;We can now select one of these addresses and look at what &lt;span class="SpellE"&gt;AppDomain&lt;/span&gt; they are associated with.&lt;/span&gt;&lt;/em&gt;&lt;em style="mso-bidi-font-style: normal;"&gt;&lt;/em&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="color: black; line-height: 107%; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="color: black; line-height: 107%; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA;"&gt;0:003&lt;span class="GramE"&gt;&amp;gt; !&lt;span class="SpellE"&gt;FindAppDomain&lt;/span&gt;&lt;/span&gt; 0x00000010b83e11e8&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span class="SpellE"&gt;&lt;span style="color: black; line-height: 107%; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA;"&gt;AppDomain&lt;/span&gt;&lt;/span&gt;&lt;span style="color: black; line-height: 107%; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA;"&gt;: 00000010a61c2700&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="background: yellow; color: black; line-height: 107%; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: yellow;"&gt;Name:&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;AppDomainDemo.exe&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="color: black; line-height: 107%; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA;"&gt;ID:&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;1&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="color: black; line-height: 107%; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;em style="mso-bidi-font-style: normal;"&gt;&lt;span style="color: black; mso-bidi-font-family: Consolas; mso-ansi-language: EN-CA;"&gt;Now that we know that our objects are directly associated with the &lt;span class="SpellE"&gt;AppDomain&lt;/span&gt; named AppDomainDemo.exe (Id 1) let&amp;rsquo;s see what other &lt;span class="SpellE"&gt;AppDomains&lt;/span&gt; are in the current process.&lt;/span&gt;&lt;/em&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="color: black; line-height: 107%; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="color: black; line-height: 107%; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA;"&gt;0:003&lt;span class="GramE"&gt;&amp;gt; !&lt;span class="SpellE"&gt;DumpDomain&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="color: black; line-height: 107%; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA;"&gt;--------------------------------------&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="color: black; line-height: 107%; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA;"&gt;Domain 1:&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;00000010a61c2700&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span class="SpellE"&gt;&lt;span style="color: black; line-height: 107%; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA;"&gt;LowFrequencyHeap&lt;/span&gt;&lt;/span&gt;&lt;span style="color: black; line-height: 107%; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA;"&gt;:&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;00000010a61c2eb8&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span class="SpellE"&gt;&lt;span style="color: black; line-height: 107%; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA;"&gt;HighFrequencyHeap&lt;/span&gt;&lt;/span&gt;&lt;span style="color: black; line-height: 107%; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA;"&gt;:&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp; &lt;/span&gt;00000010a61c2f40&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span class="SpellE"&gt;&lt;span style="color: black; line-height: 107%; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA;"&gt;StubHeap&lt;/span&gt;&lt;/span&gt;&lt;span style="color: black; line-height: 107%; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA;"&gt;:&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;00000010a61c2fc8&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="color: black; line-height: 107%; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA;"&gt;Stage:&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;OPEN&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span class="SpellE"&gt;&lt;span style="color: black; line-height: 107%; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA;"&gt;SecurityDescriptor&lt;/span&gt;&lt;/span&gt;&lt;span style="color: black; line-height: 107%; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA;"&gt;: 00000010a61c4850&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="background: yellow; color: black; line-height: 107%; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: yellow;"&gt;Name:&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;AppDomainDemo.exe&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="color: black; line-height: 107%; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA;"&gt;Assembly:&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;00000010a61af170 [C:\Windows\Microsoft.Net\assembly\GAC_64\mscorlib\v4.0_4.0.0.0__b77a5c561934e089\mscorlib.dll]&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="color: black; line-height: 107%; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA;"&gt;&amp;hellip;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="color: black; line-height: 107%; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;em style="mso-bidi-font-style: normal;"&gt;&lt;span style="color: black; mso-bidi-font-family: Consolas; mso-ansi-language: EN-CA;"&gt;What we can see from this is that there is only one &lt;span class="SpellE"&gt;AppDomain&lt;/span&gt; at the moment (beyond the shared) and will now inspect the object to see where its roots are.&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/em&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="color: black; line-height: 107%; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="color: black; line-height: 107%; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA;"&gt;0:003&lt;span class="GramE"&gt;&amp;gt; !&lt;span class="SpellE"&gt;GCRoot&lt;/span&gt;&lt;/span&gt; 0x00000010b83e11e8&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span class="SpellE"&gt;&lt;span style="color: black; line-height: 107%; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA;"&gt;HandleTable&lt;/span&gt;&lt;/span&gt;&lt;span style="color: black; line-height: 107%; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA;"&gt;:&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="color: black; line-height: 107%; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;00000010a61717d8 (pinned handle)&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="color: black; line-height: 107%; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;-&amp;gt; 00000010b83c5658 &lt;span class="SpellE"&gt;&lt;span class="GramE"&gt;System.Object&lt;/span&gt;&lt;/span&gt;&lt;span class="GramE"&gt;[]&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="color: black; line-height: 107%; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;-&amp;gt; 00000010a83c3130 System.Collections.Generic.Dictionary`2[[System.Int32, &lt;span class="SpellE"&gt;mscorlib&lt;/span&gt;]&lt;span class="GramE"&gt;,[&lt;/span&gt;&lt;span class="SpellE"&gt;DemoLibrary.MyCachedObject&lt;/span&gt;, &lt;span class="SpellE"&gt;DemoLibrary&lt;/span&gt;]]&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="color: black; line-height: 107%; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;-&amp;gt; &lt;span style="background: yellow; mso-highlight: yellow;"&gt;00000010b83e11e8 System.Collections.Generic.Dictionary`2+&lt;span class="GramE"&gt;Entry[&lt;/span&gt;[System.Int32, &lt;span class="SpellE"&gt;mscorlib&lt;/span&gt;],[&lt;span class="SpellE"&gt;DemoLibrary.MyCachedObject&lt;/span&gt;, &lt;span class="SpellE"&gt;DemoLibrary&lt;/span&gt;]][]&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="color: black; line-height: 107%; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="color: black; line-height: 107%; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA;"&gt;Found 1 unique roots (run '&lt;span class="GramE"&gt;!&lt;span class="SpellE"&gt;GCRoot&lt;/span&gt;&lt;/span&gt; -all' to see all roots).&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="color: black; line-height: 107%; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;em style="mso-bidi-font-style: normal;"&gt;&lt;span style="color: black; mso-bidi-font-family: Consolas; mso-ansi-language: EN-CA;"&gt;From this we can see that the object is rooted by a static dictionary object.&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp; &lt;/span&gt;This maps to our understanding of the source code. &lt;/span&gt;&lt;span lang="EN-US"&gt;For a final check we will review the modules and see that &lt;span class="SpellE"&gt;DemoLibrary&lt;/span&gt; and &lt;span class="SpellE"&gt;AppDomainDemo&lt;/span&gt; are both still loaded even though it is no longer being used by our code.&lt;/span&gt;&lt;/em&gt;&lt;em style="mso-bidi-font-style: normal;"&gt;&lt;/em&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="color: black; line-height: 107%; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="color: black; line-height: 107%; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA;"&gt;0:003&amp;gt; lm&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span class="GramE"&gt;&lt;span style="color: black; line-height: 107%; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA;"&gt;start&lt;/span&gt;&lt;/span&gt;&lt;span style="color: black; line-height: 107%; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;end&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;module name&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="color: black; line-height: 107%; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA;"&gt;00000010`a5cc0000 00000010`a5cc6000&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span class="SpellE"&gt;AppDomainDemo&lt;/span&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;(deferred)&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="background: yellow; color: black; line-height: 107%; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: yellow;"&gt;00000010`a63f0000 00000010`a63f6000&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span class="SpellE"&gt;DemoLibrary&lt;/span&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;(deferred)&lt;/span&gt;&lt;span style="color: black; line-height: 107%; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="color: black; line-height: 107%; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA;"&gt;000007ff`47bc0000 000007ff`47cee000&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span class="SpellE"&gt;clrjit&lt;/span&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;(deferred)&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="color: black; line-height: 107%; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA;"&gt;...&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="color: black; line-height: 107%; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA;"&gt;000007ff`56b80000 000007ff`56d3e000&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span class="SpellE"&gt;ntdll&lt;/span&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;(private &lt;span class="SpellE"&gt;pdb&lt;/span&gt; symbols&lt;span class="GramE"&gt;)&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp; &lt;/span&gt;c&lt;/span&gt;:\windbg\privatesymbols\ntdll.pdb\FFC2810A1E6F4EC49B4E4A0257637EC62\ntdll.pdb&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="color: black; line-height: 107%; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="color: black; line-height: 107%; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA;"&gt;Unloaded modules:&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="color: black; line-height: 107%; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA;"&gt;000007ff`56420000 000007ff`565d0000&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;combase.dll&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;br /&gt;
&lt;p&gt;&lt;span style="background: white; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;&amp;nbsp;&lt;/span&gt;&lt;strong&gt;&lt;span style="background: white; color: #333399; font-size: medium; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;Back to the Basics&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;br /&gt;
&lt;p class="MsoNormal"&gt;&lt;span lang="EN-US"&gt;So what can we do to change this behavior?&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp; &lt;/span&gt;When I am done my batch and want to continue running in my application I do not need these objects around for the next 24 hours?&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;Well to free up this memory we can use &lt;span class="SpellE"&gt;AppDomains&lt;/span&gt;.&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp; &lt;/span&gt;Here is the same application modified slightly, without changing the library that will free the memory when we are done with it.&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp; &lt;/span&gt;We will create an &lt;span class="SpellE"&gt;AppDomain&lt;/span&gt; using the same security evidence as the default &lt;span class="SpellE"&gt;AppDomain&lt;/span&gt;, execute our code in that domain and then unload it.&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;br /&gt;
&lt;p class="MsoNormal"&gt;&lt;span lang="EN-US"&gt;Here is one way we can adjust the console application to solve this problem, without a need to change the library:&lt;/span&gt;&lt;/p&gt;
&lt;br /&gt;
&lt;p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none;"&gt;&lt;span class="GramE"&gt;&lt;span style="background: white; color: blue; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;namespace&lt;/span&gt;&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt; &lt;span class="SpellE"&gt;AppDomainDemo&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;{&lt;br /&gt;&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;span class="GramE"&gt;&lt;span style="background: white; color: blue; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;using&lt;/span&gt;&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt; System;&lt;br /&gt;&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;span class="GramE"&gt;&lt;span style="background: white; color: blue; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;using&lt;/span&gt;&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt; &lt;span class="SpellE"&gt;System.Diagnostics&lt;/span&gt;;&lt;br /&gt;&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;span class="GramE"&gt;&lt;span style="background: white; color: blue; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;using&lt;/span&gt;&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt; &lt;span class="SpellE"&gt;DemoLibrary&lt;/span&gt;;&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none;"&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;span class="GramE"&gt;&lt;span style="background: white; color: blue; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;class &lt;/span&gt;&lt;/span&gt;&lt;span style="background: white; color: #2b91af; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;Program&lt;br /&gt;&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;{&lt;br /&gt;&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;span class="GramE"&gt;&lt;span style="background: white; color: blue; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;static&lt;/span&gt;&lt;/span&gt;&lt;span style="background: white; color: blue; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;void&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt; Main(&lt;/span&gt;&lt;span style="background: white; color: blue; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;string&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;[] &lt;span class="SpellE"&gt;args&lt;/span&gt;)&lt;br /&gt;&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;{&lt;br /&gt;&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span class="SpellE"&gt;&lt;span class="GramE"&gt;ProcessRequestBatch&lt;/span&gt;&lt;/span&gt;&lt;span class="GramE"&gt;(&lt;/span&gt;);&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none;"&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;span style="background: white; color: green; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;// &lt;span class="GramE"&gt;Only&lt;/span&gt; added to force a collection for demonstration purposes, please do not do this in production&lt;br /&gt;&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;span style="background: white; color: green; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;// inducing a GC is typically not good a good practice&lt;br /&gt;&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;span class="SpellE"&gt;&lt;span class="GramE"&gt;&lt;span style="background: white; color: #2b91af; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;GC&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;.Collect&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="GramE"&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;(&lt;/span&gt;&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;);&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none;"&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;span class="SpellE"&gt;&lt;span class="GramE"&gt;&lt;span style="background: white; color: #2b91af; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;Console&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;.WriteLine&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="GramE"&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;(&lt;/span&gt;&lt;/span&gt;&lt;span style="background: white; color: #a31515; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;"Completed the batch press enter to continue"&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;);&lt;br /&gt;&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;span class="SpellE"&gt;&lt;span class="GramE"&gt;&lt;span style="background: white; color: #2b91af; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;Console&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;.ReadLine&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="GramE"&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;(&lt;/span&gt;&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;);&lt;br /&gt;&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;}&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none;"&gt;&amp;nbsp;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none;"&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;a name="OLE_LINK8"&gt;&lt;/a&gt;&lt;a name="OLE_LINK7"&gt;&lt;/a&gt;&lt;span class="GramE"&gt;&lt;span style="mso-bookmark: OLE_LINK7;"&gt;&lt;span style="mso-bookmark: OLE_LINK8;"&gt;&lt;span style="background: white; color: blue; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;private &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="mso-bookmark: OLE_LINK7;"&gt;&lt;span style="mso-bookmark: OLE_LINK8;"&gt;&lt;span style="background: white; color: blue; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;static &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="mso-bookmark: OLE_LINK7;"&gt;&lt;span style="mso-bookmark: OLE_LINK8;"&gt;&lt;span style="background: white; color: blue; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;void&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="mso-bookmark: OLE_LINK7;"&gt;&lt;span style="mso-bookmark: OLE_LINK8;"&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt; &lt;span class="SpellE"&gt;ProcessRequestBatch&lt;/span&gt;()&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="mso-bookmark: OLE_LINK7;"&gt;&lt;span style="mso-bookmark: OLE_LINK8;"&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;{&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="mso-bookmark: OLE_LINK7;"&gt;&lt;span style="mso-bookmark: OLE_LINK8;"&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="mso-bookmark: OLE_LINK7;"&gt;&lt;span style="mso-bookmark: OLE_LINK8;"&gt;&lt;span style="background: white; color: #2b91af; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;Stopwatch&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="mso-bookmark: OLE_LINK7;"&gt;&lt;span style="mso-bookmark: OLE_LINK8;"&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt; watch = &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="mso-bookmark: OLE_LINK7;"&gt;&lt;span style="mso-bookmark: OLE_LINK8;"&gt;&lt;span style="background: white; color: blue; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;new &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="mso-bookmark: OLE_LINK7;"&gt;&lt;span style="mso-bookmark: OLE_LINK8;"&gt;&lt;span class="GramE"&gt;&lt;span style="background: white; color: #2b91af; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;Stopwatch&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;(&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="mso-bookmark: OLE_LINK7;"&gt;&lt;span style="mso-bookmark: OLE_LINK8;"&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;);&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="mso-bookmark: OLE_LINK7;"&gt;&lt;span style="mso-bookmark: OLE_LINK8;"&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none;"&gt;&lt;span style="mso-bookmark: OLE_LINK7;"&gt;&lt;span style="mso-bookmark: OLE_LINK8;"&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span class="SpellE"&gt;&lt;span class="GramE"&gt;watch.Start&lt;/span&gt;&lt;/span&gt;&lt;span class="GramE"&gt;(&lt;/span&gt;);&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="mso-bookmark: OLE_LINK7;"&gt;&lt;span style="mso-bookmark: OLE_LINK8;"&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="mso-bookmark: OLE_LINK7;"&gt;&lt;span style="mso-bookmark: OLE_LINK8;"&gt;&lt;span class="SpellE"&gt;&lt;span style="background: white; color: #2b91af; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;AppDomain&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="mso-bookmark: OLE_LINK7;"&gt;&lt;span style="mso-bookmark: OLE_LINK8;"&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt; domain = &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="mso-bookmark: OLE_LINK7;"&gt;&lt;span style="mso-bookmark: OLE_LINK8;"&gt;&lt;span class="SpellE"&gt;&lt;span class="GramE"&gt;&lt;span style="background: white; color: #2b91af; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;AppDomain&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;.CreateDomain&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="mso-bookmark: OLE_LINK7;"&gt;&lt;span style="mso-bookmark: OLE_LINK8;"&gt;&lt;span class="GramE"&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;(&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="mso-bookmark: OLE_LINK7;"&gt;&lt;span style="mso-bookmark: OLE_LINK8;"&gt;&lt;span style="background: white; color: #a31515; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;"&lt;span class="SpellE"&gt;ProcessingDomain&lt;/span&gt;"&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="mso-bookmark: OLE_LINK7;"&gt;&lt;span style="mso-bookmark: OLE_LINK8;"&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;);&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="mso-bookmark: OLE_LINK7;"&gt;&lt;span style="mso-bookmark: OLE_LINK8;"&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="mso-bookmark: OLE_LINK7;"&gt;&lt;span style="mso-bookmark: OLE_LINK8;"&gt;&lt;span class="SpellE"&gt;&lt;span style="background: white; color: #2b91af; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;ProcessingWrapper&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="mso-bookmark: OLE_LINK7;"&gt;&lt;span style="mso-bookmark: OLE_LINK8;"&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt; &lt;span class="SpellE"&gt;demoProcessor&lt;/span&gt; = (&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="mso-bookmark: OLE_LINK7;"&gt;&lt;span style="mso-bookmark: OLE_LINK8;"&gt;&lt;span style="background: white; color: #2b91af; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;ProcessingWrapper&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="mso-bookmark: OLE_LINK7;"&gt;&lt;span style="mso-bookmark: OLE_LINK8;"&gt;&lt;span class="GramE"&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;)domain.CreateInstanceAndUnwrap&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="mso-bookmark: OLE_LINK7;"&gt;&lt;span style="mso-bookmark: OLE_LINK8;"&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;(&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="mso-bookmark: OLE_LINK7;"&gt;&lt;span style="mso-bookmark: OLE_LINK8;"&gt;&lt;span style="background: white; color: #2b91af; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;Assembly&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="mso-bookmark: OLE_LINK7;"&gt;&lt;span style="mso-bookmark: OLE_LINK8;"&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;.GetExecutingAssembly().FullName, &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="mso-bookmark: OLE_LINK7;"&gt;&lt;span style="mso-bookmark: OLE_LINK8;"&gt;&lt;span class="SpellE"&gt;&lt;span style="background: white; color: blue; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;typeof&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="mso-bookmark: OLE_LINK7;"&gt;&lt;span style="mso-bookmark: OLE_LINK8;"&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;(&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="mso-bookmark: OLE_LINK7;"&gt;&lt;span style="mso-bookmark: OLE_LINK8;"&gt;&lt;span class="SpellE"&gt;&lt;span style="background: white; color: #2b91af; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;ProcessingWrapper&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="mso-bookmark: OLE_LINK7;"&gt;&lt;span style="mso-bookmark: OLE_LINK8;"&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;).&lt;span class="SpellE"&gt;FullName&lt;/span&gt;);&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none;"&gt;&lt;span style="mso-bookmark: OLE_LINK7;"&gt;&lt;span style="mso-bookmark: OLE_LINK8;"&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span class="SpellE"&gt;&lt;span class="GramE"&gt;demoProcessor.ProcessRequestBatch&lt;/span&gt;&lt;/span&gt;&lt;span class="GramE"&gt;(&lt;/span&gt;);&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="mso-bookmark: OLE_LINK7;"&gt;&lt;span style="mso-bookmark: OLE_LINK8;"&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="mso-bookmark: OLE_LINK7;"&gt;&lt;span style="mso-bookmark: OLE_LINK8;"&gt;&lt;span class="SpellE"&gt;&lt;span class="GramE"&gt;&lt;span style="background: white; color: #2b91af; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;AppDomain&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;.Unload&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="mso-bookmark: OLE_LINK7;"&gt;&lt;span style="mso-bookmark: OLE_LINK8;"&gt;&lt;span class="GramE"&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;(&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="mso-bookmark: OLE_LINK7;"&gt;&lt;span style="mso-bookmark: OLE_LINK8;"&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;domain);&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none;"&gt;&lt;span style="mso-bookmark: OLE_LINK7;"&gt;&lt;span style="mso-bookmark: OLE_LINK8;"&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span class="SpellE"&gt;&lt;span class="GramE"&gt;watch.Stop&lt;/span&gt;&lt;/span&gt;&lt;span class="GramE"&gt;(&lt;/span&gt;);&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="mso-bookmark: OLE_LINK7;"&gt;&lt;span style="mso-bookmark: OLE_LINK8;"&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none;"&gt;&lt;span style="mso-bookmark: OLE_LINK7;"&gt;&lt;span style="mso-bookmark: OLE_LINK8;"&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="mso-bookmark: OLE_LINK7;"&gt;&lt;span style="mso-bookmark: OLE_LINK8;"&gt;&lt;span class="SpellE"&gt;&lt;span class="GramE"&gt;&lt;span style="background: white; color: #2b91af; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;Console&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;.WriteLine&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="mso-bookmark: OLE_LINK7;"&gt;&lt;span style="mso-bookmark: OLE_LINK8;"&gt;&lt;span class="GramE"&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;(&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="mso-bookmark: OLE_LINK7;"&gt;&lt;span style="mso-bookmark: OLE_LINK8;"&gt;&lt;span style="background: white; color: #a31515; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;"The processing took &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="mso-bookmark: OLE_LINK7;"&gt;&lt;span style="mso-bookmark: OLE_LINK8;"&gt;&lt;span style="background: white; color: mediumseagreen; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;{0}&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="mso-bookmark: OLE_LINK7;"&gt;&lt;span style="mso-bookmark: OLE_LINK8;"&gt;&lt;span style="background: white; color: #a31515; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt; &lt;span class="SpellE"&gt;ms&lt;/span&gt; to complete."&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="mso-bookmark: OLE_LINK7;"&gt;&lt;span style="mso-bookmark: OLE_LINK8;"&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;, &lt;span class="SpellE"&gt;watch.ElapsedMilliseconds&lt;/span&gt;);&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="mso-bookmark: OLE_LINK7;"&gt;&lt;span style="mso-bookmark: OLE_LINK8;"&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;}&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="mso-bookmark: OLE_LINK7;"&gt;&lt;span style="mso-bookmark: OLE_LINK8;"&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none;"&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;span class="GramE"&gt;&lt;span style="background: white; color: blue; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;public &lt;/span&gt;&lt;/span&gt;&lt;span style="background: white; color: blue; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;sealed &lt;/span&gt;&lt;span style="background: white; color: blue; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;class &lt;/span&gt;&lt;span class="SpellE"&gt;&lt;span style="background: white; color: #2b91af; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;ProcessingWrapper&lt;/span&gt;&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt; : &lt;/span&gt;&lt;span class="SpellE"&gt;&lt;span style="background: white; color: #2b91af; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;MarshalByRefObject&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;{&lt;br /&gt;&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;span class="GramE"&gt;&lt;span style="background: white; color: blue; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;public&lt;/span&gt;&lt;/span&gt;&lt;span style="background: white; color: blue; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;void&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt; &lt;span class="SpellE"&gt;ProcessRequestBatch&lt;/span&gt;()&lt;br /&gt;&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;{&lt;br /&gt;&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;span style="background: white; color: #2b91af; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;Processor&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt; &lt;span class="SpellE"&gt;demoProcessor&lt;/span&gt; = &lt;/span&gt;&lt;span style="background: white; color: blue; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;new&lt;/span&gt;&lt;span class="GramE"&gt;&lt;span style="background: white; color: #2b91af; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;Processor&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;(&lt;/span&gt;&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;);&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none;"&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;span class="GramE"&gt;&lt;span style="background: white; color: blue; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;for&lt;/span&gt;&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt; (&lt;/span&gt;&lt;span class="SpellE"&gt;&lt;span style="background: white; color: blue; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;int&lt;/span&gt;&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt; index = 0; index &amp;lt; 10000; index++)&lt;br /&gt;&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;{&lt;br /&gt;&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;span class="SpellE"&gt;&lt;span class="GramE"&gt;&lt;span style="background: white; color: blue; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;int&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt; id = index % 5000;&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none;"&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;span class="SpellE"&gt;&lt;span class="GramE"&gt;&lt;span style="background: white; color: #2b91af; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;Console&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;.WriteLine&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="GramE"&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;(&lt;/span&gt;&lt;/span&gt;&lt;span class="SpellE"&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;demoProcessor.ProcessRequest&lt;/span&gt;&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;(id));&lt;br /&gt;&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;}&lt;br /&gt;&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;}&lt;br /&gt;&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;}&lt;br /&gt;&lt;/span&gt;&lt;span style="background: white; color: black; line-height: 107%; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;}&lt;/span&gt;&lt;/p&gt;
&lt;br /&gt;
&lt;p class="MsoNormal"&gt;&lt;span lang="EN-US"&gt;In order to make it so we can execute an assembly in a separate &lt;span class="SpellE"&gt;AppDomain&lt;/span&gt; we need to inherit from the &lt;span class="SpellE"&gt;MarshalByRefObject&lt;/span&gt; base class.&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp; &lt;/span&gt;I am attempting to make as few changes to the core library as possible so I have decided to move my loop into a separate class named &lt;span class="SpellE"&gt;ProcessingWrapper&lt;/span&gt; that inherits from it.&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp; &lt;/span&gt;The code within this &lt;span class="SpellE"&gt;MarhsalByRefObject&lt;/span&gt; is virtually identical to the code that as calling it before, without the instrumentation seeing it is more relevant in the default &lt;span class="SpellE"&gt;AppDomain&lt;/span&gt;.&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;br /&gt;
&lt;p class="MsoNormal"&gt;&lt;span lang="EN-US"&gt;In order to call the assembly in a separate &lt;span class="SpellE"&gt;AppDomain&lt;/span&gt; we must first create one with the appropriate permissions.&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp; &lt;/span&gt;I am not doing this for security reasons so I will use the same permissions and application root in the processing &lt;span class="SpellE"&gt;AppDomain&lt;/span&gt; as the default.&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp; &lt;/span&gt;In order to instantiate the type in the new &lt;span class="SpellE"&gt;AppDomain&lt;/span&gt; we call the &lt;span class="SpellE"&gt;CreateInstanceAndUnwrap&lt;/span&gt;, after which it is business as usual until I perform the final unload when my processing is done.&lt;/span&gt;&lt;/p&gt;
&lt;br /&gt;
&lt;p class="MsoNormal"&gt;&lt;span lang="EN-US"&gt;So now that we have seen the modifications how does that impact our application?&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span lang="EN-US"&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;strong style="mso-bidi-font-weight: normal;"&gt;&lt;span style="color: red;" lang="EN-US"&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-34-77-20130521/7848.AppDomainImage3.png"&gt;&lt;img src="http://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-01-34-77-20130521/7848.AppDomainImage3.png" alt="" border="0" /&gt;&lt;/a&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span lang="EN-US"&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span lang="EN-US"&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span lang="EN-US"&gt;As you can see from the console this iteration took 2057ms and was executed from the &lt;span class="SpellE"&gt;ProcessingDomain&lt;/span&gt; &lt;span class="SpellE"&gt;AppDomain&lt;/span&gt;.&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp; &lt;/span&gt;If we were to have created an &lt;span class="SpellE"&gt;AppDomain&lt;/span&gt; with every call to the Processor we would have seen a significant performance impact here.&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span lang="EN-US"&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;strong style="mso-bidi-font-weight: normal;"&gt;&lt;span style="color: red;" lang="EN-US"&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-34-77-20130521/2352.AppDomainImage4.png"&gt;&lt;img src="http://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-01-34-77-20130521/2352.AppDomainImage4.png" alt="" border="0" /&gt;&lt;/a&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span lang="EN-US"&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span lang="EN-US"&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span lang="EN-US"&gt;In the task manager we can see that the memory has dropped back down to 10.4 MB as the &lt;span class="SpellE"&gt;AppDomain&lt;/span&gt; was released.&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp; &lt;/span&gt;The memory may still be high after the &lt;span class="SpellE"&gt;AppDomain&lt;/span&gt; releases until the next garbage collection and this is why we introduced the &lt;span class="SpellE"&gt;GC.Collect&lt;/span&gt;().&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;br /&gt;
&lt;p class="MsoNormal"&gt;&lt;span lang="EN-US"&gt;Now that we have seen the memory gets released, what does it actually look like?&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp; &lt;/span&gt;I reran the application and attached a &lt;span class="SpellE"&gt;WinDBG&lt;/span&gt; to it partway through the run to get the best snapshot of memory mid processing and will then look at it after the run as we did before.&lt;/span&gt;&lt;/p&gt;
&lt;br /&gt;
&lt;p&gt;&lt;strong&gt;&lt;span style="background: white; color: #333399; font-size: medium; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;In Memory&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;br /&gt;
&lt;p class="MsoNormal"&gt;&lt;span lang="EN-US"&gt;0:007&lt;span class="GramE"&gt;&amp;gt; !&lt;span class="SpellE"&gt;DumpHeap&lt;/span&gt;&lt;/span&gt; -stat&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span lang="EN-US"&gt;Statistics:&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span lang="EN-US"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;MT&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;Count&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span class="SpellE"&gt;TotalSize&lt;/span&gt; Class Name&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span lang="EN-US"&gt;000007f900ad4be0&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;1&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;24 &lt;span class="SpellE"&gt;System.Threading.TimerHolder&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span lang="EN-US"&gt;&amp;hellip;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span lang="EN-US"&gt;000007f900abf108&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;3387&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;81288 System.Int32&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="background: yellow; mso-highlight: yellow;" lang="EN-US"&gt;000007f8a2864e20&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;5000&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;120000 &lt;span class="SpellE"&gt;DemoLibrary.MyCachedObject&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span lang="EN-US"&gt;000007f900aa0630&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;1765&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;159728 &lt;span class="SpellE"&gt;&lt;span class="GramE"&gt;System.Object&lt;/span&gt;&lt;/span&gt;&lt;span class="GramE"&gt;[]&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span lang="EN-US"&gt;000007f8a2865718&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;2&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;299280 System.Collections.Generic.Dictionary`2+&lt;span class="GramE"&gt;Entry[&lt;/span&gt;[System.Int32, &lt;span class="SpellE"&gt;mscorlib&lt;/span&gt;],[&lt;span class="SpellE"&gt;DemoLibrary.MyCachedObject&lt;/span&gt;, &lt;span class="SpellE"&gt;DemoLibrary&lt;/span&gt;]][]&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span lang="EN-US"&gt;000007f900abd5e0&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;1709&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;412384 &lt;span class="SpellE"&gt;&lt;span class="GramE"&gt;System.Char&lt;/span&gt;&lt;/span&gt;&lt;span class="GramE"&gt;[]&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span lang="EN-US"&gt;000007f900abc358&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;7032&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;636788 &lt;span class="SpellE"&gt;System.String&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span lang="EN-US"&gt;0000002f5f40b0e0&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;5155&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;3792654&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;Free&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span lang="EN-US"&gt;000007f900ac04d0&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;5005&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;240021562 &lt;span class="SpellE"&gt;&lt;span class="GramE"&gt;System.Byte&lt;/span&gt;&lt;/span&gt;&lt;span class="GramE"&gt;[]&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span lang="EN-US"&gt;Total 29505 objects&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span lang="EN-US"&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;em style="mso-bidi-font-style: normal;"&gt;&lt;span lang="EN-US"&gt;When we look at the heap statistics output above we notice that our cached object is on the heap at this point just as before.&lt;/span&gt;&lt;/em&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span lang="EN-US"&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span lang="EN-US"&gt;0:007&lt;span class="GramE"&gt;&amp;gt; !&lt;span class="SpellE"&gt;DumpHeap&lt;/span&gt;&lt;/span&gt; -type &lt;span class="SpellE"&gt;DemoLibrary.MyCachedObject&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span lang="EN-US"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;Address&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;MT&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;Size&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="mso-ansi-language: ES-US;" lang="ES-US"&gt;0000002f618a1e18 000007f8a2864ec0&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;80&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="mso-ansi-language: ES-US;" lang="ES-US"&gt;&amp;hellip; &lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="mso-ansi-language: ES-US;" lang="ES-US"&gt;0000002f7013c9b0 000007f8a2864e20&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;24&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="background: yellow; mso-ansi-language: ES-US; mso-highlight: yellow;" lang="ES-US"&gt;0000002f701454c0 000007f8a2864e20&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;24&lt;/span&gt;&lt;span style="mso-ansi-language: ES-US;" lang="ES-US"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span lang="EN-US"&gt;0000002f7189f838 000007f8a2865718&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;97200&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span lang="EN-US"&gt;0000002f718b73e8 000007f8a2865718&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;202080&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span lang="EN-US"&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span lang="EN-US"&gt;Statistics:&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span lang="EN-US"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;MT&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;Count&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span class="SpellE"&gt;TotalSize&lt;/span&gt; Class Name&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span lang="EN-US"&gt;000007f8a2864ec0&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;1&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;80 System.Collections.Generic.Dictionary`2[[System.Int32, &lt;span class="SpellE"&gt;mscorlib&lt;/span&gt;]&lt;span class="GramE"&gt;,[&lt;/span&gt;&lt;span class="SpellE"&gt;DemoLibrary.MyCachedObject&lt;/span&gt;, &lt;span class="SpellE"&gt;DemoLibrary&lt;/span&gt;]]&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span lang="EN-US"&gt;000007f8a2864e20&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;5000&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;120000 &lt;span class="SpellE"&gt;DemoLibrary.MyCachedObject&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span lang="EN-US"&gt;000007f8a2865718&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;2&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;299280 System.Collections.Generic.Dictionary`2+&lt;span class="GramE"&gt;Entry[&lt;/span&gt;[System.Int32, &lt;span class="SpellE"&gt;mscorlib&lt;/span&gt;],[&lt;span class="SpellE"&gt;DemoLibrary.MyCachedObject&lt;/span&gt;, &lt;span class="SpellE"&gt;DemoLibrary&lt;/span&gt;]][]&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span lang="EN-US"&gt;Total 5003 objects&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span lang="EN-US"&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;em style="mso-bidi-font-style: normal;"&gt;&lt;span lang="EN-US"&gt;We review a few more details about the instances of my cached object and find one we are interested in looking deeper at.&lt;/span&gt;&lt;/em&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span lang="EN-US"&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span lang="EN-US"&gt;0:007&lt;span class="GramE"&gt;&amp;gt; !&lt;span class="SpellE"&gt;FindAppDomain&lt;/span&gt;&lt;/span&gt; 0x0000002f701454c0&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span class="SpellE"&gt;&lt;span lang="EN-US"&gt;AppDomain&lt;/span&gt;&lt;/span&gt;&lt;span lang="EN-US"&gt;: 0000002f5f470ae0&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="background: yellow; mso-highlight: yellow;" lang="EN-US"&gt;Name:&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span class="SpellE"&gt;ProcessingDomain&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span lang="EN-US"&gt;ID:&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;2&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span lang="EN-US"&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;em style="mso-bidi-font-style: normal;"&gt;&lt;span lang="EN-US"&gt;The object is rooted in &lt;span class="SpellE"&gt;ProcessingDomain&lt;/span&gt; &lt;span class="SpellE"&gt;AppDomain&lt;/span&gt; as we had intended.&lt;/span&gt;&lt;/em&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span lang="EN-US"&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span lang="EN-US"&gt;0:007&lt;span class="GramE"&gt;&amp;gt; !&lt;span class="SpellE"&gt;DumpDomain&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span lang="EN-US"&gt;--------------------------------------&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span lang="EN-US"&gt;Domain 1:&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;0000002f5f423520&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span class="SpellE"&gt;&lt;span lang="EN-US"&gt;LowFrequencyHeap&lt;/span&gt;&lt;/span&gt;&lt;span lang="EN-US"&gt;:&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;0000002f5f423cd8&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span class="SpellE"&gt;&lt;span lang="EN-US"&gt;HighFrequencyHeap&lt;/span&gt;&lt;/span&gt;&lt;span lang="EN-US"&gt;:&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp; &lt;/span&gt;0000002f5f423d60&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span class="SpellE"&gt;&lt;span lang="EN-US"&gt;StubHeap&lt;/span&gt;&lt;/span&gt;&lt;span lang="EN-US"&gt;:&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;0000002f5f423de8&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span lang="EN-US"&gt;Stage:&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;OPEN&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span class="SpellE"&gt;&lt;span lang="EN-US"&gt;SecurityDescriptor&lt;/span&gt;&lt;/span&gt;&lt;span lang="EN-US"&gt;: 0000002f5f4101a0&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="background: yellow; mso-highlight: yellow;" lang="EN-US"&gt;Name:&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;AppDomainDemo.exe&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span lang="EN-US"&gt;Assembly:&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;0000002f5f4147c0 [C:\Windows\Microsoft.Net\assembly\GAC_64\mscorlib\v4.0_4.0.0.0__b77a5c561934e089\mscorlib.dll]&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span lang="EN-US"&gt;&amp;hellip;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span lang="EN-US"&gt;--------------------------------------&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span lang="EN-US"&gt;Domain 2:&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;0000002f5f470ae0&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span class="SpellE"&gt;&lt;span lang="EN-US"&gt;LowFrequencyHeap&lt;/span&gt;&lt;/span&gt;&lt;span lang="EN-US"&gt;:&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp; &lt;/span&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&lt;/span&gt;0000002f5f471298&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span class="SpellE"&gt;&lt;span lang="EN-US"&gt;HighFrequencyHeap&lt;/span&gt;&lt;/span&gt;&lt;span lang="EN-US"&gt;:&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp; &lt;/span&gt;0000002f5f471320&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span class="SpellE"&gt;&lt;span lang="EN-US"&gt;StubHeap&lt;/span&gt;&lt;/span&gt;&lt;span lang="EN-US"&gt;:&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;0000002f5f4713a8&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span lang="EN-US"&gt;Stage:&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;OPEN&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span class="SpellE"&gt;&lt;span lang="EN-US"&gt;SecurityDescriptor&lt;/span&gt;&lt;/span&gt;&lt;span lang="EN-US"&gt;: 0000002f5f40f700&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="background: yellow; mso-highlight: yellow;" lang="EN-US"&gt;Name:&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span class="SpellE"&gt;ProcessingDomain&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span lang="EN-US"&gt;Assembly:&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;0000002f5f4147c0 [C:\Windows\Microsoft.Net\assembly\GAC_64\mscorlib\v4.0_4.0.0.0__b77a5c561934e089\mscorlib.dll]&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span lang="EN-US"&gt;&amp;hellip;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span lang="EN-US"&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;em style="mso-bidi-font-style: normal;"&gt;&lt;span lang="EN-US"&gt;Notice from the output above that there are two &lt;span class="SpellE"&gt;AppDomains&lt;/span&gt; now (excluding the shared which we will not discuss in this article), one is the Default &lt;span class="SpellE"&gt;AppDomain&lt;/span&gt; and the other is the Processing &lt;span class="SpellE"&gt;AppDomain&lt;/span&gt; we created in our code.&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp; &lt;/span&gt;The &lt;span class="SpellE"&gt;ProcessingDomain&lt;/span&gt; &lt;span class="SpellE"&gt;AppDomain&lt;/span&gt; is where we executed our library.&lt;/span&gt;&lt;/em&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span lang="EN-US"&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span lang="EN-US"&gt;0:007&amp;gt; lm&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span class="GramE"&gt;&lt;span lang="EN-US"&gt;start&lt;/span&gt;&lt;/span&gt;&lt;span lang="EN-US"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;end&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;module name&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="background: yellow; mso-highlight: yellow;" lang="EN-US"&gt;0000002f`5eee0000 0000002f`5eee6000&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span class="SpellE"&gt;AppDomainDemo&lt;/span&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;(deferred)&lt;/span&gt;&lt;span lang="EN-US"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="background: yellow; mso-highlight: yellow;" lang="EN-US"&gt;0000002f`5f6d0000 0000002f`5f6d6000&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span class="SpellE"&gt;DemoLibrary&lt;/span&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;(deferred)&lt;/span&gt;&lt;span lang="EN-US"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span lang="EN-US"&gt;000007f8`f95b0000 000007f8`f96de000&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span class="SpellE"&gt;clrjit&lt;/span&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;(deferred)&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span lang="EN-US"&gt;&amp;hellip;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span lang="EN-US"&gt;000007f9`0f8d0000 000007f9`0fa8e000&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span class="SpellE"&gt;ntdll&lt;/span&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;(private &lt;span class="SpellE"&gt;pdb&lt;/span&gt; symbols&lt;span class="GramE"&gt;)&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp; &lt;/span&gt;c&lt;/span&gt;:\windbg\privatesymbols\ntdll.pdb\FFC2810A1E6F4EC49B4E4A0257637EC62\ntdll.pdb&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span lang="EN-US"&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span lang="EN-US"&gt;Unloaded modules:&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span lang="EN-US"&gt;000007f9`0ec20000 000007f9`0edd0000&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;combase.dll&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span lang="EN-US"&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;em style="mso-bidi-font-style: normal;"&gt;&lt;span lang="EN-US"&gt;Finally reviewing the modules you will notice that at this point there is no change really other than the code was executed in another &lt;span class="SpellE"&gt;AppDomain&lt;/span&gt;, the library is still in memory and the process is still consuming the memory from caching.&lt;/span&gt;&lt;/em&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;em style="mso-bidi-font-style: normal;"&gt;&lt;span lang="EN-US"&gt;So now let&amp;rsquo;s look at the memory after it has finished processing, unloaded the &lt;span class="SpellE"&gt;AppDomain&lt;/span&gt; and performed a garbage collection.&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp; &lt;/span&gt;Remember the &lt;span class="SpellE"&gt;AppDomains&lt;/span&gt; are still using the generational heaps and as such even though the &lt;span class="SpellE"&gt;AppDomain&lt;/span&gt; may be gone, until the Garbage Collector finds it has no more roots and cleans it up the memory is still being held.&lt;/span&gt;&lt;/em&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span lang="EN-US"&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span lang="EN-US"&gt;0:006&lt;span class="GramE"&gt;&amp;gt; !&lt;span class="SpellE"&gt;DumpHeap&lt;/span&gt;&lt;/span&gt; -stat&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span lang="EN-US"&gt;Statistics:&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span lang="EN-US"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;MT&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;Count&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span class="SpellE"&gt;TotalSize&lt;/span&gt; Class Name&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span lang="EN-US"&gt;000007f900ad13d8&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;1&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;24 System.Int64&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span lang="EN-US"&gt;000007f900ac14b0&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;1&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;24 System.Collections.Generic.GenericEqualityComparer`1[[System.String, &lt;span class="SpellE"&gt;mscorlib&lt;/span&gt;]]&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span lang="EN-US"&gt;000007f900abc588&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;1&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;160 &lt;span class="SpellE"&gt;System.Exception&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span lang="EN-US"&gt;000007f900abb7b0&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;3&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;192 &lt;span class="SpellE"&gt;System.Reflection.MemberFilter&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span lang="EN-US"&gt;&amp;hellip;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span lang="EN-US"&gt;000007f900abc0f0&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;7&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;768 &lt;span class="SpellE"&gt;System.Collections.Hashtable+&lt;span class="GramE"&gt;bucket&lt;/span&gt;&lt;/span&gt;&lt;span class="GramE"&gt;[]&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span lang="EN-US"&gt;000007f900ac0f48&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;3&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;1608 &lt;span class="SpellE"&gt;System.Globalization.CultureData&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span lang="EN-US"&gt;000007f900abd5e0&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;9&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;4004 &lt;span class="SpellE"&gt;&lt;span class="GramE"&gt;System.Char&lt;/span&gt;&lt;/span&gt;&lt;span class="GramE"&gt;[]&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span lang="EN-US"&gt;000007f900abe648&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;95&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;5320 &lt;span class="SpellE"&gt;System.RuntimeType&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span lang="EN-US"&gt;000007f900abc358&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;237&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;11906 &lt;span class="SpellE"&gt;System.String&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span lang="EN-US"&gt;000007f900aa0630&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;41&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;37312 &lt;span class="SpellE"&gt;&lt;span class="GramE"&gt;System.Object&lt;/span&gt;&lt;/span&gt;&lt;span class="GramE"&gt;[]&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span lang="EN-US"&gt;Total 549 objects&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span lang="EN-US"&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;em style="mso-bidi-font-style: normal;"&gt;&lt;span lang="EN-US"&gt;The first point to note is that when we dump the heap statistics we do not see any of our cached objects.&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp; &lt;/span&gt;Just to be sure that we did not miss them we will dump all of the objects of the cached object type.&lt;/span&gt;&lt;/em&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span lang="EN-US"&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span lang="EN-US"&gt;0:006&lt;span class="GramE"&gt;&amp;gt; !&lt;span class="SpellE"&gt;DumpHeap&lt;/span&gt;&lt;/span&gt; -type &lt;span class="SpellE"&gt;DemoLibrary.MyCachedObject&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span lang="EN-US"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;Address&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;MT&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;Size&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span lang="EN-US"&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span lang="EN-US"&gt;Statistics:&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span lang="EN-US"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;MT&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;Count&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span class="SpellE"&gt;TotalSize&lt;/span&gt; Class Name&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="background: yellow; mso-highlight: yellow;" lang="EN-US"&gt;Total 0 objects&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span lang="EN-US"&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;em style="mso-bidi-font-style: normal;"&gt;&lt;span lang="EN-US"&gt;This confirms that none of our cached objects are on the heap.&lt;/span&gt;&lt;/em&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span lang="EN-US"&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span lang="EN-US"&gt;0:006&lt;span class="GramE"&gt;&amp;gt; !&lt;span class="SpellE"&gt;DumpDomain&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span lang="EN-US"&gt;--------------------------------------&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span lang="EN-US"&gt;Domain 1:&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;0000002f5f423520&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span class="SpellE"&gt;&lt;span lang="EN-US"&gt;LowFrequencyHeap&lt;/span&gt;&lt;/span&gt;&lt;span lang="EN-US"&gt;:&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;0000002f5f423cd8&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span class="SpellE"&gt;&lt;span lang="EN-US"&gt;HighFrequencyHeap&lt;/span&gt;&lt;/span&gt;&lt;span lang="EN-US"&gt;:&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp; &lt;/span&gt;0000002f5f423d60&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span class="SpellE"&gt;&lt;span lang="EN-US"&gt;StubHeap&lt;/span&gt;&lt;/span&gt;&lt;span lang="EN-US"&gt;:&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;0000002f5f423de8&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span lang="EN-US"&gt;Stage:&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;OPEN&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span class="SpellE"&gt;&lt;span lang="EN-US"&gt;SecurityDescriptor&lt;/span&gt;&lt;/span&gt;&lt;span lang="EN-US"&gt;: 0000002f5f4101a0&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="background: yellow; mso-highlight: yellow;" lang="EN-US"&gt;Name:&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;AppDomainDemo.exe&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span lang="EN-US"&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;em style="mso-bidi-font-style: normal;"&gt;&lt;span lang="EN-US"&gt;At this point we no longer have the second &lt;span class="SpellE"&gt;AppDomain&lt;/span&gt;, it has been unloaded from memory and the related objects have been cleaned up by the garbage collector.&lt;/span&gt;&lt;/em&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span lang="EN-US"&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span lang="EN-US"&gt;0:006&amp;gt; lm&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span class="GramE"&gt;&lt;span lang="EN-US"&gt;start&lt;/span&gt;&lt;/span&gt;&lt;span lang="EN-US"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;end&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;module name&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span lang="EN-US"&gt;0000002f`5eee0000 0000002f`5eee6000&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span class="SpellE"&gt;AppDomainDemo&lt;/span&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;(deferred)&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="background: yellow; mso-highlight: yellow;" lang="EN-US"&gt;0000002f`5f6d0000 0000002f`5f6d6000&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span class="SpellE"&gt;DemoLibrary&lt;/span&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;(deferred)&lt;/span&gt;&lt;span lang="EN-US"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span lang="EN-US"&gt;000007f8`f95b0000 000007f8`f96de000&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span class="SpellE"&gt;clrjit&lt;/span&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;(deferred)&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span lang="EN-US"&gt;&amp;hellip;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span lang="EN-US"&gt;000007f9`0f8d0000 000007f9`0fa8e000&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span class="SpellE"&gt;ntdll&lt;/span&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;(private &lt;span class="SpellE"&gt;pdb&lt;/span&gt; symbols&lt;span class="GramE"&gt;)&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp; &lt;/span&gt;c&lt;/span&gt;:\windbg\privatesymbols\ntdll.pdb\FFC2810A1E6F4EC49B4E4A0257637EC62\ntdll.pdb&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span lang="EN-US"&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span lang="EN-US"&gt;Unloaded modules:&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span lang="EN-US"&gt;000007f9`0ec20000 000007f9`0edd0000&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;combase.dll&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span lang="EN-US"&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;em style="mso-bidi-font-style: normal;"&gt;&lt;span lang="EN-US"&gt;You may be saying right about now, wait, hold on, I would have thought that the &lt;span class="SpellE"&gt;DemoLibrary&lt;/span&gt; would be an unloaded module seeing the &lt;span class="SpellE"&gt;AppDomain&lt;/span&gt; is gone?&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp; &lt;/span&gt;What is going on?&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp; &lt;/span&gt;Well the way I built the code has the console application still with a reference to the &lt;span class="SpellE"&gt;DemoLibrary&lt;/span&gt; and any related static variables to the use of that library from the &lt;span class="SpellE"&gt;AppDomainDemo&lt;/span&gt; will still be rooted and therefore the module is not unloaded.&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp; &lt;/span&gt;This means that the data portion of memory associated with the &lt;span class="SpellE"&gt;ProcessingDomain&lt;/span&gt; &lt;span class="SpellE"&gt;AppDomains&lt;/span&gt; use is released though.&lt;/span&gt;&lt;/em&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span lang="EN-US"&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="color: #333399;"&gt;&lt;strong&gt;&lt;span style="font-size: medium;" lang="EN-US"&gt;Back to the Basics&lt;/span&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span lang="EN-US"&gt;So let&amp;rsquo;s change things up here and consider the scenario where we want to make use of that same library but don&amp;rsquo;t fully trust it.&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp; &lt;/span&gt;Sometimes when we take assemblies from other sources they could modify registry or other core system settings etc. without us knowing if the assembly that is making use of them is full trust.&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp; &lt;/span&gt;To protect against that we will start with our previously modified console and use the &lt;span class="SpellE"&gt;AppDomain&lt;/span&gt; as a security sandbox instead.&lt;/span&gt;&lt;/p&gt;
&lt;br /&gt;
&lt;p class="MsoNormal"&gt;&lt;span lang="EN-US"&gt;The only piece that we need to change is the &lt;span class="SpellE"&gt;ProcessRequestBatch&lt;/span&gt; method where we create the &lt;span class="SpellE"&gt;AppDomain&lt;/span&gt;.&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp; &lt;/span&gt;We will run in the &lt;span class="SpellE"&gt;AppDomain&lt;/span&gt; first with all of the code explicitly set to run it in the &amp;ldquo;Trusted&amp;rdquo; zone, then with the change of a single line of code we will reduce the permissions.&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp; &lt;/span&gt;In fact when we reduce the permissions it will fail because it will try to load our console application assembly which it does not have rights to do, even though it is copied into the same application directory.&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;br /&gt;
&lt;p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none;"&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;span class="GramE"&gt;&lt;span style="background: white; color: blue; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;private &lt;/span&gt;&lt;/span&gt;&lt;span style="background: white; color: blue; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;static &lt;/span&gt;&lt;span style="background: white; color: blue; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;void&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt; &lt;span class="SpellE"&gt;ProcessRequestBatch&lt;/span&gt;()&lt;br /&gt;&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;{&lt;br /&gt;&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;span class="SpellE"&gt;&lt;span class="GramE"&gt;&lt;span style="background: white; color: blue; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;const&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="background: white; color: blue; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;string&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt; &lt;span class="SpellE"&gt;DirectoryName&lt;/span&gt; = &lt;/span&gt;&lt;span style="background: white; color: #a31515; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;@"C:\Test"&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;;&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none;"&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;span style="background: white; color: #2b91af; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;Stopwatch&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt; watch = &lt;/span&gt;&lt;span style="background: white; color: blue; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;new&lt;/span&gt;&lt;span class="GramE"&gt;&lt;span style="background: white; color: #2b91af; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;Stopwatch&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;(&lt;/span&gt;&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;);&lt;br /&gt;&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span class="SpellE"&gt;&lt;span class="GramE"&gt;watch.Start&lt;/span&gt;&lt;/span&gt;&lt;span class="GramE"&gt;(&lt;/span&gt;);&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none;"&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;span style="background: white; color: green; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;// &lt;span class="GramE"&gt;Create&lt;/span&gt; the permission set found in the Trusted zone&lt;br /&gt;&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;span style="background: white; color: #2b91af; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;Evidence&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt; &lt;span class="SpellE"&gt;domainEvidence&lt;/span&gt; = &lt;/span&gt;&lt;span style="background: white; color: blue; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;new&lt;/span&gt;&lt;span class="GramE"&gt;&lt;span style="background: white; color: #2b91af; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;Evidence&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;(&lt;/span&gt;&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;);&lt;br /&gt;&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span class="SpellE"&gt;&lt;span class="GramE"&gt;domainEvidence.AddHostEvidence&lt;/span&gt;&lt;/span&gt;&lt;span class="GramE"&gt;(&lt;/span&gt;&lt;/span&gt;&lt;span style="background: white; color: blue; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;new&lt;/span&gt;&lt;span style="background: white; color: #2b91af; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;Zone&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;(&lt;/span&gt;&lt;span class="SpellE"&gt;&lt;span style="background: white; color: #2b91af; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;SecurityZone&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;.Trusted&lt;/span&gt;&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;));&lt;br /&gt;&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;span class="SpellE"&gt;&lt;span style="background: white; color: #2b91af; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;PermissionSet&lt;/span&gt;&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt; permissions = &lt;/span&gt;&lt;span class="SpellE"&gt;&lt;span class="GramE"&gt;&lt;span style="background: white; color: #2b91af; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;SecurityManager&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;.GetStandardSandbox&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="GramE"&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;(&lt;/span&gt;&lt;/span&gt;&lt;span class="SpellE"&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;domainEvidence&lt;/span&gt;&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;);&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none;"&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;span style="background: white; color: green; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;// &lt;span class="GramE"&gt;Create&lt;/span&gt; the directory to be used as the sandbox and copy the soon to be untrusted assembly to it&lt;br /&gt;&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;span class="GramE"&gt;&lt;span style="background: white; color: blue; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;if&lt;/span&gt;&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt; (!&lt;/span&gt;&lt;span class="SpellE"&gt;&lt;span style="background: white; color: #2b91af; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;Directory&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;.Exists&lt;/span&gt;&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;(&lt;span class="SpellE"&gt;DirectoryName&lt;/span&gt;)) &lt;/span&gt;&lt;span class="SpellE"&gt;&lt;span style="background: white; color: #2b91af; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;Directory&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;.CreateDirectory&lt;/span&gt;&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;(&lt;span class="SpellE"&gt;DirectoryName&lt;/span&gt;);&lt;br /&gt;&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;span class="GramE"&gt;&lt;span style="background: white; color: blue; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;string&lt;/span&gt;&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt; &lt;span class="SpellE"&gt;untrustedAssemblyPath&lt;/span&gt; = &lt;/span&gt;&lt;span class="SpellE"&gt;&lt;span style="background: white; color: #2b91af; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;Assembly&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;.GetAssembly&lt;/span&gt;&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;(&lt;/span&gt;&lt;span class="SpellE"&gt;&lt;span style="background: white; color: blue; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;typeof&lt;/span&gt;&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;(&lt;/span&gt;&lt;span style="background: white; color: #2b91af; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;Processor&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;)).Location;&lt;br /&gt;&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;span class="SpellE"&gt;&lt;span class="GramE"&gt;&lt;span style="background: white; color: #2b91af; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;File&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;.Copy&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="GramE"&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;(&lt;/span&gt;&lt;/span&gt;&lt;span class="SpellE"&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;untrustedAssemblyPath&lt;/span&gt;&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;, &lt;/span&gt;&lt;span class="SpellE"&gt;&lt;span style="background: white; color: #2b91af; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;Path&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;.Combine&lt;/span&gt;&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;(&lt;span class="SpellE"&gt;DirectoryName&lt;/span&gt;, &lt;/span&gt;&lt;span class="SpellE"&gt;&lt;span style="background: white; color: #2b91af; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;Path&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;.GetFileName&lt;/span&gt;&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;(&lt;span class="SpellE"&gt;untrustedAssemblyPath&lt;/span&gt;)), &lt;/span&gt;&lt;span style="background: white; color: blue; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;true&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;);&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none;"&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;span style="background: white; color: green; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;// Copy the one dependency assembly&lt;br /&gt;&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;span class="GramE"&gt;&lt;span style="background: white; color: blue; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;string&lt;/span&gt;&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt; &lt;span class="SpellE"&gt;trustedAssembly&lt;/span&gt; = &lt;/span&gt;&lt;span class="SpellE"&gt;&lt;span style="background: white; color: #2b91af; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;Assembly&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;.GetExecutingAssembly&lt;/span&gt;&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;().Location;&lt;br /&gt;&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;span class="SpellE"&gt;&lt;span class="GramE"&gt;&lt;span style="background: white; color: #2b91af; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;File&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;.Copy&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="GramE"&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;(&lt;/span&gt;&lt;/span&gt;&lt;span class="SpellE"&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;trustedAssembly&lt;/span&gt;&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;, &lt;/span&gt;&lt;span class="SpellE"&gt;&lt;span style="background: white; color: #2b91af; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;Path&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;.Combine&lt;/span&gt;&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;(&lt;span class="SpellE"&gt;DirectoryName&lt;/span&gt;, &lt;/span&gt;&lt;span class="SpellE"&gt;&lt;span style="background: white; color: #2b91af; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;Path&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;.GetFileName&lt;/span&gt;&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;(&lt;span class="SpellE"&gt;trustedAssembly&lt;/span&gt;)), &lt;/span&gt;&lt;span style="background: white; color: blue; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;true&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;);&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none;"&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;span style="background: white; color: green; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;// &lt;span class="GramE"&gt;Create&lt;/span&gt; the &lt;span class="SpellE"&gt;AppDomain&lt;/span&gt; configuration object&amp;nbsp;&lt;br /&gt;&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;span class="SpellE"&gt;&lt;span style="background: white; color: #2b91af; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;AppDomainSetup&lt;/span&gt;&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt; &lt;span class="SpellE"&gt;domainSetup&lt;/span&gt; = &lt;/span&gt;&lt;span style="background: white; color: blue; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;new&lt;/span&gt;&lt;span class="SpellE"&gt;&lt;span class="GramE"&gt;&lt;span style="background: white; color: #2b91af; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;AppDomainSetup&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="GramE"&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;(&lt;/span&gt;&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;) { &lt;span class="SpellE"&gt;ApplicationBase&lt;/span&gt; = &lt;span class="SpellE"&gt;DirectoryName&lt;/span&gt; };&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none;"&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;span style="background: white; color: green; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;// &lt;span class="GramE"&gt;Create&lt;/span&gt; the &lt;span class="SpellE"&gt;AppDomain&lt;/span&gt; with the full trust permissions in the sandbox defined&lt;br /&gt;&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;span class="SpellE"&gt;&lt;span style="background: white; color: #2b91af; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;AppDomain&lt;/span&gt;&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt; domain = &lt;/span&gt;&lt;span class="SpellE"&gt;&lt;span class="GramE"&gt;&lt;span style="background: white; color: #2b91af; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;AppDomain&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;.CreateDomain&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="GramE"&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;(&lt;/span&gt;&lt;/span&gt;&lt;span style="background: white; color: #a31515; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;"&lt;span class="SpellE"&gt;ProcessingDomain&lt;/span&gt;"&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;, &lt;span class="SpellE"&gt;domainEvidence&lt;/span&gt;, &lt;span class="SpellE"&gt;domainSetup&lt;/span&gt;, permissions, &lt;/span&gt;&lt;span style="background: white; color: blue; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;null&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;);&amp;nbsp;&lt;br /&gt;&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;span class="SpellE"&gt;&lt;span style="background: white; color: #2b91af; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;ProcessingWrapper&lt;/span&gt;&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt; &lt;span class="SpellE"&gt;demoProcessor&lt;/span&gt; = (&lt;/span&gt;&lt;span style="background: white; color: #2b91af; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;ProcessingWrapper&lt;/span&gt;&lt;span class="GramE"&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;)domain.CreateInstanceAndUnwrap&lt;/span&gt;&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;(&lt;/span&gt;&lt;span style="background: white; color: #2b91af; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;Assembly&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;.GetExecutingAssembly().FullName, &lt;/span&gt;&lt;span class="SpellE"&gt;&lt;span style="background: white; color: blue; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;typeof&lt;/span&gt;&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;(&lt;/span&gt;&lt;span class="SpellE"&gt;&lt;span style="background: white; color: #2b91af; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;ProcessingWrapper&lt;/span&gt;&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;).&lt;span class="SpellE"&gt;FullName&lt;/span&gt;);&lt;br /&gt;&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span class="SpellE"&gt;&lt;span class="GramE"&gt;demoProcessor.ProcessRequestBatch&lt;/span&gt;&lt;/span&gt;&lt;span class="GramE"&gt;(&lt;/span&gt;);&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;&amp;nbsp;&lt;br /&gt;&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;span class="SpellE"&gt;&lt;span class="GramE"&gt;&lt;span style="background: white; color: #2b91af; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;AppDomain&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;.Unload&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="GramE"&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;(&lt;/span&gt;&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;domain);&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span class="SpellE"&gt;&lt;span class="GramE"&gt;watch.Stop&lt;/span&gt;&lt;/span&gt;&lt;span class="GramE"&gt;(&lt;/span&gt;);&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none;"&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;span class="SpellE"&gt;&lt;span class="GramE"&gt;&lt;span style="background: white; color: #2b91af; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;Console&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;.WriteLine&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="GramE"&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;(&lt;/span&gt;&lt;/span&gt;&lt;span style="background: white; color: #a31515; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;"The processing took &lt;/span&gt;&lt;span style="background: white; color: mediumseagreen; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;{0}&lt;/span&gt;&lt;span style="background: white; color: #a31515; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt; &lt;span class="SpellE"&gt;ms&lt;/span&gt; to complete."&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;, &lt;span class="SpellE"&gt;watch.ElapsedMilliseconds&lt;/span&gt;);&lt;br /&gt;&lt;/span&gt;&lt;span style="background: white; color: black; line-height: 107%; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;}&lt;br /&gt;&lt;/span&gt;&lt;span lang="EN-US"&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span lang="EN-US"&gt;The first thing we do above is setup the evidence that will be used to tell the CLR what permissions we want to grant the assembly.&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp; &lt;/span&gt;In this case we are giving the assembly &amp;ldquo;Trusted&amp;rdquo; so it will be able to launch our console application and other assemblies.&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp; &lt;/span&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;As mentioned previously for consistency I have leveraged the &lt;span class="SpellE"&gt;SecurityManager&amp;rsquo;s&lt;/span&gt; default permission set for the &amp;ldquo;Trusted&amp;rdquo; zone rather than creating my own.&lt;/span&gt;&lt;/p&gt;
&lt;br /&gt;
&lt;p class="MsoNormal"&gt;&lt;span lang="EN-US"&gt;The sandbox directory is created and the required assemblies are copied to it.&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp; &lt;/span&gt;Remember the application base should be changed for security reasons and it becomes the root for type resolution within the &lt;span class="SpellE"&gt;AppDomain&lt;/span&gt;.&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span lang="EN-US"&gt;The final steps are to create the &lt;span class="SpellE"&gt;AppDomain&lt;/span&gt; setup information object and pass the information into the &lt;span class="SpellE"&gt;AppDomain.Create&lt;/span&gt; function call.&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp; &lt;/span&gt;You will notice the final parameter is a null, this parameter can be used to pass a list of strong named assemblies that the &lt;span class="SpellE"&gt;AppDomain&lt;/span&gt; allows code executing in it to invoke.&lt;/span&gt;&lt;/p&gt;
&lt;br /&gt;
&lt;p class="MsoNormal"&gt;&lt;span lang="EN-US"&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;strong style="mso-bidi-font-weight: normal;"&gt;&lt;span style="color: red;" lang="EN-US"&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-34-77-20130521/6116.AppDomainImage5.png"&gt;&lt;img src="http://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-01-34-77-20130521/6116.AppDomainImage5.png" alt="" border="0" /&gt;&lt;/a&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span lang="EN-US"&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span lang="EN-US"&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span lang="EN-US"&gt;As we can see by the console output everything has run successfully in the &amp;ldquo;Trusted zone.&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp; &lt;/span&gt;So what happens when we change the security zone to untrusted?&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp; &lt;/span&gt;Will everything still run ok?&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp; &lt;/span&gt;Let&amp;rsquo;s try it.&lt;/span&gt;&lt;span lang="EN-US"&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;br /&gt;
&lt;p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none;"&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;span class="GramE"&gt;&lt;span style="background: white; color: blue; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;private &lt;/span&gt;&lt;/span&gt;&lt;span style="background: white; color: blue; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;static &lt;/span&gt;&lt;span style="background: white; color: blue; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;void&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt; &lt;span class="SpellE"&gt;ProcessRequestBatch&lt;/span&gt;()&lt;br /&gt;&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;{&lt;br /&gt;&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;span class="SpellE"&gt;&lt;span class="GramE"&gt;&lt;span style="background: white; color: blue; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;const &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="background: white; color: blue; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;string&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt; &lt;span class="SpellE"&gt;DirectoryName&lt;/span&gt; = &lt;/span&gt;&lt;span style="background: white; color: #a31515; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;@"C:\Test"&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;;&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none;"&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;span style="background: white; color: #2b91af; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;Stopwatch&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt; watch = &lt;/span&gt;&lt;span style="background: white; color: blue; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;new &lt;/span&gt;&lt;span class="GramE"&gt;&lt;span style="background: white; color: #2b91af; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;Stopwatch&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;(&lt;/span&gt;&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;);&lt;br /&gt;&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span class="SpellE"&gt;&lt;span class="GramE"&gt;watch.Start&lt;/span&gt;&lt;/span&gt;&lt;span class="GramE"&gt;(&lt;/span&gt;);&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none;"&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;span style="background: white; color: green; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;// &lt;span class="GramE"&gt;Create&lt;/span&gt; the permission set found in the untrusted zone&lt;br /&gt;&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;span style="background: white; color: #2b91af; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;Evidence&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt; &lt;span class="SpellE"&gt;domainEvidence&lt;/span&gt; = &lt;/span&gt;&lt;span style="background: white; color: blue; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;new &lt;/span&gt;&lt;span class="GramE"&gt;&lt;span style="background: white; color: #2b91af; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;Evidence&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;(&lt;/span&gt;&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;);&lt;br /&gt;&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span class="SpellE"&gt;&lt;span class="GramE"&gt;domainEvidence.AddHostEvidence&lt;/span&gt;&lt;/span&gt;&lt;span class="GramE"&gt;(&lt;/span&gt;&lt;/span&gt;&lt;span style="background: white; color: blue; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;new&lt;/span&gt;&lt;span style="background: white; color: #2b91af; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;Zone&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;(&lt;/span&gt;&lt;span class="SpellE"&gt;&lt;span style="background: yellow; color: #2b91af; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: yellow;"&gt;SecurityZone&lt;/span&gt;&lt;span style="background: yellow; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: yellow;"&gt;.Untrusted&lt;/span&gt;&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;));&lt;br /&gt;&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;span class="SpellE"&gt;&lt;span style="background: white; color: #2b91af; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;PermissionSet&lt;/span&gt;&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt; permissions = &lt;/span&gt;&lt;span class="SpellE"&gt;&lt;span class="GramE"&gt;&lt;span style="background: white; color: #2b91af; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;SecurityManager&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;.GetStandardSandbox&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="GramE"&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;(&lt;/span&gt;&lt;/span&gt;&lt;span class="SpellE"&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;domainEvidence&lt;/span&gt;&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;);&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none;"&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none;"&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;span style="background: white; color: green; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;// &lt;span class="GramE"&gt;Create&lt;/span&gt; the directory to be used as the sandbox and copy the untrusted assembly to it&lt;br /&gt;&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;span class="GramE"&gt;&lt;span style="background: white; color: blue; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;if&lt;/span&gt;&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt; (!&lt;/span&gt;&lt;span class="SpellE"&gt;&lt;span style="background: white; color: #2b91af; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;Directory&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;.Exists&lt;/span&gt;&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;(&lt;span class="SpellE"&gt;DirectoryName&lt;/span&gt;)) &lt;/span&gt;&lt;span class="SpellE"&gt;&lt;span style="background: white; color: #2b91af; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;Directory&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;.CreateDirectory&lt;/span&gt;&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;(&lt;span class="SpellE"&gt;DirectoryName&lt;/span&gt;);&lt;br /&gt;&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;span class="GramE"&gt;&lt;span style="background: white; color: blue; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;string&lt;/span&gt;&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt; &lt;span class="SpellE"&gt;untrustedAssemblyPath&lt;/span&gt; = &lt;/span&gt;&lt;span class="SpellE"&gt;&lt;span style="background: white; color: #2b91af; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;Assembly&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;.GetAssembly&lt;/span&gt;&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;(&lt;/span&gt;&lt;span class="SpellE"&gt;&lt;span style="background: white; color: blue; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;typeof&lt;/span&gt;&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;(&lt;/span&gt;&lt;span style="background: white; color: #2b91af; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;Processor&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;)).Location;&lt;br /&gt;&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;span class="SpellE"&gt;&lt;span class="GramE"&gt;&lt;span style="background: white; color: #2b91af; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;File&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;.Copy&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="GramE"&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;(&lt;/span&gt;&lt;/span&gt;&lt;span class="SpellE"&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;untrustedAssemblyPath&lt;/span&gt;&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;, &lt;/span&gt;&lt;span class="SpellE"&gt;&lt;span style="background: white; color: #2b91af; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;Path&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;.Combine&lt;/span&gt;&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;(&lt;span class="SpellE"&gt;DirectoryName&lt;/span&gt;, &lt;/span&gt;&lt;span class="SpellE"&gt;&lt;span style="background: white; color: #2b91af; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;Path&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;.GetFileName&lt;/span&gt;&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;(&lt;span class="SpellE"&gt;untrustedAssemblyPath&lt;/span&gt;)), &lt;/span&gt;&lt;span style="background: white; color: blue; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;true&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;);&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none;"&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none;"&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span style="background: white; color: green; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;// Copy the one trusted assembly that we will allow "full trust"&lt;br /&gt;&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;span class="GramE"&gt;&lt;span style="background: white; color: blue; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;string&lt;/span&gt;&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt; &lt;span class="SpellE"&gt;trustedAssembly&lt;/span&gt; = &lt;/span&gt;&lt;span class="SpellE"&gt;&lt;span style="background: white; color: #2b91af; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;Assembly&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;.GetExecutingAssembly&lt;/span&gt;&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;().Location;&lt;br /&gt;&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;span class="SpellE"&gt;&lt;span class="GramE"&gt;&lt;span style="background: white; color: #2b91af; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;File&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;.Copy&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="GramE"&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;(&lt;/span&gt;&lt;/span&gt;&lt;span class="SpellE"&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;trustedAssembly&lt;/span&gt;&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;, &lt;/span&gt;&lt;span class="SpellE"&gt;&lt;span style="background: white; color: #2b91af; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;Path&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;.Combine&lt;/span&gt;&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;(&lt;span class="SpellE"&gt;DirectoryName&lt;/span&gt;, &lt;/span&gt;&lt;span class="SpellE"&gt;&lt;span style="background: white; color: #2b91af; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;Path&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;.GetFileName&lt;/span&gt;&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;(&lt;span class="SpellE"&gt;trustedAssembly&lt;/span&gt;)), &lt;/span&gt;&lt;span style="background: white; color: blue; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;true&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;);&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none;"&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;span style="background: white; color: green; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;// &lt;span class="GramE"&gt;Create&lt;/span&gt; the &lt;span class="SpellE"&gt;AppDomain&lt;/span&gt; configuration object&amp;nbsp;&lt;br /&gt;&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;span class="SpellE"&gt;&lt;span style="background: white; color: #2b91af; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;AppDomainSetup&lt;/span&gt;&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt; &lt;span class="SpellE"&gt;domainSetup&lt;/span&gt; = &lt;/span&gt;&lt;span style="background: white; color: blue; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;new&lt;/span&gt;&lt;span class="SpellE"&gt;&lt;span class="GramE"&gt;&lt;span style="background: white; color: #2b91af; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;AppDomainSetup&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="GramE"&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;(&lt;/span&gt;&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;) { &lt;span class="SpellE"&gt;ApplicationBase&lt;/span&gt; = &lt;span class="SpellE"&gt;DirectoryName&lt;/span&gt; };&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none;"&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;span style="background: white; color: green; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;// &lt;span class="GramE"&gt;Create&lt;/span&gt; the &lt;span class="SpellE"&gt;AppDomain&lt;/span&gt; with the untrusted permissions in the sandbox defined&lt;br /&gt;&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;span class="SpellE"&gt;&lt;span style="background: white; color: #2b91af; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;AppDomain&lt;/span&gt;&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt; domain = &lt;/span&gt;&lt;span class="SpellE"&gt;&lt;span class="GramE"&gt;&lt;span style="background: white; color: #2b91af; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;AppDomain&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;.CreateDomain&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="GramE"&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;(&lt;/span&gt;&lt;/span&gt;&lt;span style="background: white; color: #a31515; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;"&lt;span class="SpellE"&gt;ProcessingDomain&lt;/span&gt;"&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;, &lt;span class="SpellE"&gt;domainEvidence&lt;/span&gt;, &lt;span class="SpellE"&gt;domainSetup&lt;/span&gt;, permissions, &lt;/span&gt;&lt;span style="background: white; color: blue; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;null&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;);&amp;nbsp;&lt;br /&gt;&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;span class="SpellE"&gt;&lt;span style="background: white; color: #2b91af; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;ProcessingWrapper&lt;/span&gt;&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt; &lt;span class="SpellE"&gt;demoProcessor&lt;/span&gt; = (&lt;/span&gt;&lt;span style="background: white; color: #2b91af; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;ProcessingWrapper&lt;/span&gt;&lt;span class="GramE"&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;)domain.CreateInstanceAndUnwrap&lt;/span&gt;&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;(&lt;/span&gt;&lt;span style="background: white; color: #2b91af; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;Assembly&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;.GetExecutingAssembly().FullName, &lt;/span&gt;&lt;span class="SpellE"&gt;&lt;span style="background: white; color: blue; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;typeof&lt;/span&gt;&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;(&lt;/span&gt;&lt;span class="SpellE"&gt;&lt;span style="background: white; color: #2b91af; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;ProcessingWrapper&lt;/span&gt;&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;).&lt;span class="SpellE"&gt;FullName&lt;/span&gt;);&lt;br /&gt;&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span class="SpellE"&gt;&lt;span class="GramE"&gt;demoProcessor.ProcessRequestBatch&lt;/span&gt;&lt;/span&gt;&lt;span class="GramE"&gt;(&lt;/span&gt;);&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none;"&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;span class="SpellE"&gt;&lt;span class="GramE"&gt;&lt;span style="background: white; color: #2b91af; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;AppDomain&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;.Unload&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="GramE"&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;(&lt;/span&gt;&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;domain);&lt;br /&gt;&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span class="SpellE"&gt;&lt;span class="GramE"&gt;watch.Stop&lt;/span&gt;&lt;/span&gt;&lt;span class="GramE"&gt;(&lt;/span&gt;);&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none;"&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;span class="SpellE"&gt;&lt;span class="GramE"&gt;&lt;span style="background: white; color: #2b91af; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;Console&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;.WriteLine&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="GramE"&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;(&lt;/span&gt;&lt;/span&gt;&lt;span style="background: white; color: #a31515; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;"The processing took &lt;/span&gt;&lt;span style="background: white; color: mediumseagreen; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;{0}&lt;/span&gt;&lt;span style="background: white; color: #a31515; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt; &lt;span class="SpellE"&gt;ms&lt;/span&gt; to complete."&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;, &lt;span class="SpellE"&gt;watch.ElapsedMilliseconds&lt;/span&gt;);&lt;br /&gt;&lt;/span&gt;&lt;span style="background: white; color: black; line-height: 107%; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;}&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span lang="EN-US"&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span lang="EN-US"&gt;You will notice that the only piece of code that changed is highlighted in yellow.&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp; &lt;/span&gt;Now let&amp;rsquo;s see what happens when we run this.&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span lang="EN-US"&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span lang="EN-US"&gt;&amp;nbsp;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-34-77-20130521/6837.AppDomainImage6.png"&gt;&lt;img src="http://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-01-34-77-20130521/6837.AppDomainImage6.png" alt="" border="0" /&gt;&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span lang="EN-US"&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span lang="EN-US"&gt;You will notice at the top of the console it was a permission&amp;rsquo;s check that failed.&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp; &lt;/span&gt;So this is a simple example of how to setup permissions in a secondary &lt;span class="SpellE"&gt;AppDomain&lt;/span&gt;.&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp; &lt;/span&gt;So what next?&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp; &lt;/span&gt;Well the last thing to cover is how the &lt;span class="SpellE"&gt;AppDomain&lt;/span&gt; can help you in auditing.&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;br /&gt;
&lt;p class="MsoNormal"&gt;&lt;span lang="EN-US"&gt;In order to demonstrate logging of exceptions I have made a change to the library used to this point.&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp; &lt;/span&gt;Rather than executing any logic when &lt;span class="SpellE"&gt;ProcessRequest&lt;/span&gt; is called it immediately raises an &lt;span class="SpellE"&gt;ApplicationException&lt;/span&gt;.&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp; &lt;/span&gt;This has been done for demonstration purposes.&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span lang="EN-US"&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none;"&gt;&lt;span class="GramE"&gt;&lt;span style="background: white; color: blue; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;namespace&lt;/span&gt;&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt; &lt;span class="SpellE"&gt;DemoLibrary&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;{&lt;br /&gt;&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;span class="GramE"&gt;&lt;span style="background: white; color: blue; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;using&lt;/span&gt;&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt; System;&lt;br /&gt;&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;span class="GramE"&gt;&lt;span style="background: white; color: blue; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;using&lt;/span&gt;&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt; &lt;span class="SpellE"&gt;System.Collections.Generic&lt;/span&gt;;&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none;"&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;span class="GramE"&gt;&lt;span style="background: white; color: blue; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;public &lt;/span&gt;&lt;/span&gt;&lt;span style="background: white; color: blue; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;class &lt;/span&gt;&lt;span style="background: white; color: #2b91af; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;Processor&lt;br /&gt;&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;{&lt;br /&gt;&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;span class="GramE"&gt;&lt;span style="background: white; color: blue; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;private &lt;/span&gt;&lt;/span&gt;&lt;span style="background: white; color: blue; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;static &lt;/span&gt;&lt;span class="SpellE"&gt;&lt;span style="background: white; color: blue; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;readonly &lt;/span&gt;&lt;/span&gt;&lt;span style="background: white; color: #2b91af; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;Dictionary&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;&amp;lt;&lt;/span&gt;&lt;span class="SpellE"&gt;&lt;span style="background: white; color: blue; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;int&lt;/span&gt;&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;, &lt;/span&gt;&lt;span class="SpellE"&gt;&lt;span style="background: white; color: #2b91af; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;MyCachedObject&lt;/span&gt;&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;&amp;gt; &lt;span class="SpellE"&gt;myCache&lt;/span&gt; = &lt;/span&gt;&lt;span style="background: white; color: blue; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;new&lt;/span&gt;&lt;span style="background: white; color: #2b91af; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;Dictionary&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;&amp;lt;&lt;/span&gt;&lt;span class="SpellE"&gt;&lt;span style="background: white; color: blue; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;int&lt;/span&gt;&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;, &lt;/span&gt;&lt;span class="SpellE"&gt;&lt;span style="background: white; color: #2b91af; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;MyCachedObject&lt;/span&gt;&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;&amp;gt;();&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none;"&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;span class="GramE"&gt;&lt;span style="background: white; color: blue; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;public&lt;/span&gt;&lt;/span&gt;&lt;span style="background: white; color: blue; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;string&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt; &lt;span class="SpellE"&gt;ProcessRequest&lt;/span&gt;(&lt;/span&gt;&lt;span class="SpellE"&gt;&lt;span style="background: white; color: blue; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;int&lt;/span&gt;&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt; id)&lt;br /&gt;&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;{&lt;br /&gt;&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;span class="GramE"&gt;&lt;span style="background: yellow; color: blue; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: yellow;"&gt;throw&lt;/span&gt;&lt;/span&gt;&lt;span style="background: yellow; color: blue; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: yellow;"&gt;new&lt;/span&gt;&lt;span class="SpellE"&gt;&lt;span style="background: yellow; color: #2b91af; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: yellow;"&gt;ApplicationException&lt;/span&gt;&lt;/span&gt;&lt;span style="background: yellow; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: yellow;"&gt;(&lt;/span&gt;&lt;span style="background: yellow; color: #a31515; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: yellow;"&gt;"Oops an error occurred."&lt;/span&gt;&lt;span style="background: yellow; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: yellow;"&gt;);&lt;br /&gt;&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;}&lt;br /&gt;&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;}&lt;br /&gt;&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;}&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span lang="EN-US"&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span lang="EN-US"&gt;In order to log the exceptions when they occur within the application domain we have added four event handlers, two to the &lt;span class="SpellE"&gt;ProcessingDomain&lt;/span&gt; and two to the Default &lt;span class="SpellE"&gt;AppDomains&lt;/span&gt;.&lt;/span&gt;&lt;/p&gt;
&lt;br /&gt;
&lt;p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none;"&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;span class="GramE"&gt;&lt;span style="background: white; color: blue; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;private &lt;/span&gt;&lt;/span&gt;&lt;span style="background: white; color: blue; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;static &lt;/span&gt;&lt;span style="background: white; color: blue; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;void&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt; &lt;span class="SpellE"&gt;ProcessRequestBatch&lt;/span&gt;()&lt;br /&gt;&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;{&lt;br /&gt;&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;span style="background: white; color: #2b91af; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;Stopwatch&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt; watch = &lt;/span&gt;&lt;span style="background: white; color: blue; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;new&lt;/span&gt;&lt;span class="GramE"&gt;&lt;span style="background: white; color: #2b91af; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;Stopwatch&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;(&lt;/span&gt;&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;);&lt;br /&gt;&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span class="SpellE"&gt;&lt;span class="GramE"&gt;watch.Start&lt;/span&gt;&lt;/span&gt;&lt;span class="GramE"&gt;(&lt;/span&gt;);&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none;"&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;span class="SpellE"&gt;&lt;span style="background: white; color: #2b91af; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;AppDomain&lt;/span&gt;&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt; domain = &lt;/span&gt;&lt;span class="SpellE"&gt;&lt;span class="GramE"&gt;&lt;span style="background: white; color: #2b91af; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;AppDomain&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;.CreateDomain&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="GramE"&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;(&lt;/span&gt;&lt;/span&gt;&lt;span style="background: white; color: #a31515; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;"&lt;span class="SpellE"&gt;ProcessingDomain&lt;/span&gt;"&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;);&lt;br /&gt;&lt;/span&gt;&lt;span style="background: yellow; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: yellow;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span class="SpellE"&gt;domain.FirstChanceException&lt;/span&gt; += (sender, &lt;span class="SpellE"&gt;args&lt;/span&gt;) =&amp;gt; &lt;/span&gt;&lt;span class="SpellE"&gt;&lt;span class="GramE"&gt;&lt;span style="background: yellow; color: #2b91af; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: yellow;"&gt;Console&lt;/span&gt;&lt;span style="background: yellow; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: yellow;"&gt;.WriteLine&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="GramE"&gt;&lt;span style="background: yellow; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: yellow;"&gt;(&lt;/span&gt;&lt;/span&gt;&lt;span style="background: yellow; color: #a31515; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: yellow;"&gt;"First chance exception happened and the processing domain recorded it."&lt;/span&gt;&lt;span style="background: yellow; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: yellow;"&gt;);&lt;br /&gt;&lt;/span&gt;&lt;span style="background: yellow; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: yellow;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span class="SpellE"&gt;domain.UnhandledException&lt;/span&gt; += (sender, &lt;span class="SpellE"&gt;args&lt;/span&gt;) =&amp;gt; &lt;/span&gt;&lt;span class="SpellE"&gt;&lt;span class="GramE"&gt;&lt;span style="background: yellow; color: #2b91af; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: yellow;"&gt;Console&lt;/span&gt;&lt;span style="background: yellow; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: yellow;"&gt;.WriteLine&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="GramE"&gt;&lt;span style="background: yellow; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: yellow;"&gt;(&lt;/span&gt;&lt;/span&gt;&lt;span style="background: yellow; color: #a31515; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: yellow;"&gt;"Unhandled exception happened and the processing domain recorded it."&lt;/span&gt;&lt;span style="background: yellow; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: yellow;"&gt;);&lt;/span&gt;&lt;span style="background: yellow; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: yellow;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none;"&gt;&lt;span style="background: yellow; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: yellow;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;span class="SpellE"&gt;&lt;span style="background: yellow; color: #2b91af; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: yellow;"&gt;AppDomain&lt;/span&gt;&lt;span style="background: yellow; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: yellow;"&gt;.CurrentDomain.FirstChanceException&lt;/span&gt;&lt;/span&gt;&lt;span style="background: yellow; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: yellow;"&gt; += (sender, &lt;span class="SpellE"&gt;args&lt;/span&gt;) =&amp;gt; &lt;/span&gt;&lt;span class="SpellE"&gt;&lt;span class="GramE"&gt;&lt;span style="background: yellow; color: #2b91af; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: yellow;"&gt;Console&lt;/span&gt;&lt;span style="background: yellow; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: yellow;"&gt;.WriteLine&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="GramE"&gt;&lt;span style="background: yellow; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: yellow;"&gt;(&lt;/span&gt;&lt;/span&gt;&lt;span style="background: yellow; color: #a31515; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: yellow;"&gt;"First chance exception happened and the default domain recorded it."&lt;/span&gt;&lt;span style="background: yellow; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: yellow;"&gt;);&lt;br /&gt;&lt;/span&gt;&lt;span style="background: yellow; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: yellow;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;span class="SpellE"&gt;&lt;span style="background: yellow; color: #2b91af; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: yellow;"&gt;AppDomain&lt;/span&gt;&lt;span style="background: yellow; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: yellow;"&gt;.CurrentDomain.UnhandledException&lt;/span&gt;&lt;/span&gt;&lt;span style="background: yellow; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: yellow;"&gt; += (sender, &lt;span class="SpellE"&gt;args&lt;/span&gt;) =&amp;gt; &lt;/span&gt;&lt;span class="SpellE"&gt;&lt;span class="GramE"&gt;&lt;span style="background: yellow; color: #2b91af; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: yellow;"&gt;Console&lt;/span&gt;&lt;span style="background: yellow; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: yellow;"&gt;.WriteLine&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="GramE"&gt;&lt;span style="background: yellow; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: yellow;"&gt;(&lt;/span&gt;&lt;/span&gt;&lt;span style="background: yellow; color: #a31515; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: yellow;"&gt;"Unhandled exception happened and the default domain recorded it."&lt;/span&gt;&lt;span style="background: yellow; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: yellow;"&gt;);&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none;"&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;span class="SpellE"&gt;&lt;span style="background: white; color: #2b91af; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;ProcessingWrapper&lt;/span&gt;&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt; &lt;span class="SpellE"&gt;demoProcessor&lt;/span&gt; = (&lt;/span&gt;&lt;span style="background: white; color: #2b91af; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;ProcessingWrapper&lt;/span&gt;&lt;span class="GramE"&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;)domain.CreateInstanceAndUnwrap&lt;/span&gt;&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;(&lt;/span&gt;&lt;span style="background: white; color: #2b91af; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;Assembly&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;.GetExecutingAssembly().FullName, &lt;/span&gt;&lt;span class="SpellE"&gt;&lt;span style="background: white; color: blue; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;typeof&lt;/span&gt;&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;(&lt;/span&gt;&lt;span class="SpellE"&gt;&lt;span style="background: white; color: #2b91af; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;ProcessingWrapper&lt;/span&gt;&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;).&lt;span class="SpellE"&gt;FullName&lt;/span&gt;);&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none;"&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span class="SpellE"&gt;&lt;span class="GramE"&gt;demoProcessor.ProcessRequestBatch&lt;/span&gt;&lt;/span&gt;&lt;span class="GramE"&gt;(&lt;/span&gt;);&lt;br /&gt;&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;span class="SpellE"&gt;&lt;span class="GramE"&gt;&lt;span style="background: white; color: #2b91af; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;AppDomain&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;.Unload&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="GramE"&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;(&lt;/span&gt;&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;domain);&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none;"&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span class="SpellE"&gt;&lt;span class="GramE"&gt;watch.Stop&lt;/span&gt;&lt;/span&gt;&lt;span class="GramE"&gt;(&lt;/span&gt;);&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none;"&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;span class="SpellE"&gt;&lt;span class="GramE"&gt;&lt;span style="background: white; color: #2b91af; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;Console&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;.WriteLine&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="GramE"&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;(&lt;/span&gt;&lt;/span&gt;&lt;span style="background: white; color: #a31515; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;"The processing took &lt;/span&gt;&lt;span style="background: white; color: mediumseagreen; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;{0}&lt;/span&gt;&lt;span style="background: white; color: #a31515; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt; &lt;span class="SpellE"&gt;ms&lt;/span&gt; to complete."&lt;/span&gt;&lt;span style="background: white; color: black; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;, &lt;span class="SpellE"&gt;watch.ElapsedMilliseconds&lt;/span&gt;);&lt;br /&gt;&lt;/span&gt;&lt;span style="background: white; color: black; line-height: 107%; font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-CA; mso-highlight: white;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;}&lt;/span&gt;&lt;/p&gt;
&lt;br /&gt;
&lt;p class="MsoNormal"&gt;&lt;span lang="EN-US"&gt;It is very important that we view these as &amp;ldquo;event handlers&amp;rdquo; and not &amp;ldquo;exception handlers&amp;rdquo;, the exceptions that are raised will continue to bubble up whether it is first or second chance.&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp; &lt;/span&gt;We have two types of exceptions to be notified of being first chance and unhandled.&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp; &lt;/span&gt;Every exception that is raised starts as a first chance and if no exception handlers catch them are elevated to a second chance or unhandled exception.&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp; &lt;/span&gt;Unhandled exceptions will cause the process to terminate.&lt;/span&gt;&lt;/p&gt;
&lt;br /&gt;
&lt;p class="MsoNormal"&gt;&lt;span lang="EN-US"&gt;It can be very interesting to use for auditing, especially the unhandled (second chance) exceptions as they are terminal.&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp; &lt;/span&gt;First chance exceptions need to be audited with caution as they are raised even if the exception is handled.&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp; &lt;/span&gt;In the scenario that an application or library uses exception handling as for flow of control this can quickly drive the application to its knees.&lt;/span&gt;&lt;/p&gt;
&lt;br /&gt;
&lt;p class="MsoNormal"&gt;&lt;span lang="EN-US"&gt;So let&amp;rsquo;s run the code above and see the output.&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&amp;nbsp;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span lang="EN-US"&gt;&amp;nbsp;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-34-77-20130521/4213.AppDomainImage7.png"&gt;&lt;img src="http://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-01-34-77-20130521/4213.AppDomainImage7.png" alt="" border="0" /&gt;&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span lang="EN-US"&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span lang="EN-US"&gt;If you notice in the console output above we see that the first chance exception is raised in the &lt;span class="SpellE"&gt;ProcessingDomain&lt;/span&gt; &lt;span class="SpellE"&gt;AppDomain&lt;/span&gt; first then when not handled there it bubbles up to the Default &lt;span class="SpellE"&gt;AppDomain&lt;/span&gt;.&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp; &lt;/span&gt;Finally note that the unhandled (second chance) exception is generated from the Default &lt;span class="SpellE"&gt;AppDomain&lt;/span&gt;.&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp; &lt;/span&gt;Unhandled exceptions will not be raised in the secondary &lt;span class="SpellE"&gt;AppDomains&lt;/span&gt; as the last &lt;span class="SpellE"&gt;AppDomain&lt;/span&gt; to have an opportunity to handle an exception is the Default &lt;span class="SpellE"&gt;AppDomain&lt;/span&gt;.&lt;/span&gt;&lt;/p&gt;
&lt;br /&gt;
&lt;p class="MsoNormal"&gt;&lt;span lang="EN-US"&gt;I hope this has assisted you in your understanding of Application Domains, what they are as well as how and why to use them.&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span lang="EN-US"&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;/div&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10420363" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/b/cclayton/archive/tags/Memory+dump/">Memory dump</category><category domain="http://blogs.msdn.com/b/cclayton/archive/tags/WinDBG/">WinDBG</category><category domain="http://blogs.msdn.com/b/cclayton/archive/tags/Analysis/">Analysis</category><category domain="http://blogs.msdn.com/b/cclayton/archive/tags/managed+memory+retail+debug+web_2E00_config+machine_2E00_config/">managed memory retail debug web.config machine.config</category><category domain="http://blogs.msdn.com/b/cclayton/archive/tags/debugging/">debugging</category><category domain="http://blogs.msdn.com/b/cclayton/archive/tags/development/">development</category><category domain="http://blogs.msdn.com/b/cclayton/archive/tags/Azure/">Azure</category><category domain="http://blogs.msdn.com/b/cclayton/archive/tags/training/">training</category><category domain="http://blogs.msdn.com/b/cclayton/archive/tags/ramping/">ramping</category><category domain="http://blogs.msdn.com/b/cclayton/archive/tags/AppDomain/">AppDomain</category><category domain="http://blogs.msdn.com/b/cclayton/archive/tags/Understanding/">Understanding</category></item><item><title>Windows Azure Start-up Tasks Part 2</title><link>http://blogs.msdn.com/b/cclayton/archive/2012/05/17/windows-azure-start-up-tasks-part-2.aspx</link><pubDate>Thu, 17 May 2012 14:46:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10306281</guid><dc:creator>Chris Clayton1</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/cclayton/rsscomments.aspx?WeblogPostID=10306281</wfw:commentRss><comments>http://blogs.msdn.com/b/cclayton/archive/2012/05/17/windows-azure-start-up-tasks-part-2.aspx#comments</comments><description>&lt;p&gt;In the previous post &amp;ldquo;&lt;a title="Windows Azure Startup Tasks Part 1" href="http://blogs.msdn.com/b/cclayton/archive/2012/05/17/windows-azure-start-up-tasks-part-1.aspx"&gt;Windows Azure Startup Tasks Part 1&lt;/a&gt;&amp;rdquo; we learned about the basics of start-up tasks and how they can enable you to realize solutions that may otherwise have been outside of the scope of PaaS.&amp;nbsp; This powerful feature offers some additional functionality that we will cover in this post.&lt;/p&gt;
&lt;p&gt;Towards the end of this post we will discuss some of the lessons I have learned when working with Start-up tasks easing your adoption of them.&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;&lt;strong&gt;Environment Variables&lt;/strong&gt;&lt;br /&gt;While the start-up tasks are executing they have access to environment variables that define various characteristics of the instance.&amp;nbsp; The predefined variables are:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;@AccountUsername: the remote desktop account user name&lt;/li&gt;
&lt;li&gt;@AccountEncryptedPassword: the remote desktop account&amp;rsquo;s encrypted password&lt;/li&gt;
&lt;li&gt;@AccountExpiration: the remote desktop account&amp;rsquo;s expiration date&lt;/li&gt;
&lt;li&gt;@ConnectionString: the default diagnostics connection string&lt;/li&gt;
&lt;li&gt;DiagnosticStore: the local directory where diagnostic information is stored&lt;/li&gt;
&lt;li&gt;RdRoleId: the internal identifier azure uses to represent the current role&lt;/li&gt;
&lt;li&gt;RdRoleRoot: the root path of the drive that contains the application code&lt;/li&gt;
&lt;li&gt;RoleDeploymentId: the identifier that represents the current deployment&lt;/li&gt;
&lt;li&gt;RoleInstanceId: the identifier that represents the current instance&lt;/li&gt;
&lt;li&gt;RoleName: the name of the role that the currently executing instance is based on&lt;/li&gt;
&lt;li&gt;RoleRoot: the volume identifier for the drive that contains the application code&lt;/li&gt;
&lt;li&gt;WaRoleType:&amp;nbsp; a string that indicates the type of role the currently executing instance is based on (ex. Web Role)&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;br /&gt;In some cases you may have a need to set an environment variable to be used in your start-up tasks.&amp;nbsp;&amp;nbsp; This can be done by adding a bit more XML.&amp;nbsp; To add a new environment variable for the startup.cmd script to use named TaskName I simply add it to the service definition file as you see below.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-filesystemfile.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-34-77-20120517/6355.EnvironmentVariables.png"&gt;&lt;img style="max-width: 550px;" alt="" src="http://blogs.msdn.com/cfs-filesystemfile.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-34-77-20120517/6355.EnvironmentVariables.png" border="0" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;In order to get access to more specific instance and environment details you can leverage XPATH queries against Worker Role Schema (&lt;a href="http://msdn.microsoft.com/en-us/library/windowsazure/gg557552.aspx"&gt;http://msdn.microsoft.com/en-us/library/windowsazure/gg557552.aspx&lt;/a&gt;) or the Web Role Schema (&lt;a href="http://msdn.microsoft.com/en-us/library/windowsazure/gg557553.aspx"&gt;http://msdn.microsoft.com/en-us/library/windowsazure/gg557553.aspx&lt;/a&gt;).&amp;nbsp; In the following example an XPATH is used to determine if the task is running in the emulator.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-filesystemfile.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-34-77-20120517/7532.EnvironmentVariablesXpath.png"&gt;&lt;img style="max-width: 550px;" alt="" src="http://blogs.msdn.com/cfs-filesystemfile.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-34-77-20120517/7532.EnvironmentVariablesXpath.png" border="0" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;br /&gt;XPATH based environment variables that are typically of interest include&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a&gt;/RoleEnvironment/Deployment/@emulated&lt;/a&gt;&amp;nbsp;&lt;/li&gt;
&lt;ul&gt;
&lt;li&gt;Indicates whether the script is running in an emulated environment&lt;/li&gt;
&lt;/ul&gt;
&lt;li&gt;&lt;a&gt;/RoleEnvironment/Deployment/@id&lt;/a&gt;&lt;/li&gt;
&lt;ul&gt;
&lt;li&gt;The deployment id of the current instance&lt;/li&gt;
&lt;/ul&gt;
&lt;li&gt;&lt;a&gt;/RoleEnvironment/CurrentInstance/@id&lt;/a&gt;&lt;/li&gt;
&lt;ul&gt;
&lt;li&gt;The id of the current instance&lt;/li&gt;
&lt;/ul&gt;
&lt;li&gt;&lt;a&gt;/RoleEnvironment/CurrentInstance/@updateDomain&lt;/a&gt;&lt;/li&gt;
&lt;ul&gt;
&lt;li&gt;The number of the current instances update domain&lt;/li&gt;
&lt;/ul&gt;
&lt;li&gt;&lt;a&gt;/RoleEnvironment/CurrentInstance/@faultDomain&lt;/a&gt;&lt;/li&gt;
&lt;ul&gt;
&lt;li&gt;The fault domain the current instance is part of&lt;/li&gt;
&lt;/ul&gt;
&lt;li&gt;&lt;a&gt;/RoleEnvironment/CurrentInstance/@roleName&lt;/a&gt;&lt;/li&gt;
&lt;ul&gt;
&lt;li&gt;The name of the current role&lt;/li&gt;
&lt;/ul&gt;
&lt;li&gt;/RoleEnvironment/CurrentInstance/ConfigurationSettings/ConfigurationSetting[@name='Setting1']/@value&amp;nbsp;&lt;/li&gt;
&lt;ul&gt;
&lt;li&gt;Gets the value of a RoleEnvironment setting&lt;/li&gt;
&lt;/ul&gt;
&lt;li&gt;/RoleEnvironment/CurrentInstance/LocalResources/LocalResource[@name='LocalStore1']/@path&lt;/li&gt;
&lt;ul&gt;
&lt;li&gt;Gets the root directory of the specified local storage entry&lt;/li&gt;
&lt;/ul&gt;
&lt;li&gt;/RoleEnvironment/CurrentInstance/LocalResources/LocalResource[@name='LocalStore1']/@sizeInMB&lt;/li&gt;
&lt;ul&gt;
&lt;li&gt;The size in MB of the local storage entry&lt;/li&gt;
&lt;/ul&gt;
&lt;li&gt;/RoleEnvironment/CurrentInstance/Endpoints/Endpoint[@name='Endpoint1']/@protocol&lt;/li&gt;
&lt;ul&gt;
&lt;li&gt;Gets the protocol of the specified endpoint&lt;/li&gt;
&lt;/ul&gt;
&lt;li&gt;/RoleEnvironment/CurrentInstance/Endpoints/Endpoint[@name='Endpoint1']/@port&lt;/li&gt;
&lt;ul&gt;
&lt;li&gt;Gets the port of the specified endpoint&lt;/li&gt;
&lt;/ul&gt;
&lt;li&gt;/RoleEnvironment/CurrentInstance/Endpoints/Endpoint[@name='Endpoint1']/@address&lt;/li&gt;
&lt;ul&gt;
&lt;li&gt;Gets the IP Address of the specified endpoint&lt;/li&gt;
&lt;/ul&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;br /&gt;This was not a complete list of environment variables.&amp;nbsp; To find out more you can review the links above where you will see other exposed data such as the Virtual Machine size or web site names.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Lessons Learned&lt;/strong&gt;&lt;br /&gt;The following few points summarize lessons I have learned over time.&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;If you create your cmd, batch or ps1 files in Visual Studio be sure to use the advanced save options to select &amp;ldquo;Save with Encoding&amp;rdquo;.&amp;nbsp; You can access this using the &amp;ldquo;Save&amp;rdquo; button&amp;rsquo;s drop down menu.&amp;nbsp; The encoding type you want to select is &amp;ldquo;Unicode (UTF-8 without signature) &amp;ndash; Codepage 65001&amp;rdquo; or it may not execute properly as a start-up task&lt;/li&gt;
&lt;li&gt;When running the web platform installer command line tool it executes some packages using a 32 bit profile which will require changes to the executing user&amp;rsquo;s appdata directory as seen in a later post&lt;/li&gt;
&lt;li&gt;Be sure that your install never presents a dialog requiring user interaction, when unexpected this can cause your instance to fail to start&lt;/li&gt;
&lt;li&gt;Building your scripts on a virtual machine running Windows 2008 or 2008 R2 enterprise (depending on the matching Operating System Family) is very helpful.&amp;nbsp; Start the clean instance and launch cmd.exe.&amp;nbsp; If you can run your entire script without any user interaction you should be in good shape.&lt;/li&gt;
&lt;li&gt;If you have a start-up task that is failing and you cannot figure out why it is helpful to make it a background task, giving you the option of using remote desktop to see what is happening on the box.&amp;nbsp;&amp;nbsp;&lt;/li&gt;
&lt;li&gt;Log everything you can.&amp;nbsp; In batch files you can leverage output redirection such as &amp;ldquo;dir &amp;gt;&amp;gt; log.txt 2 &amp;gt;&amp;gt; error.txt&amp;rdquo; or in PowerShell you can leverage the Add-Content cmdlet such as &amp;lsquo;Add-Content "$debugFileName" "`nHere is my logged text"&amp;rsquo;&lt;/li&gt;
&lt;li&gt;Only elevate the tasks you need to.&amp;nbsp; Executing processes that require elevation as a start-up task allows you to continue running your core codebase as limited.&amp;nbsp; Do not overlook the opportunity to move things to start-up for this reason.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&lt;strong&gt;Helpful Things to Know&lt;/strong&gt;&lt;br /&gt;So that pretty much covers the basics.&amp;nbsp; I am hoping everyone is comfortable with the information we have covered to this point because we are not going to dive into some more detailed scenarios and samples.&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;For this next section I will point out some things you can do in batch and PowerShell scripts that you may find useful.&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;&lt;strong&gt;Batch Files&lt;/strong&gt;&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;You can use &amp;ldquo;%~dp0&amp;rdquo; to represent the directory the script is running in.&amp;nbsp; It is helpful sometimes to change directory to the folder immediately ensuring you know where you are located for building relative paths.&amp;nbsp; Placing the &amp;ldquo;cd %~dp0&amp;rdquo; command at the top of you batch file takes care of this.&amp;nbsp;&amp;nbsp;&lt;/li&gt;
&lt;li&gt;When debugging install scripts you can use &amp;ldquo;start /w cmd.exe&amp;rdquo; to open a command window in the context of the executing user.&amp;nbsp; When using this in conjunction with a background task you may be able to get additional details as to why it is failing.&amp;nbsp; Please be sure not to use this in the final production release, this is for script debugging only.&lt;/li&gt;
&lt;li&gt;There are often points in a script that you wish you had a sleep command but you don&amp;rsquo;t.&amp;nbsp; Leveraging the choice command you can get the same behavior &amp;ldquo;choice /d y /t 5 &amp;gt; nul&amp;rdquo; says to display a list of choices for 5 seconds and at the end of 5 seconds default to choice &amp;ldquo;y&amp;rdquo;.&lt;/li&gt;
&lt;li&gt;When running PowerShell scripts from the batch file remember that by default the execution policies will require you to have a signed script.&amp;nbsp; Most people do not sign their start-up scripts so in PowerShell v2 you can use If you need to run an unsigned PowerShell V2 script even though they are restricted you can execute &amp;ldquo;powershell -ExecutionPolicy Unrestricted .\Startup.ps1&amp;rdquo; to launch it.&amp;nbsp;&lt;/li&gt;
&lt;ol&gt;
&lt;li&gt;If you want to change this setting on the machine for all PowerShell scripts in PowerShell v2 you can execute &lt;br /&gt;&amp;ldquo;powershell Set-ExecutionPolicy Unrestricted&amp;rdquo; &lt;br /&gt;In PowerShell v1 you have to edit the registry &lt;br /&gt;&amp;ldquo;reg add HKLM\Software\Microsoft\PowerShell\1\ShellIds\Microsoft.PowerShell /v ExecutionPolicy /d Unrestricted /f&amp;rdquo;&amp;nbsp;&amp;nbsp;&lt;/li&gt;
&lt;li&gt;Please remember that any time you do this you need to weigh out the security considerations of your decision.&amp;nbsp;&lt;/li&gt;
&lt;/ol&gt;
&lt;li&gt;Remember that you can simulate a function call in a batch file using code blocks wrapped in&lt;/li&gt;
&lt;ol&gt;
&lt;li&gt;:myFunctionBlockName&lt;br /&gt;my commands to execute using %~1 for the first parameter &lt;br /&gt;goto:eof&lt;/li&gt;
&lt;li&gt;To call the above command you would use&lt;br /&gt;call: myFunctionBlockName parameter1&lt;/li&gt;
&lt;li&gt;Before your code blocks place&amp;nbsp;&amp;nbsp; &lt;br /&gt;goto:eof &lt;br /&gt;to ensure it does not start executing the blocks without being called&lt;/li&gt;
&lt;/ol&gt;&lt;/ol&gt;
&lt;p&gt;&lt;strong&gt;PowerShell&lt;/strong&gt;&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;You can load .NET assemblies which allows you to script the download of blobs etc. without building a custom exe&lt;br /&gt;&amp;nbsp;&amp;lsquo;add-type -Path "$roleRoot\base\Microsoft.WindowsAzure.ServiceRuntime.dll" | Out-Null&amp;rsquo;&lt;/li&gt;
&lt;li&gt;You can check if the last command failed to executed using &amp;ldquo;if(!$?)&amp;rdquo;.&amp;nbsp; This can be really handy to know for taking corrective actions in your script.&amp;nbsp; An example of where you could use this is checking whether a library loaded and if not loading it from another location.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Hopefully the lessons learned above will help guide you through the successful creation of start-up tasks.&amp;nbsp; Watch for the next post &amp;ldquo;Widnows Azure Startup-up Tasks Part3&amp;rdquo; where I will show some common tasks that I perform in my scripts that may help you in the future.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10306281" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/b/cclayton/archive/tags/development/">development</category><category domain="http://blogs.msdn.com/b/cclayton/archive/tags/Azure/">Azure</category><category domain="http://blogs.msdn.com/b/cclayton/archive/tags/tutorial/">tutorial</category><category domain="http://blogs.msdn.com/b/cclayton/archive/tags/ramping/">ramping</category><category domain="http://blogs.msdn.com/b/cclayton/archive/tags/Windows/">Windows</category><category domain="http://blogs.msdn.com/b/cclayton/archive/tags/startup_2D00_up/">startup-up</category><category domain="http://blogs.msdn.com/b/cclayton/archive/tags/start/">start</category><category domain="http://blogs.msdn.com/b/cclayton/archive/tags/task/">task</category></item><item><title>Windows Azure Start-up Tasks Part 1</title><link>http://blogs.msdn.com/b/cclayton/archive/2012/05/17/windows-azure-start-up-tasks-part-1.aspx</link><pubDate>Thu, 17 May 2012 13:48:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10306245</guid><dc:creator>Chris Clayton1</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/cclayton/rsscomments.aspx?WeblogPostID=10306245</wfw:commentRss><comments>http://blogs.msdn.com/b/cclayton/archive/2012/05/17/windows-azure-start-up-tasks-part-1.aspx#comments</comments><description>&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I find myself several times a week having conversations with people around the ability to install and configure additional software on Windows Azure&amp;trade; Web and Worker roles.&amp;nbsp; This key piece of functionality provides a mechanism for you to setup the environment the way you require and still gain the benefits of Platform as a Service.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I am writing this as a series of posts starting with the basics eventually leading to samples of how to deal with specific scenarios.&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;&lt;strong&gt;The Basics&lt;/strong&gt;&lt;br /&gt;Installation of software and features can be done through start-up tasks which run before the OnStart() method is called.&amp;nbsp; You create a list of tasks that will be executed in the order provided.&amp;nbsp; The role will not become available until all of the tasks in the list have been launched.&amp;nbsp;&amp;nbsp; There are several types of start-up tasks that you have to choose from depending on the behavior you desire such as blocking or non-blocking.&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Simple tasks are the most commonly used.&amp;nbsp; This task type will execute the specified command and wait for it to return before launching the next task in the list.&amp;nbsp; This is great when you have an ordered set of installs etc. that must occur before the instance becomes available.&lt;/li&gt;
&lt;li&gt;Background tasks are used to start processes that are not required to be complete before the instance becomes available.&amp;nbsp; When the command is launched it will execute in the background and the next task in the list will be processed.&lt;/li&gt;
&lt;li&gt;Foreground tasks are the same as background tasks with the one caveat, the instance cannot be stopped while the foreground task is running.&amp;nbsp; The interesting behavior with this is that although you cannot stop the instance that has a running foreground task you can remove it.&amp;nbsp; So if you had 3 instances running and decided to drop the instance count to 2 the instance with the running foreground task could be shutdown.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&lt;br /&gt;The OnStart() method will be executed once all of the tasks in the list have been launched and all simple tasks have completed.&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;In order to configure these tasks you need to open your ServiceDefinition.csdef file and find the element representing the role you want to add them to.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-filesystemfile.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-34-77-20120517/8446.ServiceDefinitionFile1.png"&gt;&lt;img style="max-width: 550px;" alt="" src="http://blogs.msdn.com/cfs-filesystemfile.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-34-77-20120517/8446.ServiceDefinitionFile1.png" border="0" /&gt;&lt;/a&gt;&lt;a href="http://blogs.msdn.com/cfs-filesystemfile.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-34-77-20120517/8446.ServiceDefinitionFile1.png"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp; &lt;br /&gt;Based on the XML definition above we will be working with the Worker Role named StDemo.&amp;nbsp; Add a child element named Start-up that will contain the task list.&amp;nbsp; Create a child element named task for each start-up tasks you wish to launch.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;a href="http://blogs.msdn.com/cfs-filesystemfile.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-34-77-20120517/7457.ServiceDefinitionFile2.png"&gt;&lt;img style="max-width: 550px;" alt="" src="http://blogs.msdn.com/cfs-filesystemfile.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-34-77-20120517/7457.ServiceDefinitionFile2.png" border="0" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;In the image above you can see that we have created 2 start-up tasks, the first one defining the following elements:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;commandLine: is the command to be executed, format this as you would when executing it from the command line.&amp;nbsp; In this case it will execute the file in the current directory named startup.cmd.&lt;/li&gt;
&lt;li&gt;executionContext: indicates whether to run the code as the standard or elevated user in the event it requires&amp;nbsp; administrative permissions.&amp;nbsp; In this case we are running it as an administrator (elevated).&lt;/li&gt;
&lt;li&gt;taskType: indicates the type of start-task it is.&amp;nbsp; In this case it is a simple task meaning it will block until it returns only running the second task when and if it completes.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&lt;br /&gt;&lt;strong&gt;Including the Files&lt;/strong&gt;&lt;br /&gt;Looking at the first task you will notice it is running a file named Startup.cmd but we have not added it to the deployment package yet.&amp;nbsp; I have run into encoding issues with cmd files created in Visual Studio so rather that playing with encoding I simply create the file in notepad first.&amp;nbsp; To add the file to Visual Studio 2010 perform the following steps:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;In Solution Explorer open the project that represents the worker role.&amp;nbsp; In the case of this demo it is StDemo.&lt;/li&gt;
&lt;li&gt;Right click on the project and select add -&amp;gt; Existing Item&lt;/li&gt;
&lt;li&gt;Browse to the file you want to add remembering that you may want to change the file filter to show in our case files with a &amp;ldquo;cmd&amp;rdquo; file extension.&lt;/li&gt;
&lt;li&gt;Select the file you just added in the solution explorer and navigate to the properties window.&lt;/li&gt;
&lt;li&gt;Change the &amp;ldquo;Build Action&amp;rdquo; to &amp;ldquo;Content&amp;rdquo;&lt;/li&gt;
&lt;li&gt;Change the &amp;ldquo;Copy to Output Directory&amp;rdquo; to &amp;ldquo;Copy always&amp;rdquo;&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;The changes performed will make Visual Studio add it to the package when it is created.&amp;nbsp; Remember that when using the Worker Role or Web Role in Hosted Core mode these files will be put into the %RoleRoot%\approot folder on the instance.&amp;nbsp; If this is a Web Role in full IIS mode (sites are defined) it will be added to the %RoleRoot%\Sitex where x is replaced by the site number (0 based).&amp;nbsp; This can be important to understand when building your script files.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-filesystemfile.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-34-77-20120517/5635.SolutionExplorer1.png"&gt;&lt;img style="max-width: 550px;" alt="" src="http://blogs.msdn.com/cfs-filesystemfile.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-34-77-20120517/5635.SolutionExplorer1.png" border="0" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;When using start-up tasks knowing the Operating System family can be important (ex. Windows 2008 or Windows 2008 R2).&amp;nbsp; If you want to change the family you can do it in the configuration file.&amp;nbsp; Remember if you are changing it to do it in both the local and cloud or may have some frustrations determining why your script runs in the development environment but not in the cloud.&amp;nbsp; The following image shows where to change the Operating System family in your configuration file.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-filesystemfile.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-34-77-20120517/2642.OsFamily.png"&gt;&lt;img style="max-width: 550px;" alt="" src="http://blogs.msdn.com/cfs-filesystemfile.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-34-77-20120517/2642.OsFamily.png" border="0" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;An osFamily of 1 is Windows Server 2008 while 2 is Windows Server 2008 R2.&amp;nbsp; If you choose Windows Server 2008 R2 you can leverage PowerShell 2 by default which is very nice to build start-up tasks in.&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;As you can see by leveraging start-up tasks some of the scenarios where PaaS does not seem to fit become attainable.&amp;nbsp; This is a great yet often overlooked feature that every Windows Azure&amp;trade; Developer should become familiar with.&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;I hope you found this post helpful and read more on this in my next post &amp;ldquo;&lt;a title="Windows Azure Start-up Tasks Part 2" href="http://blogs.msdn.com/b/cclayton/archive/2012/05/17/windows-azure-start-up-tasks-part-2.aspx"&gt;Windows Azure Start-up Tasks Part 2&lt;/a&gt;&amp;rdquo;.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10306245" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/b/cclayton/archive/tags/development/">development</category><category domain="http://blogs.msdn.com/b/cclayton/archive/tags/Azure/">Azure</category><category domain="http://blogs.msdn.com/b/cclayton/archive/tags/tutorial/">tutorial</category><category domain="http://blogs.msdn.com/b/cclayton/archive/tags/ramping/">ramping</category><category domain="http://blogs.msdn.com/b/cclayton/archive/tags/Windows/">Windows</category><category domain="http://blogs.msdn.com/b/cclayton/archive/tags/startup_2D00_up/">startup-up</category><category domain="http://blogs.msdn.com/b/cclayton/archive/tags/start/">start</category><category domain="http://blogs.msdn.com/b/cclayton/archive/tags/task/">task</category></item><item><title>Windows Azure™ and X509 Certificates</title><link>http://blogs.msdn.com/b/cclayton/archive/2012/03/21/windows-azure-and-x509-certificates.aspx</link><pubDate>Wed, 21 Mar 2012 14:33:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10285919</guid><dc:creator>Chris Clayton1</dc:creator><slash:comments>1</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/cclayton/rsscomments.aspx?WeblogPostID=10285919</wfw:commentRss><comments>http://blogs.msdn.com/b/cclayton/archive/2012/03/21/windows-azure-and-x509-certificates.aspx#comments</comments><description>&lt;p&gt;Quite often I meet with new Windows Azure&amp;trade; developers around how to setup X509 certificates for their development environment.&amp;nbsp; Setting up the certificates for your first time can be a bit confusing so I decided to create this how to post.&amp;nbsp; The remainder of this post will specifically target development environments that leverage a self-signed certificate for Windows Azure&amp;trade; management APIs, RDP and SSL.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;The first step is to create the appropriate self-signed certificates, one for each of the activities listed above.&amp;nbsp; We will use makecert.exe distributed as part of the in the Windows 7 SDK. &amp;nbsp;The following commands will create the required certificates and insert them into the current user&amp;rsquo;s personal store.&lt;/p&gt;
&lt;p&gt;&lt;i&gt;makecert.exe -r -pe -a sha1 -n "CN=My Azure Management Certificate"&lt;br /&gt;-ss My -sr CurrentUser -len 2048 -sky exchange -sp "Microsoft Enhanced RSA&lt;br /&gt;and AES Cryptographic Provider" -sy 24&lt;/i&gt;&lt;/p&gt;
&lt;p&gt;&lt;i&gt;makecert.exe -r -pe -a&lt;br /&gt;sha1 -n "CN=My Azure RDP Certificate" -ss My -sr CurrentUser -len&lt;br /&gt;2048 -sky exchange -sp "Microsoft Enhanced RSA and AES Cryptographic&lt;br /&gt;Provider" -sy 24&lt;/i&gt;&lt;/p&gt;
&lt;p&gt;&lt;i&gt;makecert.exe -r -pe -a&lt;br /&gt;sha1 -n "CN=My Azure SSL Certificate" -ss My -sr CurrentUser -len&lt;br /&gt;2048 -sky exchange -sp "Microsoft Enhanced RSA and AES Cryptographic&lt;br /&gt;Provider" -sy 24&lt;/i&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-34-77-20120321/4667.MakeCert.jpg"&gt;&lt;img border="0" alt="" src="http://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-01-34-77-20120321/4667.MakeCert.jpg" /&gt;&lt;/a&gt;&lt;br /&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;In order to use these certificates in our Windows Azure&amp;trade; subscription and deployments we will need to upload them from a file.&amp;nbsp; The management certificate requires a .CER format without the private key while the SSL and RDP certificates will be in the .PFX format with the private key.&amp;nbsp; In order to get these certificates into Windows Azure&amp;trade; we will first export them from the current user&amp;rsquo;s personal certificate store.&lt;/p&gt;
&lt;p&gt;Open the certificate manager by running certmgr.msc.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-34-77-20120321/4604.RunCertMgr.jpg"&gt;&lt;img border="0" alt="" src="http://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-01-34-77-20120321/4604.RunCertMgr.jpg" width="365" height="445" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;In the left hand tree view select the Personal / Certificates node.&amp;nbsp; It may take a moment depending on the number of certificates that you have in the store but the three certificates should be displayed.&amp;nbsp;The name of each certificate can be found by looking in the &amp;ldquo;Issued By&amp;rdquo; column.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-34-77-20120321/4237.CertMgr.jpg"&gt;&lt;img border="0" alt="" src="http://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-01-34-77-20120321/4237.CertMgr.jpg" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Select the certificate with an &amp;ldquo;Issued By&amp;rdquo; value of &amp;ldquo;My Azure Management Certificate&amp;rdquo;.&amp;nbsp; On the Action menu select All Tasks / Export to launch the certificate export wizard.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-34-77-20120321/1512.SelectExport.jpg"&gt;&lt;img border="0" alt="" src="http://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-01-34-77-20120321/1512.SelectExport.jpg" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Click the &amp;ldquo;Next&amp;rdquo; button to move to the first screen of the export process.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-34-77-20120321/6378.CerWizard1.jpg"&gt;&lt;img border="0" alt="" src="http://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-01-34-77-20120321/6378.CerWizard1.jpg" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;For the management certificate we will not export private keys.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-34-77-20120321/5367.CerWizard2.jpg"&gt;&lt;img border="0" alt="" src="http://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-01-34-77-20120321/5367.CerWizard2.jpg" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;The DER encoded binary X.509 (.CER) format will be used seeing there is no private key to be exported.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-34-77-20120321/7433.CerWizard3.jpg"&gt;&lt;img border="0" alt="" src="http://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-01-34-77-20120321/7433.CerWizard3.jpg" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Enter or browse to the file where this certificate will be located ensuring it has a .CER extension.&amp;nbsp;Please remember that certificates are used for security and must be stored and treated with the appropriate care.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-34-77-20120321/8156.CerWizard4.jpg"&gt;&lt;img border="0" alt="" src="http://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-01-34-77-20120321/8156.CerWizard4.jpg" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Click the &amp;ldquo;Finish&amp;rdquo; button to complete the export.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-34-77-20120321/0647.CerWizard5.jpg"&gt;&lt;img border="0" alt="" src="http://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-01-34-77-20120321/0647.CerWizard5.jpg" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;We will now export SSL and RDP certificates based on the following wizard sequence.&amp;nbsp; Remember that these certificates will require the private key.&amp;nbsp; Select the desired certificate in the Certificate Manager interface and initiate the export process as we did above.&amp;nbsp; On the first screen of the wizard click the &amp;ldquo;Next&amp;rdquo; button.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-34-77-20120321/6740.PfxWizard1.jpg"&gt;&lt;img border="0" alt="" src="http://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-01-34-77-20120321/6740.PfxWizard1.jpg" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;For these certificates we will export the private key.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-34-77-20120321/2625.PfxWizard2.jpg"&gt;&lt;img border="0" alt="" src="http://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-01-34-77-20120321/2625.PfxWizard2.jpg" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Use the PKCS #12 (.PFX) format.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-34-77-20120321/2350.PfxWizard3.jpg"&gt;&lt;img border="0" alt="" src="http://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-01-34-77-20120321/2350.PfxWizard3.jpg" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Enter a password for the certificates that you will remember for a future imports and uploads.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-34-77-20120321/4807.PfxWizard4.jpg"&gt;&lt;img border="0" alt="" src="http://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-01-34-77-20120321/4807.PfxWizard4.jpg" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Enter or browse to the path where the certificate file will be stored ensuring it ends with a PFX extension.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-34-77-20120321/7242.PfxWizard5.jpg"&gt;&lt;img border="0" alt="" src="http://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-01-34-77-20120321/7242.PfxWizard5.jpg" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Click the &amp;ldquo;Finish&amp;rdquo; button to complete the export.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-34-77-20120321/6558.PfxWizard6.jpg"&gt;&lt;img border="0" alt="" src="http://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-01-34-77-20120321/6558.PfxWizard6.jpg" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Remember to complete this export sequence for the remaining certificate.&lt;/p&gt;
&lt;p&gt;Once all of the certificates have been exported it is time to start the import.&amp;nbsp; The first certificate we will import is the management certificate, this certificate is used for accessing the management API&amp;rsquo;s and deploying your solution.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Open your web browser and navigate to the Windows Azure&amp;trade; developer portal &lt;a href="http://windows.azure.com"&gt;http://windows.azure.com&lt;/a&gt;.&amp;nbsp; Enter your credentials when prompted.&amp;nbsp; Once the screen fully populates click on the &amp;ldquo;Hosted Services, Storage Accounts &amp;amp; CDN&amp;rdquo; toolbar item in the bottom left corner.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-34-77-20120321/5468.SelectHostedServices.jpg"&gt;&lt;img border="0" alt="" src="http://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-01-34-77-20120321/5468.SelectHostedServices.jpg" width="228" height="349" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Select the &amp;ldquo;Management Certificates&amp;rdquo; option in the upper portion of the tool bar.&amp;nbsp; It is possible to have more than 1 management certificate if desired.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-34-77-20120321/5123.SelectManagementCertificates.jpg"&gt;&lt;img border="0" alt="" src="http://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-01-34-77-20120321/5123.SelectManagementCertificates.jpg" width="252" height="422" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Select the subscription that you want to add the management certificate to in the content pane and then click the &amp;ldquo;Add Certificate&amp;rdquo; toolbar item.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-34-77-20120321/1323.ClickAddCertificate.jpg"&gt;&lt;img border="0" alt="" src="http://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-01-34-77-20120321/1323.ClickAddCertificate.jpg" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;When prompted to provide the certificate, first check to make sure the subscription you want to add the certificate to is selected in the &amp;ldquo;Choose a subscription&amp;rdquo; drop down list.&amp;nbsp;Browse to the CER file of the management certificate that we exported previously.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-34-77-20120321/4130.SelectTheManagementCertificate.jpg"&gt;&lt;img border="0" alt="" src="http://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-01-34-77-20120321/4130.SelectTheManagementCertificate.jpg" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Your certificate for deploying applications and accessing the Windows Azure&amp;trade; management API is now fully configured in Windows Azure.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;For the next portion we will add the Remote Desktop (RDP) and Secure Socket Layer (SSL) certificates to the appropriate hosted service.&amp;nbsp; Where the management certificate is tied to your account at the subscription level these certificates will be attached at the Hosted Service level.&amp;nbsp; In the event that you remove your deployments these will still remain for use when you eventually redeploy, but if you remove the entire hosted service they will disappear.&amp;nbsp; Also remember that these same certificates will be exposed to both the production and the staging slots.&lt;/p&gt;
&lt;p&gt;Select the &amp;ldquo;Hosted Services&amp;rdquo; toolbar item in the upper left menu.&amp;nbsp; If you have not already created the hosted service you want to add these certificates to create it now, you can create it without a deployment if you would like.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Select the Certificates folder located under the hosted service that you would like to add them to. &amp;nbsp;Once selected click the &amp;ldquo;Add Certificate&amp;rdquo; button from the upper toolbar.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-34-77-20120321/2425.HSSelectAddCertificate.jpg"&gt;&lt;img border="0" alt="" src="http://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-01-34-77-20120321/2425.HSSelectAddCertificate.jpg" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;When prompted to upload the certificate browse to the PFX file we exported previously and enter the password of the exported certificate file.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-34-77-20120321/2402.HSSelectCertificateAndPassword.jpg"&gt;&lt;img border="0" alt="" src="http://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-01-34-77-20120321/2402.HSSelectCertificateAndPassword.jpg" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;The certificate is now uploaded and fully configured inside of your hosted service follow the same procedure to upload the remaining certificate.&amp;nbsp; Once the certificates are uploaded you should see them displayed under the Certificates folder in your hosted service.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-34-77-20120321/3603.HSServerImportComplete.jpg"&gt;&lt;img border="0" alt="" src="http://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-01-34-77-20120321/3603.HSServerImportComplete.jpg" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Now that the certificates are uploaded successfully into our Windows Azure&amp;trade; subscription and hosted service we will look at how to use them to deploy directly from Visual Studio 2010.&amp;nbsp; The assumption of the post at this point is that you have already configured your development environment with the appropriate SDKs and tools.&lt;/p&gt;
&lt;p&gt;Open the solution that you would like to publish to Windows Azure&amp;trade; and select the cloud project.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-34-77-20120321/3441.VStudioDeploy1.jpg"&gt;&lt;img border="0" alt="" src="http://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-01-34-77-20120321/3441.VStudioDeploy1.jpg" width="368" height="443" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Right click on the cloud project and select the &amp;ldquo;Publish&amp;hellip;&amp;rdquo; option from the context menu.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-34-77-20120321/0882.VStudioDeploy2.jpg"&gt;&lt;img border="0" alt="" src="http://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-01-34-77-20120321/0882.VStudioDeploy2.jpg" width="322" height="278" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;From the &amp;ldquo;Choose your subscription&amp;rdquo; drop down list select the &amp;lt;Manage&amp;hellip;&amp;gt; option and click the &amp;ldquo;Next&amp;rdquo; button.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-34-77-20120321/8360.VStudioDeploy4.jpg"&gt;&lt;img border="0" alt="" src="http://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-01-34-77-20120321/8360.VStudioDeploy4.jpg" /&gt;&lt;/a&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-34-77-20120321/1754.VStudioDeploy3.jpg"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;When presented with the list of Windows Azure&amp;trade; settings click the &amp;ldquo;New&amp;rdquo; button.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-34-77-20120321/2072.VStudioDeploy7.jpg"&gt;&lt;img border="0" alt="" src="http://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-01-34-77-20120321/2072.VStudioDeploy7.jpg" /&gt;&lt;/a&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-34-77-20120321/6036.VStudioDeploy7.jpg"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Select the management certificate we previously uploaded and enter the subscription id.&amp;nbsp; The subscription id can be found in the developer portal.&amp;nbsp; Enter a friendly name for these credentials so you will remember the subscription they are for in the future.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-34-77-20120321/6433.VStudioDeploy6.jpg"&gt;&lt;img border="0" alt="" src="http://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-01-34-77-20120321/6433.VStudioDeploy6.jpg" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;The list of settings will be displayed again and you should see the newly created one.&amp;nbsp; Highlight your new credentials and click the &amp;ldquo;Close&amp;rdquo; button.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-34-77-20120321/2072.VStudioDeploy7.jpg"&gt;&lt;img border="0" alt="" src="http://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-01-34-77-20120321/2072.VStudioDeploy7.jpg" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;If the new credentials are not already selected in the &amp;ldquo;Choose your subscription&amp;rdquo; dropdown list select them now and click the &amp;ldquo;Next&amp;rdquo; button.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-34-77-20120321/3250.VStudioDeploy8.jpg"&gt;&lt;img border="0" alt="" src="http://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-01-34-77-20120321/3250.VStudioDeploy8.jpg" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;On the settings screen you can choose the hosted service you previously created as well as the slot of interest, staging or development.&amp;nbsp; Seeing we are enabling RDP in this post check the box beside Enable Remote Desktop for all roles then click the &amp;ldquo;Settings&amp;hellip;&amp;rdquo; hyperlink located to the right of it.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-34-77-20120321/7268.VStudioDeploy11.jpg"&gt;&lt;img border="0" alt="" src="http://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-01-34-77-20120321/7268.VStudioDeploy11.jpg" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;In the RDP settings ensure that all of the options are showing, this may require you pressing the &amp;ldquo;More Options&amp;rdquo; button to expose the certificate selection.&amp;nbsp; Select the RDP certificate that we previously uploaded to the hosted service.&amp;nbsp; Enter a user name and password to use for Remote Desktop access and click the &amp;ldquo;OK&amp;rdquo; button.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-34-77-20120321/3884.VStudioDeploy10.jpg"&gt;&lt;img border="0" alt="" src="http://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-01-34-77-20120321/3884.VStudioDeploy10.jpg" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Clicking the &amp;ldquo;Publish&amp;rdquo; button will complete the publishing process.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-34-77-20120321/7268.VStudioDeploy11.jpg"&gt;&lt;img border="0" alt="" src="http://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-01-34-77-20120321/7268.VStudioDeploy11.jpg" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Now we have shown how to use the certificates for publishing a solution, exposing the instances via Remote Desktop, the final thing to show is how to setup SSL in a Web Role.&lt;/p&gt;
&lt;p&gt;In the Cloud Project expand the &amp;ldquo;Roles&amp;rdquo; folder to expose the web role that will be exposed with SSL.&amp;nbsp; Right click on the Web Role and select &amp;ldquo;Properties&amp;rdquo; from the context menu.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-34-77-20120321/8512.SSL1.jpg"&gt;&lt;img border="0" alt="" src="http://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-01-34-77-20120321/8512.SSL1.jpg" /&gt;&lt;/a&gt;&lt;br /&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Selecting the Certificates tab will expose the Remote Desktop certificate that was previously setup.&amp;nbsp; Click the &amp;ldquo;Add Certificate&amp;rdquo; button on the toolbar.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-34-77-20120321/6758.SSL2.jpg"&gt;&lt;img border="0" alt="" src="http://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-01-34-77-20120321/6758.SSL2.jpg" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Enter a user friendly name for the SSL Certificate you want to use and select it from the list ensuring to set the store location and store name appropriately. In some cases I have found that the certificate I created does not show up in this list, if not it usually will work after you export it again and import it back into your LocalMachine/My store instead of the CurrentUser/My store.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-34-77-20120321/1581.SSL3.jpg"&gt;&lt;img border="0" alt="" src="http://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-01-34-77-20120321/1581.SSL3.jpg" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;Save the properties page and click the Endpoints tab.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-34-77-20120321/7635.SSL4.jpg"&gt;&lt;img border="0" alt="" src="http://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-01-34-77-20120321/7635.SSL4.jpg" /&gt;&lt;/a&gt;&lt;br /&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;On the Web Role&amp;rsquo;s endpoint change it to https if it is not already and set the port to 443 (assuming you want the standard port).&amp;nbsp; Selecting the recently configured SSL certificate from the &amp;ldquo;SSL Certificate Name&amp;rdquo; drop down will complete the SSL configuration.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10285919" width="1" height="1"&gt;</description></item><item><title>Azure Storage and its Various Abstractions</title><link>http://blogs.msdn.com/b/cclayton/archive/2012/03/19/azure-storage-and-its-various-abstractions.aspx</link><pubDate>Mon, 19 Mar 2012 14:57:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10284977</guid><dc:creator>Chris Clayton1</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/cclayton/rsscomments.aspx?WeblogPostID=10284977</wfw:commentRss><comments>http://blogs.msdn.com/b/cclayton/archive/2012/03/19/azure-storage-and-its-various-abstractions.aspx#comments</comments><description>&lt;p&gt;As you can probably agree, very few applications, short of &amp;ldquo;Hello World&amp;rdquo;, do not have some form of storage.&amp;nbsp;The use of storage can range from core repositories to scratch disks, but regardless of the use it typically plays a critical part in the overall architecture of the application.&amp;nbsp; With the importance of storage in mind Windows Azure provides you with a lot of options ranging from strongly typed relational through to transient unstructured.&amp;nbsp; For the purposes of this post we will focus on local&amp;nbsp;storage for transient unstructured data.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;If you have worked in or read on Windows Azure compute you will hear the common principle of &amp;ldquo;do not store things locally and remain stateless&amp;rdquo;.&amp;nbsp; This is a key part of being horizontally scalable, ensuring that the consumer can move between instances in the same role without ever having an expectation that state or data already exists on the instance.&amp;nbsp; This principle holds true but remember there are specific pieces of data that can be reconstructed when required, that data is the target of local storage.&amp;nbsp; Some examples of this transient data include temporary files, folders and caches.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Local Storage is a directory on the instance that is created for you and you can access as you would any other directory or file.&amp;nbsp; To setup a Local Storage directory you leverage the property sheets in the Cloud Project&amp;rsquo;s Local Storage tab.&amp;nbsp; Defining the storage is as simple as adding a name that is meaningful to your application, the size in MB that you require and whether you want the storage to always be cleared out when the instance recycles.&amp;nbsp; I personally default to selecting the &amp;ldquo;Clean on role recycle&amp;rdquo; option so I return to a known state each time.&amp;nbsp; In the event that you have a large cache etc. that you would have to rebuild on recycle you may opt to leverage some form of time stamp or hash to ensure it is all up to date, rather than incurring the reconstruction cost.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-34-77-20120319/1256.LocalStorage.jpg"&gt;&lt;img border="0" alt="" src="http://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-01-34-77-20120319/1256.LocalStorage.jpg" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;When the role is deployed the provisioning process will ensure that a directory is available for each of the various entries in the Local Storage tab and set the ACL&amp;rsquo;s appropriately.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-34-77-20120319/2642.Code.jpg"&gt;&lt;img border="0" alt="" src="http://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-01-34-77-20120319/2642.Code.jpg" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;As you can see in the code sample above to get the local path we request it from the RoleEnvironment object that is found in the Microsoft.WindowsAzure.ServiceRuntime namespace.&amp;nbsp; Once you retrieve the directory you access it the same way you would access your local file system.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-34-77-20120319/2543.StorageFolder.jpg"&gt;&lt;img border="0" alt="" src="http://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-01-34-77-20120319/2543.StorageFolder.jpg" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;In fact the storage is nothing more than a directory created on your local instance as you see above.&lt;/p&gt;
&lt;p&gt;When selecting the size of the Local Storage you must remember to select a Virtual Machine that has enough local storage capacity.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10284977" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/b/cclayton/archive/tags/development/">development</category><category domain="http://blogs.msdn.com/b/cclayton/archive/tags/Azure/">Azure</category><category domain="http://blogs.msdn.com/b/cclayton/archive/tags/training/">training</category><category domain="http://blogs.msdn.com/b/cclayton/archive/tags/tutorial/">tutorial</category><category domain="http://blogs.msdn.com/b/cclayton/archive/tags/ramping/">ramping</category><category domain="http://blogs.msdn.com/b/cclayton/archive/tags/storage/">storage</category><category domain="http://blogs.msdn.com/b/cclayton/archive/tags/local+storage/">local storage</category></item><item><title>Roles and Instances</title><link>http://blogs.msdn.com/b/cclayton/archive/2011/11/07/roles-and-instances.aspx</link><pubDate>Mon, 07 Nov 2011 13:04:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10234550</guid><dc:creator>Chris Clayton1</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/cclayton/rsscomments.aspx?WeblogPostID=10234550</wfw:commentRss><comments>http://blogs.msdn.com/b/cclayton/archive/2011/11/07/roles-and-instances.aspx#comments</comments><description>&lt;p&gt;&lt;strong&gt;&lt;span style="text-decoration: underline;"&gt;Overview&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;In order to ensure the benefits of this post are maximized I will level set by defining what roles and instances are as well as how they relate to each other.&lt;/p&gt;
&lt;p&gt;A role in Windows Azure is really a blueprint that describes what an individual virtual machine will look like.&amp;nbsp; The blueprint includes details such as the size of the virtual machine, ports and protocols that are allowed through the firewall and whether a port is exposed publicly.&amp;nbsp; In order to simplify the definition of these roles many of the elements are defined through a service definition file that adheres to a defined XML schema.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;One or more virtual machines that are based on a role can run at the same time.&amp;nbsp; Each of these virtual machines is known as an instance.&lt;/p&gt;
&lt;p&gt;When designing a solution that will run on Windows Azure it is a good practice to decompose your application into a set of core services.&amp;nbsp; Each of these services should be considered potential roles, but keep in mind that sometimes two of these services are so closely related in scaling characteristics you may choose to consolidate them.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;A role is the smallest unit of compute scale within Windows Azure, allowing you to change the number of instances that are running.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;It is important to understand that roles are not durable, meaning that changes made during execution to the local file system or machine will be rolled back if the machine is reimaged. &amp;nbsp;A machine may be reimaged at your discretion or in the case where the Windows Azure Fabric Controller deems it required.&amp;nbsp; The reimaging could be triggered by hardware failures, software updates or other events.&amp;nbsp; There are a few options for storing data such as files that we will cover in later posts.&lt;/p&gt;
&lt;p&gt;The instances sit behind a load balancer that leverages a round robin algorithm resulting in the inability to ensure the next query from a consumer will access the same instance it previously did.&amp;nbsp;This means that any operations coming in on the public ports should ideally execute in an atomic operation, only storing session state in mechanisms that are shared between all instances.&amp;nbsp; For interrole communications the load balancer is not used, providing the ability to talk directly to a specified instance.&lt;/p&gt;
&lt;p&gt;&lt;span style="text-decoration: underline;"&gt;Role Types&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;Web Role &amp;ndash; this role is based on either Windows 2008 Server or Windows 2008 R2 Server and runs Internet Information Server.&amp;nbsp; This role defaults to exposing a single public HTTP endpoint on port 80, but others can be opened as required.&amp;nbsp; Typical uses of this include running ASP.NET, PHP and CGI applications.&amp;nbsp; This role can have patching of the Operating System set to automatic reducing administrative costs of the solution.&amp;nbsp; This role supports startup tasks allowing for the silent install of applications or environment changes.&lt;/p&gt;
&lt;p&gt;Worker Role &amp;ndash; this role is based on either Windows 2008 Server or Windows 2008 R2 Server.&amp;nbsp; This is geared towards generalized computing similar in nature to an EXE or Windows Service.&amp;nbsp; By default this role does not expose any endpoints, but can be set to as appropriate. &amp;nbsp;Typical uses include background processing or running third party applications.&amp;nbsp; This role can have patching of the Operating System set to automatic reducing administrative costs of the solution.&amp;nbsp; This role supports startup tasks allowing for the silent install of applications or environment changes.&lt;/p&gt;
&lt;p&gt;VM Role &amp;ndash; This role is in beta at the time of writing.&amp;nbsp; This role is based on a Windows 2008 R2 Enterprise image built locally and uploaded.&amp;nbsp; This role is still not durable as it could be reimaged as appropriate.&amp;nbsp; This role is geared at scenarios where a required install takes a long period of time, requires user input or is fragile.&amp;nbsp; This role does not have the ability to automatically patch the Operating System leaving updates to be made by the developer through the creation and application of differencing disks.&amp;nbsp; In general I recommend people look at the Worker and Web roles prior to falling back to the VM role.&lt;/p&gt;
&lt;p&gt;&lt;span style="text-decoration: underline;"&gt;Scaling&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;Although the role is the smallest unit of deployment I tend to encourage people to create what is sometimes termed as a &amp;ldquo;Scale Unit&amp;rdquo;.&amp;nbsp; The concept is that before deployment you benchmark a specific configuration of instance counts providing a known configuration to capacity scenario.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;For Example:&lt;/p&gt;
&lt;p&gt;In this scenario you create an expense processing system where your company&amp;rsquo;s employees will submit expenses through an ASP.NET web site (Web Role) and processing will occur later through a background process (Worker Role). You could initially benchmark the employee count that could be supported with two ASP.NET web sites (Web Role) and a single background process (Worker Role).&amp;nbsp; If this benchmark showed that 2500 employees could be supported on this configuration you could say that your &amp;ldquo;Unit of Scale&amp;rdquo; is 2 Web Roles and 1 Worker Role.&amp;nbsp; This means that if I run most of the month with 2500 users but on the last 2 days spike up to 7500 users I can run a single scale unit for most of the month and on the last 2 days bring two additional scale units online.&amp;nbsp; This allows for easier proactive scaling.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10234550" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/b/cclayton/archive/tags/development/">development</category><category domain="http://blogs.msdn.com/b/cclayton/archive/tags/Azure/">Azure</category><category domain="http://blogs.msdn.com/b/cclayton/archive/tags/sql/">sql</category><category domain="http://blogs.msdn.com/b/cclayton/archive/tags/appfabric/">appfabric</category><category domain="http://blogs.msdn.com/b/cclayton/archive/tags/Windows/">Windows</category></item><item><title>Key Concepts Associated with Windows Azure Development</title><link>http://blogs.msdn.com/b/cclayton/archive/2011/09/26/key-concepts-associated-with-windows-azure-development.aspx</link><pubDate>Mon, 26 Sep 2011 21:23:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10216861</guid><dc:creator>Chris Clayton1</dc:creator><slash:comments>1</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/cclayton/rsscomments.aspx?WeblogPostID=10216861</wfw:commentRss><comments>http://blogs.msdn.com/b/cclayton/archive/2011/09/26/key-concepts-associated-with-windows-azure-development.aspx#comments</comments><description>&lt;p&gt;As a developer first looking at diving into Windows Azure Development it is important that you are familiar with a few concepts.&lt;/p&gt;
&lt;p&gt;&lt;span style="text-decoration: underline;"&gt;Windows Azure is for Everyone&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;When adopting Windows Azure as a development platform people are often concerned about having to learn a new development environment and language.&amp;nbsp; In an effort to embrace the open nature of software development and providing the developer with choice Windows Azure applications can be written in many languages including .NET, PHP and Java.&amp;nbsp; Eclipse and Visual Studio have additional feature for developing on the Windows Azure platform but other IDE&amp;rsquo;s can also be used including our favourite Notepad.&lt;/p&gt;
&lt;p&gt;&lt;span style="text-decoration: underline;"&gt;Developing for Scale&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;When creating a scalable application you can build it to scale horizontally or vertically.&amp;nbsp; Vertically scaling is when larger machines are put in place to handle increases in load.&amp;nbsp; In general this is typically the easier method of development but has the downside of being more expensive from a hardware point of view with the larger machine costing in proportionately more than their smaller counter parts and being limited to the largest machines available.&amp;nbsp; Horizontally scaling is when additional machines are put in place (ex. a Web Farm) each doing its part to handle the load.&amp;nbsp; Horizontal scaling tends to have a linear cost when using standardized machines but it includes several development challenges.&amp;nbsp; Windows Azure&amp;rsquo;s design targets horizontal scaling and applications should be architected to take advantage of it.&lt;/p&gt;
&lt;p&gt;In an ideal scenario each machine should be able to sit behind a load balancer without session maintained.&amp;nbsp; This means that session specific details should not be stored locally on the machine such as the hard drive instead it should be stored in a centralized location that all of the servers can access.&lt;/p&gt;
&lt;p&gt;In most scenarios synchronous or blocking operations directly oppose high scalability and flexibility.&amp;nbsp; Creating loosely coupled architectures that are asynchronous are very important when leveraging Windows Azure and can be accomplished using Azure Queues or other similar structure.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Although there are many other considerations when developing highly scalable applications those are some of the big ones that should always be considered.&lt;/p&gt;
&lt;p&gt;&lt;span style="text-decoration: underline;"&gt;Feature Groups&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;When looking at Windows Azure features they are typically broken down into 3 large buckets.&lt;/p&gt;
&lt;p&gt;1)&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Windows Azure &amp;ndash; Highly scalable compute and storage often used to run background processing and application interfaces such as ASP.NET.&lt;/p&gt;
&lt;p&gt;2)&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Microsoft SQL Azure &amp;ndash; The relational database of choice on the Windows Azure platform.&amp;nbsp; This will seem very familiar to any DBA that leverages Microsoft SQL Server 2008 R2.&lt;/p&gt;
&lt;p&gt;3)&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Windows Azure AppFabric &amp;ndash; Middleware components that can be used to create highly scalable application that can exist across geographic and security boundaries.&amp;nbsp; An example is when the Windows Azure Service Bus is used to reach from Windows Azure data centres and pull information from an on premises accounting system (spanning firewalls etc.).&lt;/p&gt;
&lt;p&gt;These are some of the core pieces of information that you should keep in mind whenever dealing with anything related to Windows Azure.&amp;nbsp; Keeping these in mind while reviewing the rest of these blogs will be helpful.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10216861" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/b/cclayton/archive/tags/development/">development</category><category domain="http://blogs.msdn.com/b/cclayton/archive/tags/Azure/">Azure</category><category domain="http://blogs.msdn.com/b/cclayton/archive/tags/sql/">sql</category><category domain="http://blogs.msdn.com/b/cclayton/archive/tags/appfabric/">appfabric</category><category domain="http://blogs.msdn.com/b/cclayton/archive/tags/Windows/">Windows</category></item><item><title>Common Workloads for Azure</title><link>http://blogs.msdn.com/b/cclayton/archive/2011/07/15/common-workloads-for-azure.aspx</link><pubDate>Fri, 15 Jul 2011 10:27:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10186850</guid><dc:creator>Chris Clayton1</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/cclayton/rsscomments.aspx?WeblogPostID=10186850</wfw:commentRss><comments>http://blogs.msdn.com/b/cclayton/archive/2011/07/15/common-workloads-for-azure.aspx#comments</comments><description>&lt;p&gt;When we start looking at Windows Azure there are several key workloads that come to mind, the ones that are pretty much slam dunks for being a fit.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;span style="text-decoration: underline;"&gt;Workload 1 - On and Off&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;On and Off typically represents applications or web sites that are needed for a short period of time and later shut off.&amp;nbsp; An example of this would be a marketing campaign that runs a web site for two months every year around Christmas because it is your peak sales time.&amp;nbsp; The cost of acquiring the capacity for this heavy load period and then maintaining throughout the year or recommissioning can often be very high.&amp;nbsp; Azure allows you to minimize both the upfront capital investment and the&amp;nbsp;recurring monthly maintenance expenses.&amp;nbsp; The reason for this is that you&amp;nbsp;pay for&amp;nbsp;what you use in Azure, so if you run it for these two months then decomission it at the end you&amp;nbsp;stop paying for it until the next year when you redeploy.&amp;nbsp;&amp;nbsp;This not only helps reduce cost but potentially offers the business&amp;nbsp;the ability to execute on more campaigns than they would typically due to overall cost.&amp;nbsp;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;span style="text-decoration: underline;"&gt;Workload 2 - Scale Fast&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;Scale Fast is reflective of applications or sites that are introduced by the business without a good handle on what the adoption rate will be.&amp;nbsp; Typically you would have to build out extra capacity at the beginning beyond the anticipated level to ensure the best customer experience.&amp;nbsp; Using Azure you can start with a couple instances of the application and write code that will automatically deploy additional instances as required based on actual usage.&amp;nbsp; This allows the available capacity to closely follow the real demand for the site, keeping costs down while reducing the burden of capacity planning.&lt;/p&gt;
&lt;p&gt;&lt;span style="text-decoration: underline;"&gt;Workload 3 - Predictable Bursting&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;Predictable Bursting is typically seen in companies that have a seasonal&amp;nbsp;component to them, such as retail&amp;nbsp;with Christmas driving a large quantity of their sales or&amp;nbsp;finance where RRSP season can spike in activity.&amp;nbsp;&amp;nbsp;&amp;nbsp;Azure can be used in this scenario as well to reduce investment in additional hardware and infrastructure required&amp;nbsp;to support the load during these bursts.&amp;nbsp; There are two ways people typically handle this type of capacity "augmentation", either through load transference where they host the application, or some components of the application, in Azure during the burst or as an application extension.&amp;nbsp; Application extensions can be an interesting scenario with the application running on premise during normal&amp;nbsp;load states or periods and when&amp;nbsp;additional capacity is required they introduce&amp;nbsp;additional capacity in Azure, never eliminating the on premise portion.&amp;nbsp;&amp;nbsp;This is&amp;nbsp;sometimes referred to as a hybrid application.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;span style="text-decoration: underline;"&gt;Workload 4 - Unpredictable Bursting&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;Unpredictable Bursting is the same as Predictable Bursting above except in the sense the burst can come at any time.&amp;nbsp; An example of this is if the government ran a campaign that gave tax breaks on purchasing new appliances appliance retailers may all of a sudden realize a significant load increase on their web sites.&amp;nbsp; This is load can be handled in the same way as the Predictable Bursting scenario, except the identification of the burst scenario would typically be automated to ensure it could react and scale on demand.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;The above workloads do not make up a comprehensive list of scenarios where Azure can be leveraged, but it does identify the key four workloads where the value of Azure can be quickly recognized.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10186850" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/b/cclayton/archive/tags/development/">development</category><category domain="http://blogs.msdn.com/b/cclayton/archive/tags/Azure/">Azure</category><category domain="http://blogs.msdn.com/b/cclayton/archive/tags/training/">training</category><category domain="http://blogs.msdn.com/b/cclayton/archive/tags/tutorial/">tutorial</category><category domain="http://blogs.msdn.com/b/cclayton/archive/tags/ramping/">ramping</category><category domain="http://blogs.msdn.com/b/cclayton/archive/tags/workload/">workload</category></item><item><title>Standard Cloud Taxonomies and Windows Azure</title><link>http://blogs.msdn.com/b/cclayton/archive/2011/06/07/standard-cloud-taxonomies-and-windows-azure.aspx</link><pubDate>Tue, 07 Jun 2011 14:53:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10172150</guid><dc:creator>Chris Clayton1</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/cclayton/rsscomments.aspx?WeblogPostID=10172150</wfw:commentRss><comments>http://blogs.msdn.com/b/cclayton/archive/2011/06/07/standard-cloud-taxonomies-and-windows-azure.aspx#comments</comments><description>&lt;p&gt;Prior to evaluating a cloud solution it is important to understand the various taxonomies available in the vendor ecosystem today.&amp;nbsp; Without understanding the strengths, weaknesses and targeted mindsets of each taxonomy you may not select the appropriate one to meet your business objectives.&amp;nbsp; &lt;/p&gt;
&lt;p&gt;A Cloud Taxonomy is a way of categorizing and comparing cloud solutions based on their degree of control, methods of provisioning and delegation of operations.&amp;nbsp; The three industry accepted taxonomies are known as Infrastructure as a Service (IaaS), Platform as a Service (PaaS) and Software as a Service (SaaS).&amp;nbsp; &lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;a href="http://blogs.msdn.com/cfs-filesystemfile.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-34-77-20110525/7802.CloudTaxonomies.jpg"&gt;&lt;img src="http://blogs.msdn.com/cfs-filesystemfile.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-34-77-20110525/7802.CloudTaxonomies.jpg" border="0" style="display: block; max-width: 550px; margin-left: auto; margin-right: auto;" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;In this discussion we will move from left to right with each step typically increasing in agility, reducing cost while reducing control.&amp;nbsp; &lt;/p&gt;
&lt;p style="text-align: center;"&gt;&lt;span style="text-decoration: underline;"&gt;IaaS (Infrastructure as a Service)&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;This taxonomy is geared towards customers that require the ability to stand up virtual machines in the cloud.&amp;nbsp; This is often the taxonomy that comes to mind when customers first start thinking of cloud.&amp;nbsp; This can be an attractive offering when there is no desire to modify code and the end goal of the transition to the cloud is simply to move an existing legacy application off site with as little work as possible.&amp;nbsp; &lt;/p&gt;
&lt;p&gt;Although this IaaS has the lowest bar for entry it typically does not exhibit the maximum value proposition of the cloud.&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Common business drivers &lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Improving IT agility&lt;/li&gt;
&lt;li&gt;Moving capital expenditures to operating expenditures&lt;/li&gt;
&lt;li&gt;Reducing IT spend to deliver business aligned solutions&lt;/li&gt;
&lt;li&gt;Increasing business agility through improved speed of provisioning new environments &lt;/li&gt;
&lt;li&gt;Providing capacity that may not be available in the on-premises counterpart &lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Strengths&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Low bar of entry to move applications into the cloud&lt;/li&gt;
&lt;li&gt;High degree of control over the applications and guest environment&lt;/li&gt;
&lt;li&gt;Faster provisioning than on-premises systems&lt;/li&gt;
&lt;li&gt;Capacity that typically exceeds what is available in the on-premises environment&lt;/li&gt;
&lt;li&gt;The mindset of standing up virtual machines is familiar to customers that leverage virtualization on-premises&lt;/li&gt;
&lt;li&gt;Delegates the responsibility for hardware, physical networking and network storage to a vendor&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Weaknesses&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Responsibility associated with a large portion of the overall stack remains with the customer&lt;/li&gt;
&lt;li&gt;Adherence to operational practices and procedures for the virtualized stack remain with the customer&lt;/li&gt;
&lt;li&gt;Patching and maintenance of the guest operating system remains the responsibility of the customer&lt;/li&gt;
&lt;li&gt;The middleware and runtimes associated with the platform are the responsibility of the customer&lt;/li&gt;
&lt;li&gt;Typically there are fewer framework and application building blocks than found in the Platform as a Service offering&lt;/li&gt;
&lt;li&gt;Typically the customer is still responsible for the licensing as it relates to the guest operating system and above&lt;/li&gt;
&lt;li&gt;Stepped addition of capacity mimics that of on-premises systems making most applications less capable of tightly coupling the load and capacity, although in some scenarios it may be possible (the step is equivalent to the resources provided by a single server)&lt;/li&gt;
&lt;li&gt;Developers are still expected to have knowledge of Operating System management and security instead of focussing on writing software &amp;nbsp;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Opportunities&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Migration of applications that are not at high touch points can provide a cost benefit by saving virtual machine provisioning times and costs&lt;/li&gt;
&lt;li&gt;Application scenarios that have unpredictable capacity requirements can be handled through hypothesising the required capacity, provisioning the machines and then scaling up or back based on the application usage &lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p style="text-align: center;"&gt;&lt;span style="text-decoration: underline;"&gt;PaaS (Platform as a Service)&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;Platform as a Service provides the customer the ability to host solutions in the cloud.&amp;nbsp; These solutions are decomposed into a set of services which can typically be scaled independently.&amp;nbsp; The ability to scale independently exposes a greater degree of control with smaller steps being created in the alignment of capacity and load.&amp;nbsp;&amp;nbsp; The closer one can run the load and capacity levels usually results in a better Total Cost of Ownership (TCO) for the customer. &amp;nbsp;&amp;nbsp;With this taxonomy the mindset is not focused around standing up virtual machines rather around hosting a solution and its services.&amp;nbsp; Arguably when leveraging a PaaS offering one should not think of it in terms of Virtual Machines instead consider it hosting instances of your solution&amp;rsquo;s services.&amp;nbsp; Typically this mindset will fit very well with any customer already subscribed to the Service Oriented Architecture design methodology.&lt;/p&gt;
&lt;p&gt;Platform as a Service is ideal for migrating applications that are at high touch points (rewrites, upgrades or other milestone that requires changes to code) or have business drivers such as improving a solution&amp;rsquo;s availability, scalability, capacity or reducing cost.&amp;nbsp; The reason these situations are ideal is that in order to take advantage of many of the platform offerings it may take changes to source code.&amp;nbsp; It is important to make use of these additional feature sets as they often provide a very attractive return on investment, improve customer experience or open up the ability to deliver new business streams.&amp;nbsp; Although these platform features are desirable to implement they are typically not required, often allowing the migration of applications from an on-premises solution to cloud with little or no effort.&lt;/p&gt;
&lt;p&gt;Common Business Drivers&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Improving IT agility&lt;/li&gt;
&lt;li&gt;Moving capital expenditures to operating expenditures&lt;/li&gt;
&lt;li&gt;Reducing IT spend to deliver business aligned solutions&lt;/li&gt;
&lt;li&gt;Increasing business agility through improved speed of provisioning new environments &lt;/li&gt;
&lt;li&gt;Providing capacity that may not be available in the on-premises counterpart &lt;/li&gt;
&lt;li&gt;Increasing the speed in which custom solutions can be brought to market&lt;/li&gt;
&lt;li&gt;Reducing security related concerns surrounding hosted environments&lt;/li&gt;
&lt;li&gt;Reducing IT&amp;rsquo;s requirement for knowledge of custom solution adoption rates&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Strengths&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Simplified deployment of custom solutions&lt;/li&gt;
&lt;li&gt;Higher degree of control over the customer solutions than in a SaaS environment&lt;/li&gt;
&lt;li&gt;Reduced level of IT knowledge required by developers&lt;/li&gt;
&lt;li&gt;Less operational burden on the customer&lt;/li&gt;
&lt;li&gt;Elastic scaling reduces the requirement for business to exactly gauge uptake of new custom solutions &lt;/li&gt;
&lt;li&gt;Smaller segment of the stack remains the responsibility of the customer&lt;/li&gt;
&lt;li&gt;Automated patching of the platform helps to improve overall security&lt;/li&gt;
&lt;li&gt;Focus on hosting solutions rather than standing up virtual machines allows developers to focus on developing great software&lt;/li&gt;
&lt;li&gt;Fast scaling with ability to fully automate scaling&lt;/li&gt;
&lt;li&gt;Typically faster provisioning than IaaS&lt;/li&gt;
&lt;li&gt;Capacity that typically exceeds what is available in the on-premises environment&lt;/li&gt;
&lt;li&gt;Delegates the responsibility for hardware, physical networking, network storage to a vendor and well guest OS&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Weaknesses&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Migration of applications that will take advantages to full PaaS feature sets often require application modifications&lt;/li&gt;
&lt;li&gt;Less control than IaaS with reduced control over the guest Operating System&lt;/li&gt;
&lt;li&gt;Targeted at custom applications with support for packaged software&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Opportunities&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Migration of applications that are at high touch points can provide a better ROI and reduced TCO than the IaaS counterpart &lt;/li&gt;
&lt;li&gt;Savings in both time and cost for the provisioning of application platform may improve the time to market of custom applications&lt;/li&gt;
&lt;li&gt;Reduces the requirements for the developers to know the operating system, instead they can focus on developing software&lt;/li&gt;
&lt;li&gt;Reduces IT required involvement provides the ability for IT to focus on improving existing or introducing new services to align with key business drivers&lt;/li&gt;
&lt;li&gt;The ability to scale in line to the demand providing a great platform for micro sites and start-up applications where the adoption and demand level may not be known in advance&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p style="text-align: center;"&gt;&lt;span style="text-decoration: underline;"&gt;Software as a Service (SaaS)&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;Software as a Service provides customers with the ability to provision a new account or configuration on an existing application hosted by the vendor.&amp;nbsp; These applications are typically multitenant providing the customer with a reduced set of control in exchange for a lower level of maintenance and management.&amp;nbsp; &lt;/p&gt;
&lt;p&gt;SaaS is a great offering for customers that host applications on-premises that do not align with their core competencies.&amp;nbsp; An example of a Software as a Service offering would be a hosted enterprise messaging system.&amp;nbsp; Very few companies have enterprise messaging as a core competency, rather it is a business support function and therefore it is often well served to move to the cloud.&amp;nbsp; &lt;/p&gt;
&lt;p&gt;Common Business Drivers&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Improving IT agility&lt;/li&gt;
&lt;li&gt;Removing responsibility for management of systems that are not core business capabilities&lt;/li&gt;
&lt;li&gt;Moving capital expenditures to operating expenditures&lt;/li&gt;
&lt;li&gt;Reducing IT spend to deliver business aligned solutions&lt;/li&gt;
&lt;li&gt;Providing capacity that may not be available in the on-premises counterpart &lt;/li&gt;
&lt;li&gt;Reducing IT&amp;rsquo;s requirement for knowledge of application adoption rates&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Strengths&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Simplified deployment of applications&lt;/li&gt;
&lt;li&gt;Less operational burden on the customer&lt;/li&gt;
&lt;li&gt;Elastic scaling reduces the requirement for business to exactly gauge uptake &lt;/li&gt;
&lt;li&gt;The vendor manages most aspects of the application, typically leaving the customer with application and subscription management&lt;/li&gt;
&lt;li&gt;Automated patching of the platform helps to improve overall security&lt;/li&gt;
&lt;li&gt;Typically includes automated scaling&lt;/li&gt;
&lt;li&gt;Typically the fastest provisioning model out of the cloud taxonomies&lt;/li&gt;
&lt;li&gt;Capacity that typically exceeds what is available in the on-premises environment&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Weaknesses&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Less control than the other taxonomies&lt;/li&gt;
&lt;li&gt;Typically little ability to customize applications&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Opportunities&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Migration of purchased applications that do not align with the businesses core competencies &lt;/li&gt;
&lt;li&gt;Savings in both time and cost for the provisioning of the application &lt;/li&gt;
&lt;li&gt;Can improve new account provisioning turnaround&lt;/li&gt;
&lt;li&gt;Reduces IT required knowledge and involvement providing them the ability to focus on improving existing or introducing new services to align with key business drivers&lt;/li&gt;
&lt;li&gt;The ability to scale in line to the demand &lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;span style="text-decoration: underline;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p style="text-align: center;"&gt;&lt;span style="text-decoration: underline;"&gt;Where is Azure in this?&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;Azure is falls square in the Platform as a Service offering with many features that are not available on-premises.&amp;nbsp; Azure has been built from the ground up with scalability and cross platform support in mind.&amp;nbsp; This makes the platform great for most developers whether .NET, Java, PHP and more.&lt;/p&gt;
&lt;p&gt;There are many additional features exposed by Azure to support a wide variety of scenarios including automatic scaling, hybrid solutions where Azure reaches back on premise through to connectivity between disperse security realms.&lt;/p&gt;
&lt;p&gt;As we move through the next posts we will dig deeper into many of these features.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10172150" width="1" height="1"&gt;</description></item><item><title>Ramping on the Windows Azure Platform</title><link>http://blogs.msdn.com/b/cclayton/archive/2011/05/16/ramping-on-the-windows-azure-platform.aspx</link><pubDate>Mon, 16 May 2011 14:42:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10164913</guid><dc:creator>Chris Clayton1</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/cclayton/rsscomments.aspx?WeblogPostID=10164913</wfw:commentRss><comments>http://blogs.msdn.com/b/cclayton/archive/2011/05/16/ramping-on-the-windows-azure-platform.aspx#comments</comments><description>&lt;p&gt;It has been several months since I started my ramp on the Windows Azure Platform and am now ready to write about it.&amp;nbsp; While I worked through the material and guidance it was&amp;nbsp;evolving and growing which often changed my mindset on techniques to handle various scenarios.&lt;/p&gt;
&lt;p&gt;In an effort to allow others to learn from my ramping experience I have decided to start writing a series of posts that will help novice Azure developers learn the platform.&amp;nbsp; In this series I will discuss&lt;/p&gt;
&lt;p&gt;1)&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; the various taxonomies of cloud and where Azure plays&lt;/p&gt;
&lt;p&gt;2)&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; common workloads for Azure&lt;/p&gt;
&lt;p&gt;3)&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; key concepts associated with Azure development&lt;/p&gt;
&lt;p&gt;4)&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; roles and instances&lt;/p&gt;
&lt;p&gt;5)&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Azure storage and it&amp;rsquo;s various abstractions&lt;/p&gt;
&lt;p&gt;6)&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; SQL Azure&lt;/p&gt;
&lt;p&gt;7)&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Windows Azure Connect&lt;/p&gt;
&lt;p&gt;8)&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Windows Azure AppFabric Cache&lt;/p&gt;
&lt;p&gt;9)&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Windows Azure AppFabric Access Control&lt;/p&gt;
&lt;p&gt;10)&amp;nbsp;&amp;nbsp; Windows Azure AppFabric Service Bus&lt;/p&gt;
&lt;p&gt;11)&amp;nbsp;&amp;nbsp; Hybrid&amp;nbsp;solutions&amp;nbsp;&lt;/p&gt;
&lt;p&gt;The points above are listed in the order I plan on approaching them, but each bullet may equate to several posts.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I am sure that you will find the Windows Azure Platform to be as interesting as I have.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10164913" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/b/cclayton/archive/tags/development/">development</category><category domain="http://blogs.msdn.com/b/cclayton/archive/tags/Azure/">Azure</category><category domain="http://blogs.msdn.com/b/cclayton/archive/tags/training/">training</category><category domain="http://blogs.msdn.com/b/cclayton/archive/tags/tutorial/">tutorial</category><category domain="http://blogs.msdn.com/b/cclayton/archive/tags/ramping/">ramping</category></item></channel></rss>