<?xml version="1.0" encoding="utf-8" ?>

<rss version="2.0" 
   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
   xmlns:admin="http://webns.net/mvcb/"
   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/"
   xmlns:content="http://purl.org/rss/1.0/modules/content/"
   >
<channel>
    
    <title>manuel's blog</title>
    <link>http://suntsu.ch/serendipity/</link>
    <description>...</description>
    <dc:language>en</dc:language>
    <generator>Serendipity 1.6 - http://www.s9y.org/</generator>
    <pubDate>Wed, 25 Jan 2012 09:40:24 GMT</pubDate>

    <image>
        <url>http://suntsu.ch/serendipity/templates/bulletproof/img/s9y_banner_small.png</url>
        <title>RSS: manuel's blog - ...</title>
        <link>http://suntsu.ch/serendipity/</link>
        <width>100</width>
        <height>21</height>
    </image>

<item>
    <title>Exception: That assembly does not allow partially trusted callers</title>
    <link>http://suntsu.ch/serendipity/index.php?/archives/241-Exception-That-assembly-does-not-allow-partially-trusted-callers.html</link>
            <category>.net</category>
    
    <comments>http://suntsu.ch/serendipity/index.php?/archives/241-Exception-That-assembly-does-not-allow-partially-trusted-callers.html#comments</comments>
    <wfw:comment>http://suntsu.ch/serendipity/wfwcomment.php?cid=241</wfw:comment>

    <slash:comments>1</slash:comments>
    <wfw:commentRss>http://suntsu.ch/serendipity/rss.php?version=2.0&amp;type=comments&amp;cid=241</wfw:commentRss>
    

    <author>nospam@example.com (suntsu)</author>
    <content:encoded>
    &lt;p class=&quot;break&quot;&gt;I have .net 3.5 program where i load some assemblies from a network share via reflection. Now i&#039;ve got the following exception:  &quot;That assembly does not allow partially trusted callers&#039;&#039;(Detailed message below). &lt;/p&gt;&lt;p class=&quot;whiteline&quot;&gt;The calling assembly(.exe) is local. This .exe loads the assembly from network via reflection. The assembly from the network share then has a reference on a third assembly which is located beneath the .exe.  (Hard to explain, image will do better...)
&lt;/p&gt;&lt;p class=&quot;whiteline&quot;&gt;&lt;a title=&quot;/serendipity/uploads/NetAssemblySecurity1.png&quot; id=&quot;s9yisp295&quot;&gt;&lt;/a&gt;&lt;a class=&quot;serendipity_image_link&quot;  href=&#039;http://suntsu.ch/serendipity/serendipity_admin_image_selector.php?serendipity[step]=showItem&amp;amp;serendipity[image]=295&#039; id=&quot;s9yisphref295&quot; onclick=&quot;javascript:this.href = this.href + &#039;&amp;amp;serendipity[from]=&#039; + self.location.href;&quot;&gt;&lt;!-- s9ymdb:295 --&gt;&lt;img class=&quot;serendipity_image&quot; width=&quot;700&quot;   src=&quot;http://suntsu.ch/serendipity/uploads/NetAssemblySecurity1.serendipityThumb.png&quot;  alt=&quot;&quot; /&gt;&lt;/a&gt;

&lt;/p&gt;&lt;p class=&quot;whiteline&quot;&gt;The reason for this failure is the .net security. It doesn&#039;t allow the MyLib.dll to be loaded, because the calling assembly is located on a network share and is signed with a strong name. 
&lt;/p&gt;&lt;p class=&quot;break&quot;&gt;&lt;strong&gt;Solution 1, caspol.exe&lt;/strong&gt;&lt;/p&gt;&lt;p class=&quot;break&quot;&gt;Allow all code to be executed. &lt;/p&gt;&lt;p class=&quot;break&quot;&gt;This might be dangerous, but if you&#039;re desperate it could be a solution.&lt;/p&gt;&lt;pre name=&quot;code&quot; class=&quot;brush: bash; ruler: true;&quot; &gt;
 &quot;C:\Windows\Microsoft.NET\Framework\v2.0.50727\CasPol.exe&quot; -machine -chggroup All_Code FullTrust
&lt;/pre&gt;&lt;p&gt; 
&lt;/p&gt;&lt;p class=&quot;break&quot;&gt;&lt;strong&gt;Solution 2, no signing&lt;/strong&gt;&lt;/p&gt;&lt;p class=&quot;whiteline&quot;&gt;If you remove the signature from MyLib2.dll, everything works.
&lt;/p&gt;&lt;p class=&quot;whiteline&quot;&gt;&lt;a title=&quot;/serendipity/uploads/NetAssemblySecurity2.png&quot; id=&quot;s9yisp296&quot;&gt;&lt;/a&gt;&lt;a class=&quot;serendipity_image_link&quot;  href=&#039;http://suntsu.ch/serendipity/serendipity_admin_image_selector.php?serendipity[step]=showItem&amp;amp;serendipity[image]=296&#039; id=&quot;s9yisphref296&quot; onclick=&quot;javascript:this.href = this.href + &#039;&amp;amp;serendipity[from]=&#039; + self.location.href;&quot;&gt;&lt;!-- s9ymdb:296 --&gt;&lt;img class=&quot;serendipity_image&quot; width=&quot;700&quot;  src=&quot;http://suntsu.ch/serendipity/uploads/NetAssemblySecurity2.serendipityThumb.png&quot;  alt=&quot;&quot; /&gt;&lt;/a&gt;
&lt;/p&gt;&lt;p class=&quot;break&quot;&gt;&lt;strong&gt;Solution 3, set attribute AllowPartiallyTrustedCallers&lt;/strong&gt;&lt;/p&gt;&lt;p class=&quot;break&quot;&gt;If you set the AllowPartiallyTrustedCallers in the AssemblyInfo.cs of the signed assembly, everything works.&lt;/p&gt;&lt;pre name=&quot;code&quot; class=&quot;brush: csharp; ruler: true;&quot; &gt;
using System.Security;

