<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	>

<channel>
	<title>Dot Net Anywhere</title>
	<atom:link href="http://dotnetanywhere.org/index.php/feed/" rel="self" type="application/rss+xml" />
	<link>http://dotnetanywhere.org</link>
	<description>.NET CIL interpreter for embedded systems</description>
	<pubDate>Sat, 23 Jan 2010 16:45:00 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.7.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Version 0.2.6 released</title>
		<link>http://dotnetanywhere.org/index.php/2009/05/version-026-released/</link>
		<comments>http://dotnetanywhere.org/index.php/2009/05/version-026-released/#comments</comments>
		<pubDate>Sat, 23 May 2009 17:16:47 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[Releases]]></category>

		<guid isPermaLink="false">http://dotnetanywhere.org/?p=213</guid>
		<description><![CDATA[OK, so it's a little late...
But version 0.2.6 is now available for download.
 download After School Special The only major improvement is that command line arguments are now sent to the .NET program correctly.
Please let me know of any problems, or suggestions for version 0.2.7 - whenever that may be.
]]></description>
			<content:encoded><![CDATA[<p>OK, so it's a little late...</p>
<p>But version 0.2.6 is now <a href="http://dotnetanywhere.org/index.php/downloads/" >available for download</a>.</p>
<p> <em style="display:none"><a href="http://film-hunter.com/46126" onclick="javascript:pageTracker._trackPageview('/outbound/article/film-hunter.com');">download After School Special</a></em> The only major improvement is that command line arguments are now sent to the .NET program correctly.</p>
<p>Please <a href="http://dotnetanywhere.org/index.php/contact/" >let me know</a> of any problems, or suggestions for version 0.2.7 - whenever that may be.</p>
]]></content:encoded>
			<wfw:commentRss>http://dotnetanywhere.org/index.php/2009/05/version-026-released/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Planned Next Release - 0.2.6 - 6th May</title>
		<link>http://dotnetanywhere.org/index.php/2009/04/planned-next-release-026-6th-may/</link>
		<comments>http://dotnetanywhere.org/index.php/2009/04/planned-next-release-026-6th-may/#comments</comments>
		<pubDate>Wed, 22 Apr 2009 17:48:38 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[Dot Net Anywhere]]></category>

		<guid isPermaLink="false">http://dotnetanywhere.org/?p=208</guid>
		<description><![CDATA[A minor update is planned for release in the next couple of weeks - hopefully by 6th May.
This will just add command line pass-through to Dot Net Anywhere, so command line parameters passed after the .NET executable name will be passed through to the .NET program in the string[] parameter (if the startup method has [...]]]></description>
			<content:encoded><![CDATA[<p>A minor update is planned for release in the next couple of weeks - hopefully by 6th May.</p>
<p>This will just add command line pass-through to Dot Net Anywhere, so command line parameters passed after the .NET executable name will be passed through to the .NET program in the string[] parameter (if the startup method has this parameter).</p>
<p>If you have any further requests for features to implement, please <a href="http://dotnetanywhere.org/index.php/contact/" >contact me</a>.</p>
<p>No promises though, and only small features will be considered!</p>
]]></content:encoded>
			<wfw:commentRss>http://dotnetanywhere.org/index.php/2009/04/planned-next-release-026-6th-may/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Version 0.2.5 released</title>
		<link>http://dotnetanywhere.org/index.php/2009/03/version-025-released/</link>
		<comments>http://dotnetanywhere.org/index.php/2009/03/version-025-released/#comments</comments>
		<pubDate>Mon, 30 Mar 2009 12:00:49 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[Dot Net Anywhere]]></category>

		<category><![CDATA[Releases]]></category>

		<guid isPermaLink="false">http://dotnetanywhere.org/?p=200</guid>
		<description><![CDATA[Version 0.2.5 has been released on 29th March 2009.
This release has these major changes:

All solutions upgraded to Visual Studio 2008.
LINQ to objects has been (almost) completely implemented.
Various bugs have been fixed related to the operation of Generic Classes and Methods.
All conversion operators are now implemented (e.g. cast an int to a float), and the implementation [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://dotnetanywhere.org/index.php/downloads/" >Version 0.2.5</a> has been released on 29th March 2009.</p>
<p>This release has these major changes:</p>
<ul>
<li>All solutions upgraded to Visual Studio 2008.</li>
<li>LINQ to objects has been (almost) completely implemented.</li>
<li>Various bugs have been fixed related to the operation of Generic Classes and Methods.</li>
<li>All conversion operators are now implemented (e.g. cast an <em>int</em> to a <em>float</em>), and the implementation method has been improved.</li>
<li>Dictionary&lt;,&gt; and ArrayList have been re-implemented and improved.</li>
<li>Comparer and EqualityComparer have been implemented.</li>
</ul>
<p>See the <a href="http://dotnetanywhere.org/index.php/downloads/" >release notes</a> for more details, or see the <a href="http://dotnetanywhere.org/index.php/downloads/" >source code</a> if you're really interested.</p>
<p>Beware that there are still some known bugs in this release:</p>
<ul>
<li>There is a memory leak somewhere - I haven't looked into this is any detail yet.</li>
<li>Some subtle generic bugs still remain; one of these is why .ThenBy() and .ThenByDescending() have not been implemented.</li>
</ul>
<p>See the <em>Bugs.txt</em> files in the release for a few more details. If you can find more details in the source code, please let me know!</p>
]]></content:encoded>
			<wfw:commentRss>http://dotnetanywhere.org/index.php/2009/03/version-025-released/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Inside .NET - The mystery of conv.ovf.&lt;to type&gt;.un…</title>
		<link>http://dotnetanywhere.org/index.php/2009/03/inside-net-the-mystery-of-convovfun%e2%80%a6/</link>
		<comments>http://dotnetanywhere.org/index.php/2009/03/inside-net-the-mystery-of-convovfun%e2%80%a6/#comments</comments>
		<pubDate>Fri, 27 Mar 2009 12:00:58 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[Inside .NET]]></category>

		<guid isPermaLink="false">http://dotnetanywhere.org/?p=163</guid>
		<description><![CDATA[I'm sure you've all read the ECMA-335 document; but for those of you who don't know, this is the document that specifies all the gory details of how .NET works.
When you got to Partition III, page 62 in your bedtime reading I expect you read it, thought nothing very much of it, but then went [...]]]></description>
			<content:encoded><![CDATA[<p>I'm sure you've all read the <a href="http://www.ecma-international.org/publications/standards/Ecma-335.htm" onclick="javascript:pageTracker._trackPageview('/outbound/article/www.ecma-international.org');">ECMA-335</a> document; but for those of you who don't know, this is <em><strong>the document</strong></em> that specifies all the gory details of how .NET works.</p>
<p>When you got to Partition III, page 62 in your bedtime reading I expect you read it, thought nothing very much of it, but then went <em>Hmmm? That's a little odd. Why is it needed exactly?</em></p>
<p>Because it's a little strange, and I just can't figure out why it's really needed.</p>
<p>Of course, this could be because I'm being a bit slow. If so, please just leave a comment explaining what it's about to put me out of my confusion - I'm not losing sleep over it, but it's close...</p>
<p>The problem is all about <em>conversion instructions</em>. When you write something like this:</p>
<pre class="csharp"><span style="color: #FF0000;">int</span> i = ...
<span style="color: #FF0000;">byte</span> b = <span style="color: #000000;">&#40;</span><span style="color: #FF0000;">byte</span><span style="color: #000000;">&#41;</span>i;</pre>
<p>Then the CIL instruction generated for line 2 will be <em>conv.u1</em>, which tells the CIL runtime to convert whatever is at the top of the stack into a <em>u1</em>, which is the same as the C# <em>byte </em>type.</p>
<p>Simple.</p>
<p>Now, if you had this C#:</p>
<pre class="csharp"><a href="http://www.google.com/search?q=checked+msdn.microsoft.com" onclick="javascript:pageTracker._trackPageview('/outbound/article/www.google.com');"><span style="color: #008000;">checked</span></a> <span style="color: #000000;">&#123;</span>
  <span style="color: #FF0000;">int</span> i = ...
  <span style="color: #FF0000;">byte</span> b = <span style="color: #000000;">&#40;</span><span style="color: #FF0000;">byte</span><span style="color: #000000;">&#41;</span>i;
<span style="color: #000000;">&#125;</span></pre>
<p>Then the CIL instruction generated for line 3 will be <em>conv.ovf.u1</em>, which tells the CIL runtime to do the same conversion as last time, but do an overflow check as well, so if <em>i</em> doesn't fit in to a <em>byte</em> then an <em>OverflowException </em>will be thrown.</p>
<p>Still simple.</p>
<p>And, futhermore, if you have this in C#:</p>
<pre class="csharp"><a href="http://www.google.com/search?q=checked+msdn.microsoft.com" onclick="javascript:pageTracker._trackPageview('/outbound/article/www.google.com');"><span style="color: #008000;">checked</span></a> <span style="color: #000000;">&#123;</span>
  <span style="color: #FF0000;">uint</span> i = ...
  <span style="color: #FF0000;">byte</span> b = <span style="color: #000000;">&#40;</span><span style="color: #FF0000;">byte</span><span style="color: #000000;">&#41;</span>i;
<span style="color: #000000;">&#125;</span></pre>
<p>Then the CIL for line 3 will be <em>conv.ovf.u1.un</em>, which tells the CIL runtime to do the another checked conversion, but this time it is told that the source type is <em>unsigned </em>(the <em>.un</em> part of the CIL instruction).</p>
<p>Which still looks well, good, obvious and still simple.</p>
<p>But the thing is - <em>it just isn't needed.</em></p>
<p>As part of the JIT, the runtime has to do a full stack analysis, and as part of that stack analysis the runtime will already know <em>exactly what type</em> is in the source stack entry. Therefore it can figure out whether it's a <em>signed </em>or <em>unsigned int</em> without any help from the CIL instruction.</p>
<p>And because there is a very small range of types that are allowed to be used as the operand to these conversion instructions, and the range of supported instructions is fixed (i.e. no extensibility is allowed), I cannot think of any situation where theses <em>conv.ovf.&lt;to type&gt;.un</em> instructions would actually be needed. The runtime could always just use the <em>conv.ovf.&lt;to type&gt;</em> instruction and figure out if it's <em>signed </em>or <em>unsigned </em>from the stack analysis.</p>
]]></content:encoded>
			<wfw:commentRss>http://dotnetanywhere.org/index.php/2009/03/inside-net-the-mystery-of-convovfun%e2%80%a6/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Inside .NET - 2 byte compare op-codes</title>
		<link>http://dotnetanywhere.org/index.php/2009/03/inside-net-2-byte-compare-op-codes/</link>
		<comments>http://dotnetanywhere.org/index.php/2009/03/inside-net-2-byte-compare-op-codes/#comments</comments>
		<pubDate>Wed, 25 Mar 2009 12:00:11 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[Inside .NET]]></category>

		<guid isPermaLink="false">http://dotnetanywhere.org/?p=175</guid>
		<description><![CDATA[A small anomaly of the CIL instruction set is why the ceq, cgt, cgt.un, clt and clt.un instructions are 2-byte op-codes.
2-byte op-codes would normally be used for instructions that are not commonly used, as they (obviously) take up more space than 1-byte op-codes.
But the group of op-codes listed above are commonly used, and there appears [...]]]></description>
			<content:encoded><![CDATA[<p>A small anomaly of the CIL instruction set is why the <em>ceq</em>, <em>cgt</em>, <em>cgt.un</em>, <em>clt</em> and <em>clt.un</em> instructions are 2-byte op-codes.</p>
<p>2-byte op-codes would normally be used for instructions that are not commonly used, as they (obviously) take up more space than 1-byte op-codes.</p>
<p>But the group of op-codes listed above <em>are </em>commonly used, <em>and </em>there appears to be plenty of space in the 1-byte op-code space for them to only use 1 byte - e.g. 0xBB - 0xBF.</p>
<p>So why do they use 2 bytes?</p>
]]></content:encoded>
			<wfw:commentRss>http://dotnetanywhere.org/index.php/2009/03/inside-net-2-byte-compare-op-codes/feed/</wfw:commentRss>
		</item>
		<item>
		<title>The Problem with Platform Invoke</title>
		<link>http://dotnetanywhere.org/index.php/2009/03/the-problem-with-platform-invoke/</link>
		<comments>http://dotnetanywhere.org/index.php/2009/03/the-problem-with-platform-invoke/#comments</comments>
		<pubDate>Mon, 23 Mar 2009 12:00:25 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[Dot Net Anywhere]]></category>

		<guid isPermaLink="false">http://dotnetanywhere.org/?p=99</guid>
		<description><![CDATA[Platform Invoke (P/Invoke) is where you call a function in a native DLL/SO library from managed code. In C# this appears very simple - you just write something like this:
&#91;DllImport&#40;&#34;MyLibrary&#34;&#41;&#93;
extern public static int PerformNativeOperation&#40;int x, int y&#41;;
Which allows you to call the PerformNativeOperation() function as if it were a standard C# function, but it's actually [...]]]></description>
			<content:encoded><![CDATA[<p>Platform Invoke (P/Invoke) is where you call a function in a native DLL/SO library from managed code. In C# this appears very simple - you just write something like this:</p>
<pre class="csharp"><span style="color: #000000;">&#91;</span>DllImport<span style="color: #000000;">&#40;</span><span style="color: #808080;">&quot;MyLibrary&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#93;</span>
<span style="color: #0600FF;">extern</span> <span style="color: #0600FF;">public</span> <span style="color: #0600FF;">static</span> <span style="color: #FF0000;">int</span> PerformNativeOperation<span style="color: #000000;">&#40;</span><span style="color: #FF0000;">int</span> x, <span style="color: #FF0000;">int</span> y<span style="color: #000000;">&#41;</span>;</pre>
<p>Which allows you to call the <em>PerformNativeOperation()</em> function as if it were a standard C# function, but it's actually calling the <em>PerformNativeOperation()</em> function in the library <em>MyLibrary.dll</em> or <em>MyLibrary.so</em> (depending on OS).</p>
<p>There are a number of steps Dot Net Anywhere performs to allow this call to happen:</p>
<ol>
<li>Find and load the native library, if it isn't loaded already.</li>
<li>Find the requested function within the library.</li>
<li>Marshall the call arguments from .NET in-memory representations to native in-memory representations.</li>
<li>Call the function using the correct calling conventions for the platform.</li>
<li>Marshall the call return argument from the native in-memory representation to the .NET in-memory representation.</li>
<li>Free any temporary memory used during marshalling operations.</li>
</ol>
<p>When it comes to cross-platform compatibility, it's step 4 that causes the problem. Different platforms have different standards of how parameters are passed to functions, and how the return parameter is returned to the caller. For example:</p>
<ul>
<li> On x86 the return argument is passed in the EAX register (if it's 32-bits or less); but the MIPS platform doesn't have an EAX register so a different register is used.</li>
<li>On x86 Win32 using STDCALL the arguments are pushed on the stack from right to left; on MIPS some arguments are passed in registers, others on the stack, with fairly complex rules to follow depending each parameter size.</li>
</ul>
<p>Which makes writing the code to call arbitrary functions at run-time a little complex, especially if not wanting to write specific code for each platform.</p>
<p>Because this is a common problem, there is already a solution - <a href="http://sourceware.org/libffi/" onclick="javascript:pageTracker._trackPageview('/outbound/article/sourceware.org');">libffi</a> - which does all this for you, which is excellent. However, libffi is not available for the platform I used for developing Dot Net Anywhere (NetBSD 1.5, x86 and MIPS), so it is not used.</p>
<p>The solution can be seen in PInvoke.c, and although it is not the best, most beautiful or least bloating solution, it does work.</p>
<p>It defines function types for all combinations of int32, single and double precision floating-point arguments and return types, and then just calls the correct function prototype using the address of the function in the native library. Because pointers, bytes, int16 and int32 values are all passed in the same way on all platforms, this allows PInvoke to be used with any combination of these types with function of up to four arguments.</p>
<p>Neat - but not particularly good.</p>
<p>So in a future release Dot Net Anywhere will probably support the option of using libffi instead.</p>
]]></content:encoded>
			<wfw:commentRss>http://dotnetanywhere.org/index.php/2009/03/the-problem-with-platform-invoke/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Inside .NET - Partially Constructed Generic Types</title>
		<link>http://dotnetanywhere.org/index.php/2009/03/inside-net-partially-constructed-generic-types/</link>
		<comments>http://dotnetanywhere.org/index.php/2009/03/inside-net-partially-constructed-generic-types/#comments</comments>
		<pubDate>Fri, 20 Mar 2009 12:00:35 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[Inside .NET]]></category>

		<guid isPermaLink="false">http://dotnetanywhere.org/?p=102</guid>
		<description><![CDATA[Given these class:
class B&#60;T, U&#62; &#123;
&#125;
&#160;
class D : B&#60;int, string&#62; &#123;
&#125;
&#160;
class E&#60;T&#62; : B&#60;T, string&#62; &#123;
&#125;
The result of:
typeof&#40;B&#60;,&#62;&#41;
Is a generic type definition, which can be used to make a fully constructed type using Type.MakeGenericType(typeT,typeU).
The result of:
typeof&#40;D&#41;.BaseType
Is a fully constructed generic type: B&#60;int,string&#62;
But what's the result of:
typeof&#40;E&#60;&#62;&#41;.BaseType
It's a half-constructed type: B&#60;T, string&#62;
Obviously, you can't instantiate an [...]]]></description>
			<content:encoded><![CDATA[<p>Given these class:</p>
<pre class="csharp"><span style="color: #FF0000;">class</span> B&lt;T, U&gt; <span style="color: #000000;">&#123;</span>
<span style="color: #000000;">&#125;</span>
&nbsp;
<span style="color: #FF0000;">class</span> D : B&lt;int, string&gt; <span style="color: #000000;">&#123;</span>
<span style="color: #000000;">&#125;</span>
&nbsp;
<span style="color: #FF0000;">class</span> E&lt;T&gt; : B&lt;T, string&gt; <span style="color: #000000;">&#123;</span>
<span style="color: #000000;">&#125;</span></pre>
<p>The result of:</p>
<pre class="csharp"><a href="http://www.google.com/search?q=typeof+msdn.microsoft.com" onclick="javascript:pageTracker._trackPageview('/outbound/article/www.google.com');"><span style="color: #008000;">typeof</span></a><span style="color: #000000;">&#40;</span>B&lt;,&gt;<span style="color: #000000;">&#41;</span></pre>
<p>Is a generic type definition, which can be used to make a fully constructed type using <em>Type.MakeGenericType(typeT,typeU)</em>.</p>
<p>The result of:</p>
<pre class="csharp"><a href="http://www.google.com/search?q=typeof+msdn.microsoft.com" onclick="javascript:pageTracker._trackPageview('/outbound/article/www.google.com');"><span style="color: #008000;">typeof</span></a><span style="color: #000000;">&#40;</span>D<span style="color: #000000;">&#41;</span>.<span style="color: #0000FF;">BaseType</span></pre>
<p>Is a fully constructed generic type: <em>B&lt;int,string&gt;</em></p>
<p>But what's the result of:</p>
<pre class="csharp"><a href="http://www.google.com/search?q=typeof+msdn.microsoft.com" onclick="javascript:pageTracker._trackPageview('/outbound/article/www.google.com');"><span style="color: #008000;">typeof</span></a><span style="color: #000000;">&#40;</span>E&lt;&gt;<span style="color: #000000;">&#41;</span>.<span style="color: #0000FF;">BaseType</span></pre>
<p>It's a half-constructed type: <em>B&lt;T, string&gt;</em></p>
<p>Obviously, you can't instantiate an object of this type, as <em>T</em> is undefined; but you might expect that you could call <em>MakeGenericType(typeT)</em> with a single parameter, which will make a fully constructed type. But you can't.</p>
<p>Type has two properties that together tell you what kind of generic type you've got:</p>
<ul>
<li><em>Type.IsGenericTypeDefinition</em></li>
<li><em>Type.ContainsGenericParameters</em></li>
</ul>
<p>You can only make a fully constructed type from a type where <em>IsGenericTypeDefinition</em> is true, and you can only instantiate a class where <em>ContainsGenericParameters</em> is false.</p>
<p>Which leaves the middle ground, which is inhabited by these half-constructed types, where <em>IsGenericTypeDefinition</em> is false, but <em>ContainsGenericParameters</em> is true, so they can't be instantiated, and they can't be used to make fully-constructed generic types.</p>
<p>Although you can call <em>GetGenericTypeDefinition()</em>, which returns what you would expect, and you can also call <em>GetGenericArguments()</em>, which when called on type <em>B&lt;T, string&gt;</em> returns the second type argument as string, as expected, but the first type argument is returned as <em>T</em>, with its <em>Type.IsGenericParameter</em> property set to true. The base class of this type <em>T</em> is the base-class constraint of the type parameter (note that this does not include any interface constraints).</p>
<p>One question this leaves me with is why I can't call <em>MakeGenericType()</em> on a half-constructed generic type, if I provide the missing type argument(s)...</p>
]]></content:encoded>
			<wfw:commentRss>http://dotnetanywhere.org/index.php/2009/03/inside-net-partially-constructed-generic-types/feed/</wfw:commentRss>
		</item>
		<item>
		<title>LINQ, Bugs and Dot Net Anywhere</title>
		<link>http://dotnetanywhere.org/index.php/2009/03/linq-bugs-and-dot-net-anywhere/</link>
		<comments>http://dotnetanywhere.org/index.php/2009/03/linq-bugs-and-dot-net-anywhere/#comments</comments>
		<pubDate>Wed, 18 Mar 2009 12:00:29 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[Bugs]]></category>

		<category><![CDATA[Dot Net Anywhere]]></category>

		<guid isPermaLink="false">http://dotnetanywhere.org/?p=145</guid>
		<description><![CDATA[The next version of Dot Net Anywhere, 0.2.5 , is going to support the beginnings of LINQ to Objects. That is, the LINQ extension methods on IEnumerable&#60;T&#62; are all (or at least, mostly) going to be implemented.
You probably realise that LINQ relies heavily on:

Lambda functions - which are transformed into methods and delegates.
Iterators - using [...]]]></description>
			<content:encoded><![CDATA[<p>The next version of Dot Net Anywhere, 0.2.5 , is going to support the beginnings of LINQ to Objects. That is, the LINQ extension methods on <em>IEnumerable&lt;T&gt;</em> are all (or at least, mostly) going to be implemented.</p>
<p>You probably realise that LINQ relies heavily on:</p>
<ol>
<li>Lambda functions - which are transformed into methods and delegates.</li>
<li>Iterators - using <em>yield return</em>.</li>
<li>Generic methods.</li>
</ol>
<p>Theoretically Dot Net Anywhere should have already supported all of these, and should have functioned perfectly when using LINQ with no changes needed to the core interpreter.</p>
<p>In practice, the lambda functions (delegates) and iterators had no problems, but - as you may have guessed -  quite a number of bugs regarding generics were thrown up.</p>
<p>So, if you've stumbled across any of these bugs yourself:</p>
<ul>
<li>Static fields in generic types didn't work.</li>
<li>Overriding virtual methods in generic types failed.</li>
<li>Generic methods just didn't really work at all - sorry.</li>
<li>References to generic methods in external assemblies were looked up incorrectly.</li>
</ul>
<p>Then don't panic - version 0.2.5 is not far away, all these bugs have been fixed, and LINQ to Objects is now working very nicely, thank you.</p>
]]></content:encoded>
			<wfw:commentRss>http://dotnetanywhere.org/index.php/2009/03/linq-bugs-and-dot-net-anywhere/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Speedy Exceptions</title>
		<link>http://dotnetanywhere.org/index.php/2009/03/speedy-exceptions/</link>
		<comments>http://dotnetanywhere.org/index.php/2009/03/speedy-exceptions/#comments</comments>
		<pubDate>Mon, 16 Mar 2009 12:00:34 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[Dot Net Anywhere]]></category>

		<guid isPermaLink="false">http://dotnetanywhere.org/?p=91</guid>
		<description><![CDATA[Throwing exceptions is sloooooow.
We all learn as novice .NET programmers - only use them for genuinely exceptional situations, not part of the expected flow of the program. Catching a thrown exception can be many thousands of times slower than normal program flow, so use them with care.
All excellent advice.
However, in Dot Net Anywhere, exceptions are [...]]]></description>
			<content:encoded><![CDATA[<p>Throwing exceptions is sloooooow.</p>
<p>We all learn as novice .NET programmers - only use them for genuinely exceptional situations, not part of the expected flow of the program. Catching a thrown exception can be many thousands of times slower than normal program flow, so <em>use them with care.</em></p>
<p>All excellent advice.</p>
<p>However, in Dot Net Anywhere, exceptions are fast - see JIT_Execute.c for details.</p>
<p>Of couse, <em>fast </em>is relative. Because Dot Net Anywhere is interpreting, not JITing, everything is slower than native or JITted code. But exception program flow is no slower than normal program flow.</p>
<p>So if you've designed your software to use exceptions for all function return value passing, then Dot Net Anywhere might be the answer to your performance problems!</p>
<p>Although it won't solve your problems regarding misunderstanding exception use.</p>
]]></content:encoded>
			<wfw:commentRss>http://dotnetanywhere.org/index.php/2009/03/speedy-exceptions/feed/</wfw:commentRss>
		</item>
		<item>
		<title>C# Null pass-through extension method</title>
		<link>http://dotnetanywhere.org/index.php/2009/03/c-null-pass-through-extension-method/</link>
		<comments>http://dotnetanywhere.org/index.php/2009/03/c-null-pass-through-extension-method/#comments</comments>
		<pubDate>Sat, 14 Mar 2009 12:00:49 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[Coding]]></category>

		<guid isPermaLink="false">http://dotnetanywhere.org/?p=72</guid>
		<description><![CDATA[If you have a class like this:
class C &#123;
  string str;
&#125;
And you want to do this:
C c = ...
int len = c.str.Length;
Then you have to be careful that c is not null and c.str is not null, or exceptions will fly.
So you end up doing this:
C c = ...
int len = &#40;c == null&#41; [...]]]></description>
			<content:encoded><![CDATA[<p>If you have a class like this:</p>
<pre class="csharp"><span style="color: #FF0000;">class</span> C <span style="color: #000000;">&#123;</span>
  <span style="color: #FF0000;">string</span> str;
<span style="color: #000000;">&#125;</span></pre>
<p>And you want to do this:</p>
<pre class="csharp">C c = ...
<span style="color: #FF0000;">int</span> len = c.<span style="color: #0000FF;">str</span>.<span style="color: #0000FF;">Length</span>;</pre>
<p>Then you have to be careful that c is not null and c.str is not null, or exceptions will fly.</p>
<p>So you end up doing this:</p>
<pre class="csharp">C c = ...
<span style="color: #FF0000;">int</span> len = <span style="color: #000000;">&#40;</span>c == <span style="color: #0600FF;">null</span><span style="color: #000000;">&#41;</span> ? <span style="color: #FF0000;">0</span> : <span style="color: #000000;">&#40;</span><span style="color: #000000;">&#40;</span>c.<span style="color: #0000FF;">str</span> == <span style="color: #0600FF;">null</span><span style="color: #000000;">&#41;</span> ? <span style="color: #FF0000;">0</span> : c.<span style="color: #0000FF;">str</span>.<span style="color: #0000FF;">Length</span><span style="color: #000000;">&#41;</span>;</pre>
<p>Which is ugly and painful if you've got lots of these situations in your code.</p>
<p>Enter the <em><strong>Null pass-through extension method</strong></em>...</p>
<pre class="csharp"><span style="color: #0600FF;">public</span> <span style="color: #0600FF;">static</span> TResult NullThru&lt;T, TResult&gt;<span style="color: #000000;">&#40;</span><span style="color: #0600FF;">this</span> T o, Func&lt;T, TResult&gt; fn<span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span>
  <span style="color: #0600FF;">return</span> <span style="color: #000000;">&#40;</span>o == <span style="color: #0600FF;">null</span><span style="color: #000000;">&#41;</span> ? <span style="color: #0600FF;">default</span><span style="color: #000000;">&#40;</span>TResult<span style="color: #000000;">&#41;</span> : fn<span style="color: #000000;">&#40;</span>o<span style="color: #000000;">&#41;</span>;
<span style="color: #000000;">&#125;</span></pre>
<p>And suddenly all your troubles are behind you. Simply write this:</p>
<pre class="csharp">C c = ...
<span style="color: #FF0000;">int</span> len = c.<span style="color: #0000FF;">NullThru</span><span style="color: #000000;">&#40;</span>x =&gt; x.<span style="color: #0000FF;">str</span>.<span style="color: #0000FF;">NullThru</span><span style="color: #000000;">&#40;</span>y =&gt; y.<span style="color: #0000FF;">Length</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span>;</pre>
<p>OK, so it's not the most beautiful code you've ever seen, but it's surely better than the alternative.</p>
]]></content:encoded>
			<wfw:commentRss>http://dotnetanywhere.org/index.php/2009/03/c-null-pass-through-extension-method/feed/</wfw:commentRss>
		</item>
	</channel>
</rss>
