<?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>Kristoffer's tidbits</title><link>http://blogs.msdn.com/b/kristoffer/</link><description>Bits and pieces of useful information by Kristoffer Henriksson</description><dc:language>en-US</dc:language><generator>Telligent Evolution Platform Developer Build (Debug Build: 5.6.50428.7875)</generator><item><title>Calling WinRT functions from low level C++</title><link>http://blogs.msdn.com/b/kristoffer/archive/2012/03/26/calling-winrt-functions-from-low-level-c.aspx</link><pubDate>Mon, 26 Mar 2012 21:19:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10287765</guid><dc:creator>Kristoffer Henriksson</dc:creator><slash:comments>2</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/kristoffer/rsscomments.aspx?WeblogPostID=10287765</wfw:commentRss><comments>http://blogs.msdn.com/b/kristoffer/archive/2012/03/26/calling-winrt-functions-from-low-level-c.aspx#comments</comments><description>&lt;p&gt;The high level projection available in C++ targeting WinRT make working with WinRT from C++&amp;nbsp;a much easier task. It handles error reporting, reference counting, string conversions etc for you. As an example let's consider the following high level C++ code to retrieve the path of the temporary folder:&lt;/p&gt;
&lt;p style="padding-left: 30px;"&gt;&lt;span style="font-family: courier new,courier;"&gt;&lt;span style="color: #0000ff;"&gt;void&lt;/span&gt; GetTempFolderPathHighLevel(std::wstring&amp;amp; path)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new,courier;"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new,courier;"&gt;&amp;nbsp; path = Windows::Storage::ApplicationData::Current-&amp;gt;TemporaryFolder-&amp;gt;Path-&amp;gt;Data();&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new,courier;"&gt;}&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;Short, simple, and to the point. The equivalent low level code to get this is heinous:&lt;/p&gt;
&lt;p style="padding-left: 30px;"&gt;&lt;span style="font-family: courier new,courier;"&gt;&lt;span style="color: #0000ff;"&gt;#include&lt;/span&gt; &lt;span style="color: #800000;"&gt;&amp;lt;windows.storage.h&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: #0000ff;"&gt;#include&lt;/span&gt; &lt;span style="color: #800000;"&gt;&amp;lt;wrl/client.h&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: #0000ff;"&gt;#include&lt;/span&gt; &lt;span style="color: #800000;"&gt;&amp;lt;wrl/wrappers/corewrappers.h&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;HRESULT GetTempFolderPath(std::wstring&amp;amp; path)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new,courier;"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new,courier;"&gt;&amp;nbsp; HRESULT hr;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new,courier;"&gt;&amp;nbsp; Microsoft::WRL::ComPtr&amp;lt;ABI::Windows::Storage::IApplicationDataStatics&amp;gt; applicationDataStatics;&lt;/span&gt;&lt;/p&gt;
&lt;p style="padding-left: 30px;"&gt;&lt;span style="font-family: courier new,courier;"&gt;&amp;nbsp; hr = Windows::Foundation::GetActivationFactory(Microsoft::WRL::Wrappers::HStringReference(RuntimeClass_Windows_Storage_ApplicationData).Get(), &amp;amp;applicationDataStatics);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new,courier;"&gt;&lt;span style="color: #0000ff;"&gt;&amp;nbsp; if&lt;/span&gt; (FAILED(hr))&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new,courier;"&gt;&amp;nbsp; {&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new,courier;"&gt;&lt;span style="color: #0000ff;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; return&lt;/span&gt; hr;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new,courier;"&gt;&amp;nbsp;&amp;nbsp;}&lt;/span&gt;&lt;/p&gt;
&lt;p style="padding-left: 30px;"&gt;&lt;span style="font-family: courier new,courier;"&gt;&amp;nbsp; Microsoft::WRL::ComPtr&amp;lt;ABI::Windows::Storage::IApplicationData&amp;gt; applicationData;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new,courier;"&gt;&amp;nbsp; hr = applicationDataStatics-&amp;gt;get_Current(&amp;amp;applicationData);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new,courier;"&gt;&lt;span style="color: #0000ff;"&gt;&amp;nbsp; if&lt;/span&gt; (FAILED(hr))&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new,courier;"&gt;&amp;nbsp; {&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new,courier;"&gt;&lt;span style="color: #0000ff;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; return&lt;/span&gt; hr;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new,courier;"&gt;&amp;nbsp; }&lt;/span&gt;&lt;/p&gt;
&lt;p style="padding-left: 30px;"&gt;&lt;span style="font-family: courier new,courier;"&gt;&amp;nbsp; Microsoft::WRL::ComPtr&amp;lt;ABI::Windows::Storage::IStorageFolder&amp;gt; storageFolder;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new,courier;"&gt;&amp;nbsp; hr = applicationData-&amp;gt;get_TemporaryFolder(&amp;amp;storageFolder);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new,courier;"&gt;&lt;span style="color: #0000ff;"&gt;&amp;nbsp; if&lt;/span&gt; (FAILED(hr))&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new,courier;"&gt;&amp;nbsp; {&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new,courier;"&gt;&lt;span style="color: #0000ff;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;return&lt;/span&gt; hr;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new,courier;"&gt;&amp;nbsp; }&lt;/span&gt;&lt;/p&gt;
&lt;p style="padding-left: 30px;"&gt;&lt;span style="font-family: courier new,courier;"&gt;&amp;nbsp; Microsoft::WRL::ComPtr&amp;lt;ABI::Windows::Storage::IStorageItem&amp;gt; storageItem;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new,courier;"&gt;&amp;nbsp; hr = storageFolder.As(&amp;amp;storageItem);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new,courier;"&gt;&lt;span style="color: #0000ff;"&gt;&amp;nbsp; if&lt;/span&gt; (FAILED(hr))&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new,courier;"&gt;&amp;nbsp; {&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new,courier;"&gt;&lt;span style="color: #0000ff;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;return&lt;/span&gt; hr;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new,courier;"&gt;&amp;nbsp; }&lt;/span&gt;&lt;/p&gt;
&lt;p style="padding-left: 30px;"&gt;&lt;span style="font-family: courier new,courier;"&gt;&amp;nbsp; HSTRING folderName;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new,courier;"&gt;&amp;nbsp; hr = storageItem-&amp;gt;get_Path(&amp;amp;folderName);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new,courier;"&gt;&lt;span style="color: #0000ff;"&gt;&amp;nbsp; if&lt;/span&gt; (FAILED(hr))&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new,courier;"&gt;&amp;nbsp; {&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new,courier;"&gt;&lt;span style="color: #0000ff;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;return&lt;/span&gt; hr;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new,courier;"&gt;&amp;nbsp; }&lt;/span&gt;&lt;/p&gt;
&lt;p style="padding-left: 30px;"&gt;&lt;span style="font-family: courier new,courier;"&gt;&amp;nbsp; UINT32 length;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new,courier;"&gt;&amp;nbsp; PCWSTR value = WindowsGetStringRawBuffer(folderName, &amp;amp;length);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new,courier;"&gt;&amp;nbsp; path = value;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new,courier;"&gt;&lt;span style="color: #0000ff;"&gt;&lt;span style="font-family: courier new,courier;"&gt;&lt;span style="color: #000000;"&gt;&amp;nbsp; WindowsDeleteString(folderName);&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&amp;nbsp; return&lt;/span&gt; S_OK;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new,courier;"&gt;}&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10287765" width="1" height="1"&gt;</description></item><item><title>A concise history of the Bing Maps Windows 8 Map control.</title><link>http://blogs.msdn.com/b/kristoffer/archive/2012/03/20/a-concise-history-of-the-bing-maps-windows-8-map-control.aspx</link><pubDate>Tue, 20 Mar 2012 21:05:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10285632</guid><dc:creator>Kristoffer Henriksson</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/kristoffer/rsscomments.aspx?WeblogPostID=10285632</wfw:commentRss><comments>http://blogs.msdn.com/b/kristoffer/archive/2012/03/20/a-concise-history-of-the-bing-maps-windows-8-map-control.aspx#comments</comments><description>&lt;p&gt;&lt;span style="color: #800000;"&gt;The Windows 8 Bing map XAML control (as opposed to the javascript control which is an entirely different beast)&amp;nbsp;has a slightly different API when compared to earlier Bing Map XAML controls. Previous XAML controls have all been written in managed code whereas the Windows 8 map control is written in native code. &lt;/span&gt;&lt;span style="color: #800000;"&gt;Written in mostly cross platform C++ it originally shipped inside the Bing iPhone app. It was later branched and shipped as an iPhone map control without functional parity with the script and XAML map controls. With some more work we shipped it as part of the Bing Android app and now as a separate control for Windows 8. The Windows 8 version has had adjustments to make it behave as a native Windows 8 XAML control allowing data binding, native XAML child elements and all the good stuff you would expect from a XAML control. &lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="color: #800000;"&gt;Since we do our own Direct3D rendering we can get better performance with polygons and polylines on our map by managing the vertices ourselves and just adjusting the camera per frame instead of pushing across new vertices. As a side effect of this MapPolygon and MapPolyline do not descend from UIElement and can't be placed just anywhere in the UI tree but instead need to be children of the separate Map.ShapeLayers property to differentiate them from XAML overlay controls. XAML children still go on the Children property like you would expect.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="color: #0000ff; font-family: courier new,courier;"&gt;&amp;lt;&lt;span style="color: #800000;"&gt;bm&lt;/span&gt;:&lt;span style="color: #800000;"&gt;Map&lt;/span&gt; &lt;span style="color: #ff0000;"&gt;x&lt;/span&gt;:&lt;span style="color: #ff0000;"&gt;Name&lt;/span&gt;="map" &lt;span style="color: #ff0000;"&gt;Width&lt;/span&gt;="800" &lt;span style="color: #ff0000;"&gt;Height&lt;/span&gt;="600" &lt;span style="color: #ff0000;"&gt;Credentials&lt;/span&gt;="INSERT_YOUR_BING_MAPS_KEY"&amp;gt;&lt;br /&gt;&amp;nbsp; &lt;span style="color: #008000;"&gt;&amp;lt;!-- UIElements go under Map.Children&amp;nbsp;--&amp;gt;&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &amp;lt;&lt;span style="color: #800000;"&gt;bm&lt;/span&gt;:&lt;span style="color: #800000;"&gt;Map.Children&lt;/span&gt;&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;&lt;span style="color: #800000;"&gt;bm&lt;/span&gt;:&lt;span style="color: #800000;"&gt;Pushpin&lt;/span&gt; &lt;span style="color: #ff0000;"&gt;bm&lt;/span&gt;:&lt;span style="color: #ff0000;"&gt;MapLayer&lt;/span&gt;.&lt;span style="color: #ff0000;"&gt;PositionAnchor&lt;/span&gt;="11,11"&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;&lt;span style="color: #800000;"&gt;bm&lt;/span&gt;:&lt;span style="color: #800000;"&gt;MapLayer&lt;/span&gt;.&lt;span style="color: #800000;"&gt;Position&lt;/span&gt;&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;&lt;span style="color: #800000;"&gt;bm&lt;/span&gt;:&lt;span style="color: #800000;"&gt;Location&lt;/span&gt; &lt;span style="color: #ff0000;"&gt;Latitude&lt;/span&gt;="0" &lt;span style="color: #ff0000;"&gt;Longitude&lt;/span&gt;="0" /&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/&lt;span style="color: #800000;"&gt;bm&lt;/span&gt;:&lt;span style="color: #800000;"&gt;MapLayer&lt;/span&gt;.&lt;span style="color: #800000;"&gt;Position&lt;/span&gt;&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/&lt;span style="color: #800000;"&gt;bm&lt;/span&gt;:&lt;span style="color: #800000;"&gt;Pushpin&lt;/span&gt;&amp;gt;&lt;br /&gt;&amp;nbsp; &amp;lt;/&lt;span style="color: #800000;"&gt;bm&lt;/span&gt;:&lt;span style="color: #800000;"&gt;Map&lt;/span&gt;.&lt;span style="color: #800000;"&gt;Children&lt;/span&gt;&amp;gt;&lt;br /&gt;&amp;nbsp; &lt;span style="color: #008000;"&gt;&amp;lt;!--&amp;nbsp;MapPolygon and MapPolyline go under Map.ShapeLayers&amp;nbsp;--&amp;gt;&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &amp;lt;&lt;span style="color: #800000;"&gt;bm&lt;/span&gt;:&lt;span style="color: #800000;"&gt;Map&lt;/span&gt;.&lt;span style="color: #800000;"&gt;ShapeLayers&lt;/span&gt;&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;&lt;span style="color: #800000;"&gt;bm&lt;/span&gt;:&lt;span style="color: #800000;"&gt;MapShapeLayer&lt;/span&gt;&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;&lt;span style="color: #800000;"&gt;bm&lt;/span&gt;:&lt;span style="color: #800000;"&gt;MapShapeLayer&lt;/span&gt;.&lt;span style="color: #800000;"&gt;Shapes&lt;/span&gt;&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;&lt;span style="color: #800000;"&gt;bm&lt;/span&gt;:&lt;span style="color: #800000;"&gt;MapPolygon&lt;/span&gt;&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;&lt;span style="color: #800000;"&gt;bm&lt;/span&gt;:&lt;span style="color: #800000;"&gt;MapPolygon&lt;/span&gt;.&lt;span style="color: #800000;"&gt;Locations&lt;/span&gt;&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;&lt;span style="color: #800000;"&gt;bm&lt;/span&gt;:&lt;span style="color: #800000;"&gt;Location&lt;/span&gt; &lt;span style="color: #ff0000;"&gt;Latitude&lt;/span&gt;="-10" &lt;span style="color: #ff0000;"&gt;Longitude&lt;/span&gt;="-10" /&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;&lt;span style="color: #800000;"&gt;bm&lt;/span&gt;:&lt;span style="color: #800000;"&gt;Location&lt;/span&gt; &lt;span style="color: #ff0000;"&gt;Latitude&lt;/span&gt;="-10" &lt;span style="color: #ff0000;"&gt;Longitude&lt;/span&gt;="10" /&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;&lt;span style="color: #800000;"&gt;bm&lt;/span&gt;:&lt;span style="color: #800000;"&gt;Location&lt;/span&gt; &lt;span style="color: #ff0000;"&gt;Latitude&lt;/span&gt;="10" &lt;span style="color: #ff0000;"&gt;Longitude&lt;/span&gt;="10" /&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;&lt;span style="color: #800000;"&gt;bm&lt;/span&gt;:&lt;span style="color: #800000;"&gt;Location&lt;/span&gt; &lt;span style="color: #ff0000;"&gt;Latitude&lt;/span&gt;="10" &lt;span style="color: #ff0000;"&gt;Longitude&lt;/span&gt;="-10" /&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/&lt;span style="color: #800000;"&gt;bm&lt;/span&gt;:&lt;span style="color: #800000;"&gt;MapPolygon&lt;/span&gt;.&lt;span style="color: #800000;"&gt;Locations&lt;/span&gt;&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/&lt;span style="color: #800000;"&gt;bm&lt;/span&gt;:&lt;span style="color: #800000;"&gt;MapPolygon&lt;/span&gt;&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/&lt;span style="color: #800000;"&gt;bm&lt;/span&gt;:&lt;span style="color: #800000;"&gt;MapShapeLayer&lt;/span&gt;.&lt;span style="color: #800000;"&gt;Shapes&lt;/span&gt;&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/&lt;span style="color: #800000;"&gt;bm&lt;/span&gt;:&lt;span style="color: #800000;"&gt;MapShapeLayer&lt;/span&gt;&amp;gt;&lt;br /&gt;&amp;nbsp; &amp;lt;/&lt;span style="color: #800000;"&gt;bm&lt;/span&gt;:&lt;span style="color: #800000;"&gt;Map&lt;/span&gt;.&lt;span style="color: #800000;"&gt;ShapeLayers&lt;/span&gt;&amp;gt;&lt;br /&gt;&amp;lt;/&lt;span style="color: #800000;"&gt;bm&lt;/span&gt;:&lt;span style="color: #800000;"&gt;Map&lt;/span&gt;&amp;gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="color: #800000;"&gt;Side note: there's a XAML compiler bug in the consumer preview that prevents setting FillColor on MapPolygon but you can set it via code fine or wait until the final release where it can be set from XAML as well.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="color: #800000;"&gt;Side note 2: We're already hard at work creating the final version of the Map control with tons of tweaks and fixes. As an example Pushpin no longer requires setting PositionAnchor on it as it will default to the center of the pushpin.&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10285632" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/b/kristoffer/archive/tags/Bing+Maps/">Bing Maps</category><category domain="http://blogs.msdn.com/b/kristoffer/archive/tags/Xaml/">Xaml</category><category domain="http://blogs.msdn.com/b/kristoffer/archive/tags/Windows+8/">Windows 8</category></item><item><title>Working with the Bing Maps Metro style map in XAML</title><link>http://blogs.msdn.com/b/kristoffer/archive/2012/03/15/working-with-the-bing-maps-metro-style-map-in-xaml.aspx</link><pubDate>Thu, 15 Mar 2012 17:31:29 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10283806</guid><dc:creator>Kristoffer Henriksson</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/kristoffer/rsscomments.aspx?WeblogPostID=10283806</wfw:commentRss><comments>http://blogs.msdn.com/b/kristoffer/archive/2012/03/15/working-with-the-bing-maps-metro-style-map-in-xaml.aspx#comments</comments><description>&lt;p&gt;Win 8 xaml unfortunately does not supporting anything similar to TypeConverters to convert from strings to objects so some properties like Location end up being more verbose and less intuitive than in previous versions of Bing Maps xaml-compatible controls like Silverlight and WPF. In Silverlight one could set the Center inline:&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family: courier new,courier;"&gt;&lt;span style="color: #0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000;"&gt;bm&lt;/span&gt;:&lt;span style="color: #800000;"&gt;Map&lt;/span&gt; &lt;span style="color: #ff0000;"&gt;Center&lt;/span&gt;=&lt;span style="color: #0000ff;"&gt;"0,0"&lt;/span&gt; &lt;span style="color: #0000ff;"&gt;/&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;On the Win8 metro version of the map this looks a bit different:&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family: courier new,courier;"&gt;&lt;span style="color: #0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000;"&gt;bm&lt;/span&gt;&lt;span style="color: #0000ff;"&gt;:&lt;/span&gt;&lt;span style="color: #800000;"&gt;Map&lt;/span&gt;&lt;span style="color: #0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new,courier;"&gt;&lt;span style="color: #0000ff;"&gt;&amp;nbsp; &amp;lt;&lt;/span&gt;&lt;span style="color: #800000;"&gt;bm&lt;/span&gt;&lt;span style="color: #0000ff;"&gt;:&lt;/span&gt;&lt;span style="color: #800000;"&gt;Map&lt;/span&gt;.&lt;span style="color: #800000;"&gt;Center&lt;/span&gt;&lt;span style="color: #0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new,courier;"&gt;&lt;span style="color: #0000ff;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;&lt;/span&gt;&lt;span style="color: #800000;"&gt;bm&lt;/span&gt;&lt;span style="color: #0000ff;"&gt;:&lt;/span&gt;&lt;span style="color: #800000;"&gt;Location&lt;/span&gt; &lt;span style="color: #ff0000;"&gt;Latitude&lt;/span&gt;=&lt;span style="color: #0000ff;"&gt;"0"&lt;/span&gt; &lt;span style="color: #ff0000;"&gt;Longitude&lt;/span&gt;=&lt;span style="color: #0000ff;"&gt;"0"&lt;/span&gt; &lt;span style="color: #0000ff;"&gt;/&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new,courier;"&gt;&lt;span style="color: #0000ff;"&gt;&amp;nbsp; &amp;lt;/&lt;/span&gt;&lt;span style="color: #800000;"&gt;bm&lt;/span&gt;&lt;span style="color: #0000ff;"&gt;:&lt;/span&gt;&lt;span style="color: #800000;"&gt;Map&lt;/span&gt;.&lt;span style="color: #800000;"&gt;Center&lt;/span&gt;&lt;span style="color: #0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new,courier;"&gt;&lt;/span&gt;&lt;span style="font-family: courier new,courier;"&gt;&lt;span style="color: #0000ff;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #800000;"&gt;bm&lt;/span&gt;&lt;span style="color: #0000ff;"&gt;:&lt;/span&gt;&lt;span style="color: #800000;"&gt;Map&lt;/span&gt;&lt;span style="color: #0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;Other properties are similarly affected. The attached property MapLayer.Position for example:&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family: courier new,courier; color: #0000ff;"&gt;&amp;lt;&lt;span style="color: #800000;"&gt;bm&lt;/span&gt;:&lt;span style="color: #800000;"&gt;Map&lt;/span&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new,courier; color: #0000ff;"&gt;&lt;/span&gt;&lt;span style="font-family: courier new,courier; color: #0000ff;"&gt;&amp;nbsp; &amp;lt;&lt;span style="color: #800000;"&gt;bm&lt;/span&gt;:&lt;span style="color: #800000;"&gt;Map&lt;/span&gt;.&lt;span style="color: #800000;"&gt;Children&lt;/span&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new,courier; color: #0000ff;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;&lt;span style="color: #800000;"&gt;Button&lt;/span&gt; &lt;span style="color: #ff0000;"&gt;Width&lt;/span&gt;="100" &lt;span style="color: #ff0000;"&gt;Height&lt;/span&gt;="40" &lt;span style="color: #ff0000;"&gt;Content&lt;/span&gt;="Button" &lt;span style="color: #ff0000;"&gt;bm&lt;/span&gt;:&lt;span style="color: #ff0000;"&gt;MapLayer&lt;/span&gt;.&lt;span style="color: #ff0000;"&gt;PositionAnchor&lt;/span&gt;="50,40" &lt;span style="color: #ff0000;"&gt;Background&lt;/span&gt;="Black"&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new,courier; color: #0000ff;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;&lt;span style="color: #800000;"&gt;bm&lt;/span&gt;:&lt;span style="color: #800000;"&gt;MapLayer&lt;/span&gt;.&lt;span style="color: #800000;"&gt;Position&lt;/span&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new,courier; color: #0000ff;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;&lt;span style="color: #800000;"&gt;bm&lt;/span&gt;:&lt;span style="color: #800000;"&gt;Location&lt;/span&gt; &lt;span style="color: #ff0000;"&gt;Latitude&lt;/span&gt;="0" &lt;span style="color: #ff0000;"&gt;Longitude&lt;/span&gt;="0" /&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new,courier; color: #0000ff;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/&lt;span style="color: #800000;"&gt;bm&lt;/span&gt;:&lt;span style="color: #800000;"&gt;MapLayer&lt;/span&gt;.&lt;span style="color: #800000;"&gt;Position&lt;/span&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new,courier; color: #0000ff;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/&lt;span style="color: #800000;"&gt;Button&lt;/span&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new,courier; color: #0000ff;"&gt;&amp;nbsp; &amp;lt;/&lt;span style="color: #800000;"&gt;bm&lt;/span&gt;:&lt;span style="color: #800000;"&gt;Map&lt;/span&gt;.&lt;span style="color: #800000;"&gt;Children&lt;/span&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new,courier; color: #0000ff;"&gt;&amp;lt;/&lt;span style="color: #800000;"&gt;bm&lt;/span&gt;:&lt;span style="color: #800000;"&gt;Map&lt;/span&gt;&amp;gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;Note that MapLayer.PositionAnchor can be set inline since it is of type Point which is natively supported by the Xaml parser whereas it does not know how to convert from a string to a Location object so it needs a little help there.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10283806" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/b/kristoffer/archive/tags/Bing+Maps/">Bing Maps</category><category domain="http://blogs.msdn.com/b/kristoffer/archive/tags/Xaml/">Xaml</category><category domain="http://blogs.msdn.com/b/kristoffer/archive/tags/Windows+8/">Windows 8</category></item><item><title>Using Bing Maps in a Windows 8 Metro style app</title><link>http://blogs.msdn.com/b/kristoffer/archive/2012/03/09/using-bing-maps-in-a-windows-8-metro-style-app.aspx</link><pubDate>Fri, 09 Mar 2012 17:46:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10280516</guid><dc:creator>Kristoffer Henriksson</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/kristoffer/rsscomments.aspx?WeblogPostID=10280516</wfw:commentRss><comments>http://blogs.msdn.com/b/kristoffer/archive/2012/03/09/using-bing-maps-in-a-windows-8-metro-style-app.aspx#comments</comments><description>&lt;p&gt;&lt;span style="color: #800000;"&gt;The recently released Bing Maps controls for Windows 8 (available in the &lt;a href="http://go.microsoft.com/fwlink/?LinkId=242709"&gt;Visual Studio Gallery&lt;/a&gt;&lt;/span&gt;&lt;span style="color: #800000;"&gt;) actually contains two separate map controls to support the two types of Windows 8 applications. One is a port of our existing Javascript map control and is used to write html/javascript applications, the other is written in native C++ and is usable by any Xaml application whether it's using C#, VB.NET, or C++. We've helpfully included a template to make it easy to get started with the Xaml control. Once the Bing Maps SDK for Metro style apps is installed there will be a Bing Maps Application template available under the Visual C#&lt;/span&gt;.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-77-33-BingMapsMetro/2605.NewBingMapsApplication.png"&gt;&lt;img src="http://blogs.msdn.com/resized-image.ashx/__size/550x658/__key/communityserver-blogs-components-weblogfiles/00-00-00-77-33-BingMapsMetro/2605.NewBingMapsApplication.png" alt="" border="0" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="color: #800000;"&gt;It's also easy enough to use Bing Maps in an application from scratch. First add a Reference to Bing Maps for C#, C++, or Visual Basic (Beta) and Microsoft Visual C++ Runtime Package (if you're writing a managed app, C++ only needs Bing Maps).&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;a aiotarget="false" aiotitle="" href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-77-33-BingMapsMetro/6708.ReferenceManager.png"&gt;&lt;img src="http://blogs.msdn.com/resized-image.ashx/__size/550x266/__key/communityserver-blogs-components-weblogfiles/00-00-00-77-33-BingMapsMetro/6708.ReferenceManager.png" alt="" border="0" /&gt;&lt;/a&gt;&lt;span style="color: #800000;"&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="color: #800000;"&gt;If you try to build at this point you'll be presented&lt;/span&gt;&lt;span style="color: #800000;"&gt; with a most confusing set of error messages:&lt;/span&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;span style="font-family: courier new,courier;"&gt;Could not find SDK "Microsoft.VCLibs, Version=11.0".&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style="font-family: courier new,courier;"&gt;"APPX" attributes were found in the SDK manifest file however none of the attributes matched the targeted configuration and architecture and no "APPX" attribute without configuration and architecture could be found. If an appx is required then the project will fail at runtime.&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style="font-family: courier new,courier;"&gt;The referenced component 'Microsoft Visual C++ Runtime Package' could not be found.&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;span style="color: #800000;"&gt;Don't be alarmed. This just means you're writing a managed application and have left the platform target at the default Any CPU and both Bing Maps and Visual C++ Runtime require a specific architecture to be set. Change the Active solution platform to x64 or x86 and then it will build properly. The Visual C++ Runtime package is required to deploy on computers that do not have Visual Studio installed. To use the Map control you can drag it from the Toolbox and drop it on your page or declare it yourself with the following two snippets:&lt;/span&gt;&lt;/p&gt;
&lt;p style="padding-left: 30px;"&gt;&lt;span style="font-family: courier new,courier;"&gt;&lt;span style="color: #ff0000;"&gt;xmlns&lt;/span&gt;&lt;span style="color: #0000ff;"&gt;:&lt;/span&gt;&lt;span style="color: #ff0000;"&gt;bm&lt;/span&gt;&lt;span style="color: #0000ff;"&gt;="using:Bing.Maps"&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p style="padding-left: 30px;"&gt;&lt;span style="font-family: courier new,courier;"&gt;&lt;span style="color: #0000ff;"&gt;&amp;lt;&lt;span style="color: #800000;"&gt;bm&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #0000ff;"&gt;:&lt;/span&gt;&lt;span style="color: #800000;"&gt;Map&lt;/span&gt; &lt;span style="color: #ff0000;"&gt;Width&lt;/span&gt;&lt;span style="color: #0000ff;"&gt;="800"&lt;/span&gt; &lt;span style="color: #ff0000;"&gt;Height&lt;/span&gt;&lt;span style="color: #0000ff;"&gt;="600"&lt;/span&gt; &lt;span style="color: #ff0000;"&gt;Credentials&lt;/span&gt;&lt;span style="color: #0000ff;"&gt;="INSERT_YOUR_BING_MAPS_KEY"&lt;/span&gt; /&amp;gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="color: #800000;"&gt;You will need a Bing Maps Key to use the map but fortunately we have generous pre-release licensing terms that permit you to use it for free during the beta period. You can read more the licensing terms on the &lt;a href="http://msdn.microsoft.com/en-us/library/ff428642.aspx"&gt;Bing Maps blog&lt;/a&gt;. For digging deeper we have also worked hard to make sure the &lt;a href="http://go.microsoft.com/fwlink/?LinkID=242866"&gt;documentation&lt;/a&gt; is helpful and up to date.&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10280516" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/b/kristoffer/archive/tags/-NET/">.NET</category><category domain="http://blogs.msdn.com/b/kristoffer/archive/tags/Bing+Maps/">Bing Maps</category><category domain="http://blogs.msdn.com/b/kristoffer/archive/tags/Windows+8/">Windows 8</category></item><item><title>Shrinking .NET assemblies by removing unnecessary attributes</title><link>http://blogs.msdn.com/b/kristoffer/archive/2010/04/28/shrinking-net-assemblies-by-removing-unnecessary-attributes.aspx</link><pubDate>Wed, 28 Apr 2010 17:47:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10004023</guid><dc:creator>Kristoffer Henriksson</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/kristoffer/rsscomments.aspx?WeblogPostID=10004023</wfw:commentRss><comments>http://blogs.msdn.com/b/kristoffer/archive/2010/04/28/shrinking-net-assemblies-by-removing-unnecessary-attributes.aspx#comments</comments><description>&lt;meta http-equiv="Content-Type" content="text/html; charset=utf-8"&gt;&lt;meta name="ProgId" content="Word.Document"&gt;&lt;meta name="Generator" content="Microsoft Word 14"&gt;&lt;meta name="Originator" content="Microsoft Word 14"&gt;&lt;link href="file:///C:%5CUsers%5Ckrihenri%5CAppData%5CLocal%5CTemp%5Cmsohtmlclip1%5C01%5Cclip_filelist.xml" mce_href="file:///C:%5CUsers%5Ckrihenri%5CAppData%5CLocal%5CTemp%5Cmsohtmlclip1%5C01%5Cclip_filelist.xml" rel="File-List"&gt;&lt;!--[if gte mso 9]&gt;&lt;xml&gt;
 &lt;o:OfficeDocumentSettings&gt;
  &lt;o:AllowPNG/&gt;
 &lt;/o:OfficeDocumentSettings&gt;
