<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:pingback="http://madskills.com/public/xml/rss/module/pingback/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" version="2.0">
  <channel>
    <title>Matevž Gačnik's Weblog - CLR</title>
    <link>https://www.request-response.com/blog/</link>
    <description>Technology Philanthropy</description>
    <image>
      <url>http://www.request-response.com/blog/images/favicon.jpg</url>
      <title>Matevž Gačnik's Weblog - CLR</title>
      <link>https://www.request-response.com/blog/</link>
    </image>
    <language>en-us</language>
    <copyright>Matevz Gacnik</copyright>
    <lastBuildDate>Thu, 09 Oct 2008 19:42:02 GMT</lastBuildDate>
    <generator>newtelligence dasBlog 2.1.8102.813</generator>
    <managingEditor>matevz.gacnik@gmail.com</managingEditor>
    <webMaster>matevz.gacnik@gmail.com</webMaster>
    <item>
      <trackback:ping>https://www.request-response.com/blog/Trackback.aspx?guid=3e45c176-f86b-4b60-b0a5-9425631e2438</trackback:ping>
      <pingback:server>https://www.request-response.com/blog/pingback.aspx</pingback:server>
      <pingback:target>https://www.request-response.com/blog/PermaLink,guid,3e45c176-f86b-4b60-b0a5-9425631e2438.aspx</pingback:target>
      <dc:creator>Matevz Gacnik</dc:creator>
      <wfw:comment>https://www.request-response.com/blog/CommentView,guid,3e45c176-f86b-4b60-b0a5-9425631e2438.aspx</wfw:comment>
      <wfw:commentRss>https://www.request-response.com/blog/SyndicationService.asmx/GetEntryCommentsRss?guid=3e45c176-f86b-4b60-b0a5-9425631e2438</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
I'm sorry it took a week, but here we go.
</p>
        <p>
This is my exit content from <a href="http://www.bleedingedge.si/">Bleeding Edge 2008</a>.
I'm also posting complete conference contents, just in case.
</p>
        <p>
          <img src="http://www.request-response.com/blog/content/binary/be2008.jpg" />
        </p>
        <p>
Thanks go out to <a href="http://blogs.solidq.com/EN/dzupancic/default.aspx">Dušan</a>, <a href="http://blogs.solidq.com/EN/dsarka/default.aspx">Dejan</a>, <a href="http://www.mihavalencic.com/?p=124">Miha</a>, <a href="http://cs.rthand.com/blogs/blog_with_righthand/archive/2008/10/03/Material-from-my-_2200_Make-ORM-applications-more-secure_2F00_Naredimo-ORM-aplikacije-varnej_6101_e_2200_-presentation.aspx">Miha</a> and <a href="http://www.krneki.net/blog/">Miha</a>.
</p>
        <p>
Downloads:
</p>
        <ul>
          <li>
Middle Tier Design Unleashed: <a href="http://downloads.request-response.com/BleedingEdge2008_MiddleTier.zip">PPT
&amp; Code</a></li>
          <li>
Complete Conference: <a href="http://downloads.request-response.com/BleedingEdge2008.zip">PPT
&amp; Code</a></li>
        </ul>
        <p>
          <font color="#808080" size="1">Remark: PPT in Slovene only. Code international.</font>
        </p>
        <p>
Thank you for attending. Hope to see you next year!
</p>
        <img width="0" height="0" src="https://www.request-response.com/blog/aggbug.ashx?id=3e45c176-f86b-4b60-b0a5-9425631e2438" />
      </body>
      <title>Bleeding Edge 2008: Postback</title>
      <guid isPermaLink="false">https://www.request-response.com/blog/PermaLink,guid,3e45c176-f86b-4b60-b0a5-9425631e2438.aspx</guid>
      <link>https://www.request-response.com/blog/PermaLink,guid,3e45c176-f86b-4b60-b0a5-9425631e2438.aspx</link>
      <pubDate>Thu, 09 Oct 2008 19:42:02 GMT</pubDate>
      <description>&lt;p&gt;
I'm sorry it took a week, but here we go.
&lt;/p&gt;
&lt;p&gt;
This is my exit content from &lt;a href="http://www.bleedingedge.si/"&gt;Bleeding Edge 2008&lt;/a&gt;.
I'm also posting complete conference contents, just in case.
&lt;/p&gt;
&lt;p&gt;
&lt;img src="http://www.request-response.com/blog/content/binary/be2008.jpg"&gt;
&lt;/p&gt;
&lt;p&gt;
Thanks go out to &lt;a href="http://blogs.solidq.com/EN/dzupancic/default.aspx"&gt;Dušan&lt;/a&gt;, &lt;a href="http://blogs.solidq.com/EN/dsarka/default.aspx"&gt;Dejan&lt;/a&gt;, &lt;a href="http://www.mihavalencic.com/?p=124"&gt;Miha&lt;/a&gt;, &lt;a href="http://cs.rthand.com/blogs/blog_with_righthand/archive/2008/10/03/Material-from-my-_2200_Make-ORM-applications-more-secure_2F00_Naredimo-ORM-aplikacije-varnej_6101_e_2200_-presentation.aspx"&gt;Miha&lt;/a&gt; and &lt;a href="http://www.krneki.net/blog/"&gt;Miha&lt;/a&gt;.
&lt;/p&gt;
&lt;p&gt;
Downloads:
&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
Middle Tier Design Unleashed: &lt;a href="http://downloads.request-response.com/BleedingEdge2008_MiddleTier.zip"&gt;PPT
&amp;amp; Code&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
Complete Conference: &lt;a href="http://downloads.request-response.com/BleedingEdge2008.zip"&gt;PPT
&amp;amp; Code&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
&lt;font color=#808080 size=1&gt;Remark: PPT in Slovene only. Code international.&lt;/font&gt;
&lt;/p&gt;
&lt;p&gt;
Thank you for attending. Hope to see you next year!
&lt;/p&gt;
&lt;img width="0" height="0" src="https://www.request-response.com/blog/aggbug.ashx?id=3e45c176-f86b-4b60-b0a5-9425631e2438" /&gt;</description>
      <comments>https://www.request-response.com/blog/CommentView,guid,3e45c176-f86b-4b60-b0a5-9425631e2438.aspx</comments>
      <category>CLR</category>
      <category>Conferences</category>
      <category>Microsoft</category>
      <category>Web Services</category>
      <category>Work</category>
    </item>
    <item>
      <trackback:ping>https://www.request-response.com/blog/Trackback.aspx?guid=634a58b1-13e5-4b7a-b2ac-010965235bcb</trackback:ping>
      <pingback:server>https://www.request-response.com/blog/pingback.aspx</pingback:server>
      <pingback:target>https://www.request-response.com/blog/PermaLink,guid,634a58b1-13e5-4b7a-b2ac-010965235bcb.aspx</pingback:target>
      <dc:creator>Matevz Gacnik</dc:creator>
      <wfw:comment>https://www.request-response.com/blog/CommentView,guid,634a58b1-13e5-4b7a-b2ac-010965235bcb.aspx</wfw:comment>
      <wfw:commentRss>https://www.request-response.com/blog/SyndicationService.asmx/GetEntryCommentsRss?guid=634a58b1-13e5-4b7a-b2ac-010965235bcb</wfw:commentRss>
      <slash:comments>2</slash:comments>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
We talked today, with <a href="http://cs.rthand.com/blogs/blog_with_righthand/">Miha</a>,
a C# <a href="http://en.wikipedia.org/wiki/Yoda">Yoda</a>. Via IM, everything seemed
pointless. Couldn't find a good case for the cause of the following mind experiment:
</p>
        <p>
          <font face="Courier New">using System;<br />
class Tubo<br />
{<br />
  public static void Test() {}<br />
  private void Test() {} <br />
}<br /></font>
          <font size="1">
            <br />
Note: I'm using Miha's syntax in this post.</font>
        </p>
        <p>
We have a <strong>static method</strong> called <font face="Courier New">Test</font> and
an <strong>instance method</strong>, also called <font face="Courier New">Test</font>.
Parameter models of both methods are the same, <em>empty</em>.
</p>
        <p>
Would this compile?
</p>
        <p>
          <em>It does not.</em>
        </p>
        <p>
The question is why and who/what causes this. There is actually <strong>no rationale </strong>behind
not allowing this thing to compile since both, the compiler and the runtime know the
method info upfront.
</p>
        <p>