[assembly: AllowPartiallyTrustedCallers()]
&lt;/pre&gt;&lt;p class=&quot;whiteline&quot;&gt;&lt;a title=&quot;/serendipity/uploads/NetAssemblySecurity3.png&quot; id=&quot;s9yisp297&quot;&gt;&lt;/a&gt;&lt;a class=&quot;serendipity_image_link&quot;  href=&#039;http://suntsu.ch/serendipity/serendipity_admin_image_selector.php?serendipity[step]=showItem&amp;amp;serendipity[image]=297&#039; id=&quot;s9yisphref297&quot; onclick=&quot;javascript:this.href = this.href + &#039;&amp;amp;serendipity[from]=&#039; + self.location.href;&quot;&gt;&lt;!-- s9ymdb:297 --&gt;&lt;img class=&quot;serendipity_image&quot; width=&quot;700&quot; src=&quot;http://suntsu.ch/serendipity/uploads/NetAssemblySecurity3.serendipityThumb.png&quot;  alt=&quot;&quot; /&gt;&lt;/a&gt;
&lt;/p&gt;&lt;p class=&quot;break&quot;&gt;&lt;strong&gt;Usefull links&lt;/strong&gt;&lt;/p&gt;&lt;ul&gt;
&lt;li&gt;&lt;a onclick=&quot;_gaq.push([&#039;_trackPageview&#039;, &#039;/extlink/msdn.microsoft.com/en-us/library/cb6t8dtz(v=vs.80).aspx&#039;]);&quot;  href=&quot;http://msdn.microsoft.com/en-us/library/cb6t8dtz(v=vs.80).aspx&quot;&gt;caspol doku&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a onclick=&quot;_gaq.push([&#039;_trackPageview&#039;, &#039;/extlink/blogs.msdn.com/b/shawnfa/archive/2004/12/30/344554.aspx&#039;]);&quot;  href=&quot;http://blogs.msdn.com/b/shawnfa/archive/2004/12/30/344554.aspx&quot;&gt;howto set fulltrust to a share&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a onclick=&quot;_gaq.push([&#039;_trackPageview&#039;, &#039;/extlink/msdn.microsoft.com/en-us/library/8skskf63(v=VS.90).aspx&#039;]);&quot;  href=&quot;http://msdn.microsoft.com/en-us/library/8skskf63(v=VS.90).aspx&quot;&gt;Using Libraries from Partially Trusted Code&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a onclick=&quot;_gaq.push([&#039;_trackPageview&#039;, &#039;/extlink/blogs.msdn.com/b/shawnfa/archive/2005/02/04/367390.aspx&#039;]);&quot;  href=&quot;http://blogs.msdn.com/b/shawnfa/archive/2005/02/04/367390.aspx&quot;&gt;Allowing Partially Trusted Callers&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt; &lt;br /&gt;&lt;a href=&quot;http://suntsu.ch/serendipity/index.php?/archives/241-Exception-That-assembly-does-not-allow-partially-trusted-callers.html#extended&quot;&gt;Continue reading &quot;Exception: That assembly does not allow partially trusted callers&quot;&lt;/a&gt;
    </content:encoded>

    <pubDate>Wed, 25 Jan 2012 09:41:53 +0100</pubDate>
    <guid isPermaLink="false">http://suntsu.ch/serendipity/index.php?/archives/241-guid.html</guid>
    
</item>
<item>
    <title>MySmug version 1.2 available </title>
    <link>http://suntsu.ch/serendipity/index.php?/archives/239-MySmug-version-1.2-available.html</link>
            <category>MySmug</category>
    
    <comments>http://suntsu.ch/serendipity/index.php?/archives/239-MySmug-version-1.2-available.html#comments</comments>
    <wfw:comment>http://suntsu.ch/serendipity/wfwcomment.php?cid=239</wfw:comment>

    <slash:comments>0</slash:comments>
    <wfw:commentRss>http://suntsu.ch/serendipity/rss.php?version=2.0&amp;type=comments&amp;cid=239</wfw:commentRss>
    

    <author>nospam@example.com (suntsu)</author>
    <content:encoded>
    &lt;p class=&quot;break&quot;&gt;MySmug version 1.2 went again smooth through the submission processs, and now is available at the &lt;a onclick=&quot;_gaq.push([&#039;_trackPageview&#039;, &#039;/extlink/www.windowsphone.com/en-US/apps/e89ed9fc-9896-4212-9ac0-049a78a345bc&#039;]);&quot;  href=&quot;http://www.windowsphone.com/en-US/apps/e89ed9fc-9896-4212-9ac0-049a78a345bc&quot;&gt;marketplace&lt;/a&gt;.&lt;/p&gt;&lt;p class=&quot;break&quot;&gt;New features are: &lt;/p&gt;&lt;ul&gt;
&lt;li&gt;Save single pictures to the phone&lt;/li&gt;
&lt;li&gt;Upload pictures from phone to smugmug&lt;/li&gt;
&lt;li&gt;Change the image orientation based on the phone orientation.&lt;/li&gt;
&lt;li&gt;Performance optimization(Album data caching)&lt;/li&gt;
&lt;/ul&gt;&lt;p&gt;
&lt;/p&gt;&lt;p class=&quot;break&quot;&gt;&lt;a onclick=&quot;_gaq.push([&#039;_trackPageview&#039;, &#039;/extlink/suntsu.smugmug.com/Public/stuff/1-MySmug/20799797_MqT9hp#!i=1677818131&amp;amp;k=4KnqH9N&amp;amp;lb=1&amp;amp;s=A&#039;]);&quot;  href=&quot;http://suntsu.smugmug.com/Public/stuff/1-MySmug/20799797_MqT9hp#!i=1677818131&amp;k=4KnqH9N&amp;lb=1&amp;s=A&quot; title=&quot;&quot;&gt;&lt;img src=&quot;http://suntsu.smugmug.com/Public/stuff/1-MySmug/i-4KnqH9N/0/M/1-M.png&quot; title=&quot;&quot; alt=&quot;&quot;&gt;&lt;/a&gt;&lt;/p&gt;&lt;p class=&quot;break&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p class=&quot;break&quot;&gt;&lt;a onclick=&quot;_gaq.push([&#039;_trackPageview&#039;, &#039;/extlink/suntsu.smugmug.com/Public/stuff/1-MySmug/20799797_MqT9hp#!i=1677818129&amp;amp;k=VJcHb7F&amp;amp;lb=1&amp;amp;s=A&#039;]);&quot;  href=&quot;http://suntsu.smugmug.com/Public/stuff/1-MySmug/20799797_MqT9hp#!i=1677818129&amp;k=VJcHb7F&amp;lb=1&amp;s=A&quot; title=&quot;Photo &amp;amp; Video Sharing by SmugMug&quot;&gt;&lt;img src=&quot;http://suntsu.smugmug.com/Public/stuff/1-MySmug/i-VJcHb7F/0/M/2-M.png&quot; title=&quot;Photo &amp;amp; Video Sharing by SmugMug&quot; alt=&quot;Photo &amp;amp; Video Sharing by SmugMug&quot;&gt;&lt;/a&gt;&lt;/p&gt;&lt;p class=&quot;break&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p class=&quot;break&quot;&gt;&lt;a onclick=&quot;_gaq.push([&#039;_trackPageview&#039;, &#039;/extlink/suntsu.smugmug.com/Public/stuff/1-MySmug/20799797_MqT9hp#!i=1677818143&amp;amp;k=MtnQ7t9&amp;amp;lb=1&amp;amp;s=A&#039;]);&quot;  href=&quot;http://suntsu.smugmug.com/Public/stuff/1-MySmug/20799797_MqT9hp#!i=1677818143&amp;k=MtnQ7t9&amp;lb=1&amp;s=A&quot; title=&quot;&quot;&gt;&lt;img src=&quot;http://suntsu.smugmug.com/Public/stuff/1-MySmug/i-MtnQ7t9/0/M/4-M.png&quot; title=&quot;&quot; alt=&quot;&quot;&gt;&lt;/a&gt;&lt;/p&gt;&lt;p class=&quot;break&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p class=&quot;break&quot;&gt;&lt;a onclick=&quot;_gaq.push([&#039;_trackPageview&#039;, &#039;/extlink/suntsu.smugmug.com/Public/stuff/1-MySmug/20799797_MqT9hp#!i=1677818140&amp;amp;k=XLx3Gw7&amp;amp;lb=1&amp;amp;s=A&#039;]);&quot;  href=&quot;http://suntsu.smugmug.com/Public/stuff/1-MySmug/20799797_MqT9hp#!i=1677818140&amp;k=XLx3Gw7&amp;lb=1&amp;s=A&quot; title=&quot;&quot;&gt;&lt;img src=&quot;http://suntsu.smugmug.com/Public/stuff/1-MySmug/i-XLx3Gw7/0/M/5-M.png&quot; title=&quot;&quot; alt=&quot;&quot;&gt;&lt;/a&gt;&lt;/p&gt;&lt;p class=&quot;break&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p class=&quot;break&quot;&gt;&lt;a onclick=&quot;_gaq.push([&#039;_trackPageview&#039;, &#039;/extlink/suntsu.smugmug.com/Public/stuff/1-MySmug/20799797_MqT9hp#!i=1677818145&amp;amp;k=k8trGSb&amp;amp;lb=1&amp;amp;s=A&#039;]);&quot;  href=&quot;http://suntsu.smugmug.com/Public/stuff/1-MySmug/20799797_MqT9hp#!i=1677818145&amp;k=k8trGSb&amp;lb=1&amp;s=A&quot; title=&quot;&quot;&gt;&lt;img src=&quot;http://suntsu.smugmug.com/Public/stuff/1-MySmug/i-k8trGSb/0/M/6-M.png&quot; title=&quot;&quot; alt=&quot;&quot;&gt;&lt;/a&gt;&lt;/p&gt;&lt;p class=&quot;break&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p class=&quot;break&quot;&gt;&lt;a onclick=&quot;_gaq.push([&#039;_trackPageview&#039;, &#039;/extlink/suntsu.smugmug.com/Public/stuff/1-MySmug/20799797_MqT9hp#!i=1677818149&amp;amp;k=8Nmthjj&amp;amp;lb=1&amp;amp;s=A&#039;]);&quot;  href=&quot;http://suntsu.smugmug.com/Public/stuff/1-MySmug/20799797_MqT9hp#!i=1677818149&amp;k=8Nmthjj&amp;lb=1&amp;s=A&quot; title=&quot;&quot;&gt;&lt;img src=&quot;http://suntsu.smugmug.com/Public/stuff/1-MySmug/i-8Nmthjj/0/M/7-M.png&quot; title=&quot;&quot; alt=&quot;&quot;&gt;&lt;/a&gt;&lt;/p&gt; 
    </content:encoded>

    <pubDate>Sun, 22 Jan 2012 11:04:00 +0100</pubDate>
    <guid isPermaLink="false">http://suntsu.ch/serendipity/index.php?/archives/239-guid.html</guid>
    
</item>
<item>
    <title>Uploading large files to IIS7(asp.net or mvc)</title>
    <link>http://suntsu.ch/serendipity/index.php?/archives/240-Uploading-large-files-to-IIS7asp.net-or-mvc.html</link>
            <category>.net</category>
    
    <comments>http://suntsu.ch/serendipity/index.php?/archives/240-Uploading-large-files-to-IIS7asp.net-or-mvc.html#comments</comments>
    <wfw:comment>http://suntsu.ch/serendipity/wfwcomment.php?cid=240</wfw:comment>

    <slash:comments>0</slash:comments>
    <wfw:commentRss>http://suntsu.ch/serendipity/rss.php?version=2.0&amp;type=comments&amp;cid=240</wfw:commentRss>
    

    <author>nospam@example.com (suntsu)</author>
    <content:encoded>
    &lt;p class=&quot;whiteline&quot;&gt;You can upload files with a size of up to 2GB, but it requires some modifications in your web.config.
&lt;/p&gt;&lt;pre name=&quot;code&quot; class=&quot;brush: xml; ruler: true;&quot; &gt;
&lt;system.web&gt;
    &lt;!-- maxRequestLength Specifies the limit for the input stream buffering threshold, in KB(2097152 ar about 2GB) 
        executionTimeout in seconds(3600==1h)
    --&gt;
    &lt;httpRuntime maxRequestLength=&quot;2097152&quot; executionTimeout=&quot;3600&quot;&gt;&lt;/httpRuntime&gt;
...
&lt;/system.web&gt;
&lt;/pre&gt;&lt;p&gt;
&lt;/p&gt;&lt;pre name=&quot;code&quot; class=&quot;brush: xml; ruler: true;&quot; &gt;
&lt;system.webServer&gt;
    &lt;security&gt;
      &lt;requestFiltering&gt;
        &lt;!-- maxAllowedContentLength, Specifies the maximum length of content in a request, in bytes. (2147483648 bytes are about 2GB)--&gt;
        &lt;requestLimits maxAllowedContentLength=&quot;2147483648&quot; /&gt;
      &lt;/requestFiltering&gt;
    &lt;/security&gt;
...
&lt;/system.webServer&gt;
&lt;/pre&gt; 
    </content:encoded>

    <pubDate>Fri, 20 Jan 2012 13:03:43 +0100</pubDate>
    <guid isPermaLink="false">http://suntsu.ch/serendipity/index.php?/archives/240-guid.html</guid>
    
</item>
<item>
    <title>What to do if OnOrientationChanged is not fired on windows phone 7 emulator?</title>
    <link>http://suntsu.ch/serendipity/index.php?/archives/238-What-to-do-if-OnOrientationChanged-is-not-fired-on-windows-phone-7-emulator.html</link>
            <category>.net</category>
            <category>MySmug</category>
    
    <comments>http://suntsu.ch/serendipity/index.php?/archives/238-What-to-do-if-OnOrientationChanged-is-not-fired-on-windows-phone-7-emulator.html#comments</comments>
    <wfw:comment>http://suntsu.ch/serendipity/wfwcomment.php?cid=238</wfw:comment>

    <slash:comments>0</slash:comments>
    <wfw:commentRss>http://suntsu.ch/serendipity/rss.php?version=2.0&amp;type=comments&amp;cid=238</wfw:commentRss>
    

    <author>nospam@example.com (suntsu)</author>
    <content:encoded>
    &lt;p class=&quot;whiteline&quot;&gt;If you debug your windows phone application, and the OnOrientationChanged event is not fired, just press &lt;strong&gt;Page Up&lt;/strong&gt; or &lt;strong&gt;Page Down&lt;/strong&gt;. Those keys are used to activate/deactivate the phone keyboard. If the phone keyboard is active, the following code will be executed. Strange thing...
&lt;/p&gt;&lt;pre name=&quot;code&quot; class=&quot;brush: csharp; ruler: true;&quot; &gt;
protected override void OnOrientationChanged(OrientationChangedEventArgs e)
{ 
   base.OnOrientationChanged(e);
}
&lt;/pre&gt;&lt;p class=&quot;break&quot;&gt;Found(after some time) on the &lt;a onclick=&quot;_gaq.push([&#039;_trackPageview&#039;, &#039;/extlink/social.msdn.microsoft.com/Forums/en/windowsphone7series/thread/4d454ed6-eba7-4082-87b2-1c986f6836b8&#039;]);&quot;  href=&quot;http://social.msdn.microsoft.com/Forums/en/windowsphone7series/thread/4d454ed6-eba7-4082-87b2-1c986f6836b8&quot;&gt;microsoft forum.&lt;/a&gt;&lt;/p&gt; 
    </content:encoded>

    <pubDate>Wed, 18 Jan 2012 19:27:41 +0100</pubDate>
    <guid isPermaLink="false">http://suntsu.ch/serendipity/index.php?/archives/238-guid.html</guid>
    
</item>
<item>
    <title>Todo for the next version of MySmug</title>
    <link>http://suntsu.ch/serendipity/index.php?/archives/237-Todo-for-the-next-version-of-MySmug.html</link>
            <category>MySmug</category>
    
    <comments>http://suntsu.ch/serendipity/index.php?/archives/237-Todo-for-the-next-version-of-MySmug.html#comments</comments>
    <wfw:comment>http://suntsu.ch/serendipity/wfwcomment.php?cid=237</wfw:comment>

    <slash:comments>0</slash:comments>
    <wfw:commentRss>http://suntsu.ch/serendipity/rss.php?version=2.0&amp;type=comments&amp;cid=237</wfw:commentRss>
    

    <author>nospam@example.com (suntsu)</author>
    <content:encoded>
    &lt;p class=&quot;break&quot;&gt;This is the list of issues/features i have in mind. I&#039;m not sure whether i will solve all of those, or even when. It&#039;s just to keep them in mind. Write me a comment if you have anything in mind which should be changed/fixed.&lt;/p&gt;&lt;ul&gt;
&lt;li&gt;Save single pictures to the phone&lt;/li&gt;
&lt;li&gt;Save album to the phone&lt;/li&gt;
&lt;li&gt;Upload pictures from phone&lt;/li&gt;
&lt;li&gt;Better panning/zooming&lt;/li&gt;
&lt;li&gt;Change the image orientation based on the phone orientation.&lt;/li&gt;
&lt;li&gt;Bing Map integration based on the GPS data .&lt;/li&gt;
&lt;li&gt;Performance optimization(Album data caching)&lt;/li&gt;
&lt;/ul&gt;&lt;p&gt;
&lt;/p&gt;&lt;p class=&quot;break&quot;&gt;&lt;strong&gt;Feature list Version 1.1. In submission process&lt;/strong&gt;&lt;/p&gt;&lt;p class=&quot;break&quot;&gt;This was just a little bugfix release. Submission sent 06.01.2012&lt;/p&gt;&lt;ul&gt;
&lt;li&gt;Bug fix: Album list was loaded more than once after some time.&lt;/li&gt;
&lt;/ul&gt;&lt;p&gt;
&lt;/p&gt;&lt;p class=&quot;break&quot;&gt;&lt;strong&gt;Feature list Version 1.0. Release date: 06.01.2012&lt;/strong&gt;&lt;/p&gt;&lt;ul&gt;
&lt;li&gt;Authentication via oAuth&lt;/li&gt;
&lt;li&gt;Album browsing&lt;/li&gt;
&lt;li&gt;Pictures browsing&lt;/li&gt;
&lt;li&gt;Picture details&lt;/li&gt;
&lt;/ul&gt; 
    </content:encoded>

    <pubDate>Fri, 06 Jan 2012 18:38:00 +0100</pubDate>
    <guid isPermaLink="false">http://suntsu.ch/serendipity/index.php?/archives/237-guid.html</guid>
    
</item>
<item>
    <title>MySmug available on the marketplace</title>
    <link>http://suntsu.ch/serendipity/index.php?/archives/236-MySmug-available-on-the-marketplace.html</link>
            <category>MySmug</category>
    
    <comments>http://suntsu.ch/serendipity/index.php?/archives/236-MySmug-available-on-the-marketplace.html#comments</comments>
    <wfw:comment>http://suntsu.ch/serendipity/wfwcomment.php?cid=236</wfw:comment>

    <slash:comments>0</slash:comments>
    <wfw:commentRss>http://suntsu.ch/serendipity/rss.php?version=2.0&amp;type=comments&amp;cid=236</wfw:commentRss>
    

    <author>nospam@example.com (suntsu)</author>
    <content:encoded>
    &lt;p class=&quot;whiteline&quot;&gt;MySmug went smooth through the submission processs, and now is available at the &lt;strong&gt;&lt;a onclick=&quot;_gaq.push([&#039;_trackPageview&#039;, &#039;/extlink/www.windowsphone.com/en-US/apps/e89ed9fc-9896-4212-9ac0-049a78a345bc&#039;]);&quot;  href=&quot;http://www.windowsphone.com/en-US/apps/e89ed9fc-9896-4212-9ac0-049a78a345bc&quot;&gt;marketplace&lt;/a&gt;&lt;/strong&gt;.
&lt;/p&gt;&lt;p class=&quot;break&quot;&gt;&lt;a onclick=&quot;_gaq.push([&#039;_trackPageview&#039;, &#039;/extlink/suntsu.smugmug.com/Public/suntsublog/20913822_GqzmGz#1661094220_tMCTChs-A-LB&#039;]);&quot;  href=&quot;http://suntsu.smugmug.com/Public/suntsublog/20913822_GqzmGz#1661094220_tMCTChs-A-LB&quot; title=&quot;Photo &amp;amp; Video Sharing by SmugMug&quot;&gt;&lt;img src=&quot;http://suntsu.smugmug.com/photos/i-tMCTChs/0/M/i-tMCTChs-M.jpg&quot; title=&quot;Photo &amp;amp; Video Sharing by SmugMug&quot; alt=&quot;Photo &amp;amp; Video Sharing by SmugMug&quot;&gt;&lt;/a&gt;&lt;/p&gt; 
    </content:encoded>

    <pubDate>Fri, 06 Jan 2012 08:15:14 +0100</pubDate>
    <guid isPermaLink="false">http://suntsu.ch/serendipity/index.php?/archives/236-guid.html</guid>
    <category>mysmug</category>

</item>
<item>
    <title>MySmug version 1.0 submitted</title>
    <link>http://suntsu.ch/serendipity/index.php?/archives/235-MySmug-version-1.0-submitted.html</link>
            <category>MySmug</category>
    
    <comments>http://suntsu.ch/serendipity/index.php?/archives/235-MySmug-version-1.0-submitted.html#comments</comments>
    <wfw:comment>http://suntsu.ch/serendipity/wfwcomment.php?cid=235</wfw:comment>

    <slash:comments>0</slash:comments>
    <wfw:commentRss>http://suntsu.ch/serendipity/rss.php?version=2.0&amp;type=comments&amp;cid=235</wfw:commentRss>
    

    <author>nospam@example.com (suntsu)</author>
    <content:encoded>
    &lt;p class=&quot;break&quot;&gt;I just submitted the very first version of MySmug to the windows phone app hub.&lt;/p&gt;&lt;p class=&quot;break&quot;&gt;I just hope it will be accepted... :)&lt;br /&gt;&lt;/p&gt;&lt;p class=&quot;break&quot;&gt;&lt;a onclick=&quot;_gaq.push([&#039;_trackPageview&#039;, &#039;/extlink/suntsu.smugmug.com/Public/stuff/1-MySmug/20799797_MqT9hp#1650993041_gTnH76G-A-LB&#039;]);&quot;  href=&quot;http://suntsu.smugmug.com/Public/stuff/1-MySmug/20799797_MqT9hp#1650993041_gTnH76G-A-LB&quot; title=&quot;Photo &amp;amp; Video Sharing by SmugMug&quot;&gt;&lt;img src=&quot;http://suntsu.smugmug.com/Public/stuff/1-MySmug/i-gTnH76G/0/M/SplashScreenImage-M.jpg&quot; title=&quot;Photo &amp;amp; Video Sharing by SmugMug&quot; alt=&quot;Photo &amp;amp; Video Sharing by SmugMug&quot;&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;p class=&quot;break&quot;&gt;&lt;a onclick=&quot;_gaq.push([&#039;_trackPageview&#039;, &#039;/extlink/suntsu.smugmug.com/Public/stuff/1-MySmug/20799797_MqT9hp#1650993108_X9nhQHd-A-LB&#039;]);&quot;  href=&quot;http://suntsu.smugmug.com/Public/stuff/1-MySmug/20799797_MqT9hp#1650993108_X9nhQHd-A-LB&quot; title=&quot;&quot;&gt;&lt;img src=&quot;http://suntsu.smugmug.com/Public/stuff/1-MySmug/i-X9nhQHd/0/M/HomeScreen-M.png&quot; title=&quot;&quot; alt=&quot;&quot;&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;p class=&quot;break&quot;&gt;&lt;a onclick=&quot;_gaq.push([&#039;_trackPageview&#039;, &#039;/extlink/suntsu.smugmug.com/Public/stuff/1-MySmug/20799797_MqT9hp#1650993076_Z5dZmWq-A-LB&#039;]);&quot;  href=&quot;http://suntsu.smugmug.com/Public/stuff/1-MySmug/20799797_MqT9hp#1650993076_Z5dZmWq-A-LB&quot; title=&quot;&quot;&gt;&lt;img src=&quot;http://suntsu.smugmug.com/Public/stuff/1-MySmug/i-Z5dZmWq/0/M/Albums-M.png&quot; title=&quot;&quot; alt=&quot;&quot;&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;p class=&quot;break&quot;&gt;&lt;a onclick=&quot;_gaq.push([&#039;_trackPageview&#039;, &#039;/extlink/suntsu.smugmug.com/Public/stuff/1-MySmug/20799797_MqT9hp#1650993063_Q5PM6mZ-A-LB&#039;]);&quot;  href=&quot;http://suntsu.smugmug.com/Public/stuff/1-MySmug/20799797_MqT9hp#1650993063_Q5PM6mZ-A-LB&quot; title=&quot;&quot;&gt;&lt;img src=&quot;http://suntsu.smugmug.com/Public/stuff/1-MySmug/i-Q5PM6mZ/0/M/Photo-M.png&quot; title=&quot;&quot; alt=&quot;&quot;&gt;&lt;/a&gt;&lt;/p&gt; 
    </content:encoded>

    <pubDate>Sat, 31 Dec 2011 23:59:00 +0100</pubDate>
    <guid isPermaLink="false">http://suntsu.ch/serendipity/index.php?/archives/235-guid.html</guid>
    <category>mysmug</category>

</item>
<item>
    <title>Authenticate to smugmug with oAuth and c#</title>
    <link>http://suntsu.ch/serendipity/index.php?/archives/234-Authenticate-to-smugmug-with-oAuth-and-c.html</link>
            <category>MySmug</category>
    
    <comments>http://suntsu.ch/serendipity/index.php?/archives/234-Authenticate-to-smugmug-with-oAuth-and-c.html#comments</comments>
    <wfw:comment>http://suntsu.ch/serendipity/wfwcomment.php?cid=234</wfw:comment>

    <slash:comments>1</slash:comments>
    <wfw:commentRss>http://suntsu.ch/serendipity/rss.php?version=2.0&amp;type=comments&amp;cid=234</wfw:commentRss>
    

    <author>nospam@example.com (suntsu)</author>
    <content:encoded>
    &lt;p class=&quot;break&quot;&gt;Some weeks ago, i tried to create a windows phone 7 &lt;a onclick=&quot;_gaq.push([&#039;_trackPageview&#039;, &#039;/extlink/www.smugmug.com/&#039;]);&quot;  href=&quot;http://www.smugmug.com/&quot;&gt;smugmug&lt;/a&gt; app(photo browser).&lt;/p&gt;&lt;p class=&quot;break&quot;&gt;I had &lt;a onclick=&quot;_gaq.push([&#039;_trackPageview&#039;, &#039;/extlink/www.dgrin.com/showthread.php?t=207148&amp;amp;highlight=oauth&#039;]);&quot;  href=&quot;http://www.dgrin.com/showthread.php?t=207148&amp;highlight=oauth&quot;&gt;some problems&lt;/a&gt; with oAuth at the beginning, &lt;/p&gt;&lt;p class=&quot;whiteline&quot;&gt;First, I tried the g&lt;a onclick=&quot;_gaq.push([&#039;_trackPageview&#039;, &#039;/extlink/oauth.googlecode.com/svn/code/csharp/OAuthBase.cs&#039;]);&quot;  href=&quot;http://oauth.googlecode.com/svn/code/csharp/OAuthBase.cs&quot;&gt;oogle oAuth implementation in c#&lt;/a&gt; with the result that the first request(AcquireRequestToken) worked, but the second request(AcquireAccessToken) failed with an invalid signature. Then i tried to implement it myself with the same result. 
&lt;/p&gt;&lt;p class=&quot;whiteline&quot;&gt;Even with the &lt;a onclick=&quot;_gaq.push([&#039;_trackPageview&#039;, &#039;/extlink/wiki.smugmug.net/display/API/OAuth&#039;]);&quot;  href=&quot;http://wiki.smugmug.net/display/API/OAuth&quot;&gt;smugmug oAuth documentation&lt;/a&gt;, i found it quite hard to get it done. Some parts like the authorize parameters(public/full/read/modify) i had to figure out myself.
&lt;/p&gt;&lt;p class=&quot;break&quot;&gt;After some time, i found an c# oAuth class written for twitter access for &lt;a onclick=&quot;_gaq.push([&#039;_trackPageview&#039;, &#039;/extlink/cropperplugins.codeplex.com/&#039;]);&quot;  href=&quot;http://cropperplugins.codeplex.com/&quot;&gt;cropperplugins.codeplex&lt;/a&gt;. With this code, i was at least able to get a proper AccessToken for smugmug. &lt;/p&gt;&lt;p class=&quot;whiteline&quot;&gt;I&#039;ve written a little demo application if someone else has the same problems.
&lt;/p&gt;&lt;p class=&quot;break&quot;&gt;To get this sample working, you only have to set you apiKey and secret. This sample will do:&lt;/p&gt;&lt;p class=&quot;break&quot;&gt;&lt;strong&gt;1. Get a request token and a request token secret&lt;/p&gt;&lt;p class=&quot;break&quot;&gt;2. Authorize the request token&lt;/p&gt;&lt;p class=&quot;break&quot;&gt;3. With the request token secret, acquire a access token&lt;/p&gt;&lt;p class=&quot;break&quot;&gt;4. This access token and access token secret are used for all further authentication, and should not expire until the user revokes them.&lt;/strong&gt;&lt;/p&gt;&lt;pre name=&quot;code&quot; class=&quot;brush: csharp; ruler: false;&quot; &gt;
        private void AuthenticateSmugmug()
        {
            const string apiKey = &quot;YOUR_API_KEY&quot;;//apikey from your smugmug account
            const string secret = &quot;YOUR_SECRET&quot;;//secret from your smugmug account

            Console.WriteLine(&quot;Create new instance of OAuth Manager&quot;);
            Manager manager = new Manager(apiKey, secret);

            Console.WriteLine(&quot;Aquire a request token from smugmug&quot;);
            OAuthResponse requestToken = manager.AcquireRequestToken(&quot;http://api.smugmug.com/services/oauth/getRequestToken.mg&quot;, &quot;GET&quot;);

            string oauthToken = requestToken[&quot;oauth_token&quot;];
            Console.WriteLine(string.Format(&quot;oauthToken: {0}&quot;, oauthToken));
            string oauthTokenSecret = requestToken[&quot;oauth_token_secret&quot;];
            Console.WriteLine(string.Format(&quot;oauthTokenSecret: {0}&quot;, oauthTokenSecret));

            //Opens your default browser and authorize your request token
            //Parameters: Access=[Public|Full], Permissions=[Read|Add|Modify]
            System.Diagnostics.Process.Start(string.Format(&quot;http://api.smugmug.com/services/oauth/authorize.mg?oauth_token={0}&amp;Access=Full&amp;Permissions=Modify&quot;, oauthToken));

            Console.WriteLine(&quot;Please enter you credentials into the browser before continuing&quot;);
            Console.WriteLine(&quot;Press any key to continue...&quot;);
            Console.ReadLine();
            
            OAuthResponse accessToken = manager.AcquireAccessToken(&quot;http://api.smugmug.com/services/oauth/getAccessToken.mg&quot;, &quot;GET&quot;, oauthTokenSecret);

            Console.WriteLine(string.Format(&quot;accessToken: {0}&quot;, accessToken[&quot;oauth_token&quot;]));
            Console.WriteLine(string.Format(&quot;accessTokenSecret: {0}&quot;, accessToken[&quot;oauth_token_secret&quot;]));
            Console.WriteLine(&quot;Press any key to quit the application&quot;);
            Console.ReadLine();
        }
&lt;/pre&gt;&lt;p&gt;
&lt;/p&gt;&lt;p class=&quot;break&quot;&gt;This is the complete source code for the oAuth sample. It&#039;s c# written in Visual Studio 10:&lt;/p&gt;&lt;p class=&quot;break&quot;&gt;To get this sample working, just enter your Api Key and Secret.&lt;/p&gt;&lt;p class=&quot;whiteline&quot;&gt;&lt;a onclick=&quot;_gaq.push([&#039;_trackPageview&#039;, &#039;/download/serendipity/uploads/SmugmugOAuthSample.zip&#039;]);&quot;  href=&quot;http://suntsu.ch/serendipity/uploads/SmugmugOAuthSample.zip&quot; title=&quot;SmugmugOAuthSample.zip&quot; target=&quot;_blank&quot;&gt;SmugmugOAuthSample.zip&lt;/a&gt;



&lt;/p&gt; 
    </content:encoded>

    <pubDate>Thu, 29 Dec 2011 10:31:04 +0100</pubDate>
    <guid isPermaLink="false">http://suntsu.ch/serendipity/index.php?/archives/234-guid.html</guid>
    <category>mysmug</category>

</item>
<item>
    <title>Powershell script to upgrade several subversion repository</title>
    <link>http://suntsu.ch/serendipity/index.php?/archives/232-Powershell-script-to-upgrade-several-subversion-repository.html</link>
            <category>SVN</category>
    
    <comments>http://suntsu.ch/serendipity/index.php?/archives/232-Powershell-script-to-upgrade-several-subversion-repository.html#comments</comments>
    <wfw:comment>http://suntsu.ch/serendipity/wfwcomment.php?cid=232</wfw:comment>

    <slash:comments>0</slash:comments>
    <wfw:commentRss>http://suntsu.ch/serendipity/rss.php?version=2.0&amp;type=comments&amp;cid=232</wfw:commentRss>
    

    <author>nospam@example.com (suntsu)</author>
    <content:encoded>
    &lt;p class=&quot;break&quot;&gt;This line of powershell script will upgrade all subversion repositories which are located under the same root folder.&lt;/p&gt;&lt;pre name=&quot;code&quot; class=&quot;brush: vb; ruler: false;&quot; &gt;
dir  | Where-Object { $_.PSIsContainer } | ForEach-Object { svnadmin upgrade $_.FullName  }

.
&lt;/pre&gt; 
    </content:encoded>

    <pubDate>Tue, 04 Oct 2011 13:24:12 +0200</pubDate>
    <guid isPermaLink="false">http://suntsu.ch/serendipity/index.php?/archives/232-guid.html</guid>
    <category>svn</category>

</item>
<item>
    <title>Get the current directory from a c# application</title>
    <link>http://suntsu.ch/serendipity/index.php?/archives/231-Get-the-current-directory-from-a-c-application.html</link>
            <category>.net</category>
    
    <comments>http://suntsu.ch/serendipity/index.php?/archives/231-Get-the-current-directory-from-a-c-application.html#comments</comments>
    <wfw:comment>http://suntsu.ch/serendipity/wfwcomment.php?cid=231</wfw:comment>

    <slash:comments>0</slash:comments>
    <wfw:commentRss>http://suntsu.ch/serendipity/rss.php?version=2.0&amp;type=comments&amp;cid=231</wfw:commentRss>
    

    <author>nospam@example.com (suntsu)</author>
    <content:encoded>
    &lt;p class=&quot;break&quot;&gt;Sometimes i have to read/write files from the root directory of my application.&lt;/p&gt;&lt;p class=&quot;break&quot;&gt;Usually i did this with &lt;strong&gt;Environment.CurrentDirectory&lt;/strong&gt;.&lt;/p&gt;&lt;p class=&quot;whiteline&quot;&gt;Unfortunately, this only works if the application is a standalone application(.exe). In case the application is a windows service or a asp.net website, the path from &lt;strong&gt;Environment.CurrentDirectory&lt;/strong&gt; is wrong. 
&lt;/p&gt;&lt;p class=&quot;break&quot;&gt;There are several ways to get the root directory of an application, but so far i found only one which works in all scenarios. &lt;/p&gt;&lt;p class=&quot;break&quot;&gt;&lt;strong&gt;&lt;/p&gt;&lt;p class=&quot;break&quot;&gt;The only one which always works is:&lt;/p&gt;&lt;p class=&quot;break&quot;&gt;&lt;/strong&gt;&lt;/p&gt;&lt;pre name=&quot;code&quot; class=&quot;brush: csharp; ruler: true;&quot; &gt;
//works...
IO.Path.GetDirectoryName(new System.Uri(System.Reflection.Assembly.GetExecutingAssembly().CodeBase).LocalPath)
&lt;/pre&gt;&lt;p&gt;
&lt;/p&gt;&lt;p class=&quot;whiteline&quot;&gt;Here is a (incomplete) list of ways to get the root path of a c# application:
&lt;/p&gt;&lt;p class=&quot;break&quot;&gt;&lt;strong&gt;1. Windows service&lt;/strong&gt;&lt;/p&gt;&lt;pre name=&quot;code&quot; class=&quot;brush: csharp; ruler: true;&quot; &gt;
Environment.CurrentDirectory:
//C:\Windows\system32
System.IO.Path.GetDirectoryName(new System.Uri(System.Reflection.Assembly.GetExecutingAssembly().CodeBase).LocalPath)

//D:\project\WindowsServiceTest\WindowsServiceTest\bin\Debug
AppDomain.CurrentDomain.BaseDirectory:
//D:\project\WindowsServiceTest\WindowsServiceTest\bin\Debug\
Process.GetCurrentProcess().MainModule.FileName.Substring(0, Process.GetCurrentProcess().MainModule.FileName.LastIndexOf(&quot;\\&quot;)):
//D:\project\WindowsServiceTest\WindowsServiceTest\bin\Debug
&lt;/pre&gt;&lt;p class=&quot;break&quot;&gt;&lt;strong&gt;2. Console application&lt;/strong&gt;&lt;/p&gt;&lt;pre name=&quot;code&quot; class=&quot;brush: csharp; ruler: true;&quot; &gt;
Environment.CurrentDirectory:
//D:\project\ConsoleApplication3\ConsoleApplication3\bin\Debug
System.IO.Path.GetDirectoryName(new System.Uri(System.Reflection.Assembly.GetExecutingAssembly().CodeBase).LocalPath):
//D:\project\ConsoleApplication3\ConsoleApplication3\bin\Debug
AppDomain.CurrentDomain.BaseDirectory:
//D:\project\ConsoleApplication3\ConsoleApplication3\bin\Debug\
Process.GetCurrentProcess().MainModule.FileName.Substring(0, Process.GetCurrentProcess().MainModule.FileName.LastIndexOf(&quot;\\&quot;)):
//D:\project\ConsoleApplication3\ConsoleApplication3\bin\Debug
&lt;/pre&gt;&lt;p class=&quot;break&quot;&gt;&lt;strong&gt;3. asp.net mvc3 website vs2010 integrated webserver (Debug mode)&lt;/strong&gt;&lt;/p&gt;&lt;pre name=&quot;code&quot; class=&quot;brush: csharp; ruler: true;&quot; &gt;
Environment.CurrentDirectory:
//C:\Program Files (x86)\Common Files\Microsoft Shared\DevServer\10.0
System.IO.Path.GetDirectoryName(new System.Uri(System.Reflection.Assembly.GetExecutingAssembly().CodeBase).LocalPath):
//D:\project\MvcApplication1\MvcApplication1\bin
AppDomain.CurrentDomain.BaseDirectory:
//D:\project\MvcApplication1\MvcApplication1\
Process.GetCurrentProcess().MainModule.FileName.Substring(0, Process.GetCurrentProcess().MainModule.FileName.LastIndexOf(&quot;\\&quot;)):
//C:\Program Files (x86)\Common Files\Microsoft Shared\DevServer\10.0
&lt;/pre&gt;&lt;p class=&quot;break&quot;&gt;&lt;strong&gt;4. asp.net mvc3 website IIS (Release mode)&lt;/strong&gt;&lt;/p&gt;&lt;pre name=&quot;code&quot; class=&quot;brush: csharp; ruler: true;&quot; &gt;
Environment.CurrentDirectory: 
//c:\windows\system32\inetsrv 
System.IO.Path.GetDirectoryName(new System.Uri(System.Reflection.Assembly.GetExecutingAssembly().CodeBase).LocalPath): 
//d:\project\MvcApplication1\MvcApplication1\bin 
AppDomain.CurrentDomain.BaseDirectory: 
//d:\project\MvcApplication1\MvcApplication1\ 
Process.GetCurrentProcess().MainModule.FileName.Substring(0, Process.GetCurrentProcess().MainModule.FileName.LastIndexOf(&quot;\\&quot;)): 
//c:\windows\system32\inetsrv 
&lt;/pre&gt; 
    </content:encoded>

    <pubDate>Tue, 06 Sep 2011 13:25:40 +0200</pubDate>
    <guid isPermaLink="false">http://suntsu.ch/serendipity/index.php?/archives/231-guid.html</guid>
    <category>.net</category>
<category>c#</category>
<category>visual studio</category>

</item>
<item>
    <title>Too many kindle devices</title>
    <link>http://suntsu.ch/serendipity/index.php?/archives/227-Too-many-kindle-devices.html</link>
            <category>web stuff</category>
    
    <comments>http://suntsu.ch/serendipity/index.php?/archives/227-Too-many-kindle-devices.html#comments</comments>
    <wfw:comment>http://suntsu.ch/serendipity/wfwcomment.php?cid=227</wfw:comment>

    <slash:comments>2</slash:comments>
    <wfw:commentRss>http://suntsu.ch/serendipity/rss.php?version=2.0&amp;type=comments&amp;cid=227</wfw:commentRss>
    

    <author>nospam@example.com (suntsu)</author>
    <content:encoded>
    &lt;p class=&quot;break&quot;&gt;I was just looking for a good java script book on amazon, and wanted to send me a sample to my kindle.&lt;/p&gt;&lt;p class=&quot;break&quot;&gt;Just then, i saw this... &lt;/p&gt;&lt;p class=&quot;whiteline&quot;&gt;&lt;!-- s9ymdb:290 --&gt;&lt;img class=&quot;serendipity_image_center&quot; width=&quot;800&quot; height=&quot;331&quot;  src=&quot;http://suntsu.ch/serendipity/uploads/too_many_devices.png&quot;  alt=&quot;&quot; /&gt;
&lt;/p&gt;&lt;p class=&quot;whiteline&quot;&gt;I guess this means i own too many kindle devices...
&lt;/p&gt;&lt;p class=&quot;break&quot;&gt;btw. Do you know a really good java script book to start with? If yes, let me know...&lt;/p&gt;&lt;p class=&quot;break&quot;&gt;edit: Proud not to have any ISomething in this list... ^^&lt;/p&gt; 
    </content:encoded>

    <pubDate>Mon, 29 Aug 2011 16:22:28 +0200</pubDate>
    <guid isPermaLink="false">http://suntsu.ch/serendipity/index.php?/archives/227-guid.html</guid>
    
</item>
<item>
    <title>c# and vb.net sample to remove eventhandler with reflection</title>
    <link>http://suntsu.ch/serendipity/index.php?/archives/226-c-and-vb.net-sample-to-remove-eventhandler-with-reflection.html</link>
            <category>.net</category>
    
    <comments>http://suntsu.ch/serendipity/index.php?/archives/226-c-and-vb.net-sample-to-remove-eventhandler-with-reflection.html#comments</comments>
    <wfw:comment>http://suntsu.ch/serendipity/wfwcomment.php?cid=226</wfw:comment>

    <slash:comments>0</slash:comments>
    <wfw:commentRss>http://suntsu.ch/serendipity/rss.php?version=2.0&amp;type=comments&amp;cid=226</wfw:commentRss>
    

    <author>nospam@example.com (suntsu)</author>
    <content:encoded>
    &lt;p class=&quot;whiteline&quot;&gt;This is a sample how to remove a (non-public) eventhandler in c# and vb.net.


&lt;/p&gt;&lt;pre name=&quot;code&quot; class=&quot;brush: csharp; ruler: true;&quot; &gt;
//c# sample
using System;
using System.Reflection;
using System.Windows.Forms;

namespace WindowsFormsApplication5
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();

            Form2 form2 = new Form2();
            //remove eventhandler with reflection
            EventInfo ei = form2.GetType().GetEvent(&quot;Load&quot;);
            Delegate d = Delegate.CreateDelegate(typeof(EventHandler), form2, &quot;Form2_Load&quot;, false);
            ei.RemoveEventHandler(form2, d);

            //messagebox is not shown, since the eventhandler for load was removed
            form2.ShowDialog();
        }
    }
}

using System;
using System.Windows.Forms;
namespace WindowsFormsApplication5
{
    public partial class Form2 : Form
    {
        public Form2()
        {
            InitializeComponent();
            this.Load += new EventHandler(Form2_Load);
        }

        void Form2_Load(object sender, EventArgs e)
        {
            MessageBox.Show(&quot;Hello World&quot;);
        }
    }
}
&lt;/pre&gt;&lt;p&gt;
&lt;/p&gt;&lt;pre name=&quot;code&quot; class=&quot;vbnet&quot;&gt;
&#039;vb.net sample
Imports System.Reflection

Public Class Form1
    Private Sub Form1_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load

        Dim myForm As New Form2
        Dim type As Type = GetType(Form2)

        &#039;remove eventhandler with reflection
        Dim eventInfo As EventInfo
        eventInfo = type.GetEvent(&quot;Load&quot;)
        Dim loadHandler As System.Delegate
        loadHandler = System.Delegate.CreateDelegate(GetType(EventHandler), myForm, &quot;Form2_Load&quot;, False)
        eventInfo.RemoveEventHandler(myForm, loadHandler)

        &#039;messagebox is not shown, since the eventhandler for load was removed
        myForm.ShowDialog()

    End Sub
End Class

Public Class Form2
    Private Sub Form2_Load(sender As Object, e As System.EventArgs) Handles Me.Load
        MessageBox.Show(&quot;hello world&quot;)
    End Sub
End Class


&lt;/pre&gt;&lt;p class=&quot;break&quot;&gt;&lt;a onclick=&quot;_gaq.push([&#039;_trackPageview&#039;, &#039;/download/serendipity/uploads/RemoveEventHanlderWithReflection.zip&#039;]);&quot;  href=&quot;http://suntsu.ch/serendipity/uploads/RemoveEventHanlderWithReflection.zip&quot; title=&quot;RemoveEventHanlderWithReflection.zip&quot; target=&quot;_blank&quot;&gt;RemoveEventHanlderWithReflection.zip&lt;/a&gt;&lt;/p&gt; 
    </content:encoded>

    <pubDate>Tue, 10 May 2011 08:15:54 +0200</pubDate>
    <guid isPermaLink="false">http://suntsu.ch/serendipity/index.php?/archives/226-guid.html</guid>
    
</item>
<item>
    <title>Generic c# Json serializer/deserializer sample</title>
    <link>http://suntsu.ch/serendipity/index.php?/archives/219-Generic-c-Json-serializerdeserializer-sample.html</link>
            <category>.net</category>
    
    <comments>http://suntsu.ch/serendipity/index.php?/archives/219-Generic-c-Json-serializerdeserializer-sample.html#comments</comments>
    <wfw:comment>http://suntsu.ch/serendipity/wfwcomment.php?cid=219</wfw:comment>

    <slash:comments>0</slash:comments>
    <wfw:commentRss>http://suntsu.ch/serendipity/rss.php?version=2.0&amp;type=comments&amp;cid=219</wfw:commentRss>
    

    <author>nospam@example.com (suntsu)</author>
    <content:encoded>
    &lt;p class=&quot;break&quot;&gt;&lt;div class=&quot;csharp geshi&quot; style=&quot;text-align: left&quot;&gt;&lt;br /&gt;&lt;span style=&quot;color: #0600FF;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #FF0000;&quot;&gt;class&lt;/span&gt; JsonSerializer&lt;br /&gt;&amp;#160; &amp;#160; &lt;span style=&quot;color: #000000;&quot;&gt;&amp;#123;&lt;/span&gt;&lt;br /&gt;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &lt;span style=&quot;color: #008080; font-style: italic;&quot;&gt;/// &amp;lt;summary&amp;gt;&lt;/span&gt;&lt;br /&gt;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &lt;span style=&quot;color: #008080; font-style: italic;&quot;&gt;/// Serializes a given object into a json string&lt;/span&gt;&lt;br /&gt;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &lt;span style=&quot;color: #008080; font-style: italic;&quot;&gt;/// &amp;lt;/summary&amp;gt;&lt;/span&gt;&lt;br /&gt;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &lt;span style=&quot;color: #008080; font-style: italic;&quot;&gt;/// &amp;lt;typeparam name=&amp;quot;T&amp;quot;&amp;gt;Type to serialize&amp;lt;/typeparam&amp;gt;&lt;/span&gt;&lt;br /&gt;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &lt;span style=&quot;color: #008080; font-style: italic;&quot;&gt;/// &amp;lt;param name=&amp;quot;objectToSerialize&amp;quot;&amp;gt;Object to serialize&amp;lt;/param&amp;gt;&lt;/span&gt;&lt;br /&gt;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &lt;span style=&quot;color: #008080; font-style: italic;&quot;&gt;/// &amp;lt;returns&amp;gt;Serialized Json string of the given object&amp;lt;/returns&amp;gt;&lt;/span&gt;&lt;br /&gt;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &lt;span style=&quot;color: #0600FF;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #0600FF;&quot;&gt;static&lt;/span&gt; &lt;span style=&quot;color: #FF0000;&quot;&gt;string&lt;/span&gt; SerializeToJson&lt;span style=&quot;color: #008000;&quot;&gt;&amp;lt;&lt;/span&gt;T&lt;span style=&quot;color: #008000;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#40;&lt;/span&gt;T objectToSerialize&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#41;&lt;/span&gt; where T &lt;span style=&quot;color: #008000;&quot;&gt;:&lt;/span&gt; &lt;span style=&quot;color: #FF0000;&quot;&gt;class&lt;/span&gt;&lt;br /&gt;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &lt;span style=&quot;color: #000000;&quot;&gt;&amp;#123;&lt;/span&gt;&lt;br /&gt;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &lt;span style=&quot;color: #0600FF;&quot;&gt;if&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#40;&lt;/span&gt;objectToSerialize&lt;span style=&quot;color: #008000;&quot;&gt;==&lt;/span&gt;&lt;span style=&quot;color: #0600FF;&quot;&gt;null&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;br /&gt;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &lt;span style=&quot;color: #000000;&quot;&gt;&amp;#123;&lt;/span&gt;&lt;br /&gt;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &lt;span style=&quot;color: #0600FF;&quot;&gt;throw&lt;/span&gt; &lt;a onclick=&quot;_gaq.push([&#039;_trackPageview&#039;, &#039;/extlink/www.google.com/search?q=new+msdn.microsoft.com&#039;]);&quot;  href=&quot;http://www.google.com/search?q=new+msdn.microsoft.com&quot;&gt;&lt;span style=&quot;color: #008000;&quot;&gt;new&lt;/span&gt;&lt;/a&gt; ArgumentException&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #666666;&quot;&gt;&amp;quot;objectToSerialize must not be null&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #008000;&quot;&gt;;&lt;/span&gt;&lt;br /&gt;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &lt;span style=&quot;color: #000000;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;br /&gt;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; MemoryStream ms &lt;span style=&quot;color: #008000;&quot;&gt;=&lt;/span&gt; null&lt;span style=&quot;color: #008000;&quot;&gt;;&lt;/span&gt;&lt;br /&gt;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &lt;span style=&quot;color: #0600FF;&quot;&gt;try&lt;/span&gt;&lt;br /&gt;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &lt;span style=&quot;color: #000000;&quot;&gt;&amp;#123;&lt;/span&gt;&lt;br /&gt;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; DataContractJsonSerializer serializer &lt;span style=&quot;color: #008000;&quot;&gt;=&lt;/span&gt; &lt;a onclick=&quot;_gaq.push([&#039;_trackPageview&#039;, &#039;/extlink/www.google.com/search?q=new+msdn.microsoft.com&#039;]);&quot;  href=&quot;http://www.google.com/search?q=new+msdn.microsoft.com&quot;&gt;&lt;span style=&quot;color: #008000;&quot;&gt;new&lt;/span&gt;&lt;/a&gt; DataContractJsonSerializer&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#40;&lt;/span&gt;objectToSerialize.&lt;span style=&quot;color: #0000FF;&quot;&gt;GetType&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #008000;&quot;&gt;;&lt;/span&gt;&lt;br /&gt;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; ms &lt;span style=&quot;color: #008000;&quot;&gt;=&lt;/span&gt; &lt;a onclick=&quot;_gaq.push([&#039;_trackPageview&#039;, &#039;/extlink/www.google.com/search?q=new+msdn.microsoft.com&#039;]);&quot;  href=&quot;http://www.google.com/search?q=new+msdn.microsoft.com&quot;&gt;&lt;span style=&quot;color: #008000;&quot;&gt;new&lt;/span&gt;&lt;/a&gt; MemoryStream&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #008000;&quot;&gt;;&lt;/span&gt;&lt;br /&gt;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; serializer.&lt;span style=&quot;color: #0000FF;&quot;&gt;WriteObject&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#40;&lt;/span&gt;ms, objectToSerialize&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #008000;&quot;&gt;;&lt;/span&gt;&lt;br /&gt;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &lt;span style=&quot;color: #0600FF;&quot;&gt;return&lt;/span&gt; Encoding.&lt;span style=&quot;color: #0000FF;&quot;&gt;UTF8&lt;/span&gt;.&lt;span style=&quot;color: #0000FF;&quot;&gt;GetString&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#40;&lt;/span&gt;ms.&lt;span style=&quot;color: #0000FF;&quot;&gt;ToArray&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #008000;&quot;&gt;;&lt;/span&gt;&lt;br /&gt;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &lt;span style=&quot;color: #000000;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;br /&gt;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &lt;span style=&quot;color: #0600FF;&quot;&gt;finally&lt;/span&gt;&lt;br /&gt;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &lt;span style=&quot;color: #000000;&quot;&gt;&amp;#123;&lt;/span&gt;&lt;br /&gt;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &lt;span style=&quot;color: #0600FF;&quot;&gt;if&lt;/span&gt; &lt;span style=&quot;color: #000000;&quot;&gt;&amp;#40;&lt;/span&gt;ms &lt;span style=&quot;color: #008000;&quot;&gt;!=&lt;/span&gt; &lt;span style=&quot;color: #0600FF;&quot;&gt;null&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;br /&gt;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &lt;span style=&quot;color: #000000;&quot;&gt;&amp;#123;&lt;/span&gt;&lt;br /&gt;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; ms.&lt;span style=&quot;color: #0000FF;&quot;&gt;Close&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #008000;&quot;&gt;;&lt;/span&gt;&lt;br /&gt;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &lt;span style=&quot;color: #000000;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;br /&gt;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &lt;span style=&quot;color: #000000;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;br /&gt;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &lt;span style=&quot;color: #000000;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &lt;span style=&quot;color: #008080; font-style: italic;&quot;&gt;/// &amp;lt;summary&amp;gt;&lt;/span&gt;&lt;br /&gt;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &lt;span style=&quot;color: #008080; font-style: italic;&quot;&gt;/// Deserialize a given json string&lt;/span&gt;&lt;br /&gt;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &lt;span style=&quot;color: #008080; font-style: italic;&quot;&gt;/// &amp;lt;/summary&amp;gt;&lt;/span&gt;&lt;br /&gt;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &lt;span style=&quot;color: #008080; font-style: italic;&quot;&gt;/// &amp;lt;typeparam name=&amp;quot;T&amp;quot;&amp;gt;Type to deserialize&amp;lt;/typeparam&amp;gt;&lt;/span&gt;&lt;br /&gt;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &lt;span style=&quot;color: #008080; font-style: italic;&quot;&gt;/// &amp;lt;param name=&amp;quot;jsonStringToDeserialize&amp;quot;&amp;gt;Json String representation&amp;lt;/param&amp;gt;&lt;/span&gt;&lt;br /&gt;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &lt;span style=&quot;color: #008080; font-style: italic;&quot;&gt;/// &amp;lt;returns&amp;gt;Deserialized object&amp;lt;/returns&amp;gt;&lt;/span&gt;&lt;br /&gt;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &lt;span style=&quot;color: #0600FF;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #0600FF;&quot;&gt;static&lt;/span&gt; T DeserializeFromJson&lt;span style=&quot;color: #008000;&quot;&gt;&amp;lt;&lt;/span&gt;T&lt;span style=&quot;color: #008000;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #FF0000;&quot;&gt;string&lt;/span&gt; jsonStringToDeserialize&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#41;&lt;/span&gt; where T &lt;span style=&quot;color: #008000;&quot;&gt;:&lt;/span&gt; &lt;span style=&quot;color: #FF0000;&quot;&gt;class&lt;/span&gt; &lt;br /&gt;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &lt;span style=&quot;color: #000000;&quot;&gt;&amp;#123;&lt;/span&gt;&lt;br /&gt;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &lt;span style=&quot;color: #0600FF;&quot;&gt;if&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #FF0000;&quot;&gt;string&lt;/span&gt;.&lt;span style=&quot;color: #0000FF;&quot;&gt;IsNullOrEmpty&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#40;&lt;/span&gt;jsonStringToDeserialize&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;br /&gt;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &lt;span style=&quot;color: #000000;&quot;&gt;&amp;#123;&lt;/span&gt;&lt;br /&gt;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &lt;span style=&quot;color: #0600FF;&quot;&gt;throw&lt;/span&gt; &lt;a onclick=&quot;_gaq.push([&#039;_trackPageview&#039;, &#039;/extlink/www.google.com/search?q=new+msdn.microsoft.com&#039;]);&quot;  href=&quot;http://www.google.com/search?q=new+msdn.microsoft.com&quot;&gt;&lt;span style=&quot;color: #008000;&quot;&gt;new&lt;/span&gt;&lt;/a&gt; ArgumentException&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #666666;&quot;&gt;&amp;quot;jsonStringToDeserialize must not be null&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #008000;&quot;&gt;;&lt;/span&gt;&lt;br /&gt;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &lt;span style=&quot;color: #000000;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;br /&gt;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; MemoryStream ms &lt;span style=&quot;color: #008000;&quot;&gt;=&lt;/span&gt; null&lt;span style=&quot;color: #008000;&quot;&gt;;&lt;/span&gt;&lt;br /&gt;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &lt;span style=&quot;color: #0600FF;&quot;&gt;try&lt;/span&gt;&lt;br /&gt;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &lt;span style=&quot;color: #000000;&quot;&gt;&amp;#123;&lt;/span&gt;&lt;br /&gt;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; ms &lt;span style=&quot;color: #008000;&quot;&gt;=&lt;/span&gt; &lt;a onclick=&quot;_gaq.push([&#039;_trackPageview&#039;, &#039;/extlink/www.google.com/search?q=new+msdn.microsoft.com&#039;]);&quot;  href=&quot;http://www.google.com/search?q=new+msdn.microsoft.com&quot;&gt;&lt;span style=&quot;color: #008000;&quot;&gt;new&lt;/span&gt;&lt;/a&gt; MemoryStream&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#40;&lt;/span&gt;Encoding.&lt;span style=&quot;color: #0000FF;&quot;&gt;UTF8&lt;/span&gt;.&lt;span style=&quot;color: #0000FF;&quot;&gt;GetBytes&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#40;&lt;/span&gt;jsonStringToDeserialize&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #008000;&quot;&gt;;&lt;/span&gt;&lt;br /&gt;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; DataContractJsonSerializer serializer &lt;span style=&quot;color: #008000;&quot;&gt;=&lt;/span&gt; &lt;a onclick=&quot;_gaq.push([&#039;_trackPageview&#039;, &#039;/extlink/www.google.com/search?q=new+msdn.microsoft.com&#039;]);&quot;  href=&quot;http://www.google.com/search?q=new+msdn.microsoft.com&quot;&gt;&lt;span style=&quot;color: #008000;&quot;&gt;new&lt;/span&gt;&lt;/a&gt; DataContractJsonSerializer&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;a onclick=&quot;_gaq.push([&#039;_trackPageview&#039;, &#039;/extlink/www.google.com/search?q=typeof+msdn.microsoft.com&#039;]);&quot;  href=&quot;http://www.google.com/search?q=typeof+msdn.microsoft.com&quot;&gt;&lt;span style=&quot;color: #008000;&quot;&gt;typeof&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#40;&lt;/span&gt;T&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #008000;&quot;&gt;;&lt;/span&gt;&lt;br /&gt;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &lt;span style=&quot;color: #0600FF;&quot;&gt;return&lt;/span&gt; &lt;span style=&quot;color: #000000;&quot;&gt;&amp;#40;&lt;/span&gt;T&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#41;&lt;/span&gt;serializer.&lt;span style=&quot;color: #0000FF;&quot;&gt;ReadObject&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#40;&lt;/span&gt;ms&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #008000;&quot;&gt;;&lt;/span&gt;&lt;br /&gt;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &lt;span style=&quot;color: #000000;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;br /&gt;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &lt;span style=&quot;color: #0600FF;&quot;&gt;finally&lt;/span&gt;&lt;br /&gt;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &lt;span style=&quot;color: #000000;&quot;&gt;&amp;#123;&lt;/span&gt;&lt;br /&gt;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &lt;span style=&quot;color: #0600FF;&quot;&gt;if&lt;/span&gt; &lt;span style=&quot;color: #000000;&quot;&gt;&amp;#40;&lt;/span&gt;ms &lt;span style=&quot;color: #008000;&quot;&gt;!=&lt;/span&gt; &lt;span style=&quot;color: #0600FF;&quot;&gt;null&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;br /&gt;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; ms.&lt;span style=&quot;color: #0000FF;&quot;&gt;Close&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #008000;&quot;&gt;;&lt;/span&gt;&lt;br /&gt;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &lt;span style=&quot;color: #000000;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;br /&gt;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &lt;span style=&quot;color: #000000;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;br /&gt;&amp;#160; &amp;#160; &lt;span style=&quot;color: #000000;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;br /&gt;&amp;#160;&lt;/div&gt;&lt;/p&gt; 
    </content:encoded>

    <pubDate>Fri, 25 Feb 2011 10:03:41 +0100</pubDate>
    <guid isPermaLink="false">http://suntsu.ch/serendipity/index.php?/archives/219-guid.html</guid>
    <category>.net</category>

</item>
<item>
    <title>MSBuild problem: The type or namespace name 'Linq' does not exist in the namespace 'System' (are you missing an assembly reference?)</title>
    <link>http://suntsu.ch/serendipity/index.php?/archives/220-MSBuild-problem-The-type-or-namespace-name-Linq-does-not-exist-in-the-namespace-System-are-you-missing-an-assembly-reference.html</link>
            <category>.net</category>
    
    <comments>http://suntsu.ch/serendipity/index.php?/archives/220-MSBuild-problem-The-type-or-namespace-name-Linq-does-not-exist-in-the-namespace-System-are-you-missing-an-assembly-reference.html#comments</comments>
    <wfw:comment>http://suntsu.ch/serendipity/wfwcomment.php?cid=220</wfw:comment>

    <slash:comments>3</slash:comments>
    <wfw:commentRss>http://suntsu.ch/serendipity/rss.php?version=2.0&amp;type=comments&amp;cid=220</wfw:commentRss>
    

    <author>nospam@example.com (suntsu)</author>
    <content:encoded>
    &lt;h1&gt;Problem:&lt;/h1&gt;&lt;p&gt;  &lt;p&gt;I tried to build a .net(c#) solution with MSBuild, and got the following error:&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;The type or namespace name &#039;Linq&#039; does not exist in the namespace &#039;System&#039; (are you missing an assembly reference?)&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;Even with a valid using to System.Linq.&lt;/p&gt;  &lt;p&gt;The problem seems to be Visual Studio. It seems Visual Studio implicit adds a reference to System.Core, whereas MSBuild does not.&lt;/p&gt;  &lt;p&gt;The screenshot shows a small solution, which should be built by MSBuild. &lt;/p&gt;  &lt;p&gt;&lt;a   rel=&quot;gb_imageset[greybox_group_entry_220]&quot; href=&quot;http://suntsu.ch/serendipity/uploads/LinqMsbuild1.png&quot;&gt;&lt;img style=&quot;background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px&quot; title=&quot;LinqMsbuild1&quot; border=&quot;0&quot; alt=&quot;LinqMsbuild1&quot; src=&quot;http://suntsu.ch/serendipity/uploads/LinqMsbuild1_thumb.png&quot; width=&quot;640&quot; height=&quot;499&quot; /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;Buildscript used(master.proj):&lt;/p&gt;  &lt;/p&gt;&lt;pre class=&quot;code&quot;&gt;&lt;span style=&quot;color: blue&quot;&gt;&amp;lt;?&lt;/span&gt;&lt;span style=&quot;color: #a31515&quot;&gt;xml &lt;/span&gt;&lt;span style=&quot;color: red&quot;&gt;version&lt;/span&gt;&lt;span style=&quot;color: blue&quot;&gt;=&lt;/span&gt;&amp;quot;&lt;span style=&quot;color: blue&quot;&gt;1.0&lt;/span&gt;&amp;quot; &lt;span style=&quot;color: red&quot;&gt;encoding&lt;/span&gt;&lt;span style=&quot;color: blue&quot;&gt;=&lt;/span&gt;&amp;quot;&lt;span style=&quot;color: blue&quot;&gt;utf-8&lt;/span&gt;&amp;quot;&lt;span style=&quot;color: blue&quot;&gt;?&amp;gt;

&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #a31515&quot;&gt;Project &lt;/span&gt;&lt;span style=&quot;color: red&quot;&gt;xmlns&lt;/span&gt;&lt;span style=&quot;color: blue&quot;&gt;=&lt;/span&gt;&amp;quot;&lt;span style=&quot;color: blue&quot;&gt;http://schemas.microsoft.com/developer/msbuild/2003&lt;/span&gt;&amp;quot;&lt;span style=&quot;color: blue&quot;&gt;&amp;gt;
&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #a31515&quot;&gt;PropertyGroup&lt;/span&gt;&lt;span style=&quot;color: blue&quot;&gt;&amp;gt;
    &amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #a31515&quot;&gt;GenerateResourceNeverLockTypeAssemblies&lt;/span&gt;&lt;span style=&quot;color: blue&quot;&gt;&amp;gt;&lt;/span&gt;true&lt;span style=&quot;color: blue&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: #a31515&quot;&gt;GenerateResourceNeverLockTypeAssemblies&lt;/span&gt;&lt;span style=&quot;color: blue&quot;&gt;&amp;gt;
        &amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #a31515&quot;&gt;TargetType&lt;/span&gt;&lt;span style=&quot;color: blue&quot;&gt;&amp;gt;&lt;/span&gt;Rebuild&lt;span style=&quot;color: blue&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: #a31515&quot;&gt;TargetType&lt;/span&gt;&lt;span style=&quot;color: blue&quot;&gt;&amp;gt;
        &amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #a31515&quot;&gt;ConfigurationType&lt;/span&gt;&lt;span style=&quot;color: blue&quot;&gt;&amp;gt;&lt;/span&gt;Debug&lt;span style=&quot;color: blue&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: #a31515&quot;&gt;ConfigurationType&lt;/span&gt;&lt;span style=&quot;color: blue&quot;&gt;&amp;gt;
    &amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: #a31515&quot;&gt;PropertyGroup&lt;/span&gt;&lt;span style=&quot;color: blue&quot;&gt;&amp;gt;
        &amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #a31515&quot;&gt;Target &lt;/span&gt;&lt;span style=&quot;color: red&quot;&gt;Name&lt;/span&gt;&lt;span style=&quot;color: blue&quot;&gt;=&lt;/span&gt;&amp;quot;&lt;span style=&quot;color: blue&quot;&gt;CompileTest&lt;/span&gt;&amp;quot; &lt;span style=&quot;color: blue&quot;&gt;&amp;gt;
            &amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #a31515&quot;&gt;MSBuild &lt;/span&gt;&lt;span style=&quot;color: red&quot;&gt;Targets&lt;/span&gt;&lt;span style=&quot;color: blue&quot;&gt;=&lt;/span&gt;&amp;quot;&lt;span style=&quot;color: blue&quot;&gt;$(TargetType)&lt;/span&gt;&amp;quot;
                &lt;span style=&quot;color: red&quot;&gt;Properties&lt;/span&gt;&lt;span style=&quot;color: blue&quot;&gt;=&lt;/span&gt;&amp;quot;&lt;span style=&quot;color: blue&quot;&gt;Configuration=$(ConfigurationType)&lt;/span&gt;&amp;quot;
                &lt;span style=&quot;color: red&quot;&gt;Projects&lt;/span&gt;&lt;span style=&quot;color: blue&quot;&gt;=  &lt;/span&gt;&amp;quot;&lt;span style=&quot;color: blue&quot;&gt;D:\project\ConsoleApplication3\ConsoleApplication3.sln&lt;/span&gt;&amp;quot;
            &lt;span style=&quot;color: blue&quot;&gt;/&amp;gt;
    &amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: #a31515&quot;&gt;Target&lt;/span&gt;&lt;span style=&quot;color: blue&quot;&gt;&amp;gt;
&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: #a31515&quot;&gt;Project&lt;/span&gt;&lt;span style=&quot;color: blue&quot;&gt;&amp;gt;

&lt;/p&gt;&lt;pre class=&quot;code&quot;&gt;#Batch to start the build
SET MSBUILD=&amp;quot;C:\WINDOWS\Microsoft.NET\Framework\v3.5\msbuild.exe&amp;quot;
SET LogDll=&amp;quot;c:\windows\Microsoft.Net\Framework\v2.0.50727\Microsoft.Build.Engine.Dll&amp;quot;
%MSBUILD% master.proj /tv:3.5  /target:CompileTest /l:FileLogger,Microsoft.Build.Engine;logfile=MyLog.log;verbosity=q;encoding=utf-8 /P:NOWARN=     
pause

&lt;/pre&gt;&lt;p&gt;&lt;font color=&quot;#000000&quot;&gt;Building this, the following error is shown from MSBuild:&lt;/font&gt;&lt;/span&gt;&lt;/pre&gt;&lt;p&gt;
&lt;/p&gt;&lt;pre class=&quot;code&quot;&gt;&lt;span style=&quot;color: blue&quot;&gt;&lt;a   rel=&quot;gb_imageset[greybox_group_entry_220]&quot; href=&quot;http://suntsu.ch/serendipity/uploads/MSBuildError2.png&quot;&gt;&lt;img style=&quot;background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px&quot; title=&quot;MSBuildError2&quot; border=&quot;0&quot; alt=&quot;MSBuildError2&quot; src=&quot;http://suntsu.ch/serendipity/uploads/MSBuildError2_thumb.png&quot; width=&quot;686&quot; height=&quot;203&quot; /&gt;&lt;/a&gt;&lt;/span&gt;&lt;/pre&gt;&lt;p&gt;
&lt;/p&gt;&lt;h1&gt;Solution:&lt;/h1&gt;&lt;p&gt;
&lt;/p&gt;&lt;p class=&quot;whiteline&quot;&gt;&lt;p&gt;Add via notepad(++) a reference to &lt;strong&gt;System.Core &lt;/strong&gt;directly to the csproj/vbproj file:&lt;/p&gt;
&lt;/p&gt;&lt;p class=&quot;whiteline&quot;&gt;&lt;p&gt;&lt;a   rel=&quot;gb_imageset[greybox_group_entry_220]&quot; href=&quot;http://suntsu.ch/serendipity/uploads/MSBuildError3.png&quot;&gt;&lt;img style=&quot;background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px&quot; title=&quot;MSBuildError3&quot; border=&quot;0&quot; alt=&quot;MSBuildError3&quot; src=&quot;http://suntsu.ch/serendipity/uploads/MSBuildError3_thumb.png&quot; width=&quot;692&quot; height=&quot;373&quot; /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;/p&gt;&lt;p class=&quot;whiteline&quot;&gt;&lt;p&gt;After that, build with MSBuild works fine.&lt;/p&gt;
&lt;/p&gt;&lt;p class=&quot;whiteline&quot;&gt;&lt;p&gt;If anyone has a better solution for this problem, please leave a comment.&lt;/p&gt;
&lt;/p&gt;&lt;p class=&quot;whiteline&quot;&gt;&lt;p&gt;&amp;#160;&lt;/p&gt;
&lt;/p&gt;&lt;p class=&quot;break&quot;&gt;&lt;p&gt;cheers&lt;/p&gt;&lt;/p&gt; 
    </content:encoded>

    <pubDate>Wed, 09 Feb 2011 14:25:55 +0100</pubDate>
    <guid isPermaLink="false">http://suntsu.ch/serendipity/index.php?/archives/220-guid.html</guid>
    <category>MSBuild</category>

</item>
<item>
    <title>Using EnableVSIPLogging to identify menus and commands with VS 2005 + SP1 - Dr. eX's Blog - Site Home - MSDN Blogs</title>
    <link>http://suntsu.ch/serendipity/index.php?/archives/201-Using-EnableVSIPLogging-to-identify-menus-and-commands-with-VS-2005-+-SP1-Dr.-eXs-Blog-Site-Home-MSDN-Blogs.html</link>
    
    <comments>http://suntsu.ch/serendipity/index.php?/archives/201-Using-EnableVSIPLogging-to-identify-menus-and-commands-with-VS-2005-+-SP1-Dr.-eXs-Blog-Site-Home-MSDN-Blogs.html#comments</comments>
    <wfw:comment>http://suntsu.ch/serendipity/wfwcomment.php?cid=201</wfw:comment>

    <slash:comments>0</slash:comments>
    <wfw:commentRss>http://suntsu.ch/serendipity/rss.php?version=2.0&amp;type=comments&amp;cid=201</wfw:commentRss>
    

    <author>nospam@example.com (suntsu)</author>
    <content:encoded>
    &lt;p class=&quot;break&quot;&gt;&lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;/p&gt;&lt;blockquote&gt;&lt;p class=&quot;break&quot;&gt;   &lt;/p&gt;&lt;/p&gt;&lt;h5&gt;Using EnableVSIPLogging to identify menus and commands with VS 2005 + SP1&lt;/h5&gt;&lt;p&gt;&lt;p&gt;    &lt;/p&gt;&lt;p class=&quot;break&quot;&gt;&lt;a onclick=&quot;_gaq.push([&#039;_trackPageview&#039;, &#039;/extlink/blogs.msdn.com/members/MSDNArchive/&#039;]);&quot;  href=&quot;http://blogs.msdn.com/members/MSDNArchive/&quot;&gt;&lt;img alt=&quot;&quot; src=&quot;http://blogs.msdn.com/utility/anonymous.gif&quot; /&gt;&lt;/a&gt; &lt;a onclick=&quot;_gaq.push([&#039;_trackPageview&#039;, &#039;/extlink/blogs.msdn.com/members/MSDNArchive/&#039;]);&quot;  href=&quot;http://blogs.msdn.com/members/MSDNArchive/&quot;&gt;MSDNArchive&lt;/a&gt;    &lt;/p&gt;&lt;p class=&quot;break&quot;&gt;17 Apr 2007 3:06 PM     &lt;/p&gt;&lt;/p&gt;&lt;ul&gt;     &lt;li&gt;Comments &lt;a onclick=&quot;_gaq.push([&#039;_trackPageview&#039;, &#039;/extlink/blogs.msdn.com/b/dr._ex/archive/2007/04/17/using-enablevsiplogging-to-identify-menus-and-commands-with-vs-2005-sp1.aspx#comments&#039;]);&quot;  href=&quot;http://blogs.msdn.com/b/dr._ex/archive/2007/04/17/using-enablevsiplogging-to-identify-menus-and-commands-with-vs-2005-sp1.aspx#comments&quot;&gt;4&lt;/a&gt;&lt;/li&gt;   &lt;/ul&gt;&lt;p&gt;&lt;p&gt;    &lt;/p&gt;&lt;p class=&quot;break&quot;&gt;One of the most frequently asked questions related to Visual Studio Package and Add-in development concerns how to add additional menus and commands to a specific dropdown or context menu in the Visual Studio IDE.     &lt;/p&gt;&lt;p class=&quot;break&quot;&gt;Adding the menu or command is the easy part. Add-in developers typically use the &lt;a onclick=&quot;_gaq.push([&#039;_trackPageview&#039;, &#039;/extlink/msdn2.microsoft.com/en-us/library/envdte80.commands2.addnamedcommand2%28VS.80%29.aspx&#039;]);&quot;  href=&quot;http://msdn2.microsoft.com/en-us/library/envdte80.commands2.addnamedcommand2%28VS.80%29.aspx&quot;&gt;Commands2.AddNamedCommand2&lt;/a&gt; and &lt;a onclick=&quot;_gaq.push([&#039;_trackPageview&#039;, &#039;/extlink/msdn2.microsoft.com/en-us/library/envdte.command.addcontrol%28VS.80%29.aspx&#039;]);&quot;  href=&quot;http://msdn2.microsoft.com/en-us/library/envdte.command.addcontrol%28VS.80%29.aspx&quot;&gt;Command.AddControl&lt;/a&gt; methods, and Visual Studio Package developers use a &lt;a onclick=&quot;_gaq.push([&#039;_trackPageview&#039;, &#039;/extlink/msdn2.microsoft.com/en-us/library/bb166229%28VS.80%29.aspx&#039;]);&quot;  href=&quot;http://msdn2.microsoft.com/en-us/library/bb166229%28VS.80%29.aspx&quot;&gt;.CTC resource&lt;/a&gt;. In both instances, the hard part is trying to identify the menu or toolbar you actually want to add a new menu or command to.    &lt;/p&gt;&lt;p class=&quot;break&quot;&gt;&lt;b&gt;The Problem:&lt;/b&gt;    &lt;/p&gt;&lt;p class=&quot;break&quot;&gt;Trying to identify a specific dropdown or popup menu can be a frustrating experience. Historically, add-in developers have resorted to experimenting with Visual Studio macros to try and discover the appropriate CommandBar name in order to successfully extract a specific CommandBar object from the environment&#039;s DTE.CommandBars collection. Similarly, Visual Studio Package developers typically resort to searching the various .H and .CTC files included with the &lt;a onclick=&quot;_gaq.push([&#039;_trackPageview&#039;, &#039;/extlink/www.microsoft.com/downloads/details.aspx?FamilyID=51A5C65B-C020-4E08-8AC0-3EB9C06996F4&amp;amp;amp;displaylang=en&#039;]);&quot;  href=&quot;http://www.microsoft.com/downloads/details.aspx?FamilyID=51A5C65B-C020-4E08-8AC0-3EB9C06996F4&amp;amp;displaylang=en&quot;&gt;Visual Studio SDK&lt;/a&gt;. In both instances, success is not always guaranteed. Especially if the menu or toolbar you were interested in, was implemented by some package or add-in that was developed by a third party, or after the Visual Studio documentation and SDKs were released.    &lt;/p&gt;&lt;p class=&quot;break&quot;&gt;&lt;b&gt;The Solution:&lt;/b&gt;    &lt;/p&gt;&lt;p class=&quot;break&quot;&gt;Visual Studio Package developers know that the various menus, toolbars and commands integrated into the Visual Studio IDE, are identified by a unique &lt;a onclick=&quot;_gaq.push([&#039;_trackPageview&#039;, &#039;/extlink/msdn2.microsoft.com/en-us/library/bb165048%28VS.80%29.aspx&#039;]);&quot;  href=&quot;http://msdn2.microsoft.com/en-us/library/bb165048%28VS.80%29.aspx&quot;&gt;&lt;b&gt;GUID:ID&lt;/b&gt;&lt;/a&gt; pair. However, what they may not be aware of is a new undocumented feature introduced with Visual Studio Service Pack 1, which displays this information on demand.    &lt;/p&gt;&lt;p class=&quot;break&quot;&gt;When the DWORD registry value below is set to 1, CTRL+SHIFT is pressed, and you attempt to display a menu or execute a command, a VSDebug Message dialog will be displayed containing the GUID and ID of that menu or command.    &lt;/p&gt;&lt;p class=&quot;break&quot;&gt;&amp;#160;    &lt;/p&gt;&lt;p class=&quot;break&quot;&gt;&lt;font style=&quot;background-color: #00ff00&quot;&gt;//change the version to the proper vs version&lt;/font&gt;    &lt;/p&gt;&lt;p class=&quot;break&quot;&gt;&amp;#160;    &lt;/p&gt;&lt;p class=&quot;break&quot;&gt;Windows Registry Editor Version 5.00     &lt;br /&gt;[HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\10.0\General]      &lt;br /&gt;&amp;quot;EnableVSIPLogging&amp;quot;=dword:00000001    &lt;/p&gt;&lt;p class=&quot;break&quot;&gt;&lt;i&gt;       &lt;br /&gt;(Hint #1, copy the above into an &quot;EnableVSIPLogging.reg&quot; file. And then dblclick the file to merge this value into the registry)&lt;/i&gt;    &lt;/p&gt;&lt;p class=&quot;break&quot;&gt;For example: Set the above registry value and restart the Visual Studio IDE. Then click on the File menu, press CTRL+SHIFT, then &lt;u&gt;hover&lt;/u&gt; over the File.New menu item. This will result in the following dialog being displayed.    &lt;/p&gt;&lt;p class=&quot;break&quot;&gt;&lt;img title=&quot;File.New Menu Data&quot; alt=&quot;File.New Menu Data&quot; align=&quot;absMiddle&quot; src=&quot;http://blogs.msdn.com/photos/dr_ex/images/2165257/original.aspx&quot; width=&quot;391&quot; height=&quot;251&quot; /&gt;    &lt;/p&gt;&lt;p class=&quot;break&quot;&gt;To display similar data for a specific command (menu item), click on the &quot;Help&quot; menu, press CTRL+SHIFT, and then &lt;u&gt;select&lt;/u&gt; the &quot;About Microsoft Visual Studio&quot; menu item. This will result in the following dialog being displayed.    &lt;/p&gt;&lt;p class=&quot;break&quot;&gt;&lt;i&gt;&lt;img title=&quot;Help.About Command Data&quot; alt=&quot;Help.About Command Data&quot; align=&quot;absMiddle&quot; src=&quot;http://blogs.msdn.com/photos/dr_ex/images/2165260/original.aspx&quot; width=&quot;397&quot; height=&quot;266&quot; /&gt; &lt;/i&gt;    &lt;/p&gt;&lt;p class=&quot;break&quot;&gt;&lt;i&gt;(Hint #2: Use CTRL+C to copy the text in the VSDebug dialog to the clipboard)&lt;/i&gt;    &lt;/p&gt;&lt;p class=&quot;break&quot;&gt;In both instances the Guid and CmdID are the values we are interested in, as this forms the GUID:ID pair that uniquely identifies the command or menu that was to be invoked.    &lt;/p&gt;&lt;p class=&quot;break&quot;&gt;For developers using the Visual Studio Automation model, the GUID:ID of the command can be used with the DTE.ExecuteCommand, and IVsProfferCommands.FindCommandBar methods. Additional details about using IVsProfferCommands.FindCommandBar can be found in the Dr. eX blog entry entitled &amp;quot;&lt;a onclick=&quot;_gaq.push([&#039;_trackPageview&#039;, &#039;/extlink/blogs.msdn.com/dr._ex/archive/2007/04/17/using-ivsproffercommands-to-retrieve-a-visual-studio-commandbar.aspx&#039;]);&quot;  href=&quot;http://blogs.msdn.com/dr._ex/archive/2007/04/17/using-ivsproffercommands-to-retrieve-a-visual-studio-commandbar.aspx&quot;&gt;Using IVsProfferCommands to retrieve a Visual Studio CommandBar&lt;/a&gt;&amp;quot;.    &lt;/p&gt;&lt;p class=&quot;break&quot;&gt;For developers authoring Visual Studio Packages, the GUID:ID pair displayed for command data, can be used to enable, disable, or hide existing commands from their IOleCommandTarget.QueryStatus implementations. And the GUID:ID pair for menu data, can be used to parent new commands, menu groups, and controls onto existing menus, via the .CTC resource.    &lt;/p&gt;&lt;p class=&quot;break&quot;&gt;Note, the &lt;b&gt;GuidID&lt;/b&gt;, &lt;b&gt;Type&lt;/b&gt;, and &lt;b&gt;Flags&lt;/b&gt; are internal fields displayed by the VSDebug Message dialog, and are not relevant outside the Visual Studio development team. The &lt;b&gt;NameLoc&lt;/b&gt; field is the localized name for the menu. The &lt;b&gt;CanonicalName&lt;/b&gt; field is the dotted command name, used in the command window, DTE.ExecuteCommand, and in the KeyBindings dialog. And the &lt;b&gt;LocalizedName&lt;/b&gt; field is the localized canonical name for the command.    &lt;/p&gt;&lt;p class=&quot;break&quot;&gt;Happy Coding,      &lt;br /&gt;Dr. eX    &lt;/p&gt;&lt;/p&gt;&lt;ul&gt;     &lt;li&gt;&lt;a onclick=&quot;_gaq.push([&#039;_trackPageview&#039;, &#039;/extlink/blogs.msdn.com/b/dr._ex/archive/2007/04/17/using-enablevsiplogging-to-identify-menus-and-commands-with-vs-2005-sp1.aspx#comments&#039;]);&quot;  href=&quot;http://blogs.msdn.com/b/dr._ex/archive/2007/04/17/using-enablevsiplogging-to-identify-menus-and-commands-with-vs-2005-sp1.aspx#comments&quot;&gt;4 Comments&lt;/a&gt;&lt;/li&gt;   &lt;/ul&gt;&lt;p&gt;&lt;p&gt;    &lt;/p&gt;&lt;p class=&quot;break&quot;&gt;&lt;a onclick=&quot;_gaq.push([&#039;_trackPageview&#039;, &#039;/extlink/blogs.msdn.com/b/dr._ex/archive/tags/VS+SDK/&#039;]);&quot;  href=&quot;http://blogs.msdn.com/b/dr._ex/archive/tags/VS+SDK/&quot;&gt;VS SDK&lt;/a&gt;, &lt;a onclick=&quot;_gaq.push([&#039;_trackPageview&#039;, &#039;/extlink/blogs.msdn.com/b/dr._ex/archive/tags/Add_2D00_ins/&#039;]);&quot;  href=&quot;http://blogs.msdn.com/b/dr._ex/archive/tags/Add_2D00_ins/&quot;&gt;Add-ins&lt;/a&gt;, &lt;a onclick=&quot;_gaq.push([&#039;_trackPageview&#039;, &#039;/extlink/blogs.msdn.com/b/dr._ex/archive/tags/Macros/&#039;]);&quot;  href=&quot;http://blogs.msdn.com/b/dr._ex/archive/tags/Macros/&quot;&gt;Macros&lt;/a&gt;, &lt;a onclick=&quot;_gaq.push([&#039;_trackPageview&#039;, &#039;/extlink/blogs.msdn.com/b/dr._ex/archive/tags/VSPackages/&#039;]);&quot;  href=&quot;http://blogs.msdn.com/b/dr._ex/archive/tags/VSPackages/&quot;&gt;VSPackages&lt;/a&gt; &lt;/p&gt;&lt;/blockquote&gt;&lt;p&gt;  &lt;p&gt;&lt;a onclick=&quot;_gaq.push([&#039;_trackPageview&#039;, &#039;/extlink/blogs.msdn.com/b/dr._ex/archive/2007/04/17/using-enablevsiplogging-to-identify-menus-and-commands-with-vs-2005-sp1.aspx&#039;]);&quot;  href=&quot;http://blogs.msdn.com/b/dr._ex/archive/2007/04/17/using-enablevsiplogging-to-identify-menus-and-commands-with-vs-2005-sp1.aspx&quot;&gt;Using EnableVSIPLogging to identify menus and commands with VS 2005 + SP1 - Dr. eX&#039;s Blog - Site Home - MSDN Blogs&lt;/a&gt;&lt;/p&gt;&lt;/p&gt; 
    </content:encoded>

    <pubDate>Wed, 13 Oct 2010 13:08:54 +0200</pubDate>
    <guid isPermaLink="false">http://suntsu.ch/serendipity/index.php?/archives/201-guid.html</guid>
    
</item>

</channel>
</rss>