&lt;/xml&gt;&lt;![endif]--&gt;&lt;link href="file:///C:%5CUsers%5Ckrihenri%5CAppData%5CLocal%5CTemp%5Cmsohtmlclip1%5C01%5Cclip_themedata.thmx" mce_href="file:///C:%5CUsers%5Ckrihenri%5CAppData%5CLocal%5CTemp%5Cmsohtmlclip1%5C01%5Cclip_themedata.thmx" rel="themeData"&gt;&lt;link href="file:///C:%5CUsers%5Ckrihenri%5CAppData%5CLocal%5CTemp%5Cmsohtmlclip1%5C01%5Cclip_colorschememapping.xml" mce_href="file:///C:%5CUsers%5Ckrihenri%5CAppData%5CLocal%5CTemp%5Cmsohtmlclip1%5C01%5Cclip_colorschememapping.xml" rel="colorSchemeMapping"&gt;&lt;!--[if gte mso 9]&gt;&lt;xml&gt;
 &lt;w:WordDocument&gt;
  &lt;w:View&gt;Normal&lt;/w:View&gt;
  &lt;w:Zoom&gt;0&lt;/w:Zoom&gt;
  &lt;w:TrackMoves/&gt;
  &lt;w:TrackFormatting/&gt;
  &lt;w:PunctuationKerning/&gt;
  &lt;w:ValidateAgainstSchemas/&gt;
  &lt;w:SaveIfXMLInvalid&gt;false&lt;/w:SaveIfXMLInvalid&gt;
  &lt;w:IgnoreMixedContent&gt;false&lt;/w:IgnoreMixedContent&gt;
  &lt;w:AlwaysShowPlaceholderText&gt;false&lt;/w:AlwaysShowPlaceholderText&gt;
  &lt;w:DoNotPromoteQF/&gt;
  &lt;w:LidThemeOther&gt;EN-US&lt;/w:LidThemeOther&gt;
  &lt;w:LidThemeAsian&gt;X-NONE&lt;/w:LidThemeAsian&gt;
  &lt;w:LidThemeComplexScript&gt;X-NONE&lt;/w:LidThemeComplexScript&gt;
  &lt;w:Compatibility&gt;
   &lt;w:BreakWrappedTables/&gt;
   &lt;w:SnapToGridInCell/&gt;
   &lt;w:WrapTextWithPunct/&gt;
   &lt;w:UseAsianBreakRules/&gt;
   &lt;w:DontGrowAutofit/&gt;
   &lt;w:SplitPgBreakAndParaMark/&gt;
   &lt;w:EnableOpenTypeKerning/&gt;
   &lt;w:DontFlipMirrorIndents/&gt;
   &lt;w:OverrideTableStyleHps/&gt;
  &lt;/w:Compatibility&gt;
  &lt;m:mathPr&gt;
   &lt;m:mathFont m:val="Cambria Math"/&gt;
   &lt;m:brkBin m:val="before"/&gt;
   &lt;m:brkBinSub m:val="&amp;#45;-"/&gt;
   &lt;m:smallFrac m:val="off"/&gt;
   &lt;m:dispDef/&gt;
   &lt;m:lMargin m:val="0"/&gt;
   &lt;m:rMargin m:val="0"/&gt;
   &lt;m:defJc m:val="centerGroup"/&gt;
   &lt;m:wrapIndent m:val="1440"/&gt;
   &lt;m:intLim m:val="subSup"/&gt;
   &lt;m:naryLim m:val="undOvr"/&gt;
  &lt;/m:mathPr&gt;&lt;/w:WordDocument&gt;
&lt;/xml&gt;&lt;![endif]--&gt;&lt;!--[if gte mso 9]&gt;&lt;xml&gt;
 &lt;w:LatentStyles DefLockedState="false" DefUnhideWhenUsed="true"
  DefSemiHidden="true" DefQFormat="false" DefPriority="99"
  LatentStyleCount="267"&gt;
  &lt;w:LsdException Locked="false" Priority="0" SemiHidden="false"
   UnhideWhenUsed="false" QFormat="true" Name="Normal"/&gt;
  &lt;w:LsdException Locked="false" Priority="9" SemiHidden="false"
   UnhideWhenUsed="false" QFormat="true" Name="heading 1"/&gt;
  &lt;w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 2"/&gt;
  &lt;w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 3"/&gt;
  &lt;w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 4"/&gt;
  &lt;w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 5"/&gt;
  &lt;w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 6"/&gt;
  &lt;w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 7"/&gt;
  &lt;w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 8"/&gt;
  &lt;w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 9"/&gt;
  &lt;w:LsdException Locked="false" Priority="39" Name="toc 1"/&gt;
  &lt;w:LsdException Locked="false" Priority="39" Name="toc 2"/&gt;
  &lt;w:LsdException Locked="false" Priority="39" Name="toc 3"/&gt;
  &lt;w:LsdException Locked="false" Priority="39" Name="toc 4"/&gt;
  &lt;w:LsdException Locked="false" Priority="39" Name="toc 5"/&gt;
  &lt;w:LsdException Locked="false" Priority="39" Name="toc 6"/&gt;
  &lt;w:LsdException Locked="false" Priority="39" Name="toc 7"/&gt;
  &lt;w:LsdException Locked="false" Priority="39" Name="toc 8"/&gt;
  &lt;w:LsdException Locked="false" Priority="39" Name="toc 9"/&gt;
  &lt;w:LsdException Locked="false" Priority="35" QFormat="true" Name="caption"/&gt;
  &lt;w:LsdException Locked="false" Priority="10" SemiHidden="false"
   UnhideWhenUsed="false" QFormat="true" Name="Title"/&gt;
  &lt;w:LsdException Locked="false" Priority="1" Name="Default Paragraph Font"/&gt;
  &lt;w:LsdException Locked="false" Priority="11" SemiHidden="false"
   UnhideWhenUsed="false" QFormat="true" Name="Subtitle"/&gt;
  &lt;w:LsdException Locked="false" Priority="22" SemiHidden="false"
   UnhideWhenUsed="false" QFormat="true" Name="Strong"/&gt;
  &lt;w:LsdException Locked="false" Priority="20" SemiHidden="false"
   UnhideWhenUsed="false" QFormat="true" Name="Emphasis"/&gt;
  &lt;w:LsdException Locked="false" Priority="59" SemiHidden="false"
   UnhideWhenUsed="false" Name="Table Grid"/&gt;
  &lt;w:LsdException Locked="false" UnhideWhenUsed="false" Name="Placeholder Text"/&gt;
  &lt;w:LsdException Locked="false" Priority="1" SemiHidden="false"
   UnhideWhenUsed="false" QFormat="true" Name="No Spacing"/&gt;
  &lt;w:LsdException Locked="false" Priority="60" SemiHidden="false"
   UnhideWhenUsed="false" Name="Light Shading"/&gt;
  &lt;w:LsdException Locked="false" Priority="61" SemiHidden="false"
   UnhideWhenUsed="false" Name="Light List"/&gt;
  &lt;w:LsdException Locked="false" Priority="62" SemiHidden="false"
   UnhideWhenUsed="false" Name="Light Grid"/&gt;
  &lt;w:LsdException Locked="false" Priority="63" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Shading 1"/&gt;
  &lt;w:LsdException Locked="false" Priority="64" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Shading 2"/&gt;
  &lt;w:LsdException Locked="false" Priority="65" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium List 1"/&gt;
  &lt;w:LsdException Locked="false" Priority="66" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium List 2"/&gt;
  &lt;w:LsdException Locked="false" Priority="67" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Grid 1"/&gt;
  &lt;w:LsdException Locked="false" Priority="68" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Grid 2"/&gt;
  &lt;w:LsdException Locked="false" Priority="69" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Grid 3"/&gt;
  &lt;w:LsdException Locked="false" Priority="70" SemiHidden="false"
   UnhideWhenUsed="false" Name="Dark List"/&gt;
  &lt;w:LsdException Locked="false" Priority="71" SemiHidden="false"
   UnhideWhenUsed="false" Name="Colorful Shading"/&gt;
  &lt;w:LsdException Locked="false" Priority="72" SemiHidden="false"
   UnhideWhenUsed="false" Name="Colorful List"/&gt;
  &lt;w:LsdException Locked="false" Priority="73" SemiHidden="false"
   UnhideWhenUsed="false" Name="Colorful Grid"/&gt;
  &lt;w:LsdException Locked="false" Priority="60" SemiHidden="false"
   UnhideWhenUsed="false" Name="Light Shading Accent 1"/&gt;
  &lt;w:LsdException Locked="false" Priority="61" SemiHidden="false"
   UnhideWhenUsed="false" Name="Light List Accent 1"/&gt;
  &lt;w:LsdException Locked="false" Priority="62" SemiHidden="false"
   UnhideWhenUsed="false" Name="Light Grid Accent 1"/&gt;
  &lt;w:LsdException Locked="false" Priority="63" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Shading 1 Accent 1"/&gt;
  &lt;w:LsdException Locked="false" Priority="64" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Shading 2 Accent 1"/&gt;
  &lt;w:LsdException Locked="false" Priority="65" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium List 1 Accent 1"/&gt;
  &lt;w:LsdException Locked="false" UnhideWhenUsed="false" Name="Revision"/&gt;
  &lt;w:LsdException Locked="false" Priority="34" SemiHidden="false"
   UnhideWhenUsed="false" QFormat="true" Name="List Paragraph"/&gt;
  &lt;w:LsdException Locked="false" Priority="29" SemiHidden="false"
   UnhideWhenUsed="false" QFormat="true" Name="Quote"/&gt;
  &lt;w:LsdException Locked="false" Priority="30" SemiHidden="false"
   UnhideWhenUsed="false" QFormat="true" Name="Intense Quote"/&gt;
  &lt;w:LsdException Locked="false" Priority="66" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium List 2 Accent 1"/&gt;
  &lt;w:LsdException Locked="false" Priority="67" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Grid 1 Accent 1"/&gt;
  &lt;w:LsdException Locked="false" Priority="68" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Grid 2 Accent 1"/&gt;
  &lt;w:LsdException Locked="false" Priority="69" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Grid 3 Accent 1"/&gt;
  &lt;w:LsdException Locked="false" Priority="70" SemiHidden="false"
   UnhideWhenUsed="false" Name="Dark List Accent 1"/&gt;
  &lt;w:LsdException Locked="false" Priority="71" SemiHidden="false"
   UnhideWhenUsed="false" Name="Colorful Shading Accent 1"/&gt;
  &lt;w:LsdException Locked="false" Priority="72" SemiHidden="false"
   UnhideWhenUsed="false" Name="Colorful List Accent 1"/&gt;
  &lt;w:LsdException Locked="false" Priority="73" SemiHidden="false"
   UnhideWhenUsed="false" Name="Colorful Grid Accent 1"/&gt;
  &lt;w:LsdException Locked="false" Priority="60" SemiHidden="false"
   UnhideWhenUsed="false" Name="Light Shading Accent 2"/&gt;
  &lt;w:LsdException Locked="false" Priority="61" SemiHidden="false"
   UnhideWhenUsed="false" Name="Light List Accent 2"/&gt;
  &lt;w:LsdException Locked="false" Priority="62" SemiHidden="false"
   UnhideWhenUsed="false" Name="Light Grid Accent 2"/&gt;
  &lt;w:LsdException Locked="false" Priority="63" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Shading 1 Accent 2"/&gt;
  &lt;w:LsdException Locked="false" Priority="64" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Shading 2 Accent 2"/&gt;
  &lt;w:LsdException Locked="false" Priority="65" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium List 1 Accent 2"/&gt;
  &lt;w:LsdException Locked="false" Priority="66" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium List 2 Accent 2"/&gt;
  &lt;w:LsdException Locked="false" Priority="67" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Grid 1 Accent 2"/&gt;
  &lt;w:LsdException Locked="false" Priority="68" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Grid 2 Accent 2"/&gt;
  &lt;w:LsdException Locked="false" Priority="69" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Grid 3 Accent 2"/&gt;
  &lt;w:LsdException Locked="false" Priority="70" SemiHidden="false"
   UnhideWhenUsed="false" Name="Dark List Accent 2"/&gt;
  &lt;w:LsdException Locked="false" Priority="71" SemiHidden="false"
   UnhideWhenUsed="false" Name="Colorful Shading Accent 2"/&gt;
  &lt;w:LsdException Locked="false" Priority="72" SemiHidden="false"
   UnhideWhenUsed="false" Name="Colorful List Accent 2"/&gt;
  &lt;w:LsdException Locked="false" Priority="73" SemiHidden="false"
   UnhideWhenUsed="false" Name="Colorful Grid Accent 2"/&gt;
  &lt;w:LsdException Locked="false" Priority="60" SemiHidden="false"
   UnhideWhenUsed="false" Name="Light Shading Accent 3"/&gt;
  &lt;w:LsdException Locked="false" Priority="61" SemiHidden="false"
   UnhideWhenUsed="false" Name="Light List Accent 3"/&gt;
  &lt;w:LsdException Locked="false" Priority="62" SemiHidden="false"
   UnhideWhenUsed="false" Name="Light Grid Accent 3"/&gt;
  &lt;w:LsdException Locked="false" Priority="63" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Shading 1 Accent 3"/&gt;
  &lt;w:LsdException Locked="false" Priority="64" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Shading 2 Accent 3"/&gt;
  &lt;w:LsdException Locked="false" Priority="65" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium List 1 Accent 3"/&gt;
  &lt;w:LsdException Locked="false" Priority="66" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium List 2 Accent 3"/&gt;
  &lt;w:LsdException Locked="false" Priority="67" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Grid 1 Accent 3"/&gt;
  &lt;w:LsdException Locked="false" Priority="68" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Grid 2 Accent 3"/&gt;
  &lt;w:LsdException Locked="false" Priority="69" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Grid 3 Accent 3"/&gt;
  &lt;w:LsdException Locked="false" Priority="70" SemiHidden="false"
   UnhideWhenUsed="false" Name="Dark List Accent 3"/&gt;
  &lt;w:LsdException Locked="false" Priority="71" SemiHidden="false"
   UnhideWhenUsed="false" Name="Colorful Shading Accent 3"/&gt;
  &lt;w:LsdException Locked="false" Priority="72" SemiHidden="false"
   UnhideWhenUsed="false" Name="Colorful List Accent 3"/&gt;
  &lt;w:LsdException Locked="false" Priority="73" SemiHidden="false"
   UnhideWhenUsed="false" Name="Colorful Grid Accent 3"/&gt;
  &lt;w:LsdException Locked="false" Priority="60" SemiHidden="false"
   UnhideWhenUsed="false" Name="Light Shading Accent 4"/&gt;
  &lt;w:LsdException Locked="false" Priority="61" SemiHidden="false"
   UnhideWhenUsed="false" Name="Light List Accent 4"/&gt;
  &lt;w:LsdException Locked="false" Priority="62" SemiHidden="false"
   UnhideWhenUsed="false" Name="Light Grid Accent 4"/&gt;
  &lt;w:LsdException Locked="false" Priority="63" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Shading 1 Accent 4"/&gt;
  &lt;w:LsdException Locked="false" Priority="64" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Shading 2 Accent 4"/&gt;
  &lt;w:LsdException Locked="false" Priority="65" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium List 1 Accent 4"/&gt;
  &lt;w:LsdException Locked="false" Priority="66" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium List 2 Accent 4"/&gt;
  &lt;w:LsdException Locked="false" Priority="67" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Grid 1 Accent 4"/&gt;
  &lt;w:LsdException Locked="false" Priority="68" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Grid 2 Accent 4"/&gt;
  &lt;w:LsdException Locked="false" Priority="69" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Grid 3 Accent 4"/&gt;
  &lt;w:LsdException Locked="false" Priority="70" SemiHidden="false"
   UnhideWhenUsed="false" Name="Dark List Accent 4"/&gt;
  &lt;w:LsdException Locked="false" Priority="71" SemiHidden="false"
   UnhideWhenUsed="false" Name="Colorful Shading Accent 4"/&gt;
  &lt;w:LsdException Locked="false" Priority="72" SemiHidden="false"
   UnhideWhenUsed="false" Name="Colorful List Accent 4"/&gt;
  &lt;w:LsdException Locked="false" Priority="73" SemiHidden="false"
   UnhideWhenUsed="false" Name="Colorful Grid Accent 4"/&gt;
  &lt;w:LsdException Locked="false" Priority="60" SemiHidden="false"
   UnhideWhenUsed="false" Name="Light Shading Accent 5"/&gt;
  &lt;w:LsdException Locked="false" Priority="61" SemiHidden="false"
   UnhideWhenUsed="false" Name="Light List Accent 5"/&gt;
  &lt;w:LsdException Locked="false" Priority="62" SemiHidden="false"
   UnhideWhenUsed="false" Name="Light Grid Accent 5"/&gt;
  &lt;w:LsdException Locked="false" Priority="63" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Shading 1 Accent 5"/&gt;
  &lt;w:LsdException Locked="false" Priority="64" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Shading 2 Accent 5"/&gt;
  &lt;w:LsdException Locked="false" Priority="65" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium List 1 Accent 5"/&gt;
  &lt;w:LsdException Locked="false" Priority="66" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium List 2 Accent 5"/&gt;
  &lt;w:LsdException Locked="false" Priority="67" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Grid 1 Accent 5"/&gt;
  &lt;w:LsdException Locked="false" Priority="68" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Grid 2 Accent 5"/&gt;
  &lt;w:LsdException Locked="false" Priority="69" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Grid 3 Accent 5"/&gt;
  &lt;w:LsdException Locked="false" Priority="70" SemiHidden="false"
   UnhideWhenUsed="false" Name="Dark List Accent 5"/&gt;
  &lt;w:LsdException Locked="false" Priority="71" SemiHidden="false"
   UnhideWhenUsed="false" Name="Colorful Shading Accent 5"/&gt;
  &lt;w:LsdException Locked="false" Priority="72" SemiHidden="false"
   UnhideWhenUsed="false" Name="Colorful List Accent 5"/&gt;
  &lt;w:LsdException Locked="false" Priority="73" SemiHidden="false"
   UnhideWhenUsed="false" Name="Colorful Grid Accent 5"/&gt;
  &lt;w:LsdException Locked="false" Priority="60" SemiHidden="false"
   UnhideWhenUsed="false" Name="Light Shading Accent 6"/&gt;
  &lt;w:LsdException Locked="false" Priority="61" SemiHidden="false"
   UnhideWhenUsed="false" Name="Light List Accent 6"/&gt;
  &lt;w:LsdException Locked="false" Priority="62" SemiHidden="false"
   UnhideWhenUsed="false" Name="Light Grid Accent 6"/&gt;
  &lt;w:LsdException Locked="false" Priority="63" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Shading 1 Accent 6"/&gt;
  &lt;w:LsdException Locked="false" Priority="64" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Shading 2 Accent 6"/&gt;
  &lt;w:LsdException Locked="false" Priority="65" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium List 1 Accent 6"/&gt;
  &lt;w:LsdException Locked="false" Priority="66" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium List 2 Accent 6"/&gt;
  &lt;w:LsdException Locked="false" Priority="67" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Grid 1 Accent 6"/&gt;
  &lt;w:LsdException Locked="false" Priority="68" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Grid 2 Accent 6"/&gt;
  &lt;w:LsdException Locked="false" Priority="69" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Grid 3 Accent 6"/&gt;
  &lt;w:LsdException Locked="false" Priority="70" SemiHidden="false"
   UnhideWhenUsed="false" Name="Dark List Accent 6"/&gt;
  &lt;w:LsdException Locked="false" Priority="71" SemiHidden="false"
   UnhideWhenUsed="false" Name="Colorful Shading Accent 6"/&gt;
  &lt;w:LsdException Locked="false" Priority="72" SemiHidden="false"
   UnhideWhenUsed="false" Name="Colorful List Accent 6"/&gt;
  &lt;w:LsdException Locked="false" Priority="73" SemiHidden="false"
   UnhideWhenUsed="false" Name="Colorful Grid Accent 6"/&gt;
  &lt;w:LsdException Locked="false" Priority="19" SemiHidden="false"
   UnhideWhenUsed="false" QFormat="true" Name="Subtle Emphasis"/&gt;
  &lt;w:LsdException Locked="false" Priority="21" SemiHidden="false"
   UnhideWhenUsed="false" QFormat="true" Name="Intense Emphasis"/&gt;
  &lt;w:LsdException Locked="false" Priority="31" SemiHidden="false"
   UnhideWhenUsed="false" QFormat="true" Name="Subtle Reference"/&gt;
  &lt;w:LsdException Locked="false" Priority="32" SemiHidden="false"
   UnhideWhenUsed="false" QFormat="true" Name="Intense Reference"/&gt;
  &lt;w:LsdException Locked="false" Priority="33" SemiHidden="false"
   UnhideWhenUsed="false" QFormat="true" Name="Book Title"/&gt;
  &lt;w:LsdException Locked="false" Priority="37" Name="Bibliography"/&gt;
  &lt;w:LsdException Locked="false" Priority="39" QFormat="true" Name="TOC Heading"/&gt;
 &lt;/w:LatentStyles&gt;