Since the runtime has all the information it needs, it is strange that this would
not be allowed at compile time. However, a (C#) compiler has to determine whether
you, <strong>the programmer </strong>meant to access a <em>static</em> or an <em>instance</em> method.
</p>
        <p>
          <em>Here lie the dragons.</em>
        </p>
        <p>
It is illegal in most virtual machine based languages to have the same method name
and signature for a static/instance method.
</p>
        <p>
The following is an excerpt from a <a href="http://java.sun.com/docs/books/jls/third_edition/html/classes.html#8.4.2">Java
specification</a>:
</p>
        <blockquote dir="ltr" style="MARGIN-RIGHT: 0px">
          <p>
            <em>8.4.2 Method Signature</em>
          </p>
        </blockquote>
        <blockquote>
          <p>
            <em>Two methods have the <strong>same signature</strong> if they have the same name
and argument types.</em>
          </p>
          <p>
            <em>Two method or constructor declarations M and N have the same argument types if
all of the following conditions hold: </em>
          </p>
          <p>
            <em>
            </em>
          </p>
          <ul>
            <a name="299803">
            </a>
            <li>
              <em>They have the same number of formal parameters (possibly zero) </em>
              <a name="299804">
              </a>
            </li>
            <li>
              <em>They have the same number of type parameters (possibly zero) </em>
              <a name="324473">
              </a>
            </li>
            <li>
              <em>Let &lt;A<sub>1</sub>,...,A<sub>n</sub>&gt; be the formal type parameters of M
and let &lt;B<sub>1</sub>,...,B<sub>n</sub>&gt; be the formal type parameters of N.
After renaming each occurrence of a B<sub>i</sub> in N's type to A<sub>i</sub> the
bounds of corresponding type variables and the argument types of M and N are the same. </em>
            </li>
          </ul>
        </blockquote>
        <p>
Java (and also C#) does not allow two methods with the same name and parameter model
no matter what the access modifier is (public, private, internal, protected ...) and
whether the method is static or instance based.
</p>
        <p>
          <em>Why?</em>
        </p>
        <p>
Simple. <strong>Programmer ambiguity.</strong> There is no technical reason not to
allow it.
</p>
        <p>
Consider the following:
</p>
        <p>
          <font face="Courier New">using System;<br />
class Tubo<br />
{ 
<br />
  public static void Test(); 
<br />
  private void Test(); 
<br />
  public void AmbiguousCaller() { Test(); } 
<br />
}</font>
        </p>
        <p>
What would method <font face="Courier New">AmbiguousCaller</font> call? A static <font face="Courier New">Test</font> or
instance <font face="Courier New">Test</font> method? 
</p>
        <p>
          <em>Can't decide? </em>
        </p>
        <p>
That's why this is not allowed. 
</p>
        <p>
And yes, it would call the instance method if this would be allowed, since statics
in C# <em>should</em> be called using a class name, as in <font face="Courier New">Test.Test()</font>.
Note that the preceding example <em>does not compile</em>. Also note, that
it <em>is legal</em> to have a <font face="Courier New">AmbiguousCaller</font> body
as <font face="Courier New">Test()</font> or <font face="Courier New">Tubo.Test()</font>.
</p>
        <p>
There is another ambiguous reason. Local variables in C# <strong>cannot</strong> be
named <em>the same as the enclosing class</em>. Therefore, this is illegal:
</p>
        <p>
          <font face="Courier New">using System;<br />
class Tubo<br />
{<br />
  private int Tubo;<br />
}</font>
        </p>
        <p>
It is. Do a <font face="Courier New">csc /t:library</font> on it.
</p>
        <p>
Since you confirmed this fact, consider the following:
</p>
        <p>
          <font face="Courier New">using System;<br />
public class Tubo<br />
{ 
<br />
  public static void StaticMethod() {} 
<br />
  public void InstanceMethod() {} 
<br />
}</font>
        </p>
        <p>
          <font face="Courier New">public class RunMe<br />
{<br />
  public static void Main()<br />
  { 
<br />
    Tubo Tubo = new Tubo();<br />
    Tubo.InstanceMethod();<br />
    Tubo.StaticMethod();<br />
  }<br />
}</font>
        </p>
        <p>
Focus on the <font face="Courier New">Main</font> method <em>body</em>. In <font face="Courier New">Tubo.InstanceMethod()</font> an
instance method is called and a reference (namely <font face="Courier New">Tubo</font>)
is used. In <font face="Courier New">Tubo.StaticMethod()</font> a static method is
called and <font face="Courier New">Tubo</font> is not an instance reference, but
class name.
</p>
        <p>
It all comes down to <em>programmer ambiguity</em>. Given a chance, I would support
this design decision too.
</p>
        <img width="0" height="0" src="https://www.request-response.com/blog/aggbug.ashx?id=634a58b1-13e5-4b7a-b2ac-010965235bcb" />
      </body>
      <title>On Instance and Static Method Signatures</title>
      <guid isPermaLink="false">https://www.request-response.com/blog/PermaLink,guid,634a58b1-13e5-4b7a-b2ac-010965235bcb.aspx</guid>
      <link>https://www.request-response.com/blog/PermaLink,guid,634a58b1-13e5-4b7a-b2ac-010965235bcb.aspx</link>
      <pubDate>Sat, 03 Nov 2007 21:04:38 GMT</pubDate>
      <description>&lt;p&gt;
We talked today, with &lt;a href="http://cs.rthand.com/blogs/blog_with_righthand/"&gt;Miha&lt;/a&gt;,
a C# &lt;a href="http://en.wikipedia.org/wiki/Yoda"&gt;Yoda&lt;/a&gt;. Via IM, everything seemed
pointless. Couldn't find a good case for the cause of the following mind experiment:
&lt;/p&gt;
&lt;p&gt;
&lt;font face="Courier New"&gt;using System;&lt;br&gt;
class Tubo&lt;br&gt;
{&lt;br&gt;
&amp;nbsp; public static void Test() {}&lt;br&gt;
&amp;nbsp; private void Test() {}&amp;nbsp;&lt;br&gt;
}&lt;br&gt;
&lt;/font&gt;&lt;font size=1&gt;
&lt;br&gt;
Note: I'm using Miha's syntax in this post.&lt;/font&gt;
&lt;/p&gt;
&lt;p&gt;
We have a &lt;strong&gt;static method&lt;/strong&gt; called &lt;font face="Courier New"&gt;Test&lt;/font&gt; and
an &lt;strong&gt;instance method&lt;/strong&gt;, also called &lt;font face="Courier New"&gt;Test&lt;/font&gt;.
Parameter models of both methods&amp;nbsp;are the same, &lt;em&gt;empty&lt;/em&gt;.
&lt;/p&gt;
&lt;p&gt;
Would this compile?
&lt;/p&gt;
&lt;p&gt;
&lt;em&gt;It does not.&lt;/em&gt;
&lt;/p&gt;
&lt;p&gt;
The question is why and who/what causes this. There is actually &lt;strong&gt;no rationale &lt;/strong&gt;behind
not allowing this thing to compile since both, the compiler and the runtime know the
method info upfront.
&lt;/p&gt;
&lt;p&gt;
Since the runtime has all the information it needs, it is strange that this would
not be allowed at compile time. However, a (C#) compiler has to determine whether
you, &lt;strong&gt;the programmer &lt;/strong&gt;meant to access a &lt;em&gt;static&lt;/em&gt; or an&amp;nbsp;&lt;em&gt;instance&lt;/em&gt; method.
&lt;/p&gt;
&lt;p&gt;
&lt;em&gt;Here lie the dragons.&lt;/em&gt;
&lt;/p&gt;
&lt;p&gt;
It is illegal in most virtual machine based languages to have the same method name
and signature for a static/instance method.
&lt;/p&gt;
&lt;p&gt;
The following is an excerpt from a &lt;a href="http://java.sun.com/docs/books/jls/third_edition/html/classes.html#8.4.2"&gt;Java
specification&lt;/a&gt;:
&lt;/p&gt;
&lt;blockquote dir=ltr style="MARGIN-RIGHT: 0px"&gt; 
&lt;p&gt;
&lt;em&gt;8.4.2 Method Signature&lt;/em&gt;
&lt;/p&gt;
&lt;/blockquote&gt; &lt;blockquote&gt; 
&lt;p&gt;
&lt;em&gt;Two methods have the &lt;strong&gt;same signature&lt;/strong&gt; if they have the same name
and argument types.&lt;/em&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;em&gt;Two method or constructor declarations M and N have the same argument types if
all of the following conditions hold: &lt;/em&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;em&gt;&lt;/em&gt; 
&lt;ul&gt;
&lt;a name=299803&gt;&lt;/a&gt; 
&lt;li&gt;
&lt;em&gt;They have the same number of formal parameters (possibly zero) &lt;/em&gt;&lt;a name=299804&gt;&lt;/a&gt; 
&lt;li&gt;
&lt;em&gt;They have the same number of type parameters (possibly zero) &lt;/em&gt;&lt;a name=324473&gt;&lt;/a&gt; 
&lt;li&gt;
&lt;em&gt;Let &amp;lt;A&lt;sub&gt;1&lt;/sub&gt;,...,A&lt;sub&gt;n&lt;/sub&gt;&amp;gt; be the formal type parameters of M
and let &amp;lt;B&lt;sub&gt;1&lt;/sub&gt;,...,B&lt;sub&gt;n&lt;/sub&gt;&amp;gt; be the formal type parameters of N.
After renaming each occurrence of a B&lt;sub&gt;i&lt;/sub&gt; in N's type to A&lt;sub&gt;i&lt;/sub&gt; the
bounds of corresponding type variables and the argument types of M and N are the same. &lt;/em&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/blockquote&gt; 
&lt;p&gt;
Java (and also C#) does not allow two methods with the same name and parameter model
no matter what the access modifier is (public, private, internal, protected ...) and
whether the method is static or instance based.
&lt;/p&gt;
&lt;p&gt;
&lt;em&gt;Why?&lt;/em&gt; 
&lt;/p&gt;
&lt;p&gt;
Simple. &lt;strong&gt;Programmer ambiguity.&lt;/strong&gt; There is no technical reason not to
allow it.
&lt;/p&gt;
&lt;p&gt;
Consider the following:
&lt;/p&gt;
&lt;p&gt;
&lt;font face="Courier New"&gt;using System;&lt;br&gt;
class Tubo&lt;br&gt;
{ 
&lt;br&gt;
&amp;nbsp; public static void Test(); 
&lt;br&gt;
&amp;nbsp; private void Test(); 
&lt;br&gt;
&amp;nbsp; public void AmbiguousCaller() { Test(); } 
&lt;br&gt;
}&lt;/font&gt;
&lt;/p&gt;
&lt;p&gt;
What would method &lt;font face="Courier New"&gt;AmbiguousCaller&lt;/font&gt; call? A static &lt;font face="Courier New"&gt;Test&lt;/font&gt; or
instance &lt;font face="Courier New"&gt;Test&lt;/font&gt; method? 
&lt;/p&gt;
&lt;p&gt;
&lt;em&gt;Can't decide? &lt;/em&gt;
&lt;/p&gt;
&lt;p&gt;
That's why this is not allowed. 
&lt;/p&gt;
&lt;p&gt;
And yes, it would call the instance method if this would be allowed, since statics
in C# &lt;em&gt;should&lt;/em&gt; be called using a class name, as in &lt;font face="Courier New"&gt;Test.Test()&lt;/font&gt;.
Note that&amp;nbsp;the preceding example&amp;nbsp;&lt;em&gt;does not compile&lt;/em&gt;. Also note, that
it &lt;em&gt;is legal&lt;/em&gt; to&amp;nbsp;have a&amp;nbsp;&lt;font face="Courier New"&gt;AmbiguousCaller&lt;/font&gt;&amp;nbsp;body
as &lt;font face="Courier New"&gt;Test()&lt;/font&gt; or &lt;font face="Courier New"&gt;Tubo.Test()&lt;/font&gt;.
&lt;/p&gt;
&lt;p&gt;
There is another ambiguous reason. Local variables in C# &lt;strong&gt;cannot&lt;/strong&gt; be
named &lt;em&gt;the same as the enclosing class&lt;/em&gt;. Therefore, this is illegal:
&lt;/p&gt;
&lt;p&gt;
&lt;font face="Courier New"&gt;using System;&lt;br&gt;
class Tubo&lt;br&gt;
{&lt;br&gt;
&amp;nbsp; private int Tubo;&lt;br&gt;
}&lt;/font&gt;
&lt;/p&gt;
&lt;p&gt;
It is. Do a &lt;font face="Courier New"&gt;csc /t:library&lt;/font&gt; on it.
&lt;/p&gt;
&lt;p&gt;
Since you confirmed this fact,&amp;nbsp;consider the following:
&lt;/p&gt;
&lt;p&gt;
&lt;font face="Courier New"&gt;using System;&lt;br&gt;
public class Tubo&lt;br&gt;
{ 
&lt;br&gt;
&amp;nbsp; public static void StaticMethod() {} 
&lt;br&gt;
&amp;nbsp; public void InstanceMethod() {} 
&lt;br&gt;
}&lt;/font&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;font face="Courier New"&gt;public class RunMe&lt;br&gt;
{&lt;br&gt;
&amp;nbsp; public static void Main()&lt;br&gt;
&amp;nbsp; { 
&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; Tubo Tubo = new Tubo();&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; Tubo.InstanceMethod();&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; Tubo.StaticMethod();&lt;br&gt;
&amp;nbsp; }&lt;br&gt;
}&lt;/font&gt;
&lt;/p&gt;
&lt;p&gt;
Focus on the &lt;font face="Courier New"&gt;Main&lt;/font&gt; method &lt;em&gt;body&lt;/em&gt;. In &lt;font face="Courier New"&gt;Tubo.InstanceMethod()&lt;/font&gt; an
instance method is called and a reference&amp;nbsp;(namely &lt;font face="Courier New"&gt;Tubo&lt;/font&gt;)
is used. In &lt;font face="Courier New"&gt;Tubo.StaticMethod()&lt;/font&gt; a static method is
called and &lt;font face="Courier New"&gt;Tubo&lt;/font&gt; is not an instance reference, but
class name.
&lt;/p&gt;
&lt;p&gt;
It all comes down to &lt;em&gt;programmer ambiguity&lt;/em&gt;. Given a chance, I would support
this design decision too.
&lt;/p&gt;
&lt;img width="0" height="0" src="https://www.request-response.com/blog/aggbug.ashx?id=634a58b1-13e5-4b7a-b2ac-010965235bcb" /&gt;</description>
      <comments>https://www.request-response.com/blog/CommentView,guid,634a58b1-13e5-4b7a-b2ac-010965235bcb.aspx</comments>
      <category>CLR</category>
    </item>
    <item>
      <trackback:ping>https://www.request-response.com/blog/Trackback.aspx?guid=26149053-63bc-495e-bab0-8d14e7e46190</trackback:ping>
      <pingback:server>https://www.request-response.com/blog/pingback.aspx</pingback:server>
      <pingback:target>https://www.request-response.com/blog/PermaLink,guid,26149053-63bc-495e-bab0-8d14e7e46190.aspx</pingback:target>
      <dc:creator>Matevz Gacnik</dc:creator>
      <wfw:comment>https://www.request-response.com/blog/CommentView,guid,26149053-63bc-495e-bab0-8d14e7e46190.aspx</wfw:comment>
      <wfw:commentRss>https://www.request-response.com/blog/SyndicationService.asmx/GetEntryCommentsRss?guid=26149053-63bc-495e-bab0-8d14e7e46190</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
If you use <font face="Courier New">XmlSerializer</font> type to perform serialization
of documents which are digitally signed later on, you should be <strong>careful</strong>.
</p>
        <p>
XML namespaces which are included in the serialized form could cause trouble for anyone
signing the document after serialization, especially in the case of normalized signature
checks.
</p>
        <p>
Let's go step by step.
</p>
        <p>
Suppose we have this simple schema, let's call it <font face="Courier New">problem.xsd</font>:
</p>
        <p>
          <font face="Courier New">&lt;?xml version="1.0" encoding="utf-8"?&gt;<br />
&lt;xs:schema targetNamespace="</font>
          <font face="Courier New">http://www.gama-system.com/problems.xsd</font>
          <font face="Courier New">" 
<br />
           elementFormDefault="qualified"<br />
           xmlns="</font>
          <font face="Courier New">http://www.gama-system.com/problems.xsd</font>
          <font face="Courier New">"<br />
           xmlns:xs="</font>
          <font face="Courier New">http://www.w3.org/2001/XMLSchema</font>
          <font face="Courier New">"&gt;<br />
  &lt;xs:element name="Problem" type="ProblemType"/&gt;<br />
  &lt;xs:complexType name="<font color="#a52a2a">ProblemType</font>"&gt;<br />
    &lt;xs:sequence&gt;<br />
      &lt;xs:element name="Name" type="xs:string" /&gt;<br />
      &lt;xs:element name="Severity" type="xs:int" /&gt;<br />
      &lt;xs:element name="Definition" type="DefinitionType"/&gt;<br />
      &lt;xs:element name="Description" type="xs:string"
/&gt;<br />
    &lt;/xs:sequence&gt;<br />
  &lt;/xs:complexType&gt;<br />
  &lt;xs:complexType name="<font color="#a52a2a">DefinitionType</font>"&gt;<br />
    &lt;xs:simpleContent&gt;<br />
      &lt;xs:extension base="xs:base64Binary"&gt;<br />
        &lt;xs:attribute name="Id" type="GUIDType"
use="required"/&gt;<br />
      &lt;/xs:extension&gt;<br />
    &lt;/xs:simpleContent&gt;<br />
  &lt;/xs:complexType&gt;<br />
  &lt;xs:simpleType name="<font color="#a52a2a">GUIDType</font>"&gt;<br />
    &lt;xs:restriction base="xs:string"&gt;<br />
      &lt;xs:pattern value="Id-[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-<br />
                        
[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}"/&gt;<br />
    &lt;/xs:restriction&gt;<br />
  &lt;/xs:simpleType&gt;<br />
&lt;/xs:schema&gt;</font>
        </p>
        <p>
This schema describes <em>a problem</em>, which is defined by a <strong>name</strong> (typed
as <font face="Courier New">string</font>), <strong>severity</strong> (typed as <font face="Courier New">integer</font>), <strong>definition</strong> (typed
as <font face="Courier New">byte array</font>) and <strong>description</strong> (typed
as <font face="Courier New">string</font>). The schema also says that the definition
of a problem has an <font face="Courier New">Id</font> attribute, which we will use
when digitally signing a specific problem definition. This <font face="Courier New">Id</font> attribute
is defined as GUID, as the simple type <font face="Courier New">GUIDType</font> defines.
</p>
        <p>
Instance documents validating against this schema would look like this:
</p>
        <p>
          <font face="Courier New">&lt;?xml version="1.0"?&gt;<br />
&lt;Problem xmlns="</font>
          <font face="Courier New">http://www.gama-system.com/problems.xsd</font>
          <font face="Courier New">"&gt;<br />
  &lt;Name&gt;Specific problem&lt;/Name&gt;<br />
  &lt;Severity&gt;4&lt;/Severity&gt;<br />
  &lt;Definition Id="c31dd112-dd42-41da-c11d-33ff7d2112s2"&gt;MD1sDQ8=&lt;/Definition&gt;<br />
  &lt;Description&gt;This is a specific problem.&lt;/Description&gt;<br />
&lt;/Problem&gt;</font>
        </p>
        <p>
Or this:
</p>
        <p>
          <font face="Courier New">&lt;?xml version="1.0"?&gt;<br />
&lt;Problem xmlns="http://www.gama-system.com/problems.xsd"&gt;<br />
  &lt;Name&gt;XML DigSig Problem&lt;/Name&gt;<br />
  &lt;Severity&gt;5&lt;/Severity&gt;<br />
  &lt;Definition Id="b01cb152-cf93-48df-b07e-97ea7f2ec2e9"&gt;CgsMDQ8=&lt;/Definition&gt;<br />
  &lt;Description&gt;Ambient namespaces break digsigs.&lt;/Description&gt;<br />
&lt;/Problem&gt;</font>
        </p>
        <p>
Mark this one as <strong>exhibit A</strong>.
</p>
        <p>
Only a few of you out there are still generating XML documents by hand, since there
exists a notion of schema compilers. In the .NET Framework world, there is <font face="Courier New">xsd.exe</font>,
which bridges the gap between the XML type system and the CLR type system.
</p>
        <p>
          <font face="Courier New">xsd.exe /c problem.xsd</font>
        </p>
        <p>
The tool compiles <font face="Courier New">problem.xsd</font> schema into the CLR
type system. This allows you to use in-schema defined classes and serialize them later
on with the <font face="Courier New">XmlSerializer</font> class. The second instance
document (exhibit A) serialization program would look like this:
</p>
        <p>
          <font face="Courier New">// generate problem<br />
ProblemType problem = new ProblemType();<br />
problem.Name = "XML DigSig Problem";<br />
problem.Severity = 5;<br />
DefinitionType dt = new DefinitionType();<br />
dt.Id = Guid.NewGuid().ToString();<br />
dt.Value = new byte[] { 0xa, 0xb, 0xc, 0xd, 0xf };<br />
problem.Definition = dt;<br />
problem.Description = "Ambient namespaces break digsigs.";</font>
        </p>
        <p>
          <font face="Courier New">// serialize problem<br />
XmlSerializer ser = new XmlSerializer(typeof(ProblemType));<br />
FileStream stream = new FileStream("Problem.xml", FileMode.Create, FileAccess.Write);<br />
ser.Serialize(stream, problem);<br />
stream.Close();<br /></font>            
<br />
Here <strong>lie </strong>the dragons.
</p>
        <p>
          <font face="Courier New">XmlSerializer</font> class default serialization mechanism
would output this:
</p>
        <p>
          <font face="Courier New">&lt;?xml version="1.0"?&gt;<br />
&lt;Problem <font color="#a52a2a">xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"</font><br />
         <font color="#a52a2a">xmlns:xsd="http://www.w3.org/2001/XMLSchema"<br /></font><font color="#000000">         xmlns="http://www.gama-system.com/problems.xsd"&gt;</font><br />
  &lt;Name&gt;XML DigSig Problem&lt;/Name&gt;<br />
  &lt;Severity&gt;5&lt;/Severity&gt;<br />
  &lt;Definition Id="b01cb152-cf93-48df-b07e-97ea7f2ec2e9"&gt;CgsMDQ8=&lt;/Definition&gt;<br />
  &lt;Description&gt;Ambient namespaces break digsigs.&lt;/Description&gt;<br />
&lt;/Problem&gt;</font>
        </p>
        <p>
Mark this one as <strong>exhibit B</strong>.
</p>
        <p>
If you look closely, you will notice two additional prefix namespace declarations
in exhibit B bound to <font face="Courier New">xsi</font> and <font face="Courier New">xsd</font> prefixes,
against exhibit A.
</p>
        <p>
The fact is, that both documents (exhibit B, and exhibit A) are valid against the <font face="Courier New">problem.xsd</font> schema.
</p>
        <p dir="ltr" style="MARGIN-RIGHT: 0px">
          <font face="Courier New">&lt;theory&gt;</font>
        </p>
        <blockquote dir="ltr" style="MARGIN-RIGHT: 0px">
          <p dir="ltr" style="MARGIN-RIGHT: 0px">
Prefixed namespaces are part of the <a href="http://www.w3.org/TR/xml-infoset/">XML
Infoset</a>. All XML processing is done on XML Infoset level. Since only declarations
(look at prefixes <font face="Courier New">xsi</font> and <font face="Courier New">xsd</font>)
are made in exhibit B, the document itself is not semantically different from exhibit
A. That stated, instance documents are equivalent and should validate against the
same schema.
</p>
        </blockquote>
        <p dir="ltr" style="MARGIN-RIGHT: 0px">
          <font face="Courier New">&lt;/theory&gt;</font>
        </p>
        <p>
What happens if we sign the <font face="Courier New">Definition</font> element of
exhibit B (<font face="Courier New">XmlSerializer</font> generated, prefixed namespaces
present)?
</p>
        <p>
We get this:
</p>
        <p>
          <font face="Courier New">&lt;?xml version="1.0"?&gt;<br />
&lt;Problem <font color="#a52a2a">xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"</font><br />
         <font color="#a52a2a">xmlns:xsd="http://www.w3.org/2001/XMLSchema"<br /></font><font color="#000000">         xmlns="http://www.gama-system.com/problems.xsd"&gt;</font><br />
  &lt;Name&gt;XML DigSig Problem&lt;/Name&gt;<br />
  &lt;Severity&gt;5&lt;/Severity&gt;<br />
  &lt;Definition <font color="#a52a2a"><strong>Id="b01cb152-cf93-48df-b07e-97ea7f2ec2e9"</strong></font>&gt;CgsMDQ8=&lt;/Definition&gt;<br />
  &lt;Description&gt;Ambient namespaces break digsigs.&lt;/Description&gt;<br /><font color="#000000"><strong>  &lt;Signature xmlns="http://www.w3.org/2000/09/xmldsig#"&gt;<br />
    &lt;SignedInfo&gt;<br />
      &lt;CanonicalizationMethod Algorithm="http://www.w3.org/TR/...20010315"
/&gt;<br />
      &lt;SignatureMethod Algorithm="http://www.w3.org/...rsa-sha1"
/&gt;<br />
      &lt;Reference <font color="#a52a2a">URI="#Id-b01cb152-cf93-48df-b07e-97ea7f2ec2e9"&gt;</font><br />
        &lt;DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"
/&gt;<br />
        &lt;DigestValue&gt;k3gbdFVJEpv4LWJAvvHUZZo/VUQ=&lt;/DigestValue&gt;<br />
      &lt;/Reference&gt;<br />
    &lt;/SignedInfo&gt;<br />
    &lt;SignatureValue&gt;K8f...p14=&lt;/SignatureValue&gt;<br />
    &lt;KeyInfo&gt;<br />
      &lt;KeyValue&gt;<br />
        &lt;RSAKeyValue&gt;<br />
          &lt;Modulus&gt;eVs...rL4=&lt;/Modulus&gt;<br />
          &lt;Exponent&gt;AQAB&lt;/Exponent&gt;<br />
        &lt;/RSAKeyValue&gt;<br />
      &lt;/KeyValue&gt;<br />
      &lt;X509Data&gt;<br />
        &lt;X509Certificate&gt;MIIF...Bw==&lt;/X509Certificate&gt;<br />
      &lt;/X509Data&gt;<br />
    &lt;/KeyInfo&gt;<br />
  &lt;/Signature&gt;</strong><br /></font>&lt;/Problem&gt;</font>
        </p>
        <p>
Let's call this document <strong>exhibit D</strong>.
</p>
        <p>
This document is the same as exhibit B, but has the <font face="Courier New">Definition</font> element
digitally signed. Note the <font face="Courier New">/Problem/Signature/SingedInfo/Reference[@URI]</font> value.
Digital signature is performed only on the <font face="Courier New">Definition</font> element
and not the complete document.
</p>
        <p>
Now, if one would validate the same document without the prefixed namespace declarations,
as in:
</p>
        <p>
          <font face="Courier New">&lt;?xml version="1.0"?&gt;<br />
&lt;Problem xmlns="http://www.gama-system.com/problems.xsd"&gt;<br />
  &lt;Name&gt;XML DigSig Problem&lt;/Name&gt;<br />
  &lt;Severity&gt;5&lt;/Severity&gt;<br />
  &lt;Definition <strong>Id="b01cb152-cf93-48df-b07e-97ea7f2ec2e9"&gt;</strong>CgsMDQ8=&lt;/Definition&gt;<br />
  &lt;Description&gt;Ambient namespaces break digsigs.&lt;/Description&gt;<br /><strong>  &lt;Signature xmlns="http://www.w3.org/2000/09/xmldsig#"&gt;<br />
    ...<br />
  &lt;/Signature&gt;</strong><br />
&lt;/Problem&gt;</font>
        </p>
        <p>
... the signature verification <strong>would fail</strong>. Let's call this document <strong>exhibit
C</strong>.
</p>
        <p>
          <font face="Courier New">&lt;theory&gt;</font>
        </p>
        <blockquote dir="ltr" style="MARGIN-RIGHT: 0px">
          <p>
As said earlier, all XML processing is done on the XML Infoset level. Since ambient
prefixed namespace declarations are visible in all child elements of the declaring
element, exhibits C and D are different. Explicitly, element contexts are different
for element <font face="Courier New">Definition</font>, since exhibit C does not have
ambient declarations present and exhibit D does. The signature verification <strong>fails</strong>.
</p>
        </blockquote>
        <p>
          <font face="Courier New">&lt;/theory&gt;</font>
        </p>
        <p>
Solution?
</p>
        <p>
Much simpler than what's written above. Force <font face="Courier New">XmlSerializer</font> class
to serialize what should be serialized in the first place. We need to declare the
namespace definition of the serialized document and prevent <font face="Courier New">XmlSerializer</font> to
be too smart. The .NET Framework serialization mechanism contains a <font face="Courier New">XmlSerializerNamespaces</font> class
which can be specified during serialization process.
</p>
        <p>
Since we know the only (and by the way, default) namespace of the serialized document,
this makes things work out OK:
</p>
        <p>
          <font face="Courier New">// generate problem<br />
ProblemType problem = new ProblemType();<br />
problem.Name = "XML DigSig Problem";<br />
problem.Severity = 5;<br />
DefinitionType dt = new DefinitionType();<br />
dt.Id = Guid.NewGuid().ToString();<br />
dt.Value = new byte[] { 0xa, 0xb, 0xc, 0xd, 0xf };<br />
problem.Definition = dt;<br />
problem.Description = "Ambient namespaces break digsigs.";</font>
        </p>
        <p>
          <font face="Courier New">// serialize problem<br /><strong><font color="#a52a2a">XmlSerializerNamespaces xsn = new XmlSerializerNamespaces();<br />
xsn.Add(String.Empty, "http://www.gama-system.com/problem.xsd");</font></strong></font>
        </p>
        <p>
          <font face="Courier New">XmlSerializer ser = new XmlSerializer(typeof(ProblemType));<br />
FileStream stream = new FileStream("Problem.xml", FileMode.Create, FileAccess.Write);<br />
ser.Serialize(stream, problem, <strong><font color="#a52a2a">xsn</font></strong>);<br />
stream.Close();</font>
        </p>
        <p>
This will force <font face="Courier New">XmlSerializer</font> to produce a valid document
- with valid XML element contexts, without any ambient namespaces.
</p>
        <p>
The question is, why does <font face="Courier New">XmlSerialzer</font> produce this
namespaces by default? That should be a topic for another post.
</p>
        <img width="0" height="0" src="https://www.request-response.com/blog/aggbug.ashx?id=26149053-63bc-495e-bab0-8d14e7e46190" />
      </body>
      <title>XmlSerializer, Ambient XML Namespaces and Digital Signatures</title>
      <guid isPermaLink="false">https://www.request-response.com/blog/PermaLink,guid,26149053-63bc-495e-bab0-8d14e7e46190.aspx</guid>
      <link>https://www.request-response.com/blog/PermaLink,guid,26149053-63bc-495e-bab0-8d14e7e46190.aspx</link>
      <pubDate>Wed, 19 Sep 2007 20:57:57 GMT</pubDate>
      <description>&lt;p&gt;
If you use &lt;font face="Courier New"&gt;XmlSerializer&lt;/font&gt; type to perform serialization
of documents which are digitally signed later on, you should be &lt;strong&gt;careful&lt;/strong&gt;.
&lt;/p&gt;
&lt;p&gt;
XML namespaces which are included in the serialized form could cause trouble for anyone
signing the document after serialization, especially in the case of normalized signature
checks.
&lt;/p&gt;
&lt;p&gt;
Let's go step by step.
&lt;/p&gt;
&lt;p&gt;
Suppose we have this simple schema, let's call it &lt;font face="Courier New"&gt;problem.xsd&lt;/font&gt;:
&lt;/p&gt;
&lt;p&gt;
&lt;font face="Courier New"&gt;&amp;lt;?xml version="1.0" encoding="utf-8"?&amp;gt;&lt;br&gt;
&amp;lt;xs:schema targetNamespace="&lt;/font&gt;&lt;font face="Courier New"&gt;http://www.gama-system.com/problems.xsd&lt;/font&gt;&lt;font face="Courier New"&gt;" 
&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; elementFormDefault="qualified"&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; xmlns="&lt;/font&gt;&lt;font face="Courier New"&gt;http://www.gama-system.com/problems.xsd&lt;/font&gt;&lt;font face="Courier New"&gt;"&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; xmlns:xs="&lt;/font&gt;&lt;font face="Courier New"&gt;http://www.w3.org/2001/XMLSchema&lt;/font&gt;&lt;font face="Courier New"&gt;"&amp;gt;&lt;br&gt;
&amp;nbsp; &amp;lt;xs:element name="Problem" type="ProblemType"/&amp;gt;&lt;br&gt;
&amp;nbsp; &amp;lt;xs:complexType name="&lt;font color=#a52a2a&gt;ProblemType&lt;/font&gt;"&amp;gt;&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;xs:sequence&amp;gt;&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;xs:element name="Name" type="xs:string" /&amp;gt;&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;xs:element name="Severity" type="xs:int" /&amp;gt;&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;xs:element name="Definition" type="DefinitionType"/&amp;gt;&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;xs:element name="Description" type="xs:string"
/&amp;gt;&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/xs:sequence&amp;gt;&lt;br&gt;
&amp;nbsp; &amp;lt;/xs:complexType&amp;gt;&lt;br&gt;
&amp;nbsp; &amp;lt;xs:complexType name="&lt;font color=#a52a2a&gt;DefinitionType&lt;/font&gt;"&amp;gt;&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;xs:simpleContent&amp;gt;&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;xs:extension base="xs:base64Binary"&amp;gt;&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;xs:attribute name="Id" type="GUIDType"
use="required"/&amp;gt;&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/xs:extension&amp;gt;&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/xs:simpleContent&amp;gt;&lt;br&gt;
&amp;nbsp; &amp;lt;/xs:complexType&amp;gt;&lt;br&gt;
&amp;nbsp; &amp;lt;xs:simpleType name="&lt;font color=#a52a2a&gt;GUIDType&lt;/font&gt;"&amp;gt;&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;xs:restriction base="xs:string"&amp;gt;&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;xs:pattern value="Id-[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-&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;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}"/&amp;gt;&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/xs:restriction&amp;gt;&lt;br&gt;
&amp;nbsp; &amp;lt;/xs:simpleType&amp;gt;&lt;br&gt;
&amp;lt;/xs:schema&amp;gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p&gt;
This schema describes &lt;em&gt;a problem&lt;/em&gt;, which is defined by a &lt;strong&gt;name&lt;/strong&gt; (typed
as &lt;font face="Courier New"&gt;string&lt;/font&gt;), &lt;strong&gt;severity&lt;/strong&gt; (typed as &lt;font face="Courier New"&gt;integer&lt;/font&gt;), &lt;strong&gt;definition&lt;/strong&gt; (typed
as &lt;font face="Courier New"&gt;byte array&lt;/font&gt;) and &lt;strong&gt;description&lt;/strong&gt; (typed
as &lt;font face="Courier New"&gt;string&lt;/font&gt;). The schema also says that the definition
of a problem has an &lt;font face="Courier New"&gt;Id&lt;/font&gt; attribute, which we will use
when digitally signing a specific problem definition. This &lt;font face="Courier New"&gt;Id&lt;/font&gt; attribute
is defined as GUID, as the simple type &lt;font face="Courier New"&gt;GUIDType&lt;/font&gt; defines.
&lt;/p&gt;
&lt;p&gt;
Instance documents validating against this schema would look like this:
&lt;/p&gt;
&lt;p&gt;
&lt;font face="Courier New"&gt;&amp;lt;?xml version="1.0"?&amp;gt;&lt;br&gt;
&amp;lt;Problem xmlns="&lt;/font&gt;&lt;font face="Courier New"&gt;http://www.gama-system.com/problems.xsd&lt;/font&gt;&lt;font face="Courier New"&gt;"&amp;gt;&lt;br&gt;
&amp;nbsp; &amp;lt;Name&amp;gt;Specific problem&amp;lt;/Name&amp;gt;&lt;br&gt;
&amp;nbsp; &amp;lt;Severity&amp;gt;4&amp;lt;/Severity&amp;gt;&lt;br&gt;
&amp;nbsp; &amp;lt;Definition Id="c31dd112-dd42-41da-c11d-33ff7d2112s2"&amp;gt;MD1sDQ8=&amp;lt;/Definition&amp;gt;&lt;br&gt;
&amp;nbsp; &amp;lt;Description&amp;gt;This is a specific problem.&amp;lt;/Description&amp;gt;&lt;br&gt;
&amp;lt;/Problem&amp;gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p&gt;
Or this:
&lt;/p&gt;
&lt;p&gt;
&lt;font face="Courier New"&gt;&amp;lt;?xml version="1.0"?&amp;gt;&lt;br&gt;
&amp;lt;Problem xmlns="http://www.gama-system.com/problems.xsd"&amp;gt;&lt;br&gt;
&amp;nbsp; &amp;lt;Name&amp;gt;XML DigSig Problem&amp;lt;/Name&amp;gt;&lt;br&gt;
&amp;nbsp; &amp;lt;Severity&amp;gt;5&amp;lt;/Severity&amp;gt;&lt;br&gt;
&amp;nbsp; &amp;lt;Definition Id="b01cb152-cf93-48df-b07e-97ea7f2ec2e9"&amp;gt;CgsMDQ8=&amp;lt;/Definition&amp;gt;&lt;br&gt;
&amp;nbsp; &amp;lt;Description&amp;gt;Ambient namespaces break digsigs.&amp;lt;/Description&amp;gt;&lt;br&gt;
&amp;lt;/Problem&amp;gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p&gt;
Mark this one as &lt;strong&gt;exhibit A&lt;/strong&gt;.
&lt;/p&gt;
&lt;p&gt;
Only a few of you out there are still generating XML documents by hand, since there
exists a notion of schema compilers. In the .NET Framework world, there is &lt;font face="Courier New"&gt;xsd.exe&lt;/font&gt;,
which bridges the gap between the XML type system and the CLR type system.
&lt;/p&gt;
&lt;p&gt;
&lt;font face="Courier New"&gt;xsd.exe /c problem.xsd&lt;/font&gt;
&lt;/p&gt;
&lt;p&gt;
The tool compiles &lt;font face="Courier New"&gt;problem.xsd&lt;/font&gt; schema into the CLR
type system. This allows you to use in-schema defined classes and serialize them later
on with the &lt;font face="Courier New"&gt;XmlSerializer&lt;/font&gt; class. The second instance
document (exhibit A) serialization program would look like this:
&lt;/p&gt;
&lt;p&gt;
&lt;font face="Courier New"&gt;// generate problem&lt;br&gt;
ProblemType problem = new ProblemType();&lt;br&gt;
problem.Name = "XML DigSig Problem";&lt;br&gt;
problem.Severity = 5;&lt;br&gt;
DefinitionType dt = new DefinitionType();&lt;br&gt;
dt.Id = Guid.NewGuid().ToString();&lt;br&gt;
dt.Value = new byte[] { 0xa, 0xb, 0xc, 0xd, 0xf };&lt;br&gt;
problem.Definition = dt;&lt;br&gt;
problem.Description = "Ambient namespaces break digsigs.";&lt;/font&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;font face="Courier New"&gt;// serialize problem&lt;br&gt;
XmlSerializer ser = new XmlSerializer(typeof(ProblemType));&lt;br&gt;
FileStream stream = new FileStream("Problem.xml", FileMode.Create, FileAccess.Write);&lt;br&gt;
ser.Serialize(stream, problem);&lt;br&gt;
stream.Close();&lt;br&gt;
&lt;/font&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&lt;br&gt;
Here &lt;strong&gt;lie &lt;/strong&gt;the dragons.
&lt;/p&gt;
&lt;p&gt;
&lt;font face="Courier New"&gt;XmlSerializer&lt;/font&gt; class default serialization mechanism
would output this:
&lt;/p&gt;
&lt;p&gt;
&lt;font face="Courier New"&gt;&amp;lt;?xml version="1.0"?&amp;gt;&lt;br&gt;
&amp;lt;Problem &lt;font color=#a52a2a&gt;xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"&lt;/font&gt;
&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;font color=#a52a2a&gt;xmlns:xsd="http://www.w3.org/2001/XMLSchema"&lt;br&gt;
&lt;/font&gt;&lt;font color=#000000&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; xmlns="http://www.gama-system.com/problems.xsd"&amp;gt;&lt;/font&gt;
&lt;br&gt;
&amp;nbsp; &amp;lt;Name&amp;gt;XML DigSig Problem&amp;lt;/Name&amp;gt;&lt;br&gt;
&amp;nbsp; &amp;lt;Severity&amp;gt;5&amp;lt;/Severity&amp;gt;&lt;br&gt;
&amp;nbsp; &amp;lt;Definition Id="b01cb152-cf93-48df-b07e-97ea7f2ec2e9"&amp;gt;CgsMDQ8=&amp;lt;/Definition&amp;gt;&lt;br&gt;
&amp;nbsp; &amp;lt;Description&amp;gt;Ambient namespaces break digsigs.&amp;lt;/Description&amp;gt;&lt;br&gt;
&amp;lt;/Problem&amp;gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p&gt;
Mark this one as &lt;strong&gt;exhibit B&lt;/strong&gt;.
&lt;/p&gt;
&lt;p&gt;
If you look closely, you will notice two additional prefix namespace declarations
in exhibit B bound to &lt;font face="Courier New"&gt;xsi&lt;/font&gt; and &lt;font face="Courier New"&gt;xsd&lt;/font&gt; prefixes,
against exhibit A.
&lt;/p&gt;
&lt;p&gt;
The fact is, that both documents (exhibit B, and exhibit A) are valid against the &lt;font face="Courier New"&gt;problem.xsd&lt;/font&gt; schema.
&lt;/p&gt;
&lt;p dir=ltr style="MARGIN-RIGHT: 0px"&gt;
&lt;font face="Courier New"&gt;&amp;lt;theory&amp;gt;&lt;/font&gt;
&lt;/p&gt;
&lt;blockquote dir=ltr style="MARGIN-RIGHT: 0px"&gt; 
&lt;p dir=ltr style="MARGIN-RIGHT: 0px"&gt;
Prefixed namespaces are part of the &lt;a href="http://www.w3.org/TR/xml-infoset/"&gt;XML
Infoset&lt;/a&gt;. All XML processing is done on XML Infoset level. Since only declarations
(look at prefixes &lt;font face="Courier New"&gt;xsi&lt;/font&gt; and &lt;font face="Courier New"&gt;xsd&lt;/font&gt;)
are made in exhibit B, the document itself is not semantically different from exhibit
A. That stated, instance documents are equivalent and should validate against the
same schema.
&lt;/p&gt;
&lt;/blockquote&gt; 
&lt;p dir=ltr style="MARGIN-RIGHT: 0px"&gt;
&lt;font face="Courier New"&gt;&amp;lt;/theory&amp;gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p&gt;
What happens if we sign the &lt;font face="Courier New"&gt;Definition&lt;/font&gt; element of
exhibit B (&lt;font face="Courier New"&gt;XmlSerializer&lt;/font&gt; generated, prefixed namespaces
present)?
&lt;/p&gt;
&lt;p&gt;
We get this:
&lt;/p&gt;
&lt;p&gt;
&lt;font face="Courier New"&gt;&amp;lt;?xml version="1.0"?&amp;gt;&lt;br&gt;
&amp;lt;Problem &lt;font color=#a52a2a&gt;xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"&lt;/font&gt;
&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;font color=#a52a2a&gt;xmlns:xsd="http://www.w3.org/2001/XMLSchema"&lt;br&gt;
&lt;/font&gt;&lt;font color=#000000&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; xmlns="http://www.gama-system.com/problems.xsd"&amp;gt;&lt;/font&gt;
&lt;br&gt;
&amp;nbsp; &amp;lt;Name&amp;gt;XML DigSig Problem&amp;lt;/Name&amp;gt;&lt;br&gt;
&amp;nbsp; &amp;lt;Severity&amp;gt;5&amp;lt;/Severity&amp;gt;&lt;br&gt;
&amp;nbsp; &amp;lt;Definition &lt;font color=#a52a2a&gt;&lt;strong&gt;Id="b01cb152-cf93-48df-b07e-97ea7f2ec2e9"&lt;/strong&gt;&lt;/font&gt;&amp;gt;CgsMDQ8=&amp;lt;/Definition&amp;gt;&lt;br&gt;
&amp;nbsp; &amp;lt;Description&amp;gt;Ambient namespaces break digsigs.&amp;lt;/Description&amp;gt;&lt;br&gt;
&lt;font color=#000000&gt;&lt;strong&gt;&amp;nbsp; &amp;lt;Signature xmlns="http://www.w3.org/2000/09/xmldsig#"&amp;gt;&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;SignedInfo&amp;gt;&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;CanonicalizationMethod Algorithm="http://www.w3.org/TR/...20010315"
/&amp;gt;&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;SignatureMethod Algorithm="http://www.w3.org/...rsa-sha1"
/&amp;gt;&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;Reference &lt;font color=#a52a2a&gt;URI="#Id-b01cb152-cf93-48df-b07e-97ea7f2ec2e9"&amp;gt;&lt;/font&gt;
&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"
/&amp;gt;&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;DigestValue&amp;gt;k3gbdFVJEpv4LWJAvvHUZZo/VUQ=&amp;lt;/DigestValue&amp;gt;&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/Reference&amp;gt;&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/SignedInfo&amp;gt;&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;SignatureValue&amp;gt;K8f...p14=&amp;lt;/SignatureValue&amp;gt;&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;KeyInfo&amp;gt;&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;KeyValue&amp;gt;&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;RSAKeyValue&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;Modulus&amp;gt;eVs...rL4=&amp;lt;/Modulus&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;Exponent&amp;gt;AQAB&amp;lt;/Exponent&amp;gt;&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/RSAKeyValue&amp;gt;&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/KeyValue&amp;gt;&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;X509Data&amp;gt;&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;X509Certificate&amp;gt;MIIF...Bw==&amp;lt;/X509Certificate&amp;gt;&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/X509Data&amp;gt;&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/KeyInfo&amp;gt;&lt;br&gt;
&amp;nbsp; &amp;lt;/Signature&amp;gt;&lt;/strong&gt;
&lt;br&gt;
&lt;/font&gt;&amp;lt;/Problem&amp;gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p&gt;
Let's call this document &lt;strong&gt;exhibit D&lt;/strong&gt;.
&lt;/p&gt;
&lt;p&gt;
This document is the same as exhibit B, but has the &lt;font face="Courier New"&gt;Definition&lt;/font&gt; element
digitally signed. Note the &lt;font face="Courier New"&gt;/Problem/Signature/SingedInfo/Reference[@URI]&lt;/font&gt; value.
Digital signature is performed only on the &lt;font face="Courier New"&gt;Definition&lt;/font&gt; element
and not the complete document.
&lt;/p&gt;
&lt;p&gt;
Now, if one would validate the same document without the prefixed namespace declarations,
as in:
&lt;/p&gt;
&lt;p&gt;
&lt;font face="Courier New"&gt;&amp;lt;?xml version="1.0"?&amp;gt;&lt;br&gt;
&amp;lt;Problem xmlns="http://www.gama-system.com/problems.xsd"&amp;gt;&lt;br&gt;
&amp;nbsp; &amp;lt;Name&amp;gt;XML DigSig Problem&amp;lt;/Name&amp;gt;&lt;br&gt;
&amp;nbsp; &amp;lt;Severity&amp;gt;5&amp;lt;/Severity&amp;gt;&lt;br&gt;
&amp;nbsp; &amp;lt;Definition &lt;strong&gt;Id="b01cb152-cf93-48df-b07e-97ea7f2ec2e9"&amp;gt;&lt;/strong&gt;CgsMDQ8=&amp;lt;/Definition&amp;gt;&lt;br&gt;
&amp;nbsp; &amp;lt;Description&amp;gt;Ambient namespaces break digsigs.&amp;lt;/Description&amp;gt;&lt;br&gt;
&lt;strong&gt;&amp;nbsp; &amp;lt;Signature xmlns="http://www.w3.org/2000/09/xmldsig#"&amp;gt;&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; ...&lt;br&gt;
&amp;nbsp; &amp;lt;/Signature&amp;gt;&lt;/strong&gt;
&lt;br&gt;
&amp;lt;/Problem&amp;gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p&gt;
... the signature verification &lt;strong&gt;would fail&lt;/strong&gt;. Let's call this document &lt;strong&gt;exhibit
C&lt;/strong&gt;.
&lt;/p&gt;
&lt;p&gt;
&lt;font face="Courier New"&gt;&amp;lt;theory&amp;gt;&lt;/font&gt;
&lt;/p&gt;
&lt;blockquote dir=ltr style="MARGIN-RIGHT: 0px"&gt; 
&lt;p&gt;
As said earlier, all XML processing is done on the XML Infoset level. Since ambient
prefixed namespace declarations are visible in all child elements of the declaring
element, exhibits C and D are different. Explicitly, element contexts are different
for element &lt;font face="Courier New"&gt;Definition&lt;/font&gt;, since exhibit C does not have
ambient declarations present and exhibit D does. The signature verification &lt;strong&gt;fails&lt;/strong&gt;.
&lt;/p&gt;
&lt;/blockquote&gt; 
&lt;p&gt;
&lt;font face="Courier New"&gt;&amp;lt;/theory&amp;gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p&gt;
Solution?
&lt;/p&gt;
&lt;p&gt;
Much simpler than what's written above. Force &lt;font face="Courier New"&gt;XmlSerializer&lt;/font&gt; class
to serialize what should be serialized in the first place. We need to declare the
namespace definition of the serialized document and prevent &lt;font face="Courier New"&gt;XmlSerializer&lt;/font&gt; to
be too smart. The .NET Framework serialization mechanism contains a &lt;font face="Courier New"&gt;XmlSerializerNamespaces&lt;/font&gt; class
which can be specified during serialization process.
&lt;/p&gt;
&lt;p&gt;
Since we know the only (and by the way, default) namespace of the serialized document,
this makes things work out OK:
&lt;/p&gt;
&lt;p&gt;
&lt;font face="Courier New"&gt;// generate problem&lt;br&gt;
ProblemType problem = new ProblemType();&lt;br&gt;
problem.Name = "XML DigSig Problem";&lt;br&gt;
problem.Severity = 5;&lt;br&gt;
DefinitionType dt = new DefinitionType();&lt;br&gt;
dt.Id = Guid.NewGuid().ToString();&lt;br&gt;
dt.Value = new byte[] { 0xa, 0xb, 0xc, 0xd, 0xf };&lt;br&gt;
problem.Definition = dt;&lt;br&gt;
problem.Description = "Ambient namespaces break digsigs.";&lt;/font&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;font face="Courier New"&gt;// serialize problem&lt;br&gt;
&lt;strong&gt;&lt;font color=#a52a2a&gt;XmlSerializerNamespaces xsn = new XmlSerializerNamespaces();&lt;br&gt;
xsn.Add(String.Empty, "http://www.gama-system.com/problem.xsd");&lt;/font&gt;&lt;/strong&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;font face="Courier New"&gt;XmlSerializer ser = new XmlSerializer(typeof(ProblemType));&lt;br&gt;
FileStream stream = new FileStream("Problem.xml", FileMode.Create, FileAccess.Write);&lt;br&gt;
ser.Serialize(stream, problem, &lt;strong&gt;&lt;font color=#a52a2a&gt;xsn&lt;/font&gt;&lt;/strong&gt;);&lt;br&gt;
stream.Close();&lt;/font&gt;
&lt;/p&gt;
&lt;p&gt;
This will force &lt;font face="Courier New"&gt;XmlSerializer&lt;/font&gt; to produce a valid document
- with valid XML element contexts, without any ambient namespaces.
&lt;/p&gt;
&lt;p&gt;
The question is, why does &lt;font face="Courier New"&gt;XmlSerialzer&lt;/font&gt; produce this
namespaces by default? That should be a topic for another post.
&lt;/p&gt;
&lt;img width="0" height="0" src="https://www.request-response.com/blog/aggbug.ashx?id=26149053-63bc-495e-bab0-8d14e7e46190" /&gt;</description>
      <comments>https://www.request-response.com/blog/CommentView,guid,26149053-63bc-495e-bab0-8d14e7e46190.aspx</comments>
      <category>CLR</category>
      <category>XML</category>
    </item>
    <item>
      <trackback:ping>https://www.request-response.com/blog/Trackback.aspx?guid=53aa79e4-b540-49b3-b502-a87b97c5a223</trackback:ping>
      <pingback:server>https://www.request-response.com/blog/pingback.aspx</pingback:server>
      <pingback:target>https://www.request-response.com/blog/PermaLink,guid,53aa79e4-b540-49b3-b502-a87b97c5a223.aspx</pingback:target>
      <dc:creator>Matevz Gacnik</dc:creator>
      <wfw:comment>https://www.request-response.com/blog/CommentView,guid,53aa79e4-b540-49b3-b502-a87b97c5a223.aspx</wfw:comment>
      <wfw:commentRss>https://www.request-response.com/blog/SyndicationService.asmx/GetEntryCommentsRss?guid=53aa79e4-b540-49b3-b502-a87b97c5a223</wfw:commentRss>
      <slash:comments>1</slash:comments>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
          <a href="http://weblogs.asp.net/nunitaddin/default.aspx">Jamie Cansdale</a> of
TestDriven.NET fame just posted an intro <a href="http://weblogs.asp.net/nunitaddin/archive/2007/05/10/silverlight-console-applications.aspx">post</a> describing
the hosting of Silverlight's CLR - CoreCLR.
</p>
        <p>
Having the ability to host the runtime inside a Win32/.NET process brings up new possibilities,
especially running Silverlight apps outside the browser or developing test harnesses/unit
tests for Silverlight intended object models.
</p>
        <p>
          <a href="http://msdn.microsoft.com/vstudio/eula.aspx?id=e2c1a44f-0b5c-face-28c8-08a26f2e0b3c">Silverlight
1.1 alpha</a> and CoreCLR currently expose a very trimmed down version of the Framework's
BCL. This will change by RTM, but be aware that its sweet spot is still the browser.
</p>
        <p>
I can imagine a world where Silverlight apps will not only be media/presentation related.
Currently, the <a href="http://www.adobe.com/products/flex/">competing platform</a>,
though having a strong install base, has not reached into that space. 
</p>
        <p>
You could arm Flash developers with rocket launchers, but they would still lose a <strike>battle</strike> war
against .NET developers armed with chopsticks. Every day of the week and twice on
Sunday. I believe the number of souls will significantly influence the outcome in
this case.
</p>
        <img width="0" height="0" src="https://www.request-response.com/blog/aggbug.ashx?id=53aa79e4-b540-49b3-b502-a87b97c5a223" />
      </body>
      <title>CoreCLR Exposed</title>
      <guid isPermaLink="false">https://www.request-response.com/blog/PermaLink,guid,53aa79e4-b540-49b3-b502-a87b97c5a223.aspx</guid>
      <link>https://www.request-response.com/blog/PermaLink,guid,53aa79e4-b540-49b3-b502-a87b97c5a223.aspx</link>
      <pubDate>Sat, 12 May 2007 20:42:30 GMT</pubDate>
      <description>&lt;p&gt;
&lt;a href="http://weblogs.asp.net/nunitaddin/default.aspx"&gt;Jamie Cansdale&lt;/a&gt;&amp;nbsp;of
TestDriven.NET fame just posted an intro &lt;a href="http://weblogs.asp.net/nunitaddin/archive/2007/05/10/silverlight-console-applications.aspx"&gt;post&lt;/a&gt;&amp;nbsp;describing
the&amp;nbsp;hosting of Silverlight's CLR - CoreCLR.
&lt;/p&gt;
&lt;p&gt;
Having the ability to host the runtime inside a Win32/.NET process brings up new possibilities,
especially running Silverlight apps outside the browser&amp;nbsp;or developing test harnesses/unit
tests for Silverlight intended object models.
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://msdn.microsoft.com/vstudio/eula.aspx?id=e2c1a44f-0b5c-face-28c8-08a26f2e0b3c"&gt;Silverlight
1.1 alpha&lt;/a&gt; and CoreCLR currently expose a very trimmed down version of the Framework's
BCL. This will change by RTM, but be aware that its sweet spot is still the browser.
&lt;/p&gt;
&lt;p&gt;
I can imagine a world where Silverlight apps will not only be media/presentation related.
Currently, the &lt;a href="http://www.adobe.com/products/flex/"&gt;competing platform&lt;/a&gt;,
though having a strong install base, has not reached into that space. 
&lt;/p&gt;
&lt;p&gt;
You could arm Flash developers with rocket launchers, but they would still lose&amp;nbsp;a&amp;nbsp;&lt;strike&gt;battle&lt;/strike&gt; war
against .NET developers armed with chopsticks. Every day of the week and twice on
Sunday. I believe the number of souls will significantly influence the outcome in
this case.
&lt;/p&gt;
&lt;img width="0" height="0" src="https://www.request-response.com/blog/aggbug.ashx?id=53aa79e4-b540-49b3-b502-a87b97c5a223" /&gt;</description>
      <comments>https://www.request-response.com/blog/CommentView,guid,53aa79e4-b540-49b3-b502-a87b97c5a223.aspx</comments>
      <category>Architecture</category>
      <category>CLR</category>
      <category>Silverlight</category>
    </item>
    <item>
      <trackback:ping>https://www.request-response.com/blog/Trackback.aspx?guid=90c93e85-16da-4ac6-9d35-d5d8a993a186</trackback:ping>
      <pingback:server>https://www.request-response.com/blog/pingback.aspx</pingback:server>
      <pingback:target>https://www.request-response.com/blog/PermaLink,guid,90c93e85-16da-4ac6-9d35-d5d8a993a186.aspx</pingback:target>
      <dc:creator>Matevz Gacnik</dc:creator>
      <wfw:comment>https://www.request-response.com/blog/CommentView,guid,90c93e85-16da-4ac6-9d35-d5d8a993a186.aspx</wfw:comment>
      <wfw:commentRss>https://www.request-response.com/blog/SyndicationService.asmx/GetEntryCommentsRss?guid=90c93e85-16da-4ac6-9d35-d5d8a993a186</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
          <a href="http://devhawk.net/">Harry Pierson</a> is <a href="http://feeds.feedburner.com/~r/Devhawk/~3/99827836/The+Virtuous+Cycle+Of+Virtual+Platforms.aspx">discussing</a> the
correlation between market penetration and hassle free installation experience and <em>hits
the nail on its head</em>.
</p>
        <p>
Big market success of <a href="http://en.wikipedia.org/wiki/Macromedia_Flash">Adobe
Flash</a>, its omnipresence and high install base can definitely be traced back to
flawless install experience. In fact, it's so perfect, that <em>most users don't even
know which version they're running</em>. They don't care (me included). And they shouldn't
care.
</p>
        <p>
The first thing any platform needs to achieve is simple and effective installation
experience. I don't want to manually download platform installers to use certain
web services. It has to auto-install and has to be safe. This is what Flash does perfectly.
</p>
        <p>
All current virtual machine based platforms can be installed independently. Or they
can be flawlessly smuggled in by a host application setup program. The problem is,
that we can't compare CLR (or JVM) based platforms to Windows (as a platform), since
the user can't run five of the latter at the same time.
</p>
        <p>
Flash 9 market penetration is currently at <strong>~40%</strong>. Flash 8 penetration
is <strong>~90%</strong>, while Flash 6 penetration is <strong>~96%</strong>.
</p>
        <p>
          <a href="http://msdn2.microsoft.com/en-us/asp.net/bb187358.aspx">WPF/E</a> will have
the same install experience. Bet on it. If it wants to succeed, it will also have
to allow multiple versions to coexist gracefully.
</p>
        <img width="0" height="0" src="https://www.request-response.com/blog/aggbug.ashx?id=90c93e85-16da-4ac6-9d35-d5d8a993a186" />
      </body>
      <title>Hassle Free Setups and Market Penetration</title>
      <guid isPermaLink="false">https://www.request-response.com/blog/PermaLink,guid,90c93e85-16da-4ac6-9d35-d5d8a993a186.aspx</guid>
      <link>https://www.request-response.com/blog/PermaLink,guid,90c93e85-16da-4ac6-9d35-d5d8a993a186.aspx</link>
      <pubDate>Sun, 11 Mar 2007 20:37:09 GMT</pubDate>
      <description>&lt;p&gt;
&lt;a href="http://devhawk.net/"&gt;Harry Pierson&lt;/a&gt; is &lt;a href="http://feeds.feedburner.com/~r/Devhawk/~3/99827836/The+Virtuous+Cycle+Of+Virtual+Platforms.aspx"&gt;discussing&lt;/a&gt; the
correlation between market penetration and hassle free installation experience and &lt;em&gt;hits
the nail on its head&lt;/em&gt;.
&lt;/p&gt;
&lt;p&gt;
Big market success of &lt;a href="http://en.wikipedia.org/wiki/Macromedia_Flash"&gt;Adobe
Flash&lt;/a&gt;, its omnipresence and high install base can definitely be traced back to
flawless install experience. In fact, it's so perfect, that &lt;em&gt;most users don't even
know which version they're running&lt;/em&gt;. They don't care (me included). And they shouldn't
care.
&lt;/p&gt;
&lt;p&gt;
The first thing any platform needs to achieve is simple and effective installation
experience. I don't want to manually download platform installers to&amp;nbsp;use certain
web services. It has to auto-install and has to be safe. This is what Flash does perfectly.
&lt;/p&gt;
&lt;p&gt;
All current virtual machine based platforms can be installed independently. Or they
can be flawlessly smuggled in by a host application setup program. The problem is,
that we can't compare CLR (or JVM) based platforms to Windows (as a platform), since
the user can't run five of the latter at the same time.
&lt;/p&gt;
&lt;p&gt;
Flash 9 market penetration is currently at &lt;strong&gt;~40%&lt;/strong&gt;. Flash 8 penetration
is &lt;strong&gt;~90%&lt;/strong&gt;, while Flash 6 penetration is &lt;strong&gt;~96%&lt;/strong&gt;.
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://msdn2.microsoft.com/en-us/asp.net/bb187358.aspx"&gt;WPF/E&lt;/a&gt; will have
the same install experience. Bet on it. If it wants to succeed, it will also have
to allow multiple versions to coexist gracefully.
&lt;/p&gt;
&lt;img width="0" height="0" src="https://www.request-response.com/blog/aggbug.ashx?id=90c93e85-16da-4ac6-9d35-d5d8a993a186" /&gt;</description>
      <comments>https://www.request-response.com/blog/CommentView,guid,90c93e85-16da-4ac6-9d35-d5d8a993a186.aspx</comments>
      <category>CLR</category>
      <category>Other</category>
    </item>
    <item>
      <trackback:ping>https://www.request-response.com/blog/Trackback.aspx?guid=baaf6646-162a-4557-9d7e-10e4953ab627</trackback:ping>
      <pingback:server>https://www.request-response.com/blog/pingback.aspx</pingback:server>
      <pingback:target>https://www.request-response.com/blog/PermaLink,guid,baaf6646-162a-4557-9d7e-10e4953ab627.aspx</pingback:target>
      <dc:creator>Matevz Gacnik</dc:creator>
      <wfw:comment>https://www.request-response.com/blog/CommentView,guid,baaf6646-162a-4557-9d7e-10e4953ab627.aspx</wfw:comment>
      <wfw:commentRss>https://www.request-response.com/blog/SyndicationService.asmx/GetEntryCommentsRss?guid=baaf6646-162a-4557-9d7e-10e4953ab627</wfw:commentRss>
      <slash:comments>1</slash:comments>
      <title>Article: Type Systems Compared, XML, CLR</title>
      <guid isPermaLink="false">https://www.request-response.com/blog/PermaLink,guid,baaf6646-162a-4557-9d7e-10e4953ab627.aspx</guid>
      <link>https://www.request-response.com/blog/PermaLink,guid,baaf6646-162a-4557-9d7e-10e4953ab627.aspx</link>
      <pubDate>Thu, 01 Jun 2006 13:38:54 GMT</pubDate>
      <description>&lt;p&gt;
I'm going to publish a series of my articles, which went out the door a couple of
months ago.
&lt;/p&gt;
&lt;p&gt;
All articles are in &lt;strong&gt;&lt;em&gt;Slovene language&lt;/em&gt;&lt;/strong&gt;.
&lt;/p&gt;
&lt;p&gt;
Here goes the first one.
&lt;/p&gt;
&lt;hr&gt;
&lt;p&gt;
Naslov:
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://www.request-response.com/blog/content/binary/MatevzGacnik-XMLCLRTypeSystem.doc"&gt;Tipski
sistem XML &amp;lt;&amp;gt; Tipski sistem CLR&lt;/a&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;em&gt;&lt;a href="http://www.request-response.com/blog/content/binary/MatevzGacnik-XMLCLRTypeSystem.doc"&gt;&lt;img alt="Tipski sistem XML &lt;&gt; Tipski sistem CLR" hspace=0 src="http://www.request-response.com/blog/images/matevzgacnik-xmlclrtypesystem.jpg" align=baseline border=1&gt;&lt;/a&gt;&lt;/em&gt;
&lt;/p&gt;
&lt;img width="0" height="0" src="https://www.request-response.com/blog/aggbug.ashx?id=baaf6646-162a-4557-9d7e-10e4953ab627" /&gt;</description>
      <comments>https://www.request-response.com/blog/CommentView,guid,baaf6646-162a-4557-9d7e-10e4953ab627.aspx</comments>
      <category>Articles</category>
      <category>CLR</category>
      <category>XML</category>
    </item>
    <item>
      <trackback:ping>https://www.request-response.com/blog/Trackback.aspx?guid=cf345d71-cdc7-46b9-8c1c-eb21581a9222</trackback:ping>
      <pingback:server>https://www.request-response.com/blog/pingback.aspx</pingback:server>
      <pingback:target>https://www.request-response.com/blog/PermaLink,guid,cf345d71-cdc7-46b9-8c1c-eb21581a9222.aspx</pingback:target>
      <dc:creator>Matevz Gacnik</dc:creator>
      <wfw:comment>https://www.request-response.com/blog/CommentView,guid,cf345d71-cdc7-46b9-8c1c-eb21581a9222.aspx</wfw:comment>
      <wfw:commentRss>https://www.request-response.com/blog/SyndicationService.asmx/GetEntryCommentsRss?guid=cf345d71-cdc7-46b9-8c1c-eb21581a9222</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
There's a nice little (and dangerous) tool present in every .NET Framework SDK.
</p>
        <p>
It's called <font face="Courier New">corflags.exe</font>. If you run it, you might
get something like this:
</p>
        <p>
          <font face="Courier New">C:\corflags testme.exe</font>
        </p>
        <p>
          <font face="Courier New">Microsoft (R) .NET Framework CorFlags Conversion Tool. 
Version  2.0.50727.42<br />
Copyright (c) Microsoft Corporation.  All rights reserved.</font>
        </p>
        <p>
          <font face="Courier New">Version   : v2.0.50727<br />
CLR Header: 2.5<br />
PE        : PE32<br />
CorFlags  : 1<br />
ILONLY    : 1<br />
32BIT     : 0<br />
Signed    : 0</font>
        </p>
        <p>
What this tells you (via the CLR Header) is that <font face="Courier New">testme.exe</font> assembly hides
a .NET Framework 2.0 compiled code. All 2.0 framework code will have 2.5 header version,
while all 1.0/1.1 compiled code will have 2.0 header version. It's a bit of a mess,
but noone can change history.
</p>
        <p>
Next important value is PE. It tells you whether this assembly is a 32-bit or 'any
cpu' compiled assembly. If PE value should be 'PE32+' than you could conclude that
this is a 64-bit capable assembly.
</p>
        <p>
The 32BIT property, contrary to its name, does not represent bitness of the assembly.
In this case, 32BIT property holds a value of <font face="Courier New">0</font>, which
would mean that this is a 64-bit assembly. Actually this assembly can be run anywhere,
since it was compiled with agnostic setting of 'any cpu'. If I wanted to, I could
turn this knob using the following:
</p>
        <p>
          <font face="Courier New">corflags.exe /32BIT+ testme.exe</font>
        </p>
        <p>
Now, this assembly would always execute under WoW64 (emulated 32-bit environment on
a 64-bit box). In a case where this execution would not be possible - ie. run against
an ia64 box - one would get a <font face="Courier New">BadImageFormatException</font> exception.
</p>
        <p>
There is no way (for now) to demand execution in a 64-bit process because this thing
is not controled by a metadata flag. Rather it's controled at compile time and compiler
has to emit PE32+ compatible code.
</p>
        <p>
Recap: CLR Header property denotes compiler version which was used to produce the
assembly. PE property tells you whether this assembly is either 32-bit (PE32), 'any
cpu' (PE32) or 64-bit (PE32+). If the 32BIT property is set it mandates execution
in a 32-bit process, if the platform allows it.
</p>
        <img width="0" height="0" src="https://www.request-response.com/blog/aggbug.ashx?id=cf345d71-cdc7-46b9-8c1c-eb21581a9222" />
      </body>
      <title>Corflags.exe in 64-bit Environment</title>
      <guid isPermaLink="false">https://www.request-response.com/blog/PermaLink,guid,cf345d71-cdc7-46b9-8c1c-eb21581a9222.aspx</guid>
      <link>https://www.request-response.com/blog/PermaLink,guid,cf345d71-cdc7-46b9-8c1c-eb21581a9222.aspx</link>
      <pubDate>Wed, 28 Dec 2005 22:22:51 GMT</pubDate>
      <description>&lt;p&gt;
There's a nice little (and dangerous) tool present in every .NET Framework SDK.
&lt;/p&gt;
&lt;p&gt;
It's called &lt;font face="Courier New"&gt;corflags.exe&lt;/font&gt;. If you run it, you might
get something like this:
&lt;/p&gt;
&lt;p&gt;
&lt;font face="Courier New"&gt;C:\corflags testme.exe&lt;/font&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;font face="Courier New"&gt;Microsoft (R) .NET Framework CorFlags Conversion Tool.&amp;nbsp;
Version&amp;nbsp; 2.0.50727.42&lt;br&gt;
Copyright (c) Microsoft Corporation.&amp;nbsp; All rights reserved.&lt;/font&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;font face="Courier New"&gt;Version&amp;nbsp;&amp;nbsp; : v2.0.50727&lt;br&gt;
CLR Header: 2.5&lt;br&gt;
PE&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; : PE32&lt;br&gt;
CorFlags&amp;nbsp; : 1&lt;br&gt;
ILONLY&amp;nbsp;&amp;nbsp;&amp;nbsp; : 1&lt;br&gt;
32BIT&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; : 0&lt;br&gt;
Signed&amp;nbsp;&amp;nbsp;&amp;nbsp; : 0&lt;/font&gt;
&lt;/p&gt;
&lt;p&gt;
What this tells you (via the CLR Header) is that&amp;nbsp;&lt;font face="Courier New"&gt;testme.exe&lt;/font&gt; assembly&amp;nbsp;hides
a .NET Framework 2.0 compiled code. All 2.0 framework code will have 2.5 header version,
while all 1.0/1.1 compiled code will have 2.0 header version. It's a bit of a mess,
but noone can change history.
&lt;/p&gt;
&lt;p&gt;
Next important value is PE. It tells you whether this assembly is a 32-bit or 'any
cpu' compiled assembly. If PE value should be 'PE32+' than you could conclude that
this is a 64-bit capable assembly.
&lt;/p&gt;
&lt;p&gt;
The 32BIT property, contrary to its name, does not represent bitness of the assembly.
In this case, 32BIT property holds a value of &lt;font face="Courier New"&gt;0&lt;/font&gt;, which
would mean that this is a 64-bit assembly. Actually this assembly can be run anywhere,
since it was compiled with agnostic setting of 'any cpu'. If I wanted to, I could
turn this knob using the following:
&lt;/p&gt;
&lt;p&gt;
&lt;font face="Courier New"&gt;corflags.exe /32BIT+ testme.exe&lt;/font&gt;
&lt;/p&gt;
&lt;p&gt;
Now, this assembly would always execute under WoW64 (emulated 32-bit environment on
a 64-bit box). In a case where this execution would not be possible - ie. run against
an ia64 box - one would get a &lt;font face="Courier New"&gt;BadImageFormatException&lt;/font&gt; exception.
&lt;/p&gt;
&lt;p&gt;
There is no way (for now) to demand execution in a 64-bit process because this thing
is not controled by a metadata flag. Rather it's controled at compile time and compiler
has to emit PE32+ compatible code.
&lt;/p&gt;
&lt;p&gt;
Recap: CLR Header property denotes compiler version which was used to produce the
assembly. PE property tells you whether this assembly is either 32-bit (PE32), 'any
cpu' (PE32) or 64-bit (PE32+). If the 32BIT property is set it mandates execution
in a 32-bit process, if the platform allows it.
&lt;/p&gt;
&lt;img width="0" height="0" src="https://www.request-response.com/blog/aggbug.ashx?id=cf345d71-cdc7-46b9-8c1c-eb21581a9222" /&gt;</description>
      <comments>https://www.request-response.com/blog/CommentView,guid,cf345d71-cdc7-46b9-8c1c-eb21581a9222.aspx</comments>
      <category>CLR</category>
    </item>
    <item>
      <trackback:ping>https://www.request-response.com/blog/Trackback.aspx?guid=34966ef8-3142-46b2-84e0-372b5c36ddcc</trackback:ping>
      <pingback:server>https://www.request-response.com/blog/pingback.aspx</pingback:server>
      <pingback:target>https://www.request-response.com/blog/PermaLink,guid,34966ef8-3142-46b2-84e0-372b5c36ddcc.aspx</pingback:target>
      <dc:creator>Matevz Gacnik</dc:creator>
      <wfw:comment>https://www.request-response.com/blog/CommentView,guid,34966ef8-3142-46b2-84e0-372b5c36ddcc.aspx</wfw:comment>
      <wfw:commentRss>https://www.request-response.com/blog/SyndicationService.asmx/GetEntryCommentsRss?guid=34966ef8-3142-46b2-84e0-372b5c36ddcc</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
If you happen to be in the 64-bit world (read running a 64-bit OS on the x64 box,
not IA64), there are two options on how your managed code runs.
</p>
        <p>
It can run:
</p>
        <ul>
          <li>
In a 32-bit process (loads x86 CLR)</li>
          <li>
In a 64-bit process (loads x64 CLR)</li>
        </ul>
        <p>
The high order bit here is the flag under which the image was compiled. Since you
cannot compile for 64-bit architecture in .NET Framework 1.0/1.1, and 2.0 is your
only choice, let's focus on Visual Studio 2005/.NET Framework 2.0 features.
</p>
        <p>
If you look under the hood on a x64 box, you will find that VS 2005 installer will
drop TWO frameworks on your machine.
</p>
        <p>
The 32-bit framework will install in <font face="Courier New">c:\windows\microsoft.net\framework</font> directory,
the 64-bit framework will install in <font face="Courier New">c:\windows\microsoft.net\framework64
directory</font>.
</p>
        <p>
If you installed .NET Framework SDK, you will get two SDKs too. One will be in <font face="Courier New">c:\program
files\microsoft.net\sdk\v2.0 64bit</font> (64-bit), the other in <font face="Courier New">c:\program
files (x86)\microsoft visual studio 8\sdk\v2.0</font> (32-bit, installed in VS 2005
base directory).
</p>
        <p>
What happens at load time is the CLR runtime host decides on which CLR it needs to
load based on the CLR metadata flags. Normally, if you do not change the defaults
in VS 2005, your assemblies will be compiled using the 'anycpu' (also known as MSIL
flag) which will allow the runtime to host the managed app in a 64-bit process on
a x64 box and in a 32-bit process on a x86 box.
</p>
        <p>
You can, however,  control and override this default behaviour even after your
code has been compiled. There's a handy tool called <font face="Courier New">corflags.exe</font> present
in the SDK that allows you to force 'anycpu' compiled code to use 32-bit process in
64-bit world.
</p>
        <p>
More on that in another blog entry.
</p>
        <img width="0" height="0" src="https://www.request-response.com/blog/aggbug.ashx?id=34966ef8-3142-46b2-84e0-372b5c36ddcc" />
      </body>
      <title>Running 64-bit Managed Code</title>
      <guid isPermaLink="false">https://www.request-response.com/blog/PermaLink,guid,34966ef8-3142-46b2-84e0-372b5c36ddcc.aspx</guid>
      <link>https://www.request-response.com/blog/PermaLink,guid,34966ef8-3142-46b2-84e0-372b5c36ddcc.aspx</link>
      <pubDate>Wed, 28 Dec 2005 12:14:51 GMT</pubDate>
      <description>&lt;p&gt;
If you happen to be in the 64-bit world (read running a 64-bit OS on the x64 box,
not IA64), there are two options on how your managed code runs.
&lt;/p&gt;
&lt;p&gt;
It can run:
&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
In a 32-bit process (loads x86 CLR)&lt;/li&gt;
&lt;li&gt;
In a 64-bit process (loads x64 CLR)&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
The high order bit here is the flag under which the image was compiled. Since you
cannot compile for 64-bit architecture in .NET Framework 1.0/1.1, and 2.0 is your
only choice, let's focus on Visual Studio 2005/.NET Framework 2.0 features.
&lt;/p&gt;
&lt;p&gt;
If you look under the hood on a x64 box, you will find that VS 2005 installer will
drop TWO frameworks on your machine.
&lt;/p&gt;
&lt;p&gt;
The 32-bit framework will install in &lt;font face="Courier New"&gt;c:\windows\microsoft.net\framework&lt;/font&gt; directory,
the 64-bit framework will install in &lt;font face="Courier New"&gt;c:\windows\microsoft.net\framework64
directory&lt;/font&gt;.
&lt;/p&gt;
&lt;p&gt;
If you installed .NET Framework SDK, you will get two SDKs too. One will be in &lt;font face="Courier New"&gt;c:\program
files\microsoft.net\sdk\v2.0 64bit&lt;/font&gt; (64-bit), the other in &lt;font face="Courier New"&gt;c:\program
files (x86)\microsoft visual studio 8\sdk\v2.0&lt;/font&gt; (32-bit, installed in VS 2005
base directory).
&lt;/p&gt;
&lt;p&gt;
What happens at load time is the CLR runtime host decides on which CLR it needs to
load based on the CLR metadata flags. Normally, if you do not change the defaults
in VS 2005, your assemblies will be compiled using the 'anycpu' (also known as MSIL
flag) which will allow the runtime to host the managed app in a 64-bit process on
a x64 box and in a 32-bit process on a x86 box.
&lt;/p&gt;
&lt;p&gt;
You can, however, &amp;nbsp;control and override this default behaviour even after your
code has been compiled. There's a handy tool called &lt;font face="Courier New"&gt;corflags.exe&lt;/font&gt; present
in the SDK that allows you to force 'anycpu' compiled code to use 32-bit process in
64-bit world.
&lt;/p&gt;
&lt;p&gt;
More on that in another blog entry.
&lt;/p&gt;
&lt;img width="0" height="0" src="https://www.request-response.com/blog/aggbug.ashx?id=34966ef8-3142-46b2-84e0-372b5c36ddcc" /&gt;</description>
      <comments>https://www.request-response.com/blog/CommentView,guid,34966ef8-3142-46b2-84e0-372b5c36ddcc.aspx</comments>
      <category>CLR</category>
      <category>Work</category>
    </item>
    <item>
      <trackback:ping>https://www.request-response.com/blog/Trackback.aspx?guid=9f383687-3e1e-4568-833b-ef80e0938337</trackback:ping>
      <pingback:server>https://www.request-response.com/blog/pingback.aspx</pingback:server>
      <pingback:target>https://www.request-response.com/blog/PermaLink,guid,9f383687-3e1e-4568-833b-ef80e0938337.aspx</pingback:target>
      <dc:creator>Matevz Gacnik</dc:creator>
      <wfw:comment>https://www.request-response.com/blog/CommentView,guid,9f383687-3e1e-4568-833b-ef80e0938337.aspx</wfw:comment>
      <wfw:commentRss>https://www.request-response.com/blog/SyndicationService.asmx/GetEntryCommentsRss?guid=9f383687-3e1e-4568-833b-ef80e0938337</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
It seems to me that either fuslogvw.exe or fusion.dll has a serious bug.
</p>
        <p>
If you try to do some CLR assembly resolver logging using the above mentioned tehnology
you can end up with an empty fuslogvw.exe window.
</p>
        <p>
If that's the case and you have set ForceLog [1] registry key to 1 and LogFailures
to 1 and still only get the empty window, try deleting temporary internet files directory.
As it seems, Fusion has a problem when certain number of files exist in there.
</p>
        <p>
After purging the internet temp files directory, things returned to normal.
</p>
        <p>
[1] HCLM/Software/Microsoft/Fusion/ForceLog, DWORD
</p>
        <img width="0" height="0" src="https://www.request-response.com/blog/aggbug.ashx?id=9f383687-3e1e-4568-833b-ef80e0938337" />
      </body>
      <title>Assembly binding log viewer bug</title>
      <guid isPermaLink="false">https://www.request-response.com/blog/PermaLink,guid,9f383687-3e1e-4568-833b-ef80e0938337.aspx</guid>
      <link>https://www.request-response.com/blog/PermaLink,guid,9f383687-3e1e-4568-833b-ef80e0938337.aspx</link>
      <pubDate>Mon, 11 Apr 2005 20:54:52 GMT</pubDate>
      <description>&lt;p&gt;
It seems to me that either fuslogvw.exe or fusion.dll has a serious bug.
&lt;/p&gt;
&lt;p&gt;
If you try to do some CLR assembly resolver logging using the above mentioned tehnology
you can end up with an empty fuslogvw.exe window.
&lt;/p&gt;
&lt;p&gt;
If that's the case and you have set ForceLog [1] registry key to 1 and LogFailures
to 1 and still only get the empty window, try deleting temporary internet files directory.
As it seems, Fusion has a problem when certain number of files exist in there.
&lt;/p&gt;
&lt;p&gt;
After purging the internet temp files directory, things returned to normal.
&lt;/p&gt;
&lt;p&gt;
[1] HCLM/Software/Microsoft/Fusion/ForceLog, DWORD
&lt;/p&gt;
&lt;img width="0" height="0" src="https://www.request-response.com/blog/aggbug.ashx?id=9f383687-3e1e-4568-833b-ef80e0938337" /&gt;</description>
      <comments>https://www.request-response.com/blog/CommentView,guid,9f383687-3e1e-4568-833b-ef80e0938337.aspx</comments>
      <category>CLR</category>
    </item>
    <item>
      <trackback:ping>https://www.request-response.com/blog/Trackback.aspx?guid=2f107e46-47f5-4ea3-8b8e-06f9eba08873</trackback:ping>
      <pingback:server>https://www.request-response.com/blog/pingback.aspx</pingback:server>
      <pingback:target>https://www.request-response.com/blog/PermaLink,guid,2f107e46-47f5-4ea3-8b8e-06f9eba08873.aspx</pingback:target>
      <dc:creator />
      <wfw:comment>https://www.request-response.com/blog/CommentView,guid,2f107e46-47f5-4ea3-8b8e-06f9eba08873.aspx</wfw:comment>
      <wfw:commentRss>https://www.request-response.com/blog/SyndicationService.asmx/GetEntryCommentsRss?guid=2f107e46-47f5-4ea3-8b8e-06f9eba08873</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
I had an 'Inside CLR' workshop today. Some attandees had really good questions and
some good comments.
</p>
        <p>
I really liked the comment that in-memory instance representation layout can be controlled
using the StructLayoutAttribute attribute. I was sure that it's compiler default was
AutoLayout, specified by Auto attribute in type metadata. One always learns new things
when talking about deep subjects.
</p>
        <p>
I am redelivering this workshop in a few months.
</p>
        <img width="0" height="0" src="https://www.request-response.com/blog/aggbug.ashx?id=2f107e46-47f5-4ea3-8b8e-06f9eba08873" />
      </body>
      <title>Inside CLR Workshop</title>
      <guid isPermaLink="false">https://www.request-response.com/blog/PermaLink,guid,2f107e46-47f5-4ea3-8b8e-06f9eba08873.aspx</guid>
      <link>https://www.request-response.com/blog/PermaLink,guid,2f107e46-47f5-4ea3-8b8e-06f9eba08873.aspx</link>
      <pubDate>Tue, 09 Dec 2003 18:17:49 GMT</pubDate>
      <description>&lt;p&gt;
I had an 'Inside CLR' workshop today. Some attandees had really good questions and
some good comments.
&lt;/p&gt;
&lt;p&gt;
I really liked the comment that in-memory instance representation layout can be controlled
using the StructLayoutAttribute attribute. I was sure that it's compiler default was
AutoLayout, specified by Auto attribute in type metadata. One always learns new things
when talking about deep subjects.
&lt;/p&gt;
&lt;p&gt;
I am redelivering this workshop in a few months.
&lt;/p&gt;
&lt;img width="0" height="0" src="https://www.request-response.com/blog/aggbug.ashx?id=2f107e46-47f5-4ea3-8b8e-06f9eba08873" /&gt;</description>
      <comments>https://www.request-response.com/blog/CommentView,guid,2f107e46-47f5-4ea3-8b8e-06f9eba08873.aspx</comments>
      <category>CLR</category>
    </item>
    <item>
      <trackback:ping>https://www.request-response.com/blog/Trackback.aspx?guid=b3ad2eea-c992-4b9c-83ab-f8959e8d46e9</trackback:ping>
      <pingback:server>https://www.request-response.com/blog/pingback.aspx</pingback:server>
      <pingback:target>https://www.request-response.com/blog/PermaLink,guid,b3ad2eea-c992-4b9c-83ab-f8959e8d46e9.aspx</pingback:target>
      <dc:creator />
      <wfw:comment>https://www.request-response.com/blog/CommentView,guid,b3ad2eea-c992-4b9c-83ab-f8959e8d46e9.aspx</wfw:comment>
      <wfw:commentRss>https://www.request-response.com/blog/SyndicationService.asmx/GetEntryCommentsRss?guid=b3ad2eea-c992-4b9c-83ab-f8959e8d46e9</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
I just installed <a href="http://www.go-mono.com">Mono 0.25</a> on a Red Hat 9 box. 
</p>
        <p>
This is it's <a href="http://www.request-response.com/images/mono1.png">output</a>.
Investigative work follows. 
</p>
        <img width="0" height="0" src="https://www.request-response.com/blog/aggbug.ashx?id=b3ad2eea-c992-4b9c-83ab-f8959e8d46e9" />
      </body>
      <title>Mono lives...</title>
      <guid isPermaLink="false">https://www.request-response.com/blog/PermaLink,guid,b3ad2eea-c992-4b9c-83ab-f8959e8d46e9.aspx</guid>
      <link>https://www.request-response.com/blog/PermaLink,guid,b3ad2eea-c992-4b9c-83ab-f8959e8d46e9.aspx</link>
      <pubDate>Sat, 02 Aug 2003 12:26:52 GMT</pubDate>
      <description>&lt;p&gt;
I just installed &lt;a href="http://www.go-mono.com"&gt;Mono 0.25&lt;/a&gt; on a Red Hat 9 box. 
&lt;/p&gt;
&lt;p&gt;
This is it's &lt;a href="http://www.request-response.com/images/mono1.png"&gt;output&lt;/a&gt;.
Investigative work follows. 
&lt;/p&gt;
&lt;img width="0" height="0" src="https://www.request-response.com/blog/aggbug.ashx?id=b3ad2eea-c992-4b9c-83ab-f8959e8d46e9" /&gt;</description>
      <comments>https://www.request-response.com/blog/CommentView,guid,b3ad2eea-c992-4b9c-83ab-f8959e8d46e9.aspx</comments>
      <category>CLR</category>
    </item>
    <item>
      <trackback:ping>https://www.request-response.com/blog/Trackback.aspx?guid=b0993b21-2031-4ba3-abdc-6501cc389621</trackback:ping>
      <pingback:server>https://www.request-response.com/blog/pingback.aspx</pingback:server>
      <pingback:target>https://www.request-response.com/blog/PermaLink,guid,b0993b21-2031-4ba3-abdc-6501cc389621.aspx</pingback:target>
      <dc:creator />
      <wfw:comment>https://www.request-response.com/blog/CommentView,guid,b0993b21-2031-4ba3-abdc-6501cc389621.aspx</wfw:comment>
      <wfw:commentRss>https://www.request-response.com/blog/SyndicationService.asmx/GetEntryCommentsRss?guid=b0993b21-2031-4ba3-abdc-6501cc389621</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <body xmlns="http://www.w3.org/1999/xhtml">
          <p>
Well, been there, done that. 
</p>
          <p>
When I came home at least one thing in blogspace was worth reading: <a href="http://blogs.gotdotnet.com/cbrumme/permalink.aspx/24e9e5f5-9923-4cf9-b097-9c018c69d5cb">new
Chris Brumme article</a>. 
</p>
        </body>
        <img width="0" height="0" src="https://www.request-response.com/blog/aggbug.ashx?id=b0993b21-2031-4ba3-abdc-6501cc389621" />
      </body>
      <title>Back for good</title>
      <guid isPermaLink="false">https://www.request-response.com/blog/PermaLink,guid,b0993b21-2031-4ba3-abdc-6501cc389621.aspx</guid>
      <link>https://www.request-response.com/blog/PermaLink,guid,b0993b21-2031-4ba3-abdc-6501cc389621.aspx</link>
      <pubDate>Tue, 15 Jul 2003 10:08:51 GMT</pubDate>
      <description>&lt;body xmlns="http://www.w3.org/1999/xhtml"&gt;
&lt;p&gt;
Well, been there, done that. 
&lt;/p&gt;
&lt;p&gt;
When I came home at least one thing in blogspace was worth reading: &lt;a href="http://blogs.gotdotnet.com/cbrumme/permalink.aspx/24e9e5f5-9923-4cf9-b097-9c018c69d5cb"&gt;new
Chris Brumme article&lt;/a&gt;. 
&lt;/p&gt;
&lt;/body&gt;
&lt;img width="0" height="0" src="https://www.request-response.com/blog/aggbug.ashx?id=b0993b21-2031-4ba3-abdc-6501cc389621" /&gt;</description>
      <comments>https://www.request-response.com/blog/CommentView,guid,b0993b21-2031-4ba3-abdc-6501cc389621.aspx</comments>
      <category>CLR</category>
    </item>
    <item>
      <trackback:ping>https://www.request-response.com/blog/Trackback.aspx?guid=e9427746-4856-4554-972f-7fdcbfac296a</trackback:ping>
      <pingback:server>https://www.request-response.com/blog/pingback.aspx</pingback:server>
      <pingback:target>https://www.request-response.com/blog/PermaLink,guid,e9427746-4856-4554-972f-7fdcbfac296a.aspx</pingback:target>
      <dc:creator />
      <wfw:comment>https://www.request-response.com/blog/CommentView,guid,e9427746-4856-4554-972f-7fdcbfac296a.aspx</wfw:comment>
      <wfw:commentRss>https://www.request-response.com/blog/SyndicationService.asmx/GetEntryCommentsRss?guid=e9427746-4856-4554-972f-7fdcbfac296a</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">I admire <a href="http://blogs.gotdotnet.com/cbrumme/">this</a> guy.
Not only he writes five pages of <a href="http://blogs.gotdotnet.com/cbrumme/PermaLink.aspx/68bb6af0-d15f-44fd-b6a7-41926c415cc4">first
class material from his vacation in Maui</a>, he also does it <a href="http://blogs.gotdotnet.com/cbrumme/PermaLink.aspx/19f7fe52-1225-49cd-86df-9c6ee40deb5a">besides
the pool</a>.<img width="0" height="0" src="https://www.request-response.com/blog/aggbug.ashx?id=e9427746-4856-4554-972f-7fdcbfac296a" /></body>
      <title>Chris Brumme</title>
      <guid isPermaLink="false">https://www.request-response.com/blog/PermaLink,guid,e9427746-4856-4554-972f-7fdcbfac296a.aspx</guid>
      <link>https://www.request-response.com/blog/PermaLink,guid,e9427746-4856-4554-972f-7fdcbfac296a.aspx</link>
      <pubDate>Mon, 23 Jun 2003 20:18:30 GMT</pubDate>
      <description>I admire &lt;a href="http://blogs.gotdotnet.com/cbrumme/"&gt;this&lt;/a&gt; guy. Not only he writes
five pages of &lt;a href="http://blogs.gotdotnet.com/cbrumme/PermaLink.aspx/68bb6af0-d15f-44fd-b6a7-41926c415cc4"&gt;first
class material from his vacation in Maui&lt;/a&gt;, he also does it &lt;a href="http://blogs.gotdotnet.com/cbrumme/PermaLink.aspx/19f7fe52-1225-49cd-86df-9c6ee40deb5a"&gt;besides
the pool&lt;/a&gt;.&lt;img width="0" height="0" src="https://www.request-response.com/blog/aggbug.ashx?id=e9427746-4856-4554-972f-7fdcbfac296a" /&gt;</description>
      <comments>https://www.request-response.com/blog/CommentView,guid,e9427746-4856-4554-972f-7fdcbfac296a.aspx</comments>
      <category>Work</category>
      <category>CLR</category>
    </item>
    <item>
      <trackback:ping>https://www.request-response.com/blog/Trackback.aspx?guid=fa85f64f-cd46-4318-a246-adf773d119e4</trackback:ping>
      <pingback:server>https://www.request-response.com/blog/pingback.aspx</pingback:server>
      <pingback:target>https://www.request-response.com/blog/PermaLink,guid,fa85f64f-cd46-4318-a246-adf773d119e4.aspx</pingback:target>
      <dc:creator />
      <wfw:comment>https://www.request-response.com/blog/CommentView,guid,fa85f64f-cd46-4318-a246-adf773d119e4.aspx</wfw:comment>
      <wfw:commentRss>https://www.request-response.com/blog/SyndicationService.asmx/GetEntryCommentsRss?guid=fa85f64f-cd46-4318-a246-adf773d119e4</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">Finally. <a href="http://www.sscli.net">Rotor
unleashed</a>.<img width="0" height="0" src="https://www.request-response.com/blog/aggbug.ashx?id=fa85f64f-cd46-4318-a246-adf773d119e4" /></body>
      <title>SSCLI</title>
      <guid isPermaLink="false">https://www.request-response.com/blog/PermaLink,guid,fa85f64f-cd46-4318-a246-adf773d119e4.aspx</guid>
      <link>https://www.request-response.com/blog/PermaLink,guid,fa85f64f-cd46-4318-a246-adf773d119e4.aspx</link>
      <pubDate>Sun, 22 Jun 2003 05:15:09 GMT</pubDate>
      <description>Finally. &lt;a href="http://www.sscli.net"&gt;Rotor unleashed&lt;/a&gt;.&lt;img width="0" height="0" src="https://www.request-response.com/blog/aggbug.ashx?id=fa85f64f-cd46-4318-a246-adf773d119e4" /&gt;</description>
      <comments>https://www.request-response.com/blog/CommentView,guid,fa85f64f-cd46-4318-a246-adf773d119e4.aspx</comments>
      <category>CLR</category>
    </item>
  </channel>
</rss>