&lt;/xml&gt;&lt;![endif]--&gt;&lt;style&gt;
&lt;!--
 /* Font Definitions */
 @font-face
	{font-family:Calibri;
	panose-1:2 15 5 2 2 2 4 3 2 4;
	mso-font-charset:0;
	mso-generic-font-family:swiss;
	mso-font-pitch:variable;
	mso-font-signature:-520092929 1073786111 9 0 415 0;}
 /* Style Definitions */
 p.MsoNormal, li.MsoNormal, div.MsoNormal
	{mso-style-unhide:no;
	mso-style-qformat:yes;
	mso-style-parent:"";
	margin-top:0in;
	margin-right:0in;
	margin-bottom:10.0pt;
	margin-left:0in;
	line-height:115%;
	mso-pagination:widow-orphan;
	font-size:11.0pt;
	font-family:"Calibri","sans-serif";
	mso-ascii-font-family:Calibri;
	mso-ascii-theme-font:minor-latin;
	mso-fareast-font-family:Calibri;
	mso-fareast-theme-font:minor-latin;
	mso-hansi-font-family:Calibri;
	mso-hansi-theme-font:minor-latin;
	mso-bidi-font-family:"Times New Roman";
	mso-bidi-theme-font:minor-bidi;}
a:link, span.MsoHyperlink
	{mso-style-priority:99;
	color:blue;
	mso-themecolor:hyperlink;
	text-decoration:underline;
	text-underline:single;}
a:visited, span.MsoHyperlinkFollowed
	{mso-style-noshow:yes;
	mso-style-priority:99;
	color:purple;
	mso-themecolor:followedhyperlink;
	text-decoration:underline;
	text-underline:single;}
.MsoChpDefault
	{mso-style-type:export-only;
	mso-default-props:yes;
	font-family:"Calibri","sans-serif";
	mso-ascii-font-family:Calibri;
	mso-ascii-theme-font:minor-latin;
	mso-fareast-font-family:Calibri;
	mso-fareast-theme-font:minor-latin;
	mso-hansi-font-family:Calibri;
	mso-hansi-theme-font:minor-latin;
	mso-bidi-font-family:"Times New Roman";
	mso-bidi-theme-font:minor-bidi;}
.MsoPapDefault
	{mso-style-type:export-only;
	margin-bottom:10.0pt;
	line-height:115%;}
@page WordSection1
	{size:8.5in 11.0in;
	margin:1.0in 1.0in 1.0in 1.0in;
	mso-header-margin:.5in;
	mso-footer-margin:.5in;
	mso-paper-source:0;}
div.WordSection1
	{page:WordSection1;}
--&gt;
&lt;/style&gt;&lt;!--[if gte mso 10]&gt;
&lt;style&gt;
 /* Style Definitions */
 table.MsoNormalTable
	{mso-style-name:"Table Normal";
	mso-tstyle-rowband-size:0;
	mso-tstyle-colband-size:0;
	mso-style-noshow:yes;
	mso-style-priority:99;
	mso-style-parent:"";
	mso-padding-alt:0in 5.4pt 0in 5.4pt;
	mso-para-margin-top:0in;
	mso-para-margin-right:0in;
	mso-para-margin-bottom:10.0pt;
	mso-para-margin-left:0in;
	line-height:115%;
	mso-pagination:widow-orphan;
	font-size:11.0pt;
	font-family:"Calibri","sans-serif";
	mso-ascii-font-family:Calibri;
	mso-ascii-theme-font:minor-latin;
	mso-hansi-font-family:Calibri;
	mso-hansi-theme-font:minor-latin;
	mso-bidi-font-family:"Times New Roman";
	mso-bidi-theme-font:minor-bidi;}
&lt;/style&gt;
&lt;![endif]--&gt;

&lt;p class="MsoNormal" style="line-height: normal;"&gt;&lt;span style="font-size: 10pt; font-family: 'Arial','sans-serif';"&gt;.NET assemblies contain a rich set
of metadata for use by the run time, debugger, and compiler. This information
is stored in the assembly whether it will be used or not which for certain
types of shipping assemblies is unnecessary. For example when you create a new
automatic property:&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"&gt;&lt;span style="font-size: 10pt; font-family: 'Courier New'; color: blue;"&gt;public&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: 'Courier New';"&gt; &lt;span style="color: blue;"&gt;int&lt;/span&gt;
MyProperty { &lt;span style="color: blue;"&gt;get&lt;/span&gt;; &lt;span style="color: blue;"&gt;set&lt;/span&gt;;
}&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"&gt;&amp;nbsp;&lt;/p&gt;

&lt;p class="MsoNormal" style="line-height: normal;"&gt;&lt;span style="font-size: 10pt; font-family: 'Arial','sans-serif';"&gt;The compiler generates the following
disassembled code:&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal; background: none repeat scroll 0% 0% white;"&gt;&lt;span style="font-size: 10pt; font-family: 'Courier New'; color: black;"&gt;.field private int32
'&amp;lt;MyProperty&amp;gt;k__BackingField'&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal; background: none repeat scroll 0% 0% white;"&gt;&lt;span style="font-size: 10pt; font-family: 'Courier New'; color: black;"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal; background: none repeat scroll 0% 0% white;"&gt;&lt;span style="font-size: 10pt; font-family: 'Courier New'; color: black;"&gt;.method public hidebysig
specialname instance int32 &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal; background: none repeat scroll 0% 0% white;"&gt;&lt;span style="font-size: 10pt; font-family: 'Courier New'; color: black;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp; get_MyProperty() cil managed&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal; background: none repeat scroll 0% 0% white;"&gt;&lt;span style="font-size: 10pt; font-family: 'Courier New'; color: black;"&gt;&amp;nbsp; {&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal; background: none repeat scroll 0% 0% white;"&gt;&lt;span style="font-size: 10pt; font-family: 'Courier New'; color: black;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;b style=""&gt;.custom instance void
[mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() =
( 01&lt;span style=""&gt; 00 00 00 )&lt;/span&gt; &lt;o:p&gt;&lt;/o:p&gt;&lt;/b&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal; background: none repeat scroll 0% 0% white;"&gt;&lt;span style="font-size: 10pt; font-family: 'Courier New'; color: black;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; //
Code size&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; 11 (0xb)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal; background: none repeat scroll 0% 0% white;"&gt;&lt;span style="font-size: 10pt; font-family: 'Courier New'; color: black;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;
.maxstack&amp;nbsp; 1&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal; background: none repeat scroll 0% 0% white;"&gt;&lt;span style="font-size: 10pt; font-family: 'Courier New'; color: black;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;
.locals init (int32 V_0)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal; background: none repeat scroll 0% 0% white;"&gt;&lt;span style="font-size: 10pt; font-family: 'Courier New'; color: black;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; IL_0000:&amp;nbsp;
ldarg.0&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal; background: none repeat scroll 0% 0% white;"&gt;&lt;span style="font-size: 10pt; font-family: 'Courier New'; color: black;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;
IL_0001:&amp;nbsp; ldfld&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp; int32 ConsoleApplication1.Test::'&amp;lt;MyProperty&amp;gt;k__BackingField'&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal; background: none repeat scroll 0% 0% white;"&gt;&lt;span style="font-size: 10pt; font-family: 'Courier New'; color: black;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;
IL_0006:&amp;nbsp; stloc.0&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal; background: none repeat scroll 0% 0% white;"&gt;&lt;span style="font-size: 10pt; font-family: 'Courier New'; color: black;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;
IL_0007:&amp;nbsp; br.s&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; IL_0009&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal; background: none repeat scroll 0% 0% white;"&gt;&lt;span style="font-size: 10pt; font-family: 'Courier New'; color: black;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;
IL_0009:&amp;nbsp; ldloc.0&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal; background: none repeat scroll 0% 0% white;"&gt;&lt;span style="font-size: 10pt; font-family: 'Courier New'; color: black;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;
IL_000a:&amp;nbsp; ret&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal; background: none repeat scroll 0% 0% white;"&gt;&lt;span style="font-size: 10pt; font-family: 'Courier New'; color: black;"&gt;&amp;nbsp; } // end of
method Program::get_MyProperty&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal; background: none repeat scroll 0% 0% white;"&gt;&lt;span style="font-size: 10pt; font-family: 'Courier New'; color: black;"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal; background: none repeat scroll 0% 0% white;"&gt;&lt;span style="font-size: 10pt; font-family: 'Courier New'; color: black;"&gt;&amp;nbsp; .method private
hidebysig specialname instance void &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal; background: none repeat scroll 0% 0% white;"&gt;&lt;span style="font-size: 10pt; font-family: 'Courier New'; color: black;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp; set_MyProperty(int32 'value') cil managed&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal; background: none repeat scroll 0% 0% white;"&gt;&lt;span style="font-size: 10pt; font-family: 'Courier New'; color: black;"&gt;&amp;nbsp; {&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal; background: none repeat scroll 0% 0% white;"&gt;&lt;span style="font-size: 10pt; font-family: 'Courier New'; color: black;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;b&gt;.custom
instance void
[mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() =
( 01 00 00 00 )&lt;/b&gt; &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal; background: none repeat scroll 0% 0% white;"&gt;&lt;span style="font-size: 10pt; font-family: 'Courier New'; color: black;" lang="DE"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;
// Code size&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; 8 (0x8)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal; background: none repeat scroll 0% 0% white;"&gt;&lt;span style="font-size: 10pt; font-family: 'Courier New'; color: black;" lang="DE"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;
.maxstack&amp;nbsp; 8&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal; background: none repeat scroll 0% 0% white;"&gt;&lt;span style="font-size: 10pt; font-family: 'Courier New'; color: black;" lang="DE"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;
IL_0000:&amp;nbsp; ldarg.0&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal; background: none repeat scroll 0% 0% white;"&gt;&lt;span style="font-size: 10pt; font-family: 'Courier New'; color: black;" lang="DE"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;
IL_0001:&amp;nbsp; ldarg.1&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal; background: none repeat scroll 0% 0% white;"&gt;&lt;span style="font-size: 10pt; font-family: 'Courier New'; color: black;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; IL_0002:&amp;nbsp;
stfld&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp; int32 ConsoleApplication1.Test'&amp;lt;MyProperty&amp;gt;k__BackingField'&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal; background: none repeat scroll 0% 0% white;"&gt;&lt;span style="font-size: 10pt; font-family: 'Courier New'; color: black;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;
IL_0007:&amp;nbsp; ret&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal; background: none repeat scroll 0% 0% white;"&gt;&lt;span style="font-size: 10pt; font-family: 'Courier New'; color: black;"&gt;&amp;nbsp; } // end of
method Program::set_MyProperty&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal; background: none repeat scroll 0% 0% white;"&gt;&lt;span style="font-size: 10pt; font-family: 'Courier New'; color: black;"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class="MsoNormal" style="line-height: normal; background: none repeat scroll 0% 0% white;"&gt;&lt;span style="font-size: 10pt; font-family: 'Arial','sans-serif'; color: black;"&gt;Note the extra &lt;b style=""&gt;CompilerGeneratedAttribute&lt;/b&gt; that the
compiler inserts to note that this code was generated by the compiler. This
attribute is used by the debugger to step over code but when you’re done
debugging and ready to ship it adds little value.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class="MsoNormal" style="line-height: normal; background: none repeat scroll 0% 0% white;"&gt;&lt;span style="font-size: 10pt; font-family: 'Arial','sans-serif'; color: black;"&gt;Thanks to the &lt;a href="http://ccimetadata.codeplex.com/" mce_href="http://ccimetadata.codeplex.com/"&gt;Common Compiler Infrastructure Metadata
Components&lt;/a&gt; we can easily create a tool to remove attributes from an
assembly. Using MetadataMutor we override Visit(List&amp;lt;ICustomAttribute&amp;gt;)
and return a modified list of attributes by removing all attributes of a
certain type:&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal; background: none repeat scroll 0% 0% white;"&gt;&lt;span style="font-size: 10pt; font-family: 'Courier New'; color: blue;"&gt;public&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: 'Courier New'; color: black;"&gt; &lt;/span&gt;&lt;span style="font-size: 10pt; font-family: 'Courier New'; color: blue;"&gt;class&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: 'Courier New'; color: black;"&gt; &lt;/span&gt;&lt;span style="font-size: 10pt; font-family: 'Courier New'; color: rgb(43, 145, 175);"&gt;AttributeMutator&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: 'Courier New'; color: black;"&gt; : &lt;/span&gt;&lt;span style="font-size: 10pt; font-family: 'Courier New'; color: rgb(43, 145, 175);"&gt;MetadataMutator&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: 'Courier New'; color: black;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal; background: none repeat scroll 0% 0% white;"&gt;&lt;span style="font-size: 10pt; font-family: 'Courier New'; color: black;"&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal; background: none repeat scroll 0% 0% white;"&gt;&lt;span style="font-size: 10pt; font-family: 'Courier New'; color: black;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="font-size: 10pt; font-family: 'Courier New'; color: blue;"&gt;private&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: 'Courier New'; color: black;"&gt; &lt;/span&gt;&lt;span style="font-size: 10pt; font-family: 'Courier New'; color: rgb(43, 145, 175);"&gt;Dictionary&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: 'Courier New'; color: black;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: 'Courier New'; color: blue;"&gt;string&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: 'Courier New'; color: black;"&gt;, &lt;/span&gt;&lt;span style="font-size: 10pt; font-family: 'Courier New'; color: blue;"&gt;string&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: 'Courier New'; color: black;"&gt;&amp;gt; attributesToRemove;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal; background: none repeat scroll 0% 0% white;"&gt;&lt;span style="font-size: 10pt; font-family: 'Courier New'; color: black;"&gt;&amp;nbsp;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal; background: none repeat scroll 0% 0% white;"&gt;&lt;span style="font-size: 10pt; font-family: 'Courier New'; color: black;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="font-size: 10pt; font-family: 'Courier New'; color: blue;"&gt;public&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: 'Courier New'; color: black;"&gt; AttributeMutator(&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: 'Courier New'; color: rgb(43, 145, 175);"&gt;IMetadataHost&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: 'Courier New'; color: black;"&gt; host, &lt;/span&gt;&lt;span style="font-size: 10pt; font-family: 'Courier New'; color: rgb(43, 145, 175);"&gt;IEnumerable&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: 'Courier New'; color: black;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: 'Courier New'; color: blue;"&gt;string&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: 'Courier New'; color: black;"&gt;&amp;gt; attributesToRemove)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal; background: none repeat scroll 0% 0% white;"&gt;&lt;span style="font-size: 10pt; font-family: 'Courier New'; color: black;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&amp;nbsp;&amp;nbsp;&amp;nbsp; : &lt;/span&gt;&lt;span style="font-size: 10pt; font-family: 'Courier New'; color: blue;"&gt;base&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: 'Courier New'; color: black;"&gt;(host)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal; background: none repeat scroll 0% 0% white;"&gt;&lt;span style="font-size: 10pt; font-family: 'Courier New'; color: black;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal; background: none repeat scroll 0% 0% white;"&gt;&lt;span style="font-size: 10pt; font-family: 'Courier New'; color: black;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="font-size: 10pt; font-family: 'Courier New'; color: blue;"&gt;this&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: 'Courier New'; color: black;"&gt;.attributesToRemove = &lt;/span&gt;&lt;span style="font-size: 10pt; font-family: 'Courier New'; color: blue;"&gt;new&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: 'Courier New'; color: black;"&gt; &lt;/span&gt;&lt;span style="font-size: 10pt; font-family: 'Courier New'; color: rgb(43, 145, 175);"&gt;Dictionary&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: 'Courier New'; color: black;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: 'Courier New'; color: blue;"&gt;string&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: 'Courier New'; color: black;"&gt;, &lt;/span&gt;&lt;span style="font-size: 10pt; font-family: 'Courier New'; color: blue;"&gt;string&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: 'Courier New'; color: black;"&gt;&amp;gt;();&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal; background: none repeat scroll 0% 0% white;"&gt;&lt;span style="font-size: 10pt; font-family: 'Courier New'; color: black;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="font-size: 10pt; font-family: 'Courier New'; color: blue;"&gt;foreach&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: 'Courier New'; color: black;"&gt; (&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: 'Courier New'; color: blue;"&gt;string&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: 'Courier New'; color: black;"&gt; attribute &lt;/span&gt;&lt;span style="font-size: 10pt; font-family: 'Courier New'; color: blue;"&gt;in&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: 'Courier New'; color: black;"&gt; attributesToRemove)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal; background: none repeat scroll 0% 0% white;"&gt;&lt;span style="font-size: 10pt; font-family: 'Courier New'; color: black;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal; background: none repeat scroll 0% 0% white;"&gt;&lt;span style="font-size: 10pt; font-family: 'Courier New'; color: black;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="font-size: 10pt; font-family: 'Courier New'; color: blue;"&gt;this&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: 'Courier New'; color: black;"&gt;.attributesToRemove.Add(attribute.ToUpperInvariant(), attribute);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal; background: none repeat scroll 0% 0% white;"&gt;&lt;span style="font-size: 10pt; font-family: 'Courier New'; color: black;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal; background: none repeat scroll 0% 0% white;"&gt;&lt;span style="font-size: 10pt; font-family: 'Courier New'; color: black;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal; background: none repeat scroll 0% 0% white;"&gt;&lt;span style="font-size: 10pt; font-family: 'Courier New'; color: black;"&gt;&amp;nbsp;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal; background: none repeat scroll 0% 0% white;"&gt;&lt;span style="font-size: 10pt; font-family: 'Courier New'; color: black;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="font-size: 10pt; font-family: 'Courier New'; color: blue;"&gt;public&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: 'Courier New'; color: black;"&gt; &lt;/span&gt;&lt;span style="font-size: 10pt; font-family: 'Courier New'; color: blue;"&gt;override&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: 'Courier New'; color: black;"&gt; &lt;/span&gt;&lt;span style="font-size: 10pt; font-family: 'Courier New'; color: rgb(43, 145, 175);"&gt;List&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: 'Courier New'; color: black;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: 'Courier New'; color: rgb(43, 145, 175);"&gt;ICustomAttribute&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: 'Courier New'; color: black;"&gt;&amp;gt;
Visit(&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: 'Courier New'; color: rgb(43, 145, 175);"&gt;List&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: 'Courier New'; color: black;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: 'Courier New'; color: rgb(43, 145, 175);"&gt;ICustomAttribute&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: 'Courier New'; color: black;"&gt;&amp;gt; customAttributes)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal; background: none repeat scroll 0% 0% white;"&gt;&lt;span style="font-size: 10pt; font-family: 'Courier New'; color: black;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal; background: none repeat scroll 0% 0% white;"&gt;&lt;span style="font-size: 10pt; font-family: 'Courier New'; color: black;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="font-size: 10pt; font-family: 'Courier New'; color: rgb(43, 145, 175);"&gt;List&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: 'Courier New'; color: black;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: 'Courier New'; color: rgb(43, 145, 175);"&gt;ICustomAttribute&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: 'Courier New'; color: black;"&gt;&amp;gt; result = &lt;/span&gt;&lt;span style="font-size: 10pt; font-family: 'Courier New'; color: blue;"&gt;new&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: 'Courier New'; color: black;"&gt; &lt;/span&gt;&lt;span style="font-size: 10pt; font-family: 'Courier New'; color: rgb(43, 145, 175);"&gt;List&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: 'Courier New'; color: black;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: 'Courier New'; color: rgb(43, 145, 175);"&gt;ICustomAttribute&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: 'Courier New'; color: black;"&gt;&amp;gt;(customAttributes);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal; background: none repeat scroll 0% 0% white;"&gt;&lt;span style="font-size: 10pt; font-family: 'Courier New'; color: black;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="font-size: 10pt; font-family: 'Courier New'; color: blue;"&gt;for&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: 'Courier New'; color: black;"&gt; (&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: 'Courier New'; color: blue;"&gt;int&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: 'Courier New'; color: black;"&gt; i = result.Count - 1; i &amp;gt;= 0; i--)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal; background: none repeat scroll 0% 0% white;"&gt;&lt;span style="font-size: 10pt; font-family: 'Courier New'; color: black;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal; background: none repeat scroll 0% 0% white;"&gt;&lt;span style="font-size: 10pt; font-family: 'Courier New'; color: black;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="font-size: 10pt; font-family: 'Courier New'; color: blue;"&gt;if&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: 'Courier New'; color: black;"&gt; (&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: 'Courier New'; color: blue;"&gt;this&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: 'Courier New'; color: black;"&gt;.attributesToRemove.ContainsKey(result[i].Type.ToString().ToUpperInvariant()))&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal; background: none repeat scroll 0% 0% white;"&gt;&lt;span style="font-size: 10pt; font-family: 'Courier New'; color: black;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal; background: none repeat scroll 0% 0% white;"&gt;&lt;span style="font-size: 10pt; font-family: 'Courier New'; color: black;"&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; result.RemoveAt(i);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal; background: none repeat scroll 0% 0% white;"&gt;&lt;span style="font-size: 10pt; font-family: 'Courier New'; color: black;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal; background: none repeat scroll 0% 0% white;"&gt;&lt;span style="font-size: 10pt; font-family: 'Courier New'; color: black;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal; background: none repeat scroll 0% 0% white;"&gt;&lt;span style="font-size: 10pt; font-family: 'Courier New'; color: black;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="font-size: 10pt; font-family: 'Courier New'; color: blue;"&gt;return&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: 'Courier New'; color: black;"&gt; &lt;/span&gt;&lt;span style="font-size: 10pt; font-family: 'Courier New'; color: blue;"&gt;base&lt;/span&gt;&lt;span style="font-size: 10pt; font-family: 'Courier New'; color: black;"&gt;.Visit(result);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal; background: none repeat scroll 0% 0% white;"&gt;&lt;span style="font-size: 10pt; font-family: 'Courier New'; color: black;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal; background: none repeat scroll 0% 0% white;"&gt;&lt;span style="font-size: 10pt; font-family: 'Courier New'; color: black;"&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class="MsoNormal" style="line-height: normal; background: none repeat scroll 0% 0% white;"&gt;&lt;span style="font-size: 10pt; font-family: 'Arial','sans-serif'; color: black;"&gt;The rest of the code to read
and write assemblies can be copied from the CCI samples.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class="MsoNormal" style="line-height: normal; background: none repeat scroll 0% 0% white;"&gt;&lt;span style="font-size: 10pt; font-family: 'Arial','sans-serif'; color: black;"&gt;&lt;a href="http://kristoffer.members.winisp.net/StripAttributes.zip" mce_href="http://kristoffer.members.winisp.net/StripAttributes.zip"&gt;Download the
Visual Studio 2010 project&lt;/a&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class="MsoNormal" style="line-height: normal; background: none repeat scroll 0% 0% white;"&gt;&lt;span style="font-size: 10pt; font-family: 'Arial','sans-serif'; color: black;"&gt;To use this program run:&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class="MsoNormal" style="line-height: normal; background: none repeat scroll 0% 0% white;"&gt;&lt;span style="font-size: 10pt; font-family: 'Arial','sans-serif'; color: black;"&gt;&lt;span style=""&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;StripAttributes.exe C:\Input\MyAssembly.dll C:\Output
@attributes.txt&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class="MsoNormal" style="line-height: normal; background: none repeat scroll 0% 0% white;"&gt;&lt;span style="font-size: 10pt; font-family: 'Arial','sans-serif'; color: black;"&gt;where attributes.txt is
a list of attributes, one per line, to be removed from the assembly. The
resulting file is written to C:\Output. Since the assembly is rewritten it will
need to be resigned with sn.exe before shipping.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class="MsoNormal" style="line-height: normal; background: none repeat scroll 0% 0% white;"&gt;&lt;span style="font-size: 10pt; font-family: 'Arial','sans-serif'; color: black;"&gt;The cost savings per
assembly will vary depending on your attribute usage and how the PE pages line
up. Sometimes no savings can be achieved even if attributes are removed because
the assembly is written in 512 byte chunks. &lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="line-height: normal; background: none repeat scroll 0% 0% white;"&gt;&lt;span style="font-size: 10pt; font-family: 'Arial','sans-serif'; color: black;"&gt;For desktop CLR assemblies disk size is relatively unimportant but when the end user has to download your code (Silverlight for example) every byte matters.&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10004023" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/b/kristoffer/archive/tags/Performance/">Performance</category><category domain="http://blogs.msdn.com/b/kristoffer/archive/tags/-NET/">.NET</category></item><item><title>Streetside photos is live!</title><link>http://blogs.msdn.com/b/kristoffer/archive/2010/02/11/streetside-photos-is-live.aspx</link><pubDate>Fri, 12 Feb 2010 00:11:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9962343</guid><dc:creator>Kristoffer Henriksson</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/kristoffer/rsscomments.aspx?WeblogPostID=9962343</wfw:commentRss><comments>http://blogs.msdn.com/b/kristoffer/archive/2010/02/11/streetside-photos-is-live.aspx#comments</comments><description>Bing Maps just shipped a tech preview of Streetside photos which overlays Flickr photos on Streetside to show where the photos were taken. The team worked hard to get it out the door and we're proud to share it with the rest of the world. &lt;a href="http://www.bing.com/maps/explore/#5003/0.6044=s:http%253A%2f%2ffarm3.static.flickr.com%2f2651%2f4115828663_437e2ab815.jpg&amp;amp;o=&amp;amp;a=0&amp;amp;n=0/5872/lat=47.606988&amp;amp;lon=-122.338356&amp;amp;alt=1.34&amp;amp;z=30&amp;amp;h=30.7&amp;amp;p=5.9&amp;amp;pid=5082" mce_href="http://www.bing.com/maps/explore/#5003/0.6044=s:http%253A%2f%2ffarm3.static.flickr.com%2f2651%2f4115828663_437e2ab815.jpg&amp;amp;o=&amp;amp;a=0&amp;amp;n=0/5872/lat=47.606988&amp;amp;lon=-122.338356&amp;amp;alt=1.34&amp;amp;z=30&amp;amp;h=30.7&amp;amp;p=5.9&amp;amp;pid=5082"&gt;Check it out on Bing Maps&lt;/a&gt;.&lt;br&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9962343" width="1" height="1"&gt;</description></item><item><title>Streetside smoove</title><link>http://blogs.msdn.com/b/kristoffer/archive/2010/01/20/streetside-smoove.aspx</link><pubDate>Wed, 20 Jan 2010 22:41:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9951133</guid><dc:creator>Kristoffer Henriksson</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/kristoffer/rsscomments.aspx?WeblogPostID=9951133</wfw:commentRss><comments>http://blogs.msdn.com/b/kristoffer/archive/2010/01/20/streetside-smoove.aspx#comments</comments><description>Bing Maps Streetside just released a minor update that allows you to smoothly glide through streets like a first-person shooter or pacman. &lt;a href="http://www.bing.com/maps/explore/#5003/o=&amp;amp;a=&amp;amp;s=w&amp;amp;n=0/5872/lat=39.952219&amp;amp;lon=-75.162033&amp;amp;alt=-19.8&amp;amp;z=30&amp;amp;h=108.3&amp;amp;p=-4&amp;amp;pid=5082" mce_href="http://www.bing.com/maps/explore/#5003/o=&amp;amp;a=&amp;amp;s=w&amp;amp;n=0/5872/lat=39.952219&amp;amp;lon=-75.162033&amp;amp;alt=-19.8&amp;amp;z=30&amp;amp;h=108.3&amp;amp;p=-4&amp;amp;pid=5082"&gt;Try it out&lt;/a&gt; yourself, just hold down the Up key and turn with Left and Right. Faster connections give a more pleasant experience.&lt;br&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9951133" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/b/kristoffer/archive/tags/Bing+Maps/">Bing Maps</category><category domain="http://blogs.msdn.com/b/kristoffer/archive/tags/Streetside/">Streetside</category></item><item><title>It's 10 pm, do you know what your JITter is doing?</title><link>http://blogs.msdn.com/b/kristoffer/archive/2009/11/13/it-s-10-pm-do-you-know-what-your-jitter-is-doing.aspx</link><pubDate>Fri, 13 Nov 2009 21:52:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9922260</guid><dc:creator>Kristoffer Henriksson</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/kristoffer/rsscomments.aspx?WeblogPostID=9922260</wfw:commentRss><comments>http://blogs.msdn.com/b/kristoffer/archive/2009/11/13/it-s-10-pm-do-you-know-what-your-jitter-is-doing.aspx#comments</comments><description>&lt;p&gt;Ever have that awkward feeling like you don't know what actually gets executed as a result of your managed code? Visual Studio allows you to inspect the JITted code easily but does require a few tweaks first:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;First set your project to build in &lt;b&gt;Release&lt;/b&gt; mode.&lt;/li&gt;
&lt;li&gt;Next go to &lt;b&gt;Tools|Options|Debugging&lt;/b&gt; and uncheck both &lt;b&gt;Suppress JIT optimization on module load (Managed only)&lt;/b&gt; and &lt;b&gt;Enable Just My Code (Managed only)&lt;/b&gt;&lt;/li&gt;&lt;/ol&gt;
&lt;p&gt;Now you can run your project and set a breakpoint where you want to look at code and go to &lt;b&gt;Debug | Windows | Disassembly&lt;/b&gt; to get an annotated disassembly like the following:&amp;nbsp;&lt;/p&gt;
&lt;div style="background: white none repeat scroll 0% 0%; font-family: Courier New; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous; color: black; font-size: 10pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; static void Main(string[] args)&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; DoTest();&lt;br&gt;&lt;span style="color: gray;"&gt;00000000 push ebp &lt;br&gt;00000001 mov ebp,esp &lt;br&gt;00000003 push esi &lt;br&gt;00000004 call dword ptr ds:[00159B7Ch] &lt;/span&gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; Console.WriteLine(s);&lt;br&gt;&lt;span style="color: gray;"&gt;0000000a mov esi,dword ptr ds:[037D5B20h] &lt;br&gt;00000010 call 6B20BE78 &lt;br&gt;00000015 mov ecx,eax &lt;br&gt;00000017 mov edx,esi &lt;br&gt;00000019 mov eax,dword ptr [ecx] &lt;br&gt;0000001b call dword ptr [eax+000000D8h] &lt;br&gt;00000021 pop esi &lt;/span&gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br&gt;&lt;span style="color: gray;"&gt;00000022 pop ebp &lt;br&gt;00000023 ret &amp;nbsp;&lt;/span&gt;&lt;/div&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9922260" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/b/kristoffer/archive/tags/-NET/">.NET</category></item><item><title>OutOfMemoryException is special</title><link>http://blogs.msdn.com/b/kristoffer/archive/2009/02/25/outofmemoryexception-is-special.aspx</link><pubDate>Wed, 25 Feb 2009 20:25:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9444365</guid><dc:creator>Kristoffer Henriksson</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/kristoffer/rsscomments.aspx?WeblogPostID=9444365</wfw:commentRss><comments>http://blogs.msdn.com/b/kristoffer/archive/2009/02/25/outofmemoryexception-is-special.aspx#comments</comments><description>&lt;p&gt;Consider the humble OutOfMemoryException and its most common usage. If it is thrown when the system is well and truly out of memory then how would the system allocate enough memory to create a new instance of OutOfMemoryException? Luckily this problem has a simple solution: OutOfMemoryException is allocated up front so it's available when it needs to be thrown.&lt;/p&gt;&lt;p&gt;The .NET runtime does first try to create a new OutOfMemoryException instance but if it fails it will fall back to the preallocated instance so there is always an exception available to be thrown. &lt;/p&gt;&lt;p&gt;Some other exceptions are preallocated: StackOverflowException, ExecutionEngineException, and ThreadAbortException.&lt;br&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9444365" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/b/kristoffer/archive/tags/Interesting/">Interesting</category><category domain="http://blogs.msdn.com/b/kristoffer/archive/tags/-NET/">.NET</category></item><item><title>Troubleshooting a failed Virtual Earth 3D installation</title><link>http://blogs.msdn.com/b/kristoffer/archive/2008/05/16/troubleshooting-a-failed-virtual-earth-3d-installation.aspx</link><pubDate>Fri, 16 May 2008 22:54:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8514828</guid><dc:creator>Kristoffer Henriksson</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/kristoffer/rsscomments.aspx?WeblogPostID=8514828</wfw:commentRss><comments>http://blogs.msdn.com/b/kristoffer/archive/2008/05/16/troubleshooting-a-failed-virtual-earth-3d-installation.aspx#comments</comments><description>&lt;p&gt;The Virtual Earth 3D setup program is a small executable that downloads and installs pre-requisites if they're not already installed and then the correct MSI for your OS flavor (32 or 64 bit). The pre-requisites are Windows Imaging Components and .NET Framework 2.0. WIC comes with Vista and XP sp3 and doesn't need to be downloaded on those platforms. The setup program logs its status to a file named VirtualEarth3DInstallLog.txt in the Temp folder. On a default Windows XP installation the Temp folder is located at C:\Documents and Settings\[username]\Local Settings\Temp.&lt;br&gt;&lt;/p&gt;&lt;p&gt;After the pre-requisites have been validated VirtualEarth3D.msi or VirtualEarth3D64.msi are downloaded and installed.&amp;nbsp; The 64 bit MSI contains both 32 and 64 bit modules so you can run internet explorer in 32 or 64 bit mode. The MSI log is stored in MsiInstall.log, also in the Temp folder.&lt;/p&gt;&lt;p&gt;So what errors go to what log?&lt;/p&gt;&lt;ul&gt;&lt;li&gt;If the error happens in the Setup program, for example a failure to download a prerequisite or the MSI, VirtualEarth3DInstallLog.txt will have an error message with the details.&lt;/li&gt;&lt;li&gt;If the error happens once Setup starts running the Virtual Earth 3D MSI MsiInstall.log will contain the details.&lt;/li&gt;&lt;/ul&gt;&lt;br&gt;If you still have problems installing Virtual Earth 3D, &lt;a href="https://support.live.com/eform.aspx?productKey=wllocal&amp;amp;ct=eformts" mce_href="https://support.live.com/eform.aspx?productKey=wllocal&amp;amp;ct=eformts"&gt;Live Maps support&lt;/a&gt; is only a click away.&lt;br&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=8514828" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/b/kristoffer/archive/tags/Virtual+Earth+3D/">Virtual Earth 3D</category></item><item><title>How does Virtual Earth 3D find and load plugins?</title><link>http://blogs.msdn.com/b/kristoffer/archive/2007/12/07/how-does-virtual-earth-3d-find-and-load-plugins.aspx</link><pubDate>Fri, 07 Dec 2007 21:45:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:6696138</guid><dc:creator>Kristoffer Henriksson</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/kristoffer/rsscomments.aspx?WeblogPostID=6696138</wfw:commentRss><comments>http://blogs.msdn.com/b/kristoffer/archive/2007/12/07/how-does-virtual-earth-3d-find-and-load-plugins.aspx#comments</comments><description>&lt;p&gt;On startup VE3D looks in the Plugins folder of the install directory (ProgramFiles\Virtual Earth 3D) and iterates through the assemblies in each subfolder of Plugins. A plugin named Sample would install itself as C:\Program Files\Virtual Earth 3D\Plugins\Sample\Sample.dll. Note that this folder doesn't exist by default so your plugin installer will need to create it.&lt;br&gt; &lt;/p&gt;
&lt;p&gt;Next each assembly is probed for classes that descend from &lt;span style="font-size: 10pt; font-family: Courier New;"&gt;&lt;span style="color: black;"&gt;Microsoft.MapPoint.PlugIns.&lt;/span&gt;&lt;span style="color: rgb(43, 145, 175);"&gt;PlugIn&lt;/span&gt;&lt;/span&gt;. For security reasons only assemblies that are in the GAC are allowed to run. The good news is that we are investigating allowing partially trusted plugins for our next release. This means you will be able to visit a website and have it load its own plugins to add new functionality to VE3D without forcing you to go through an install process. Since we're still in the early parts of our next release I don't know for sure if this will make the cut but it is something we would like to add.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=6696138" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/b/kristoffer/archive/tags/Virtual+Earth+3D/">Virtual Earth 3D</category><category domain="http://blogs.msdn.com/b/kristoffer/archive/tags/Virtual+Earth+3D+Plugins/">Virtual Earth 3D Plugins</category></item><item><title>Using a plugin to add a billboard to Virtual Earth 3D</title><link>http://blogs.msdn.com/b/kristoffer/archive/2007/11/14/using-a-plugin-to-add-a-billboard-to-virtual-earth-3d.aspx</link><pubDate>Wed, 14 Nov 2007 23:10:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:6223935</guid><dc:creator>Kristoffer Henriksson</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/kristoffer/rsscomments.aspx?WeblogPostID=6223935</wfw:commentRss><comments>http://blogs.msdn.com/b/kristoffer/archive/2007/11/14/using-a-plugin-to-add-a-billboard-to-virtual-earth-3d.aspx#comments</comments><description>&lt;P&gt;To add objects to the VE3D world we need to create our own actor that knows how to render itself.&lt;/P&gt;
&lt;P&gt;Actors descend from &lt;SPAN style="FONT-FAMILY: Courier New"&gt;Microsoft.MapPoint.Rendering3D.Steps.Actors.&lt;SPAN style="COLOR: #2b91af"&gt;Actor&lt;/SPAN&gt;&lt;/SPAN&gt; and must override the &lt;SPAN style="FONT-FAMILY: Courier New"&gt;Render&lt;/SPAN&gt; method. When it comes time to render a frame, all actors have their Render method called to queue up renderable objects. To show a billboard we'll create a BillboardActor and use a SpriteGraphicsObject to render our image.&lt;/P&gt;
&lt;DIV style="FONT-SIZE: 10pt; BACKGROUND: white; COLOR: black; FONT-FAMILY: Courier New"&gt;
&lt;P style="MARGIN: 0px"&gt;&lt;SPAN style="COLOR: blue"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; public&lt;/SPAN&gt; BillboardActor(&lt;SPAN style="COLOR: #2b91af"&gt;LatLonAlt&lt;/SPAN&gt; position)&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="COLOR: blue"&gt;this&lt;/SPAN&gt;.texture = &lt;SPAN style="COLOR: #2b91af"&gt;Texture&lt;/SPAN&gt;.FromResource(&lt;SPAN style="COLOR: blue"&gt;this&lt;/SPAN&gt;.GetType().Assembly, &lt;SPAN style="COLOR: #a31515"&gt;"VirtualEarth3DSamplePlugins.Billboard.Flower.png"&lt;/SPAN&gt;);&lt;/P&gt;
&lt;P style="MARGIN: 0px" mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="COLOR: blue"&gt;this&lt;/SPAN&gt;.billboard = &lt;SPAN style="COLOR: blue"&gt;new&lt;/SPAN&gt; &lt;SPAN style="COLOR: #2b91af"&gt;SpriteGraphicsObject&lt;/SPAN&gt;();&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="COLOR: blue"&gt;this&lt;/SPAN&gt;.billboard.Texture = &lt;SPAN style="COLOR: blue"&gt;this&lt;/SPAN&gt;.texture;&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="COLOR: blue"&gt;this&lt;/SPAN&gt;.billboard.Mode = &lt;SPAN style="COLOR: #2b91af"&gt;SpriteMode&lt;/SPAN&gt;.Billboard;&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="COLOR: blue"&gt;this&lt;/SPAN&gt;.billboard.Scale = &lt;SPAN style="COLOR: blue"&gt;new&lt;/SPAN&gt; &lt;SPAN style="COLOR: #2b91af"&gt;Vector2D&lt;/SPAN&gt;(1000, 1000);&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="COLOR: blue"&gt;this&lt;/SPAN&gt;.billboard.Color = &lt;SPAN style="COLOR: #2b91af"&gt;Color&lt;/SPAN&gt;.White;&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="COLOR: blue"&gt;this&lt;/SPAN&gt;.billboard.AlphaEnable = &lt;SPAN style="COLOR: blue"&gt;true&lt;/SPAN&gt;;&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="COLOR: blue"&gt;this&lt;/SPAN&gt;.billboard.Position = position.GetVector();&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/P&gt;&lt;/DIV&gt;
&lt;DIV style="FONT-SIZE: 10pt; BACKGROUND: white; COLOR: black; FONT-FAMILY: Courier New"&gt;
&lt;P style="MARGIN: 0px"&gt;&lt;SPAN style="COLOR: blue"&gt;&lt;/SPAN&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&lt;SPAN style="COLOR: blue"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;public&lt;/SPAN&gt; &lt;SPAN style="COLOR: blue"&gt;override&lt;/SPAN&gt; &lt;SPAN style="COLOR: blue"&gt;void&lt;/SPAN&gt; Render(Microsoft.MapPoint.Rendering3D.Scene.&lt;SPAN style="COLOR: #2b91af"&gt;SceneState&lt;/SPAN&gt; sceneState)&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="COLOR: #2b91af"&gt;RenderQueues&lt;/SPAN&gt; renderQueues = sceneState.GetData&amp;lt;&lt;SPAN style="COLOR: #2b91af"&gt;RenderQueues&lt;/SPAN&gt;&amp;gt;();&lt;/P&gt;
&lt;P style="MARGIN: 0px" mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; renderQueues.AddAlphaRenderable(0, &lt;SPAN style="COLOR: blue"&gt;this&lt;/SPAN&gt;.billboard);&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/P&gt;&lt;/DIV&gt;
&lt;P&gt;Once we have our actor we just need to add it to the ActorManager so it knows to start rendering it. We can do this in our Activate method on the plugin.&lt;/P&gt;
&lt;DIV style="FONT-SIZE: 10pt; BACKGROUND: white; COLOR: black; FONT-FAMILY: Courier New"&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="COLOR: #2b91af"&gt;LatLonAlt&lt;/SPAN&gt; position = &lt;SPAN style="COLOR: #2b91af"&gt;LatLonAlt&lt;/SPAN&gt;.CreateUsingDegrees(46.849743288383046, -121.7498016357422, 5000);&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="COLOR: green"&gt;// Add the actor at the specified position&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="COLOR: blue"&gt;this&lt;/SPAN&gt;.Host.Actors.Add(&lt;SPAN style="COLOR: blue"&gt;new&lt;/SPAN&gt; &lt;SPAN style="COLOR: #2b91af"&gt;BillboardActor&lt;/SPAN&gt;(position));&lt;/P&gt;&lt;/DIV&gt;
&lt;P&gt;&lt;IMG title="Billboard in action" style="WIDTH: 886px; HEIGHT: 714px" height=714 alt="Billboard in action" src="http://kristoffer.members.winisp.net/Images/VirtualEarth3DPlugins/VirtualEarth3DBillboardPlugin.png" width=886 border=0 mce_src="http://kristoffer.members.winisp.net/Images/VirtualEarth3DPlugins/VirtualEarth3DBillboardPlugin.png"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can browse the source code for the actor and the plugin online or download the entire project.&lt;BR&gt;&lt;A title="BillboardActor.cs source code" href="http://blogs.msdn.com/Kristoffer/pages/billboardactor-cs.aspx" mce_href="http://blogs.msdn.com/Kristoffer/pages/billboardactor-cs.aspx"&gt;BillboardActor.cs&lt;/A&gt;&amp;nbsp;| &lt;A title="BillboardPlugin.cs source code" href="http://blogs.msdn.com/Kristoffer/pages/billboardplugin-cs.aspx" mce_href="http://blogs.msdn.com/Kristoffer/pages/billboardplugin-cs.aspx"&gt;BillboardPlugin.cs&lt;/A&gt;&lt;BR&gt;&lt;A href="http://kristoffer.members.winisp.net/VE3D/VirtualEarth3DPlugins.zip"&gt;Download project&lt;/P&gt;&lt;/A&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=6223935" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/b/kristoffer/archive/tags/Virtual+Earth+3D/">Virtual Earth 3D</category><category domain="http://blogs.msdn.com/b/kristoffer/archive/tags/Virtual+Earth+3D+Plugins/">Virtual Earth 3D Plugins</category></item><item><title>Creating a Hello World plugin for Virtual Earth 3D</title><link>http://blogs.msdn.com/b/kristoffer/archive/2007/11/13/creating-a-hello-world-plugin-for-virtual-earth-3d.aspx</link><pubDate>Tue, 13 Nov 2007 20:33:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:6178675</guid><dc:creator>Kristoffer Henriksson</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/kristoffer/rsscomments.aspx?WeblogPostID=6178675</wfw:commentRss><comments>http://blogs.msdn.com/b/kristoffer/archive/2007/11/13/creating-a-hello-world-plugin-for-virtual-earth-3d.aspx#comments</comments><description>&lt;p&gt;With latest&amp;nbsp;release of the Virtual Earth 3D release we now support loading plugins to perform additional functionality not implemented in the main product. Two new features of the release are even implemented as plugins (bird's eye photos and user created models).&lt;/p&gt;
&lt;p&gt;To get you started with creating your own plugin for VE3D here's a short starter guide using Visual Studio 2005.&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Create a new C# Class Library project, call it HelloWorld.&lt;/li&gt;
&lt;li&gt;Add references to the following assemblies located in C:\Program Files\Virtual Earth 3D:&lt;br&gt;
&lt;ul&gt;
&lt;li&gt;Microsoft.MapPoint.Rendering3D.dll&lt;/li&gt;
&lt;li&gt;Microsoft.MapPoint.Rendering3D.Utility.dll&lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;
&lt;li&gt;Rename Class1.cs to HelloWorldPlugin.cs and paste the following code over the file:&lt;br&gt;
&lt;div style="background: white none repeat scroll 0% 50%; font-size: 10pt; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; color: black; font-family: Courier New;"&gt;
&lt;p style="margin: 0px;"&gt;&lt;span style="color: blue;"&gt;using&lt;/span&gt; System;&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;&lt;span style="color: blue;"&gt;using&lt;/span&gt; System.Collections.Generic;&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;&lt;span style="color: blue;"&gt;using&lt;/span&gt; System.Text;&lt;/p&gt;
&lt;p style="margin: 0px;" mce_keep="true"&gt;&amp;nbsp;&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;&lt;span style="color: blue;"&gt;using&lt;/span&gt; Microsoft.MapPoint.PlugIns;&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;&lt;span style="color: blue;"&gt;using&lt;/span&gt; Microsoft.MapPoint.Rendering3D;&lt;/p&gt;
&lt;p style="margin: 0px;" mce_keep="true"&gt;&amp;nbsp;&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;&lt;span style="color: blue;"&gt;namespace&lt;/span&gt; VirtualEarth3DSamplePlugins.HelloWorld&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;{&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: blue;"&gt;public&lt;/span&gt; &lt;span style="color: blue;"&gt;class&lt;/span&gt; &lt;span style="color: rgb(43, 145, 175);"&gt;HelloWorldPlugin&lt;/span&gt; : PlugIn&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;&lt;span style="color: blue;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; #region&lt;/span&gt; Constructor&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: blue;"&gt;public&lt;/span&gt; HelloWorldPlugin(Host host)&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; : &lt;span style="color: blue;"&gt;base&lt;/span&gt;(host)&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;&lt;span style="color: blue;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; #endregion&lt;/span&gt;&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;&lt;span style="color: blue;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; #region&lt;/span&gt; Overrides&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: blue;"&gt;public&lt;/span&gt; &lt;span style="color: blue;"&gt;override&lt;/span&gt; &lt;span style="color: blue;"&gt;void&lt;/span&gt; Activate(&lt;span style="color: blue;"&gt;object&lt;/span&gt; activationObject)&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: blue;"&gt;this&lt;/span&gt;.Host.Notifications.Display(&lt;span style="color: rgb(163, 21, 21);"&gt;"Hello world!"&lt;/span&gt;);&lt;/p&gt;
&lt;p style="margin: 0px;" mce_keep="true"&gt;&amp;nbsp;&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: blue;"&gt;base&lt;/span&gt;.Activate(activationObject);&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: blue;"&gt;public&lt;/span&gt; &lt;span style="color: blue;"&gt;override&lt;/span&gt; &lt;span style="color: blue;"&gt;string&lt;/span&gt; Name&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: blue;"&gt;get&lt;/span&gt;&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/p&gt;
&lt;p style="margin: 0px;"&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 style="color: blue;"&gt;return&lt;/span&gt; &lt;span style="color: rgb(163, 21, 21);"&gt;"HelloWorldPlugin"&lt;/span&gt;;&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;&lt;span style="color: blue;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; #endregion&lt;/span&gt;&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;}&lt;/p&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li&gt;Go to Project Properties, Signing, check &lt;b&gt;Sign the assembly&lt;/b&gt; and create a new key to sign your project with. Only plugins that are in the GAC will be granted permissions to run and only strongly named assemblies may be placed in the GAC. 
&lt;p&gt;Build your project and copy HelloWorld.dll to a new folder named &lt;b&gt;C:\Program Files\Virtual Earth 3D\Plugins\HelloWorld&lt;/b&gt;. From a &lt;b&gt;Visual Studio 2005 Command Prompt&lt;/b&gt; run &lt;br&gt;&lt;font style="font-family: Courier New;"&gt;gacutil -i "C:\Program Files\Virtual Earth 3D\Plugins\HelloWorld\HelloWorld.dll"&lt;/font&gt;&lt;/p&gt;&lt;/li&gt;&lt;/ol&gt;
&lt;p&gt;Now start up 3D mode on &lt;a href="http://maps.live.com/" class="" mce_href="http://maps.live.com/"&gt;maps.live.com&lt;/a&gt;&amp;nbsp;and you should see a notification upon startup from the hello world plugin.&lt;/p&gt;
&lt;p&gt;&lt;img src="http://kristoffer.members.winisp.net/Images/VirtualEarth3DPlugins/HelloWorldFromPlugin.png" style="width: 874px; height: 704px;" mce_src="http://kristoffer.members.winisp.net/Images/VirtualEarth3DPlugins/HelloWorldFromPlugin.png" border="0" height="704" width="874"&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;That's it for creating a simple plugin. If you want to explore further on your own the Host object contains all the interfaces for a plugin to communicate with VE3D.&lt;/p&gt;&lt;p&gt;Mandatory disclaimer so I don't get into trouble: creating plugins is not officially supported.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=6178675" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/b/kristoffer/archive/tags/Virtual+Earth+3D/">Virtual Earth 3D</category><category domain="http://blogs.msdn.com/b/kristoffer/archive/tags/Virtual+Earth+3D+Plugins/">Virtual Earth 3D Plugins</category></item><item><title>Is your e-mail going unanswered?</title><link>http://blogs.msdn.com/b/kristoffer/archive/2007/06/29/is-your-e-mail-going-unanswered.aspx</link><pubDate>Fri, 29 Jun 2007 21:00:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:3608199</guid><dc:creator>Kristoffer Henriksson</dc:creator><slash:comments>1</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/kristoffer/rsscomments.aspx?WeblogPostID=3608199</wfw:commentRss><comments>http://blogs.msdn.com/b/kristoffer/archive/2007/06/29/is-your-e-mail-going-unanswered.aspx#comments</comments><description>&lt;p&gt;As a general rule the chance of your e-mail getting a response is inversely proportional to the number of people on the To and Cc lines.&lt;/p&gt; &lt;p&gt;Let's take an example:&lt;/p&gt; &lt;blockquote&gt; &lt;p&gt;You e-mail Bob a question. Bob now feels directly responsible for your question and promptly replies.&lt;/p&gt; &lt;p&gt;You e-mail Bob, Anna, and Frank a question and put them all on the To line. Now Bob, Anna, and Frank are only one third responsible each&amp;nbsp;for replying and all three ignore your e-mail hoping one of the other two will respond.&lt;/p&gt;&lt;/blockquote&gt; &lt;p&gt;Psychologists call this "diffusion of responsibility".&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=3608199" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/b/kristoffer/archive/tags/Office+observations/">Office observations</category></item><item><title>Virtual Earth update</title><link>http://blogs.msdn.com/b/kristoffer/archive/2007/04/03/virtual-earth-update.aspx</link><pubDate>Wed, 04 Apr 2007 04:47:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:2022535</guid><dc:creator>Kristoffer Henriksson</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/kristoffer/rsscomments.aspx?WeblogPostID=2022535</wfw:commentRss><comments>http://blogs.msdn.com/b/kristoffer/archive/2007/04/03/virtual-earth-update.aspx#comments</comments><description>Virtual Earth released a new version this afternoon; read about the new features on the &lt;a href="http://virtualearth.spaces.live.com/blog/cns%212BBC66E99FDCDB98%218495.entry" mce_href="http://virtualearth.spaces.live.com/blog/cns!2BBC66E99FDCDB98!8495.entry"&gt;Virtual Earth blog&lt;/a&gt;.&lt;br&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=2022535" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/b/kristoffer/archive/tags/Virtual+Earth/">Virtual Earth</category></item><item><title>Visual Studio Tip: Examining long strings while debugging</title><link>http://blogs.msdn.com/b/kristoffer/archive/2007/04/03/visual-studio-tip-examining-long-strings-while-debugging.aspx</link><pubDate>Tue, 03 Apr 2007 19:53:23 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:2019349</guid><dc:creator>Kristoffer Henriksson</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/kristoffer/rsscomments.aspx?WeblogPostID=2019349</wfw:commentRss><comments>http://blogs.msdn.com/b/kristoffer/archive/2007/04/03/visual-studio-tip-examining-long-strings-while-debugging.aspx#comments</comments><description>&lt;p&gt;Long strings can be a pain to examine in Visual Studio while you're debugging but in .NET projects&amp;nbsp;you can easily write these to a file on the fly. If for example we want to examine the contents of string &lt;strong&gt;s&lt;/strong&gt;, open up the &lt;strong&gt;Immediate Window&lt;/strong&gt; (&lt;strong&gt;Ctrl+I&lt;/strong&gt;) and type &lt;pre&gt;&lt;strong&gt;System.IO.File.WriteAllText("C:\\Debug.txt", s);&lt;/strong&gt;&lt;/pre&gt;
&lt;p&gt;Then open up C:\Debug.txt to see the entire string.&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=2019349" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/b/kristoffer/archive/tags/Visual+Studio/">Visual Studio</category></item><item><title>Navigate large solutions in Visual Studio quicker</title><link>http://blogs.msdn.com/b/kristoffer/archive/2007/03/23/navigate-large-solutions-in-visual-studio-quicker.aspx</link><pubDate>Fri, 23 Mar 2007 19:25:57 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:1938281</guid><dc:creator>Kristoffer Henriksson</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/kristoffer/rsscomments.aspx?WeblogPostID=1938281</wfw:commentRss><comments>http://blogs.msdn.com/b/kristoffer/archive/2007/03/23/navigate-large-solutions-in-visual-studio-quicker.aspx#comments</comments><description>&lt;p&gt;The one Visual Studio tip that everyone should know is how to quickly open a file in a large solution without having to remember which folder or project it's in.&lt;/p&gt; &lt;p&gt;Press &lt;strong&gt;Ctrl+Alt+A&lt;/strong&gt; to open up the Command Window, then type &lt;strong&gt;open&lt;/strong&gt; and the first few letters of the filename and you'll get a dropdown of all matching files in the current solution. Press Enter to open the selected file.&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=1938281" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/b/kristoffer/archive/tags/Visual+Studio/">Visual Studio</category></item><item><title>Javascript prototype versus closure execution speed</title><link>http://blogs.msdn.com/b/kristoffer/archive/2007/02/13/javascript-prototype-versus-closure-execution-speed.aspx</link><pubDate>Tue, 13 Feb 2007 19:49:12 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:1670057</guid><dc:creator>Kristoffer Henriksson</dc:creator><slash:comments>3</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/kristoffer/rsscomments.aspx?WeblogPostID=1670057</wfw:commentRss><comments>http://blogs.msdn.com/b/kristoffer/archive/2007/02/13/javascript-prototype-versus-closure-execution-speed.aspx#comments</comments><description>&lt;p&gt;When Javascript&amp;nbsp;execution speed matters consider using prototype instead of closures where possible. Even for a small closure the difference can be noticable when called hundreds of times. Consider the following example that implements a Pixel object with some ancillary functions in both the closure and prototype patterns:&lt;/p&gt; &lt;div style="font-size: 10pt; background: white; color: black; font-family: courier new"&gt; &lt;p style="margin: 0px"&gt;&lt;span style="color: green"&gt;// Closure implementation&lt;/span&gt;&lt;/p&gt; &lt;p style="margin: 0px"&gt;&lt;span style="color: blue"&gt;function&lt;/span&gt; Pixel(x, y)&lt;/p&gt; &lt;p style="margin: 0px"&gt;{&lt;/p&gt; &lt;p style="margin: 0px"&gt;&amp;nbsp; &lt;span style="color: blue"&gt;this&lt;/span&gt;.x = x;&lt;/p&gt; &lt;p style="margin: 0px"&gt;&amp;nbsp; &lt;span style="color: blue"&gt;this&lt;/span&gt;.y = y;&lt;/p&gt; &lt;p style="margin: 0px"&gt;&amp;nbsp; &lt;span style="color: blue"&gt;this&lt;/span&gt;.getX = &lt;span style="color: blue"&gt;function&lt;/span&gt;()&lt;/p&gt; &lt;p style="margin: 0px"&gt;&amp;nbsp; {&lt;/p&gt; &lt;p style="margin: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: blue"&gt;return&lt;/span&gt; &lt;span style="color: blue"&gt;this&lt;/span&gt;.x;&lt;/p&gt; &lt;p style="margin: 0px"&gt;&amp;nbsp; }&lt;/p&gt; &lt;p style="margin: 0px"&gt;&amp;nbsp; &lt;span style="color: blue"&gt;this&lt;/span&gt;.getY = &lt;span style="color: blue"&gt;function&lt;/span&gt;()&lt;/p&gt; &lt;p style="margin: 0px"&gt;&amp;nbsp; {&lt;/p&gt; &lt;p style="margin: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: blue"&gt;return&lt;/span&gt; &lt;span style="color: blue"&gt;this&lt;/span&gt;.y;&lt;/p&gt; &lt;p style="margin: 0px"&gt;&amp;nbsp; }&lt;/p&gt; &lt;p style="margin: 0px"&gt;&amp;nbsp; &lt;span style="color: blue"&gt;this&lt;/span&gt;.setX = &lt;span style="color: blue"&gt;function&lt;/span&gt;(value)&lt;/p&gt; &lt;p style="margin: 0px"&gt;&amp;nbsp; {&lt;/p&gt; &lt;p style="margin: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: blue"&gt;this&lt;/span&gt;.x = value;&lt;/p&gt; &lt;p style="margin: 0px"&gt;&amp;nbsp; }&lt;/p&gt; &lt;p style="margin: 0px"&gt;&amp;nbsp; &lt;span style="color: blue"&gt;this&lt;/span&gt;.setY = &lt;span style="color: blue"&gt;function&lt;/span&gt;(value)&lt;/p&gt; &lt;p style="margin: 0px"&gt;&amp;nbsp; {&lt;/p&gt; &lt;p style="margin: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: blue"&gt;this&lt;/span&gt;.y = value;&lt;/p&gt; &lt;p style="margin: 0px"&gt;&amp;nbsp; }&lt;/p&gt; &lt;p style="margin: 0px"&gt;}&lt;/p&gt; &lt;p style="margin: 0px"&gt;&amp;nbsp;&lt;/p&gt; &lt;div style="font-size: 10pt; background: white; color: black; font-family: courier new"&gt; &lt;p style="margin: 0px"&gt;&lt;span style="color: green"&gt;// Prototype implementation&lt;/span&gt;&lt;/p&gt; &lt;p style="margin: 0px"&gt;&lt;span style="color: blue"&gt;function&lt;/span&gt; PixelP(x, y)&lt;/p&gt; &lt;p style="margin: 0px"&gt;{&lt;/p&gt; &lt;p style="margin: 0px"&gt;&amp;nbsp; &lt;span style="color: blue"&gt;this&lt;/span&gt;.x = x; &lt;/p&gt; &lt;p style="margin: 0px"&gt;&amp;nbsp; &lt;span style="color: blue"&gt;this&lt;/span&gt;.y = y;&lt;/p&gt; &lt;p style="margin: 0px"&gt;}&lt;/p&gt; &lt;p style="margin: 0px"&gt;PixelP.prototype.getX = &lt;span style="color: blue"&gt;function&lt;/span&gt;()&lt;/p&gt; &lt;p style="margin: 0px"&gt;{&lt;/p&gt; &lt;p style="margin: 0px"&gt;&amp;nbsp; &lt;span style="color: blue"&gt;return&lt;/span&gt; &lt;span style="color: blue"&gt;this&lt;/span&gt;.x;&lt;/p&gt; &lt;p style="margin: 0px"&gt;}&lt;/p&gt; &lt;p style="margin: 0px"&gt;PixelP.prototype.getY = &lt;span style="color: blue"&gt;function&lt;/span&gt;()&lt;/p&gt; &lt;p style="margin: 0px"&gt;{&lt;/p&gt; &lt;p style="margin: 0px"&gt;&amp;nbsp; &lt;span style="color: blue"&gt;return&lt;/span&gt; &lt;span style="color: blue"&gt;this&lt;/span&gt;.y;&lt;/p&gt; &lt;p style="margin: 0px"&gt;}&lt;/p&gt; &lt;p style="margin: 0px"&gt;PixelP.prototype.setX = &lt;span style="color: blue"&gt;function&lt;/span&gt;(value)&lt;/p&gt; &lt;p style="margin: 0px"&gt;{&lt;/p&gt; &lt;p style="margin: 0px"&gt;&amp;nbsp; &lt;span style="color: blue"&gt;this&lt;/span&gt;.x = value;&lt;/p&gt; &lt;p style="margin: 0px"&gt;}&lt;/p&gt; &lt;p style="margin: 0px"&gt;PixelP.prototype.setY = &lt;span style="color: blue"&gt;function&lt;/span&gt;(value)&lt;/p&gt; &lt;p style="margin: 0px"&gt;{&lt;/p&gt; &lt;p style="margin: 0px"&gt;&amp;nbsp; &lt;span style="color: blue"&gt;this&lt;/span&gt;.y = value;&lt;/p&gt; &lt;p style="margin: 0px"&gt;}&lt;/p&gt; &lt;p style="margin: 0px"&gt;&amp;nbsp;&lt;/p&gt; &lt;p style="margin: 0px"&gt;&amp;nbsp;&lt;/p&gt; &lt;div style="font-size: 10pt; background: white; color: black; font-family: courier new"&gt; &lt;p style="margin: 0px"&gt;&lt;span style="color: blue"&gt;function&lt;/span&gt; TestPerformance()&lt;/p&gt; &lt;p style="margin: 0px"&gt;{&lt;/p&gt; &lt;p style="margin: 0px"&gt;&amp;nbsp; &lt;span style="color: blue"&gt;var&lt;/span&gt; closureStartDateTime = &lt;span style="color: blue"&gt;new&lt;/span&gt; Date();&lt;/p&gt; &lt;p style="margin: 0px"&gt;&amp;nbsp; &lt;span style="color: blue"&gt;for&lt;/span&gt; (&lt;span style="color: blue"&gt;var&lt;/span&gt; i = 0; i &amp;lt; 20000; i++)&lt;/p&gt; &lt;p style="margin: 0px"&gt;&amp;nbsp; {&lt;/p&gt; &lt;p style="margin: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: blue"&gt;var&lt;/span&gt; x = &lt;span style="color: blue"&gt;new&lt;/span&gt; Pixel(i, i);&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/p&gt; &lt;p style="margin: 0px"&gt;&amp;nbsp; }&lt;/p&gt; &lt;p style="margin: 0px"&gt;&amp;nbsp; &lt;span style="color: blue"&gt;var&lt;/span&gt; closureEndDateTime = &lt;span style="color: blue"&gt;new&lt;/span&gt; Date();&lt;/p&gt; &lt;p style="margin: 0px"&gt;&amp;nbsp;&lt;/p&gt; &lt;p style="margin: 0px"&gt;&amp;nbsp; &lt;span style="color: blue"&gt;var&lt;/span&gt; prototypeStartDateTime = &lt;span style="color: blue"&gt;new&lt;/span&gt; Date();&lt;/p&gt; &lt;p style="margin: 0px"&gt;&amp;nbsp; &lt;span style="color: blue"&gt;for&lt;/span&gt; (&lt;span style="color: blue"&gt;var&lt;/span&gt; i = 0; i &amp;lt; 20000; i++)&lt;/p&gt; &lt;p style="margin: 0px"&gt;&amp;nbsp; {&lt;/p&gt; &lt;p style="margin: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: blue"&gt;var&lt;/span&gt; x = &lt;span style="color: blue"&gt;new&lt;/span&gt; PixelP(i, i);&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/p&gt; &lt;p style="margin: 0px"&gt;&amp;nbsp; }&lt;/p&gt; &lt;p style="margin: 0px"&gt;&amp;nbsp; &lt;span style="color: blue"&gt;var&lt;/span&gt; prototypeEndDateTime = &lt;span style="color: blue"&gt;new&lt;/span&gt; Date();&lt;/p&gt; &lt;p style="margin: 0px"&gt;&amp;nbsp; &lt;span style="color: blue"&gt;var&lt;/span&gt; closureTime = closureEndDateTime.getTime() - closureStartDateTime.getTime();&lt;/p&gt; &lt;p style="margin: 0px"&gt;&amp;nbsp; &lt;span style="color: blue"&gt;var&lt;/span&gt; prototypeTime = prototypeEndDateTime.getTime() - prototypeStartDateTime.getTime();&lt;/p&gt; &lt;p style="margin: 0px"&gt;&amp;nbsp; alert(&lt;span style="color: #a31515"&gt;"Closure time: "&lt;/span&gt; + closureTime + &lt;span style="color: #a31515"&gt;", prototype time: "&lt;/span&gt; + prototypeTime);&lt;/p&gt; &lt;p style="margin: 0px"&gt;}&lt;/p&gt;&lt;/div&gt;&lt;!--EndFragment--&gt;&lt;/div&gt;&lt;!--EndFragment--&gt;&lt;/div&gt; &lt;p&gt;&amp;nbsp;&lt;/p&gt; &lt;p&gt;When this is run in IE7 on my machine, the closure implementation takes around 450ms and prototype takes around 140ms. Add two more empty functions and the closure time increases to 560ms and prototype to 155ms.&lt;/p&gt; &lt;p&gt;On Firefox 1.5.0.9 the difference is in the listed example is even larger with the closure taking 515ms and prototype still around 140ms. &lt;/p&gt; &lt;p&gt;For small applications that don't construct hundreds or thousands of the same type of object the execution speed difference between closure and prototype probably doesn't matter so as with all performance advice measure, measure, measure.&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=1670057" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/b/kristoffer/archive/tags/Javascript+performance/">Javascript performance</category></item><item><title>Debugging memory usage in managed code using Windbg</title><link>http://blogs.msdn.com/b/kristoffer/archive/2007/01/09/debugging-memory-usage-in-managed-code-using-windbg.aspx</link><pubDate>Tue, 09 Jan 2007 20:08:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:1439777</guid><dc:creator>Kristoffer Henriksson</dc:creator><slash:comments>1</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/kristoffer/rsscomments.aspx?WeblogPostID=1439777</wfw:commentRss><comments>http://blogs.msdn.com/b/kristoffer/archive/2007/01/09/debugging-memory-usage-in-managed-code-using-windbg.aspx#comments</comments><description>&lt;p&gt;Windbg, is there anything it can't do?&lt;/p&gt; &lt;p&gt;&lt;a href="http://www.microsoft.com/downloads/details.aspx?familyid=a362781c-3870-43be-8926-862b40aa0cd0&amp;amp;displaylang=en" mce_href="http://www.microsoft.com/downloads/details.aspx?familyid=a362781c-3870-43be-8926-862b40aa0cd0&amp;amp;displaylang=en"&gt;CLR Profiler&lt;/a&gt; is great for getting an overview of memory allocations and usage for managed applications but it doesn't work for very large applications and can't be attached after the application has been running for a while to determine why after 12 hours memory use spikes. Windbg can be an acceptable alternative when you find yourself looking at an unexpected memory spike and you're curious where all that memory is being allocated.&lt;/p&gt; &lt;p&gt;Start Windbg, attach to the process, and load the sos dll (&lt;a href="http://blogs.msdn.com/kristoffer/archive/2006/12/29/getting-started-with-windbg-and-managed-code.aspx" mce_href="http://blogs.msdn.com/kristoffer/archive/2006/12/29/getting-started-with-windbg-and-managed-code.aspx"&gt;see previous post&lt;/a&gt;).&lt;/p&gt; &lt;p&gt;We start out by getting a summary of our memory allocations with !dumpheap&lt;/p&gt;&lt;div class="WindbgOutput" style="white-space: pre;"&gt;0:004&amp;gt; !dumpheap -stat total 8952 objects Statistics:&lt;br&gt;       MT    Count    TotalSize Class Name &lt;br&gt;7b4779b8        1           12 System.Windows.Forms.OSFeature &lt;br&gt;7b475ca8        1           12 System.Windows.Forms.FormCollection &lt;br&gt;7b474f8c        1           12 System.Windows.Forms.Layout.DefaultLayout &lt;br&gt;7b4749e0        1           12 System.Windows.Forms.ClientUtils+WeakRefCollection &lt;br&gt;79128f18        1           12 System.Collections.Generic.GenericEqualityComparer`1[[System.Int16, mscorlib]] &lt;br&gt;79128b94        1           12 System.Collections.Generic.ObjectEqualityComparer`1[[System.IntPtr, mscorlib]] &lt;br&gt;79127ae4        1           12 System.Collections.Generic.ObjectEqualityComparer`1[[System.Object, mscorlib]] &lt;br&gt;79114408        1           12 System.Security.Permissions.ReflectionPermission &lt;br&gt;791142e8        1           12 System.Security.Permissions.FileDialogPermission &lt;br&gt;----------------- snip ---------------------- &lt;br&gt;790fd4ec       82         1968 System.Version &lt;br&gt;7ae76b24      208         2496 System.Drawing.KnownColor &lt;br&gt;791242ec       20         2952 System.Collections.Hashtable+bucket[] &lt;br&gt;79114bf0      181         5068 System.Security.SecurityElement &lt;br&gt;791036b0      229         5496 System.Collections.ArrayList &lt;br&gt;00155a48       50        23424      Free &lt;br&gt;79124228      306        47780 System.Object[] &lt;br&gt;790fa3e0     6662       379600 System.String &lt;br&gt;79124418        9      3156304 &lt;b&gt;System.Byte[]&lt;/b&gt; Total 8952 objects&lt;/div&gt; &lt;p&gt;We've got about 3 megs worth of System.Byte[] allocated so let's focus in on this to see why these objects exist.&lt;/p&gt;&lt;div class="WindbgOutput" style="white-space: pre;"&gt;0:004&amp;gt; !dumpheap -type &lt;b&gt;System.Byte[]&lt;/b&gt; &lt;br&gt;&amp;nbsp;Address       MT     Size &lt;br&gt;01241e5c 79124418       12      &lt;br&gt;0124aaf4 79124418       28      &lt;br&gt;0124ab48 79124418      140      &lt;br&gt;01251178 79124418      172      &lt;br&gt;0125129c 79124418       28      &lt;br&gt;01254f7c 79124418    10148      &lt;br&gt;&lt;b&gt;02246da8&lt;/b&gt; 79124418  1048592      &lt;br&gt;02346db8 79124418  1048592      &lt;br&gt;02446dc8 79124418  1048592      &lt;br&gt;total 9 objects &lt;br&gt;Statistics:       MT    Count    TotalSize Class Name &lt;br&gt;79124418        9      3156304 System.Byte[] &lt;br&gt;Total 9 objects&lt;/div&gt; &lt;p&gt;A few small Byte arrays but 3 of them are a meg each so let's find out why the first object is still alive (or if it is alive at all, a GC might not have happened to collect it yet).&lt;/p&gt;&lt;div class="WindbgOutput" style="white-space: pre;"&gt;0:004&amp;gt; !gcroot &lt;b&gt;02246da8&lt;/b&gt; &lt;br&gt;Note: Roots found on stacks may be false positives. Run "!help gcroot" for more info. &lt;br&gt;ebx:Root:012525d8(System.Windows.Forms.Application+ThreadContext)-&amp;gt; &lt;br&gt;01251d58(WindbgDemo.Form1)-&amp;gt; &lt;br&gt;01251edc(System.Collections.ArrayList)-&amp;gt; &lt;br&gt;0125c278(System.Object[])-&amp;gt; &lt;br&gt;02246da8(System.Byte[]) &lt;br&gt;Scan Thread 0 OSTHread 1194 &lt;br&gt;Scan Thread 2 OSTHread 1720&lt;/div&gt; &lt;p&gt;The application has a reference to Form1 which has a reference to an ArrayList which has a reference to my Byte array. If a GC were to happen right now this object would be kept alive.&lt;/p&gt; &lt;p&gt;Instead of checking each Byte array by address individually we can use the .foreach token.&lt;/p&gt;&lt;div class="WindbgOutput" style="white-space: pre;"&gt;0:004&amp;gt; .foreach (obj {!dumpheap -type &lt;b&gt;System.Byte[]&lt;/b&gt; -short}) {.echo obj;!gcroot obj} &lt;br&gt;01241e5c &lt;br&gt;Note: Roots found on stacks may be false positives. Run "!help gcroot" for more info. &lt;br&gt;Scan Thread 0 OSTHread 1194 &lt;br&gt;Scan Thread 2 OSTHread 1720 &lt;br&gt;DOMAIN(00149768):HANDLE(Pinned):3e13fc:Root:02241010(System.Object[])-&amp;gt; &lt;br&gt;01241e5c(System.Byte[]) &lt;br&gt;0124aaf4 &lt;br&gt;Note: Roots found on stacks may be false positives. Run "!help gcroot" for more info. &lt;br&gt;Scan Thread 0 OSTHread 1194 &lt;br&gt;Scan Thread 2 OSTHread 1720 &lt;br&gt;DOMAIN(00149768):HANDLE(Pinned):3e13fc:Root:02241010(System.Object[])-&amp;gt; &lt;br&gt;0124a1c4(System.Environment+ResourceHelper)-&amp;gt; &lt;br&gt;0124a358(System.Resources.ResourceManager)-&amp;gt; &lt;br&gt;0124a3a0(System.Collections.Hashtable)-&amp;gt; &lt;br&gt;0124a3d8(System.Collections.Hashtable+bucket[])-&amp;gt; &lt;br&gt;0124a9f8(System.Resources.RuntimeResourceSet)-&amp;gt; &lt;br&gt;0124aa5c(System.Resources.ResourceReader)-&amp;gt; &lt;br&gt;0124aaac(System.IO.BinaryReader)-&amp;gt; &lt;br&gt;0124aaf4(System.Byte[]) &lt;br&gt;0124ab48 &lt;br&gt;Note: Roots found on stacks may be false positives. Run "!help gcroot" for more info. &lt;br&gt;Scan Thread 0 OSTHread 1194 &lt;br&gt;Scan Thread 2 OSTHread 1720 &lt;br&gt;DOMAIN(00149768):HANDLE(Pinned):3e13fc:Root:02241010(System.Object[])-&amp;gt; &lt;br&gt;0124a1c4(System.Environment+ResourceHelper)-&amp;gt; &lt;br&gt;0124a358(System.Resources.ResourceManager)-&amp;gt; &lt;br&gt;0124a3a0(System.Collections.Hashtable)-&amp;gt; &lt;br&gt;0124a3d8(System.Collections.Hashtable+bucket[])-&amp;gt; &lt;br&gt;0124a9f8(System.Resources.RuntimeResourceSet)-&amp;gt; &lt;br&gt;0124aa5c(System.Resources.ResourceReader)-&amp;gt; &lt;br&gt;0124aaac(System.IO.BinaryReader)-&amp;gt; &lt;br&gt;0124ab48(System.Byte[]) &lt;br&gt;--------------- remainder of output snipped --------------&lt;/div&gt; &lt;p&gt;By using the /ps parameter to .foreach (see Windbg help file for details) you can run gcroot on every nth item to get a sample of objects.&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=1439777" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/b/kristoffer/archive/tags/Windbg/">Windbg</category></item><item><title>Debugging lock issues in managed code using Windbg</title><link>http://blogs.msdn.com/b/kristoffer/archive/2007/01/05/debugging-lock-issues-in-managed-code-using-windbg.aspx</link><pubDate>Fri, 05 Jan 2007 19:35:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:1417123</guid><dc:creator>Kristoffer Henriksson</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/kristoffer/rsscomments.aspx?WeblogPostID=1417123</wfw:commentRss><comments>http://blogs.msdn.com/b/kristoffer/archive/2007/01/05/debugging-lock-issues-in-managed-code-using-windbg.aspx#comments</comments><description>&lt;p&gt;Windbg can be helpful for locking lock issues in managed code that seem to only happen on client machines when the moon is full and the stars are aligned just right. Windbg is a minimal installation and with managed code doesn't require debug symbols to still be useful.&lt;/p&gt;
&lt;p&gt;For my test scenario I have an application that hangs for 10 seconds at a time once a button is pressed so I start up windbg and break during the hang so I can inspect what's going on. First we check to see what the managed threads are currently running what:&lt;/p&gt;&lt;div class="WindbgOutput" style="white-space: pre;"&gt;0:000&amp;gt; ~*e!clrstack &lt;br&gt;OS Thread Id: 0x123c (0) &lt;br&gt;ESP       EIP      &lt;br&gt;0012eec8 7c82ed54 [GCFrame: 0012eec8]  0012ef98 7c82ed54 [HelperMethodFrame_1OBJ: 0012ef98] &lt;br&gt;System.Threading.Monitor.Enter(System.Object) &lt;br&gt;0012eff0 00cc0381 TestApp.Form1.button1_Click(System.Object, System.EventArgs) &lt;br&gt;0012f02c 7b060a6b System.Windows.Forms.Control.OnClick(System.EventArgs) &lt;br&gt;0012f03c 7b105379 System.Windows.Forms.Button.OnClick(System.EventArgs) &lt;br&gt;0012f048 7b10547f System.Windows.Forms.Button.OnMouseUp(System.Windows.Forms.MouseEventArgs) &lt;br&gt;0012f06c 7b0d02d2 System.Windows.Forms.Control.WmMouseUp(System.Windows.Forms.Message ByRef, System.Windows.Forms.MouseButtons, Int32) &lt;br&gt;0012f0b8 7b072c74 System.Windows.Forms.Control.WndProc(System.Windows.Forms.Message ByRef) &lt;br&gt;0012f0bc 7b0815a6 [InlinedCallFrame: 0012f0bc]  0012f158 7b0814c3 System.Windows.Forms.Button.WndProc(System.Windows.Forms.Message ByRef) &lt;br&gt;0012f160 7b07a72d System.Windows.Forms.Control+ControlNativeWindow.OnMessage(System.Windows.Forms.Message ByRef) &lt;br&gt;0012f164 7b07a706 System.Windows.Forms.Control+ControlNativeWindow.WndProc(System.Windows.Forms.Message ByRef) &lt;br&gt;0012f178 7b07a515 System.Windows.Forms.NativeWindow.Callback(IntPtr, Int32, IntPtr, IntPtr) &lt;br&gt;0012f324 0033216c [NDirectMethodFrameStandalone: 0012f324] System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG ByRef) &lt;br&gt;0012f334 7b084766 System.Windows.Forms.Application+ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32, Int32, Int32) &lt;br&gt;0012f3d4 7b08432d System.Windows.Forms.Application+ThreadContext.RunMessageLoopInner(Int32, System.Windows.Forms.ApplicationContext) &lt;br&gt;0012f440 7b08416b System.Windows.Forms.Application+ThreadContext.RunMessageLoop(Int32, System.Windows.Forms.ApplicationContext) &lt;br&gt;0012f470 7b0c69fe System.Windows.Forms.Application.Run(System.Windows.Forms.Form) &lt;br&gt;0012f480 00cc00a8 TestApp.Program.Main() &lt;br&gt;0012f69c 79e88f63 [GCFrame: 0012f69c]  &lt;br&gt;OS Thread Id: 0x1408 (1) &lt;br&gt;Unable to walk the managed stack. The current thread is likely not a  &lt;br&gt;managed thread. You can run !threads to get a list of managed threads in &lt;br&gt;the process &lt;br&gt;OS Thread Id: 0xb30 (2) &lt;br&gt;Failed to start stack walk: 80004005 &lt;br&gt;OS Thread Id: 0x161c (3) &lt;br&gt;Unable to walk the managed stack. The current thread is likely not a  &lt;br&gt;managed thread. You can run !threads to get a list of managed threads in &lt;br&gt;the process &lt;br&gt;OS Thread Id: 0x149c (4) &lt;br&gt;ESP       EIP      &lt;br&gt;011ef82c 7c82ed54 [HelperMethodFrame: 011ef82c] System.Threading.Thread.SleepInternal(Int32) &lt;br&gt;011ef880 793d80f5 System.Threading.Thread.Sleep(Int32) &lt;br&gt;011ef884 00cc042d TestApp.Form1.ThreadProc() &lt;br&gt;011ef8b4 793d7a7b System.Threading.ThreadHelper.ThreadStart_Context(System.Object) &lt;br&gt;011ef8bc 793683dd System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object) &lt;br&gt;011ef8d4 793d7b5c System.Threading.ThreadHelper.ThreadStart() &lt;br&gt;011efaf8 79e88f63 [GCFrame: 011efaf8]  &lt;br&gt;OS Thread Id: 0x7e0 (5) &lt;br&gt;Unable to walk the managed stack. The current thread is likely not a  &lt;br&gt;managed thread. You can run !threads to get a list of managed threads in &lt;br&gt;the process &lt;br&gt;OS Thread Id: 0xf94 (6) &lt;br&gt;Unable to walk the managed stack. The current thread is likely not a &lt;br&gt;managed thread. You can run !threads to get a list of managed threads in &lt;br&gt;the process &lt;br&gt;OS Thread Id: 0x5e4 (7) &lt;br&gt;Unable to walk the managed stack. The current thread is likely not a &lt;br&gt;managed thread. You can run !threads to get a list of managed threads in &lt;br&gt;the process&lt;/div&gt;So we've got two managed threads: 0 (the message pumping thread) and 4. Thread 0 is currently in a call to System.Threading.Monitor.Enter which the &lt;b&gt;lock&lt;/b&gt; statement wraps. Let's see what locks are held by the application. &lt;div class="WindbgOutput" style="white-space: pre;"&gt;0:000&amp;gt; !syncblk &lt;br&gt;Index SyncBlock MonitorHeld Recursion Owning Thread Info  SyncBlock Owner    &lt;br&gt;11 001b415c            3         1 001be180  149c   4   &lt;b&gt;012cfdfc&lt;/b&gt; TestApp.Form1 &lt;br&gt;----------------------------- &lt;br&gt;Total           11 &lt;br&gt;CCW             0 &lt;br&gt;RCW             0 &lt;br&gt;ComClassFactory 0 &lt;br&gt;Free            0&lt;/div&gt;So thread 4 (which is currently sleeping) holds a lock on the object at address 012cfdfc. Let's see what type of object this is: &lt;div class="WindbgOutput" style="white-space: pre;"&gt;0:000&amp;gt; !DumpObj -nofields &lt;b&gt;012cfdfc&lt;/b&gt; &lt;br&gt;Name: TestApp.Form1 &lt;br&gt;MethodTable: &lt;b&gt;008f5ac4&lt;/b&gt; &lt;br&gt;EEClass: 008f165c &lt;br&gt;Size: 332(0x14c) bytes &lt;br&gt; (C:\Testing\WindowsApplication17\WindowsApplication17\bin\Debug\WindowsApplication17.exe)&lt;/div&gt;Thread 4 has a lock on the Form. Looking at the stack objects for thread 0 we can see the Form object right before a synchronization context. &lt;div class="WindbgOutput" style="white-space: pre;"&gt;0:000&amp;gt; !dso &lt;br&gt;OS Thread Id: 0x123c (0) &lt;br&gt;ESP/REG  Object   Name &lt;br&gt;0012edd0 012d05f4 System.Windows.Forms.WindowsFormsSynchronizationContext &lt;br&gt;0012ef00 &lt;b&gt;012cfdfc&lt;/b&gt; TestApp.Form1 &lt;br&gt;0012ef54 012f9f1c System.Threading.ThreadStart &lt;br&gt;0012ef58 012f9f3c System.Threading.Thread &lt;br&gt;0012ef64 012f9f1c System.Threading.ThreadStart &lt;br&gt;0012ef6c 012f9f3c System.Threading.Thread &lt;br&gt;0012efac 012cff60 Microsoft.Win32.SafeHandles.SafeWaitHandle &lt;br&gt;0012efd4 012cfdfc TestApp.Form1 &lt;br&gt;0012eff0 012cfdfc TestApp.Form1 &lt;br&gt;0012eff4 012f9f3c System.Threading.Thread &lt;br&gt;0012eff8 012cfdfc TestApp.Form1 &lt;br&gt;0012effc 012ea688 System.Windows.Forms.Button &lt;br&gt;-------------- snip -----------------------&lt;br&gt; 0012f46c 012ec1e0 System.Windows.Forms.ApplicationContext &lt;br&gt;0012f474 012cfdfc TestApp.Form1&lt;/div&gt;We can confirm this by looking at the IL code for TestApp.Form1.button1_Click. &lt;div class="WindbgOutput" style="white-space: pre;"&gt;0:000&amp;gt; !dumpmt -md &lt;b&gt;008f5ac4&lt;/b&gt; &lt;br&gt;EEClass: 008f165c &lt;br&gt;Module: 008f2d5c &lt;br&gt;Name: TestApp.Form1 &lt;br&gt;mdToken: 02000003 &lt;br&gt; (C:\Testing\WindowsApplication17\WindowsApplication17\bin\Debug\WindowsApplication17.exe)&lt;br&gt;BaseSize: 0x14c &lt;br&gt;ComponentSize: 0x0 &lt;br&gt;Number of IFaces in IFaceMap: 15 &lt;br&gt;Slots in VTable: 376 &lt;br&gt;-------------------------------------- &lt;br&gt;MethodDesc Table &lt;br&gt;&amp;nbsp; &amp;nbsp;Entry MethodDesc      JIT Name &lt;br&gt;7b05c298   7b4a5518   PreJIT System.Windows.Forms.Form.ToString() &lt;br&gt;793539c0   7913bd50   PreJIT System.Object.Equals(System.Object) &lt;br&gt;793539b0   7913bd68   PreJIT System.Object.GetHashCode() &lt;br&gt;7a4a6510   7a75bf58   PreJIT System.ComponentModel.Component.Finalize() &lt;br&gt;79361e50   7913dbd8   PreJIT System.MarshalByRefObject.GetLifetimeService() &lt;br&gt;7b0662a4   7b4a5530   PreJIT System.Windows.Forms.Form.OnResizeEnd(System.EventArgs) &lt;br&gt;------------------ snip -----------------&lt;br&gt;008f61d4   008f5a68      JIT TestApp.Form1.InitializeComponent() &lt;br&gt;008f61b0   008f5a70      JIT TestApp.Form1..ctor() &lt;br&gt;008f6cfc   008f5a78      JIT TestApp.Form1.ThreadProc() &lt;br&gt;008f6a54   &lt;b&gt;008f5a80&lt;/b&gt;      JIT TestApp.Form1.button1_Click(System.Object, System.EventArgs) &lt;br&gt;0:000&amp;gt; !dumpil &lt;b&gt;008f5a80&lt;/b&gt; &lt;br&gt;ilAddr = 00402274 &lt;br&gt;IL_0000: nop &lt;br&gt;IL_0001: ldarg.0 &lt;br&gt;IL_0002: ldftn TestApp.Form1::ThreadProc&lt;br&gt;IL_0008: newobj System.Threading.ThreadStart::.ctor &lt;br&gt;IL_000d: newobj System.Threading.Thread::.ctor &lt;br&gt;IL_0012: stloc.0 &lt;br&gt;IL_0013: ldloc.0 &lt;br&gt;IL_0014: callvirt System.Threading.Thread::Start &lt;br&gt;IL_0019: nop &lt;br&gt;IL_001a: ldarg.0 &lt;br&gt;IL_001b: ldfld TestApp.Form1::threadStarted&lt;br&gt;IL_0020: callvirt System.Threading.WaitHandle::WaitOne &lt;br&gt;IL_0025: pop &lt;br&gt;&lt;b&gt;IL_0026: ldarg.0 &lt;br&gt;IL_0027: dup &lt;br&gt;IL_0028: stloc.1 &lt;br&gt;IL_0029: call System.Threading.Monitor::Enter&lt;/b&gt; &lt;br&gt;IL_002e: nop &lt;br&gt;.try&lt;br&gt;{&lt;br&gt;&amp;nbsp; IL_002f: nop &lt;br&gt;&amp;nbsp; IL_0030: nop &lt;br&gt;&amp;nbsp; IL_0031: leave.s IL_003b&lt;br&gt;} // end .try&lt;br&gt;.finally&lt;br&gt;{&lt;br&gt;&amp;nbsp; IL_0033: ldloc.1 &lt;br&gt;&amp;nbsp; IL_0034: call System.Threading.Monitor::Exit &lt;br&gt;&amp;nbsp; IL_0039: nop &lt;br&gt;&amp;nbsp; IL_003a: endfinally &lt;br&gt;} // end .finally&lt;br&gt;IL_003b: nop &lt;br&gt;IL_003c: ldloc.0 &lt;br&gt;IL_003d: callvirt System.Threading.Thread::Join &lt;br&gt;IL_0042: nop &lt;br&gt;IL_0043: ret &lt;br&gt;&lt;/div&gt;Sure enough Form1 is passing itself to System.Threading.Monitor.Enter.&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=1417123" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/b/kristoffer/archive/tags/Windbg/">Windbg</category></item><item><title>Debugging exceptions in managed code using Windbg</title><link>http://blogs.msdn.com/b/kristoffer/archive/2007/01/03/debugging-exceptions-in-managed-code-using-windbg.aspx</link><pubDate>Wed, 03 Jan 2007 19:04:27 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:1405113</guid><dc:creator>Kristoffer Henriksson</dc:creator><slash:comments>2</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/kristoffer/rsscomments.aspx?WeblogPostID=1405113</wfw:commentRss><comments>http://blogs.msdn.com/b/kristoffer/archive/2007/01/03/debugging-exceptions-in-managed-code-using-windbg.aspx#comments</comments><description>&lt;p&gt;By default Windbg will break for access violations (or null reference exceptions as they're called in managed code). To get Windbg to break for managed exceptions use the sxe command.&lt;/p&gt;&lt;div class="WindbgOutput" style="white-space: pre"&gt;0:004&amp;gt; sxe clr&lt;br&gt;0:004&amp;gt; g&lt;/div&gt; &lt;p&gt;A little while later our program generates a CLR exception and pops into the debugger.&lt;/p&gt;&lt;div class="WindbgOutput" style="white-space: pre"&gt;(17c.1194): CLR exception - code e0434f4d (first chance)&lt;br&gt;First chance exceptions are reported before any exception handling.&lt;br&gt;This exception may be expected and handled.&lt;br&gt;eax=0012eea0 ebx=0014d578 ecx=00000000 edx=00000025 esi=0012ef2c edi=e0434f4d&lt;br&gt;eip=77e55e02 esp=0012ee9c ebp=0012eef0 iopl=0         nv up ei pl nz na po nc&lt;br&gt;cs=001b  ss=0023  ds=0023  es=0023  fs=003b  gs=0000             efl=00000202&lt;br&gt;KERNEL32!RaiseException+0x53:&lt;br&gt;77e55e02 5e              pop     esi&lt;/div&gt; &lt;p&gt;This is a first chance exception so this may be expected and handled, as the message helpfully reminds you. Let's find out what caused this exception.&lt;/p&gt;&lt;div class="WindbgOutput" style="white-space: pre"&gt;0:000&amp;gt; !PrintException&lt;br&gt;Exception object: 01289fb0&lt;br&gt;Exception type: System.ArgumentException&lt;br&gt;Message: Value does not fall within the expected range.&lt;br&gt;InnerException: &amp;lt;none&amp;gt;&lt;none&gt;&lt;br&gt;StackTrace (generated):&lt;br&gt;&amp;lt;none&amp;gt;&lt;br&gt;StackTraceString: &amp;lt;none&amp;gt;&lt;br&gt;HResult: 80070057&lt;/div&gt; &lt;p&gt;We can also have a look at the managed stack trace to see where this exception happened.&lt;/p&gt;&lt;div class="WindbgOutput" style="white-space: pre"&gt;0:000&amp;gt; !CLRStack&lt;br&gt;OS Thread Id: 0x1194 (0)&lt;br&gt;ESP       EIP      &lt;br&gt;0012ef78 77e55e02 [HelperMethodFrame: 0012ef78]&lt;br&gt;0012f01c 00cc0795 WindbgDemo.Form1.CauseOtherException()&lt;br&gt;0012f024 00cc075d WindbgDemo.Form1.btnOtherException_Click(System.Object, System.EventArgs)&lt;br&gt;0012f02c 7b060a6b System.Windows.Forms.Control.OnClick(System.EventArgs)&lt;br&gt;0012f03c 7b105379 System.Windows.Forms.Button.OnClick(System.EventArgs) &lt;br&gt;0012f048 7b10547f System.Windows.Forms.Button.OnMouseUp(System.Windows.Forms.MouseEventArgs)&lt;br&gt;0012f06c 7b0d02d2 System.Windows.Forms.Control.WmMouseUp(System.Windows.Forms.Message ByRef, System.Windows.Forms.MouseButtons, Int32)&lt;br&gt;0012f0b8 7b072c74 System.Windows.Forms.Control.WndProc(System.Windows.Forms.Message ByRef)&lt;br&gt;0012f0bc 7b0815a6 [InlinedCallFrame: 0012f0bc] &lt;br&gt;0012f158 7b0814c3 System.Windows.Forms.Button.WndProc(System.Windows.Forms.Message ByRef)&lt;br&gt;0012f160 7b07a72d System.Windows.Forms.Control+ControlNativeWindow.OnMessage(System.Windows.Forms.Message ByRef)&lt;br&gt;0012f164 7b07a706 System.Windows.Forms.Control+ControlNativeWindow.WndProc(System.Windows.Forms.Message ByRef)&lt;br&gt;0012f178 7b07a515 System.Windows.Forms.NativeWindow.Callback(IntPtr, Int32, IntPtr, IntPtr)&lt;br&gt;0012f324 0033216c [NDirectMethodFrameStandalone: 0012f324] System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG ByRef)&lt;br&gt;0012f334 7b084766 System.Windows.Forms.Application+ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32, Int32, Int32)&lt;br&gt;0012f3d4 7b08432d System.Windows.Forms.Application+ThreadContext.RunMessageLoopInner(Int32, System.Windows.Forms.ApplicationContext)&lt;br&gt;0012f440 7b08416b System.Windows.Forms.Application+ThreadContext.RunMessageLoop(Int32, System.Windows.Forms.ApplicationContext)&lt;br&gt;0012f470 7b0c69fe System.Windows.Forms.Application.Run(System.Windows.Forms.Form)&lt;br&gt;0012f480 00cc0097 WindbgDemo.Program.Main()&lt;br&gt;0012f69c 79e88f63 [GCFrame: 0012f69c]&lt;/div&gt; &lt;p&gt;If we want to get a feel for what sorts of exceptions are generated by our program but not necessarily inspect each one we can tell Windbg to stop on exceptions, print out some information about the exception, and then continue running all without user intervention.&lt;/p&gt;&lt;div class="WindbgOutput" style="white-space: pre"&gt;0:000&amp;gt; sxe -c "!pe;!clrstack;gc" clr&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=1405113" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/b/kristoffer/archive/tags/Windbg/">Windbg</category></item><item><title>Setting a breakpoint in managed code using Windbg</title><link>http://blogs.msdn.com/b/kristoffer/archive/2007/01/02/setting-a-breakpoint-in-managed-code-using-windbg.aspx</link><pubDate>Tue, 02 Jan 2007 19:49:06 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:1399686</guid><dc:creator>Kristoffer Henriksson</dc:creator><slash:comments>2</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/kristoffer/rsscomments.aspx?WeblogPostID=1399686</wfw:commentRss><comments>http://blogs.msdn.com/b/kristoffer/archive/2007/01/02/setting-a-breakpoint-in-managed-code-using-windbg.aspx#comments</comments><description>&lt;p&gt;One of the great features of managed code is getting call stacks and proper class and member function names without debug symbols. We can examine the methods of a class and set breakpoints based on name.&lt;/p&gt; &lt;p&gt;To see the methods on an object in Windbg we first need to find its method table. We can do this with the !name2ee command which will look up information about a class.&lt;/p&gt;&lt;div class="WindbgOutput" style="white-space: pre"&gt;0:004&amp;gt; !Name2EE *!WindbgDemo.Form1&lt;br&gt;Module: 790c2000 (mscorlib.dll)&lt;br&gt;--------------------------------------&lt;br&gt;Module: 00912380 sortkey.nlp)&lt;br&gt;--------------------------------------&lt;br&gt;Module: 00912010 (sorttbls.nlp)&lt;br&gt;--------------------------------------&lt;br&gt;Module: 008f2d5c (WindbgDemo.exe)&lt;br&gt;Token: 0x02000004&lt;br&gt;MethodTable: &lt;strong&gt;008f5b5c&lt;/strong&gt;&lt;br&gt;EEClass: 008f15dc&lt;br&gt;Name: WindbgDemo.Form1&lt;br&gt;--------------------------------------&lt;br&gt;Module: 7b442000 (System.Windows.Forms.dll)&lt;br&gt;--------------------------------------&lt;br&gt;Module: 7a714000 (System.dll)&lt;br&gt;--------------------------------------&lt;br&gt;Module: 7ae72000 (System.Drawing.dll)&lt;/div&gt; &lt;p&gt;With the method table address we can examine all the methods defined on the object.&lt;/p&gt;&lt;div class="WindbgOutput" style="white-space: pre"&gt;0:004&amp;gt; !DumpMT -MD &lt;strong&gt;008f5b5c&lt;/strong&gt;&lt;br&gt;EEClass: 008f15dc&lt;br&gt;Module: 008f2d5c&lt;br&gt;Name: WindbgDemo.Form1&lt;br&gt;mdToken: 02000004  (C:\Testing\WindbgDemo\WindbgDemo\bin\Release\WindbgDemo.exe)&lt;br&gt;BaseSize: 0x16c&lt;br&gt;ComponentSize: 0x0&lt;br&gt;Number of IFaces in IFaceMap: 15&lt;br&gt;Slots in VTable: 383&lt;br&gt;--------------------------------------&lt;br&gt;MethodDesc Table&lt;br&gt;   Entry MethodDesc      JIT Name&lt;br&gt;7b05c298   7b4a5518   PreJIT System.Windows.Forms.Form.ToString()&lt;br&gt;793539c0   7913bd50   PreJIT System.Object.Equals(System.Object)&lt;br&gt;793539b0   7913bd68   PreJIT System.Object.GetHashCode()&lt;br&gt;7a4a6510   7a75bf58   PreJIT System.ComponentModel.Component.Finalize()&lt;br&gt;79361e50   7913dbd8   PreJIT System.MarshalByRefObject.GetLifetimeService()&lt;br&gt;79360770   7913dbe0   PreJIT System.MarshalByRefObject.InitializeLifetimeService()&lt;br&gt;--------------- snip ----------------&lt;br&gt;7b06621c   7b4a5528   PreJIT System.Windows.Forms.Form.OnResizeBegin(System.EventArgs)&lt;br&gt;7b0662a4   7b4a5530   PreJIT System.Windows.Forms.Form.OnResizeEnd(System.EventArgs)&lt;br&gt;008f62a0   008f5ac8      JIT WindbgDemo.Form1.InitializeComponent()&lt;br&gt;008f627c   008f5ad0      JIT WindbgDemo.Form1..ctor()&lt;br&gt;008f62bc   008f5ad8     NONE WindbgDemo.Form1.btnLockBlock_Click(System.Object, System.EventArgs)&lt;br&gt;008f6249   008f5ae0     NONE WindbgDemo.Form1.LockBlock()&lt;br&gt;008f62d0   008f5ae8     NONE WindbgDemo.Form1.btnException_Click(System.Object, System.EventArgs)&lt;br&gt;008f6251   008f5af0     NONE WindbgDemo.Form1.CauseException()&lt;br&gt;008f630c   008f5af8     NONE WindbgDemo.Form1.btnOtherException_Click(System.Object, System.EventArgs)&lt;br&gt;008f6259   008f5b00     NONE WindbgDemo.Form1.CauseOtherException()&lt;br&gt;008f62e4   008f5b08     NONE WindbgDemo.Form1.btnMemoryGrowth_Click(System.Object, System.EventArgs)&lt;br&gt;008f62f8   &lt;strong&gt;008f5b10&lt;/strong&gt;     NONE WindbgDemo.Form1.btnBreakpoint_Click(System.Object, System.EventArgs)&lt;br&gt;008f6265   008f5b18     NONE WindbgDemo.Form1.Foo()&lt;/div&gt; &lt;p&gt;For the curious we can see whether the function is ngen'ed code or if it has been JITted yet. PreJIT means ngen code, JIT and NONE is whether the function has been JITted or not. From here we can set a breakpoint.&lt;/p&gt;&lt;div class="WindbgOutput" style="white-space: pre"&gt;0:004&amp;gt; !bpmd -md &lt;b&gt;008f5b10&lt;/b&gt; &lt;br&gt;MethodDesc = 008f5b10&lt;br&gt;Adding pending breakpoints...&lt;/div&gt; &lt;p&gt;It's a pending breakpoint because this code has not been jitted yet and thus has no place to put the debug breakpoint. You can also set breakpoints directly by name using !bpmd.&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=1399686" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/b/kristoffer/archive/tags/Windbg/">Windbg</category></item><item><title>Getting started with Windbg and managed code</title><link>http://blogs.msdn.com/b/kristoffer/archive/2006/12/29/getting-started-with-windbg-and-managed-code.aspx</link><pubDate>Sat, 30 Dec 2006 00:51:10 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:1381372</guid><dc:creator>Kristoffer Henriksson</dc:creator><slash:comments>1</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/kristoffer/rsscomments.aspx?WeblogPostID=1381372</wfw:commentRss><comments>http://blogs.msdn.com/b/kristoffer/archive/2006/12/29/getting-started-with-windbg-and-managed-code.aspx#comments</comments><description>&lt;p&gt;&lt;a href="http://www.microsoft.com/whdc/devtools/debugging/default.mspx"&gt;Windbg&lt;/a&gt; (or wind bag as my friend calls it) is my one stop shop for almost everything debugging related. It's great for finding issues that only happen on a client machine and you don't want a full blown Visual Studio installation mucking up your repro.&lt;/p&gt; &lt;p&gt;With the &lt;strong&gt;sos&lt;/strong&gt; extension Windbg becomes useful at debugging managed code as well. To get started with Windbg and sos fire up Windbg and attach to a managed process. I'm using .Net 2.0 for my development so I need to load the sos dll from the Framework directory (for 1.1 .Net use .load clr10\sos.dll instead) . I can do this with the .loadby command: &lt;div class="WindbgOutput"&gt;0:000&amp;gt; .loadby sos mscorwks&lt;/div&gt; &lt;p&gt;This tells Windbg to load the debugger extension sos.dll from the same directory that the current process has mscorwks.dll loaded from.&lt;br&gt;Next we hit Debug | Go (or F5) and the process is now happily running away. &lt;/p&gt; &lt;p&gt;Once the problem occurs go back to Windbg and press Debug | Break and we can now examine the process state in safety. If at any point you need help with the sos commands, &lt;b&gt;!help&lt;/b&gt; will get you going.&lt;/p&gt; &lt;p&gt;Coming up next week: using Windbg to debug exceptions, deadlocks, and memory problems in managed code.&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=1381372" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/b/kristoffer/archive/tags/Windbg/">Windbg</category></item><item><title>Loading website images in parallel</title><link>http://blogs.msdn.com/b/kristoffer/archive/2006/12/27/loading-website-images-in-parallel.aspx</link><pubDate>Wed, 27 Dec 2006 20:10:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:1369810</guid><dc:creator>Kristoffer Henriksson</dc:creator><slash:comments>5</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/kristoffer/rsscomments.aspx?WeblogPostID=1369810</wfw:commentRss><comments>http://blogs.msdn.com/b/kristoffer/archive/2006/12/27/loading-website-images-in-parallel.aspx#comments</comments><description>&lt;p&gt;By default web browsers will only open 2 simultaneous connections to a named website to be a good client. If you're loading several images this means you may hamstring your bandwidth usage and make your website load slower.&lt;/p&gt; &lt;p&gt;Take the following HTML source as our base, off a site hosted at www.example.com:&lt;/p&gt; &lt;div style="background: white none repeat scroll 0% 50%; font-size: 10pt; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; color: black; font-family: courier new;"&gt; &lt;p style="margin: 0px;"&gt;&lt;span style="color: blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: maroon;"&gt;img&lt;/span&gt; &lt;span style="color: red;"&gt;src&lt;/span&gt;&lt;span style="color: blue;"&gt;="Image1.png"&lt;/span&gt; &lt;span style="color: red;"&gt;width&lt;/span&gt;&lt;span style="color: blue;"&gt;="200"&lt;/span&gt; &lt;span style="color: red;"&gt;height&lt;/span&gt;&lt;span style="color: blue;"&gt;="200"&lt;/span&gt; &lt;span style="color: blue;"&gt;/&amp;gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin: 0px;"&gt;&lt;span style="color: blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: maroon;"&gt;img&lt;/span&gt; &lt;span style="color: red;"&gt;src&lt;/span&gt;&lt;span style="color: blue;"&gt;="Image2.png"&lt;/span&gt; &lt;span style="color: red;"&gt;width&lt;/span&gt;&lt;span style="color: blue;"&gt;="200"&lt;/span&gt; &lt;span style="color: red;"&gt;height&lt;/span&gt;&lt;span style="color: blue;"&gt;="200"&lt;/span&gt; &lt;span style="color: blue;"&gt;/&amp;gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin: 0px;"&gt;&lt;span style="color: blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: maroon;"&gt;img&lt;/span&gt; &lt;span style="color: red;"&gt;src&lt;/span&gt;&lt;span style="color: blue;"&gt;="Image3.png"&lt;/span&gt; &lt;span style="color: red;"&gt;width&lt;/span&gt;&lt;span style="color: blue;"&gt;="200"&lt;/span&gt; &lt;span style="color: red;"&gt;height&lt;/span&gt;&lt;span style="color: blue;"&gt;="200"&lt;/span&gt; &lt;span style="color: blue;"&gt;/&amp;gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin: 0px;"&gt;&lt;span style="color: blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: maroon;"&gt;img&lt;/span&gt; &lt;span style="color: red;"&gt;src&lt;/span&gt;&lt;span style="color: blue;"&gt;="Image4.png"&lt;/span&gt; &lt;span style="color: red;"&gt;width&lt;/span&gt;&lt;span style="color: blue;"&gt;="200"&lt;/span&gt; &lt;span style="color: red;"&gt;height&lt;/span&gt;&lt;span style="color: blue;"&gt;="200"&lt;/span&gt; &lt;span style="color: blue;"&gt;/&amp;gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin: 0px;"&gt;&lt;span style="color: blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: maroon;"&gt;img&lt;/span&gt; &lt;span style="color: red;"&gt;src&lt;/span&gt;&lt;span style="color: blue;"&gt;="Image5.png"&lt;/span&gt; &lt;span style="color: red;"&gt;width&lt;/span&gt;&lt;span style="color: blue;"&gt;="200"&lt;/span&gt; &lt;span style="color: red;"&gt;height&lt;/span&gt;&lt;span style="color: blue;"&gt;="200"&lt;/span&gt; &lt;span style="color: blue;"&gt;/&amp;gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin: 0px;"&gt;&lt;span style="color: blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: maroon;"&gt;img&lt;/span&gt; &lt;span style="color: red;"&gt;src&lt;/span&gt;&lt;span style="color: blue;"&gt;="Image6.png"&lt;/span&gt; &lt;span style="color: red;"&gt;width&lt;/span&gt;&lt;span style="color: blue;"&gt;="200"&lt;/span&gt; &lt;span style="color: red;"&gt;height&lt;/span&gt;&lt;span style="color: blue;"&gt;="200"&lt;/span&gt; &lt;span style="color: blue;"&gt;/&amp;gt;&lt;/span&gt;&lt;/p&gt;&lt;/div&gt;&lt;!--EndFragment--&gt; &lt;div style="border: 1px inset black; margin-top: 5px; padding-bottom: 10px; margin-left: 30px; width: 500px; background-color: rgb(192, 192, 192);"&gt;Network traffic for downloading 6 images over 2 connections  &lt;div style="padding-right: 10px; padding-left: 10px; padding-top: 10px;"&gt; &lt;table&gt; &lt;tbody&gt; &lt;tr&gt; &lt;td style="font-weight: bold; width: 100px;"&gt;www&lt;/td&gt; &lt;td style="margin: 2px; width: 150px; background-color: rgb(142, 196, 207);"&gt;Image1.png&lt;/td&gt; &lt;td style="margin: 2px; width: 150px; background-color: rgb(142, 196, 207);"&gt;Image3.png&lt;/td&gt; &lt;td style="margin: 2px; width: 150px; background-color: rgb(142, 196, 207);"&gt;Image5.png&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td style="font-weight: bold; width: 100px;"&gt;www&lt;/td&gt; &lt;td style="margin: 2px; width: 150px; background-color: rgb(142, 196, 207);"&gt;Image2.png&lt;/td&gt; &lt;td style="margin: 2px; width: 150px; background-color: rgb(142, 196, 207);"&gt;Image4.png&lt;/td&gt; &lt;td style="margin: 2px; width: 150px; background-color: rgb(142, 196, 207);"&gt;Image6.png&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/div&gt;&lt;/div&gt; &lt;p&gt;By not allowing more than 2 images to be downloaded at once the total page load time takes longer than is necessary. Since we own the host in question we know we can safely allow more than 2 images to be downloaded at once so we create two DNS aliases, img1.example.com and img2.example.com that both point to www.example.com. We now modify our HTML source to make use of these two new hosts:&lt;/p&gt; &lt;div style="background: white none repeat scroll 0% 50%; font-size: 10pt; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; color: black; font-family: courier new;"&gt; &lt;p style="margin: 0px;"&gt;&lt;span style="color: blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: maroon;"&gt;img&lt;/span&gt; &lt;span style="color: red;"&gt;src&lt;/span&gt;&lt;span style="color: blue;"&gt;="Image1.png"&lt;/span&gt; &lt;span style="color: red;"&gt;width&lt;/span&gt;&lt;span style="color: blue;"&gt;="200"&lt;/span&gt; &lt;span style="color: red;"&gt;height&lt;/span&gt;&lt;span style="color: blue;"&gt;="200"&lt;/span&gt; &lt;span style="color: blue;"&gt;/&amp;gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin: 0px;"&gt;&lt;span style="color: blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: maroon;"&gt;img&lt;/span&gt; &lt;span style="color: red;"&gt;src&lt;/span&gt;&lt;span style="color: blue;"&gt;="Image2.png"&lt;/span&gt; &lt;span style="color: red;"&gt;width&lt;/span&gt;&lt;span style="color: blue;"&gt;="200"&lt;/span&gt; &lt;span style="color: red;"&gt;height&lt;/span&gt;&lt;span style="color: blue;"&gt;="200"&lt;/span&gt; &lt;span style="color: blue;"&gt;/&amp;gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin: 0px;"&gt;&lt;span style="color: blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: maroon;"&gt;img&lt;/span&gt; &lt;span style="color: red;"&gt;src&lt;/span&gt;&lt;span style="color: blue;"&gt;="http://img1.example.com/Image3.png"&lt;/span&gt; &lt;span style="color: red;"&gt;width&lt;/span&gt;&lt;span style="color: blue;"&gt;="200"&lt;/span&gt; &lt;span style="color: red;"&gt;height&lt;/span&gt;&lt;span style="color: blue;"&gt;="200"&lt;/span&gt; &lt;span style="color: blue;"&gt;/&amp;gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin: 0px;"&gt;&lt;span style="color: blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: maroon;"&gt;img&lt;/span&gt; &lt;span style="color: red;"&gt;src&lt;/span&gt;&lt;span style="color: blue;"&gt;="http://img1.example.com/Image4.png"&lt;/span&gt; &lt;span style="color: red;"&gt;width&lt;/span&gt;&lt;span style="color: blue;"&gt;="200"&lt;/span&gt; &lt;span style="color: red;"&gt;height&lt;/span&gt;&lt;span style="color: blue;"&gt;="200"&lt;/span&gt; &lt;span style="color: blue;"&gt;/&amp;gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin: 0px;"&gt;&lt;span style="color: blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: maroon;"&gt;img&lt;/span&gt; &lt;span style="color: red;"&gt;src&lt;/span&gt;&lt;span style="color: blue;"&gt;="http://img2.example.com/Image5.png"&lt;/span&gt; &lt;span style="color: red;"&gt;width&lt;/span&gt;&lt;span style="color: blue;"&gt;="200"&lt;/span&gt; &lt;span style="color: red;"&gt;height&lt;/span&gt;&lt;span style="color: blue;"&gt;="200"&lt;/span&gt; &lt;span style="color: blue;"&gt;/&amp;gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin: 0px;"&gt;&lt;span style="color: blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: maroon;"&gt;img&lt;/span&gt; &lt;span style="color: red;"&gt;src&lt;/span&gt;&lt;span style="color: blue;"&gt;="http://img2.example.com/Image6.png"&lt;/span&gt; &lt;span style="color: red;"&gt;width&lt;/span&gt;&lt;span style="color: blue;"&gt;="200"&lt;/span&gt; &lt;span style="color: red;"&gt;height&lt;/span&gt;&lt;span style="color: blue;"&gt;="200"&lt;/span&gt; &lt;span style="color: blue;"&gt;/&amp;gt;&lt;/span&gt;&lt;/p&gt;&lt;/div&gt; &lt;p&gt;Web browsers will now open 2 connections per named host (www.example.com, img1.example.com, and img2.example.com) for a total of 6 concurrent connections.&lt;/p&gt; &lt;div style="border: 1px inset black; margin-top: 5px; padding-bottom: 10px; margin-left: 30px; width: 500px; background-color: rgb(192, 192, 192);"&gt;Network traffic for downloading 6 images over 6 connections  &lt;div style="padding-right: 10px; padding-left: 10px; padding-top: 10px;"&gt; &lt;table&gt; &lt;tbody&gt; &lt;tr&gt; &lt;td style="font-weight: bold; width: 100px;"&gt;www&lt;/td&gt; &lt;td style="margin: 2px; width: 180px; background-color: rgb(142, 196, 207);"&gt;Image1.png&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td style="font-weight: bold; width: 100px;"&gt;www&lt;/td&gt; &lt;td style="margin: 2px; width: 180px; background-color: rgb(142, 196, 207);"&gt;Image2.png&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td style="font-weight: bold; width: 100px;"&gt;img1&lt;/td&gt; &lt;td style="margin: 2px; width: 180px; background-color: rgb(142, 196, 207);"&gt;Image3.png&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td style="font-weight: bold; width: 100px;"&gt;img1&lt;/td&gt; &lt;td style="margin: 2px; width: 180px; background-color: rgb(142, 196, 207);"&gt;Image4.png&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td style="font-weight: bold; width: 100px;"&gt;img2&lt;/td&gt; &lt;td style="margin: 2px; width: 180px; background-color: rgb(142, 196, 207);"&gt;Image5.png&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td style="font-weight: bold; width: 100px;"&gt;img2&lt;/td&gt; &lt;td style="margin: 2px; width: 180px; background-color: rgb(142, 196, 207);"&gt;Image6.png&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/div&gt;&lt;/div&gt; &lt;p&gt;Downloading all of them at the same time decreases the amount of bandwidth available for any individual image but will maximize the overall bandwidth usage leading to faster load times.&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=1369810" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/b/kristoffer/archive/tags/Website+Performance/">Website Performance</category></item><item><title>Loading Javascript files in parallel</title><link>http://blogs.msdn.com/b/kristoffer/archive/2006/12/22/loading-javascript-files-in-parallel.aspx</link><pubDate>Fri, 22 Dec 2006 23:58:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:1349461</guid><dc:creator>Kristoffer Henriksson</dc:creator><slash:comments>8</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/kristoffer/rsscomments.aspx?WeblogPostID=1349461</wfw:commentRss><comments>http://blogs.msdn.com/b/kristoffer/archive/2006/12/22/loading-javascript-files-in-parallel.aspx#comments</comments><description>&lt;p&gt;You've got your website all set up but are experiencing slow load times for some customers, especially on slower connections. One possible cause is inefficient network usage because of serialized loading of external Javascript files.&lt;/p&gt; &lt;h3&gt;Static links in &amp;lt;head&amp;gt;&lt;/h3&gt; &lt;p&gt;If you include script files in the HEAD element both IE and Firefox will download the scripts serially, waiting for each one to finish downloading before proceeding with the next one. Take the following HTML snippet that loads two external javascripts:  &lt;/p&gt;&lt;div style="background: white none repeat scroll 0% 50%; font-size: 10pt; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; color: black; font-family: courier new;"&gt; &lt;p style="margin: 0px;"&gt;&lt;span style="color: rgb(43, 145, 175);"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/p&gt; &lt;div style="background: white none repeat scroll 0% 50%; font-size: 10pt; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; color: black; font-family: courier new;"&gt; &lt;p style="margin: 0px;"&gt;&lt;span style="color: blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: maroon;"&gt;head&lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: maroon;"&gt;script&lt;/span&gt; &lt;span style="color: red;"&gt;type&lt;/span&gt;&lt;span style="color: blue;"&gt;="text/javascript"&lt;/span&gt; &lt;span style="color: red;"&gt;src&lt;/span&gt;&lt;span style="color: blue;"&gt;="Script1.js"&amp;gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: maroon;"&gt;script&lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: maroon;"&gt;script&lt;/span&gt; &lt;span style="color: red;"&gt;type&lt;/span&gt;&lt;span style="color: blue;"&gt;="text/javascript"&lt;/span&gt; &lt;span style="color: red;"&gt;src&lt;/span&gt;&lt;span style="color: blue;"&gt;="Script2.js"&amp;gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: maroon;"&gt;script&lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin: 0px;"&gt;&lt;span style="color: blue;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: maroon;"&gt;head&lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/p&gt;&lt;/div&gt;&lt;!--EndFragment--&gt;&lt;/div&gt; &lt;div style="border: 1px inset black; margin-top: 5px; padding-bottom: 10px; margin-left: 30px; width: 500px; background-color: rgb(192, 192, 192);"&gt;Network traffic for loading scripts in &amp;lt;head&amp;gt; tag  &lt;div style="padding-right: 10px; padding-left: 10px; padding-top: 10px;"&gt; &lt;div style="padding: 1px; width: 200px; background-color: red;"&gt;Script1.js&lt;/div&gt; &lt;div style="padding: 1px; margin-top: 2px; margin-left: 205px; width: 200px; background-color: green;"&gt;Script2.js&lt;/div&gt;&lt;/div&gt;&lt;/div&gt; &lt;p&gt;In this common scenario a large amount of network bandwidth can potentially go unused.&lt;/p&gt; &lt;h3&gt;Loading the scripts in parallel&lt;/h3&gt;You have two options for loading scripts in parallel:  &lt;ul&gt; &lt;li&gt;Attach them as elements dynamically  &lt;/li&gt;&lt;li&gt;Use document.write to attach them &lt;/li&gt;&lt;/ul&gt;Both of these options will produce the same network traffic with the difference being in how the scripts are executed on the client. By loading the scripts in parallel we can cut down initial page load time drastically. The time for Script1.js to finish downloading will probably go up slightly over serial loading (since more of the connection is used) but the overall download time should decrease.  &lt;div style="border: 1px inset black; margin-top: 5px; padding-bottom: 10px; margin-left: 30px; width: 500px; background-color: rgb(192, 192, 192);"&gt;Network traffic for&amp;nbsp;loading scripts in parallel&amp;nbsp;  &lt;div style="padding-right: 10px; padding-left: 10px; padding-top: 10px;"&gt; &lt;div style="padding: 1px; width: 230px; background-color: red;"&gt;Script1.js&lt;/div&gt; &lt;div style="padding: 1px; margin-top: 2px; width: 230px; background-color: green;"&gt;Script2.js&lt;/div&gt;&lt;/div&gt;&lt;/div&gt; &lt;h4&gt;Attaching scripts as elements&amp;nbsp;dynamically&lt;/h4&gt; &lt;div style="background: white none repeat scroll 0% 50%; font-size: 10pt; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; color: black; font-family: courier new;"&gt; &lt;p style="margin: 0px;"&gt;&lt;span style="color: blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: maroon;"&gt;head&lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: maroon;"&gt;script&lt;/span&gt; &lt;span style="color: red;"&gt;type&lt;/span&gt;&lt;span style="color: blue;"&gt;="text/javascript"&amp;gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: blue;"&gt;function&lt;/span&gt; AttachScript(src)&lt;/p&gt; &lt;p style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/p&gt; &lt;p style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: blue;"&gt;var&lt;/span&gt; script = document.createElement(&lt;span style="color: maroon;"&gt;"SCRIPT"&lt;/span&gt;);&lt;/p&gt; &lt;p style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; script.type = &lt;span style="color: maroon;"&gt;"text/javascript"&lt;/span&gt;;&lt;/p&gt; &lt;p style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; document.getElementsByTagName(&lt;span style="color: maroon;"&gt;"body"&lt;/span&gt;)[0].appendChild(script);&lt;/p&gt; &lt;p style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; script.src = src;&lt;/p&gt; &lt;p style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/p&gt; &lt;p style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: blue;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: maroon;"&gt;script&lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin: 0px;"&gt;&lt;span style="color: blue;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: maroon;"&gt;head&lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin: 0px;"&gt;&lt;span style="color: blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: maroon;"&gt;body&lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin: 0px;"&gt;&amp;nbsp; &lt;span style="color: blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: maroon;"&gt;script&lt;/span&gt; &lt;span style="color: red;"&gt;type&lt;/span&gt;&lt;span style="color: blue;"&gt;="text/javascript"&amp;gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; AttachScript(&lt;span style="color: maroon;"&gt;"Script1.js"&lt;/span&gt;);&lt;/p&gt; &lt;p style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; AttachScript(&lt;span style="color: maroon;"&gt;"Script2.js"&lt;/span&gt;);&lt;/p&gt; &lt;p style="margin: 0px;"&gt;&amp;nbsp; &lt;span style="color: blue;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: maroon;"&gt;script&lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin: 0px;"&gt;&lt;span style="color: blue;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: maroon;"&gt;body&lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/p&gt;&lt;/div&gt; &lt;p&gt;In this scenario IE and Firefox will download both scripts &lt;b&gt;but&lt;/b&gt; Internet Explorer will also execute them in the order they finish downloading in whereas Firefox downloads them asynchronously but still executes them in the order they are attached in the DOM. &lt;/p&gt; &lt;p&gt;In Internet Explorer this means your scripts cannot have dependancies on one another as the execution order will vary depending on network traffic, caches, etc.&lt;/p&gt; &lt;p&gt;In Firefox&amp;nbsp;you can mostly get away with keeping dependancies on Script1 from Script2 with the caveat that&amp;nbsp;if the user presses stop after Script2 has finished downloading but Script1 has not, Firefox will execute Script2 and abort downloading Script1. Ensure that Script2 can properly handle Script1 failing to load.&lt;/p&gt; &lt;h3&gt;Attaching scripts via document.write&lt;/h3&gt; &lt;div style="background: white none repeat scroll 0% 50%; font-size: 10pt; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; color: black; font-family: courier new;"&gt; &lt;p style="margin: 0px;"&gt;&lt;span style="color: blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: maroon;"&gt;script&lt;/span&gt; &lt;span style="color: red;"&gt;type&lt;/span&gt;&lt;span style="color: blue;"&gt;="text/javascript"&amp;gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin: 0px;"&gt;&amp;nbsp; document.writeln(&lt;span style="color: maroon;"&gt;"&amp;lt;script type='text/javascript' src='Script1.js'&amp;gt;&amp;lt;"&lt;/span&gt; + &lt;span style="color: maroon;"&gt;"/script&amp;gt;"&lt;/span&gt;);&lt;/p&gt; &lt;p style="margin: 0px;"&gt;&amp;nbsp; document.writeln(&lt;span style="color: maroon;"&gt;"&amp;lt;script type='text/javascript' src='Script2.js'&amp;gt;&amp;lt;"&lt;/span&gt; + &lt;span style="color: maroon;"&gt;"/script&amp;gt;"&lt;/span&gt;);&lt;/p&gt; &lt;p style="margin: 0px;"&gt;&lt;span style="color: blue;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: maroon;"&gt;script&lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/p&gt;&lt;/div&gt;&lt;!--EndFragment--&gt; &lt;p&gt;Using document.write produces the same effect in both Internet Explorer and Firefox: the scripts are downloaded in parallel but executed in the order they're written to the page. The same caveat above about the user stopping the page after Script2 has finished downloading before Script1 has applies.&lt;/p&gt; &lt;p&gt;&amp;nbsp;&lt;/p&gt; &lt;p&gt;This technique can be used to download more than two files at the same time as long as more than 1 hostname is used. IE will only open 2 HTTP connections to a named server in order to be a good client (Firefox will open 4) but you can easily work around this by creating additional domain names like scripts1.example.com, scripts2.example.com etc that point to the same host. At some point you will see diminishing returns and possibly even slowdowns from trying to download too many files at once so don't go too crazy with parallelizing.&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;br&gt;Edit: Noted that Firefox will open 4 connections per named host by default.&lt;br&gt;&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=1349461" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/b/kristoffer/archive/tags/Website+Performance/">Website Performance</category></item></channel></rss>