<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://aspadvice.com/utility/FeedStylesheets/atom.xsl" media="screen"?><feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en"><title type="html">C# Nuggets</title><subtitle type="html" /><id>http://aspadvice.com/blogs/rbirkby/atom.aspx</id><link rel="alternate" type="text/html" href="http://aspadvice.com/blogs/rbirkby/default.aspx" /><link rel="self" type="application/atom+xml" href="http://aspadvice.com/blogs/rbirkby/atom.aspx" /><generator uri="http://communityserver.org" version="2.1.60809.935">Community Server</generator><updated>2006-11-01T08:49:00Z</updated><entry><title>Concurrency bugs in the CLR JIT</title><link rel="alternate" type="text/html" href="http://aspadvice.com/blogs/rbirkby/archive/2009/01/10/Concurrency-bugs-in-the-CLR-JIT.aspx" /><id>http://aspadvice.com/blogs/rbirkby/archive/2009/01/10/Concurrency-bugs-in-the-CLR-JIT.aspx</id><published>2009-01-10T09:08:00Z</published><updated>2009-01-10T09:08:00Z</updated><content type="html">&lt;p&gt;A recent paper by Microsoft research has discovered a concurrency bug in the .Net JIT. They used the F# &lt;a href="http://research.microsoft.com/en-us/um/redmond/projects/z3/"&gt;theorem prover&lt;/a&gt; to analyze the JIT il-&amp;gt;x86 transformations which were previously thought to comply with the &lt;a href="http://blogs.msdn.com/jaredpar/archive/2008/01/17/clr-memory-model.aspx"&gt;.Net memory model&lt;/a&gt;. These bugs show that writing correct concurrent (multi-threaded) code is &lt;a href="http://www.ddj.com/cpp/210600279"&gt;hard&lt;/a&gt; - and in a multi-core world we need to find a way to provably write correct code.&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&amp;quot;This discovery means that the current CLR JIT 
compiler for the x86 platform is not correct; it will be ﬁxed in the 
future by strictly emitting locked instructions for all volatile stores&amp;quot;&lt;/p&gt;&lt;p&gt;- &lt;a href="http://research.microsoft.com/apps/pubs/default.aspx?id=76524"&gt;http://research.microsoft.com/apps/pubs/default.aspx?id=76524 &lt;/a&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;via &lt;a href="http://lambda-the-ultimate.org/node/3159"&gt;LtU &lt;/a&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;div class = "shareblock"&gt;&lt;strong&gt;Share this post:&lt;/strong&gt; &lt;a href = "mailto:?body=Thought you might like this: http://aspadvice.com/blogs/rbirkby/archive/2009/01/10/Concurrency-bugs-in-the-CLR-JIT.aspx&amp;amp;;subject=Concurrency+bugs+in+the+CLR+JIT" target="_blank" title = "Post http://aspadvice.com/blogs/rbirkby/archive/2009/01/10/Concurrency-bugs-in-the-CLR-JIT.aspx"&gt;email it!&lt;/a&gt; |  &lt;a href = "http://del.icio.us/post?url=http://aspadvice.com/blogs/rbirkby/archive/2009/01/10/Concurrency-bugs-in-the-CLR-JIT.aspx&amp;amp;;title=Concurrency+bugs+in+the+CLR+JIT" target="_blank" title = "Post http://aspadvice.com/blogs/rbirkby/archive/2009/01/10/Concurrency-bugs-in-the-CLR-JIT.aspx"&gt;bookmark it!&lt;/a&gt; |  &lt;a href = "http://www.digg.com/submit?url=http://aspadvice.com/blogs/rbirkby/archive/2009/01/10/Concurrency-bugs-in-the-CLR-JIT.aspx&amp;amp;;phase=2" target="_blank" title = "Post http://aspadvice.com/blogs/rbirkby/archive/2009/01/10/Concurrency-bugs-in-the-CLR-JIT.aspx"&gt;digg it!&lt;/a&gt; |  &lt;a href = "http://reddit.com/submit?url=http://aspadvice.com/blogs/rbirkby/archive/2009/01/10/Concurrency-bugs-in-the-CLR-JIT.aspx&amp;amp;title=Concurrency+bugs+in+the+CLR+JIT" target="_blank" title = "Post http://aspadvice.com/blogs/rbirkby/archive/2009/01/10/Concurrency-bugs-in-the-CLR-JIT.aspx"&gt;reddit!&lt;/a&gt; |  &lt;a href = "http://www.dotnetkicks.com/submit/?url=http://aspadvice.com/blogs/rbirkby/archive/2009/01/10/Concurrency-bugs-in-the-CLR-JIT.aspx&amp;amp;;title=Concurrency+bugs+in+the+CLR+JIT" target="_blank" title = "Post http://aspadvice.com/blogs/rbirkby/archive/2009/01/10/Concurrency-bugs-in-the-CLR-JIT.aspx"&gt;kick it!&lt;/a&gt; |  &lt;a href = "https://favorites.live.com/quickadd.aspx?marklet=1&amp;amp;;mkt=en-us&amp;amp;;url=http://aspadvice.com/blogs/rbirkby/archive/2009/01/10/Concurrency-bugs-in-the-CLR-JIT.aspx&amp;amp;;title=Concurrency+bugs+in+the+CLR+JIT&amp;amp;;top=1" target="_blank" title = "Post http://aspadvice.com/blogs/rbirkby/archive/2009/01/10/Concurrency-bugs-in-the-CLR-JIT.aspx"&gt;live it!&lt;/a&gt;&lt;/div&gt;&lt;img src="http://aspadvice.com/aggbug.aspx?PostID=49999" width="1" height="1"&gt;</content><author><name>rbirkby</name><uri>http://aspadvice.com/members/rbirkby.aspx</uri></author><category term="dotnet" scheme="http://aspadvice.com/blogs/rbirkby/archive/tags/dotnet/default.aspx" /><category term="validation" scheme="http://aspadvice.com/blogs/rbirkby/archive/tags/validation/default.aspx" /><category term="memory" scheme="http://aspadvice.com/blogs/rbirkby/archive/tags/memory/default.aspx" /><category term=".Net" scheme="http://aspadvice.com/blogs/rbirkby/archive/tags/.Net/default.aspx" /></entry><entry><title>JavaScript performance</title><link rel="alternate" type="text/html" href="http://aspadvice.com/blogs/rbirkby/archive/2008/09/10/JavaScript-performance.aspx" /><id>http://aspadvice.com/blogs/rbirkby/archive/2008/09/10/JavaScript-performance.aspx</id><published>2008-09-10T19:27:00Z</published><updated>2008-09-10T19:27:00Z</updated><content type="html">&lt;p&gt;Recently, the browser vendors have been making serious gains in JavaScript performance. A week ago, Google launched their web browser called &lt;a href="http://www.google.com/chrome"&gt;Chrome&lt;/a&gt; with much fanfare. Chrome is based on the &lt;a href="http://webkit.org/"&gt;WebKit&lt;/a&gt; rendering engine which underpins Apple&amp;#39;s Safari browser and the iPhone browser, but using a brand new Just-in-time (JIT) compiling JavaScript virtual machine. This JIT virtual machine is called &lt;a href="http://code.google.com/p/v8/"&gt;V8&lt;/a&gt; and was created over the past 18 months by a team led by Lars Bak who created the Java Hotspot virtual machine. The Chrome browser is Open Source in the form of code going by the name &lt;a href="http://code.google.com/chromium/"&gt;Chromium&lt;/a&gt;.&lt;br /&gt;&lt;/p&gt;&lt;p&gt;Interestingly, it turns out that Apple and Mozilla have spent the past few months building JITs for their JavaScript engines. Apple have an engine called JavaScriptCore, while Mozilla have an engine called SpiderMonkey. The JITs they have built are based on these existing engines but have been given new names. Apple&amp;#39;s is called Squirrelfish-Extreme (SFX) while Mozilla&amp;#39;s is called &lt;a href="http://weblogs.mozillazine.org/roadmap/archives/2008/08/tracemonkey_javascript_lightsp.html"&gt;TraceMonkey&lt;/a&gt;. &lt;/p&gt;&lt;p&gt;Each of these engines seem to have unique features. V8 has what are called &amp;#39;&lt;a href="http://code.google.com/apis/v8/design.html#prop_access"&gt;hidden class transitions&lt;/a&gt;&amp;#39; which are simply class definitions inferred at runtime. As class definitions change infrequently, this means that V8 has very fast class member lookup. TraceMonkey uses a novel technique called &lt;a href="http://andreasgal.com/2008/08/22/tracing-the-web/"&gt;Tracing&lt;/a&gt;. Instead of compiling a method &amp;#39;just in time&amp;#39; and then executing the compiled machine code, TraceMonkey interprets everything up until it detects a loop. At this point, it will compile the loop. So whereas traditional JIT compiling will compile code which potentially never gets run, Tracing will only ever compile code that gets run. Webkit&amp;#39;s SFX has borrowed a trick from .Net and will compile any regular expressions into machine code. Their Webkit Regular Expression Compiler (WREC) is why SFX beats everyone else hands down on regular expression performance.&lt;br /&gt;&lt;/p&gt;&lt;p&gt;It has been a hectic 2 weeks. In that time, there have been various claims that first TraceMonkey was the fastest. Then V8 claimed they were the fastest. And over the past couple of days there have been claims that Webkit&amp;#39;s SFX is the fastest. So who is right? Well, many factors are involved, and all three engines are still very much in active development. So the lead could shift around yet again.&lt;/p&gt;&lt;p&gt;To try and get a handle on the current state, I ran a benchmark called &lt;a href="http://www2.webkit.org/perf/sunspider-0.9/sunspider.html"&gt;SunSpider&lt;/a&gt;. This is a JavaScript benchmark which does not test HTML DOM performance, therefore giving a true picture of pure JavaScript virtual machine speed.&lt;/p&gt;&lt;p&gt;The headline figure is: &lt;br /&gt;&lt;/p&gt;&lt;blockquote&gt;&lt;b&gt;&lt;/b&gt;Webkit (ie Safari) nightly builds are 46% faster than Firefox nightly builds. Chrome is 7% faster than Firefox.&lt;br /&gt;&lt;/blockquote&gt;&lt;p&gt;However, the above statement does not give the whole picture. It appears that Safari&amp;#39;s SFX JIT is not fully enabled on Windows. &lt;a href="http://trac.webkit.org/changeset/36226"&gt;Recent Webkit checkins&lt;/a&gt; indicate that the Windows JIT is still being worked on. As Chrome is currently a Windows-only browser, it is impossible to compare Webkit-SFX with Chrome. Therefore, the 46% figure advantage Webkit has over firefox was obtained on OSX 10.5.&lt;/p&gt;&lt;p&gt;Microsoft have been working on a JavaScript JIT for a couple of years now. It&amp;#39;s called &lt;a href="http://blogs.msdn.com/jscript/archive/2007/05/04/managed-jscript-announced.aspx"&gt;Managed JScript&lt;/a&gt; and runs on top of the Dynamic Language Runtime (DLR). However, there has been no news from this project for a long while and it certainly won&amp;#39;t be included in IE8. The old ActiveScripting-based JScript engine in IE8 has been tweaked a little for performance but lags a long way behind the other vendors. This is a real shame as Microsoft have some world-class virtual machine architects. &lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;b&gt;&lt;br /&gt;Benchmark&lt;/b&gt;: Sunspider 0.9&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Windows XP SP2 results (Core2 Duo, T7300/2Ghz)&lt;br /&gt;&lt;/b&gt;Chromium: 2747.8ms +/- 2%&lt;br /&gt;Firefox: 2941.4ms +/- 4.3% (1.07x as slow)&lt;br /&gt;webkit: 3124.6ms +/-3.3% (1.14x as slow)&lt;br /&gt;
&lt;br /&gt;&lt;b&gt;OSX 10.5.4 results (Core2 Duo, 2.8Ghz)&lt;/b&gt;&lt;br /&gt;&lt;a href="http://www2.webkit.org/perf/sunspider-0.9/sunspider-results.html?{%223d-cube%22:[51,49,51,52,50],%223d-morph%22:[30,27,27,28,28],%223d-raytrace%22:[38,37,36,38,35],%22access-binary-trees%22:[43,41,42,46,41],%22access-fannkuch%22:[69,71,137,83,71],%22access-nbody%22:[30,29,31,31,30],%22access-nsieve%22:[12,12,11,12,14],%22bitops-3bit-bits-in-byte%22:[1,1,2,1,2],%22bitops-bits-in-byte%22:[8,9,9,9,9],%22bitops-bitwise-and%22:[3,12,11,11,12],%22bitops-nsieve-bits%22:[22,22,22,22,22],%22controlflow-recursive%22:[30,30,30,29,31],%22crypto-aes%22:[32,30,31,32,31],%22crypto-md5%22:[22,29,31,22,30],%22crypto-sha1%22:[8,11,8,9,8],%22date-format-tofte%22:[138,138,139,138,137],%22date-format-xparb%22:[119,120,121,119,123],%22math-cordic%22:[19,24,19,18,18],%22math-partial-sums%22:[12,13,12,12,11],%22math-spectral-norm%22:[5,6,6,6,6],%22regexp-dna%22:[217,214,213,215,212],%22string-base64%22:[19,21,20,18,23],%22string-fasta%22:[80,80,83,79,80],%22string-tagcloud%22:[103,103,101,106,102],%22string-unpack-code%22:[168,167,168,169,168],%22string-validate-input%22:[59,55,52,52,52]}"&gt;Firefox&lt;/a&gt;: 1361ms +/- 2.7%&lt;br /&gt;&lt;a href="http://www2.webkit.org/perf/sunspider-0.9/sunspider-results.html?%7B%223d-cube%22:%5B47,47,50,48,46%5D,%223d-morph%22:%5B55,56,57,54,56%5D,%223d-raytrace%22:%5B50,51,52,52,51%5D,%22access-binary-trees%22:%5B21,20,25,21,22%5D,%22access-fannkuch%22:%5B18,22,17,18,18%5D,%22access-nbody%22:%5B55,53,57,54,56%5D,%22access-nsieve%22:%5B17,16,17,17,18%5D,%22bitops-3bit-bits-in-byte%22:%5B10,11,11,11,10%5D,%22bitops-bits-in-byte%22:%5B12,11,13,12,12%5D,%22bitops-bitwise-and%22:%5B25,26,30,24,24%5D,%22bitops-nsieve-bits%22:%5B15,16,17,16,16%5D,%22controlflow-recursive%22:%5B15,15,15,14,15%5D,%22crypto-aes%22:%5B15,14,15,14,15%5D,%22crypto-md5%22:%5B23,24,23,19,22%5D,%22crypto-sha1%22:%5B20,22,20,19,21%5D,%22date-format-tofte%22:%5B42,41,39,41,42%5D,%22date-format-xparb%22:%5B47,48,47,45,45%5D,%22math-cordic%22:%5B37,34,34,34,33%5D,%22math-partial-sums%22:%5B59,57,57,58,59%5D,%22math-spectral-norm%22:%5B24,23,26,23,23%5D,%22regexp-dna%22:%5B36,34,39,36,37%5D,%22string-base64%22:%5B25,22,21,23,22%5D,%22string-fasta%22:%5B56,57,56,55,57%5D,%22string-tagcloud%22:%5B90,83,84,82,84%5D,%22string-unpack-code%22:%5B86,75,76,75,75%5D,%22string-validate-input%22:%5B46,41,54,49,45%5D%7D"&gt;webkit&lt;/a&gt;: 931ms +/- 2.3% (1.46x as fast)&lt;br /&gt;&lt;br /&gt;Browsers used were the latest nightlies:&lt;br /&gt;
&lt;br /&gt;
Chromium 0.2.152.0&lt;br /&gt;Win32 Firefox 3.1b1pre Gecko/20080910043000 (Content JIT=on)&lt;br /&gt;OSX Firefox 3.1b1pre Gecko/20080910020330 (Content JIT=on)&lt;br /&gt;Webkit r36309 using Squirrelfish-Extreme (SFX)&lt;/p&gt;&lt;b&gt;&lt;/b&gt;
&lt;div class = "shareblock"&gt;&lt;strong&gt;Share this post:&lt;/strong&gt; &lt;a href = "mailto:?body=Thought you might like this: http://aspadvice.com/blogs/rbirkby/archive/2008/09/10/JavaScript-performance.aspx&amp;amp;;subject=JavaScript+performance" target="_blank" title = "Post http://aspadvice.com/blogs/rbirkby/archive/2008/09/10/JavaScript-performance.aspx"&gt;email it!&lt;/a&gt; |  &lt;a href = "http://del.icio.us/post?url=http://aspadvice.com/blogs/rbirkby/archive/2008/09/10/JavaScript-performance.aspx&amp;amp;;title=JavaScript+performance" target="_blank" title = "Post http://aspadvice.com/blogs/rbirkby/archive/2008/09/10/JavaScript-performance.aspx"&gt;bookmark it!&lt;/a&gt; |  &lt;a href = "http://www.digg.com/submit?url=http://aspadvice.com/blogs/rbirkby/archive/2008/09/10/JavaScript-performance.aspx&amp;amp;;phase=2" target="_blank" title = "Post http://aspadvice.com/blogs/rbirkby/archive/2008/09/10/JavaScript-performance.aspx"&gt;digg it!&lt;/a&gt; |  &lt;a href = "http://reddit.com/submit?url=http://aspadvice.com/blogs/rbirkby/archive/2008/09/10/JavaScript-performance.aspx&amp;amp;title=JavaScript+performance" target="_blank" title = "Post http://aspadvice.com/blogs/rbirkby/archive/2008/09/10/JavaScript-performance.aspx"&gt;reddit!&lt;/a&gt; |  &lt;a href = "http://www.dotnetkicks.com/submit/?url=http://aspadvice.com/blogs/rbirkby/archive/2008/09/10/JavaScript-performance.aspx&amp;amp;;title=JavaScript+performance" target="_blank" title = "Post http://aspadvice.com/blogs/rbirkby/archive/2008/09/10/JavaScript-performance.aspx"&gt;kick it!&lt;/a&gt; |  &lt;a href = "https://favorites.live.com/quickadd.aspx?marklet=1&amp;amp;;mkt=en-us&amp;amp;;url=http://aspadvice.com/blogs/rbirkby/archive/2008/09/10/JavaScript-performance.aspx&amp;amp;;title=JavaScript+performance&amp;amp;;top=1" target="_blank" title = "Post http://aspadvice.com/blogs/rbirkby/archive/2008/09/10/JavaScript-performance.aspx"&gt;live it!&lt;/a&gt;&lt;/div&gt;&lt;img src="http://aspadvice.com/aggbug.aspx?PostID=46218" width="1" height="1"&gt;</content><author><name>rbirkby</name><uri>http://aspadvice.com/members/rbirkby.aspx</uri></author><category term="Javascript" scheme="http://aspadvice.com/blogs/rbirkby/archive/tags/Javascript/default.aspx" /><category term="firefox" scheme="http://aspadvice.com/blogs/rbirkby/archive/tags/firefox/default.aspx" /><category term="sfx" scheme="http://aspadvice.com/blogs/rbirkby/archive/tags/sfx/default.aspx" /><category term="TraceMonkey" scheme="http://aspadvice.com/blogs/rbirkby/archive/tags/TraceMonkey/default.aspx" /><category term="chromium" scheme="http://aspadvice.com/blogs/rbirkby/archive/tags/chromium/default.aspx" /><category term="Squirrelfish" scheme="http://aspadvice.com/blogs/rbirkby/archive/tags/Squirrelfish/default.aspx" /><category term="Chrome" scheme="http://aspadvice.com/blogs/rbirkby/archive/tags/Chrome/default.aspx" /><category term="Sunspider" scheme="http://aspadvice.com/blogs/rbirkby/archive/tags/Sunspider/default.aspx" /><category term="squirrelfishextreme" scheme="http://aspadvice.com/blogs/rbirkby/archive/tags/squirrelfishextreme/default.aspx" /><category term="v8" scheme="http://aspadvice.com/blogs/rbirkby/archive/tags/v8/default.aspx" /><category term="webkit" scheme="http://aspadvice.com/blogs/rbirkby/archive/tags/webkit/default.aspx" /></entry><entry><title>Fixup candidates for .Net v4</title><link rel="alternate" type="text/html" href="http://aspadvice.com/blogs/rbirkby/archive/2008/08/08/Fixup-candidates-for-.Net-v4.aspx" /><id>http://aspadvice.com/blogs/rbirkby/archive/2008/08/08/Fixup-candidates-for-.Net-v4.aspx</id><published>2008-08-08T08:05:00Z</published><updated>2008-08-08T08:05:00Z</updated><content type="html">&lt;p&gt;The C# team has been fairly candid in the features they are considering for C# v4. You just have to look hard enough. We&amp;#39;ll know what they decide on soon enough as the PDC is just around the corner. Declarative &lt;a href="http://channel9.msdn.com/posts/Charles/C-40-Meet-the-Design-Team/"&gt;side-effect free methods&lt;/a&gt;, &lt;a href="http://blogs.msdn.com/ericlippert/archive/tags/Covariance+and+Contravariance/default.aspx"&gt;Contra/covariance&lt;/a&gt; of arguments/return values, Declarative &lt;a href="http://blogs.msdn.com/charlie/archive/2008/01/25/future-focus.aspx"&gt;dynamic dispatch&lt;/a&gt; (VB-style object access). These all sound great. Perhaps I can add a few suggestions of my own not just for C# but for .Net in general:&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;A few ideas for .Net vnext:&lt;br /&gt;&lt;/p&gt;&lt;ul&gt;&lt;li&gt;String.Join should work on IEnumerable&amp;lt;string&amp;gt; not just arrays.&lt;/li&gt;&lt;li&gt;C# enums should be OO just like Java 5.0.&lt;/li&gt;&lt;li&gt;Forget about the ThreadPool. We need a resource-management WorkerPool. Something that manages a task based not just on availability of threads, but of memory and IO. There&amp;#39;s no point in throttling threads if you&amp;#39;re task/agent is memory or IO bound.&lt;/li&gt;&lt;li&gt;C# null propagation (lifted member access). Ian Griffiths has by far the &lt;a href="http://www.interact-sw.co.uk/iangblog/2008/04/13/member-lifting"&gt;best description&lt;/a&gt; I&amp;#39;ve ever seen. I&amp;#39;d love to use something like var x = foo()..bar()..baz()..quux() where the double period (..) means propagate nulls.&lt;/li&gt;&lt;li&gt;Server-side CSS parsing, optimization, minimizing.&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;&amp;nbsp;As for Visual Studio:&lt;/p&gt;&lt;ul&gt;&lt;li&gt;Collaborative Editing (cross network pair-programming). Eclipse does it. SubEthaEdit does it.&lt;/li&gt;&lt;li&gt;Much better JavaScript type inferrence in the IDE.&lt;/li&gt;&lt;li&gt;MSTest is too tightly coupled to the IDE. And it shows. MSTest is needy in many areas. There are 2 .Net Unit Testing pioneers at Microsoft. It&amp;#39;s a wonder they got it so wrong.&lt;/li&gt;&lt;li&gt;Sort out Edit n Continue so it actually works when I modify an iterator, anonymous method etc. We&amp;#39;re still a long long way from the glorious &lt;a href="http://en.wikipedia.org/wiki/Read-eval-print_loop"&gt;REPL&lt;/a&gt; in VB1-6.&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;
&lt;div class = "shareblock"&gt;&lt;strong&gt;Share this post:&lt;/strong&gt; &lt;a href = "mailto:?body=Thought you might like this: http://aspadvice.com/blogs/rbirkby/archive/2008/08/08/Fixup-candidates-for-.Net-v4.aspx&amp;amp;;subject=Fixup+candidates+for+.Net+v4" target="_blank" title = "Post http://aspadvice.com/blogs/rbirkby/archive/2008/08/08/Fixup-candidates-for-.Net-v4.aspx"&gt;email it!&lt;/a&gt; |  &lt;a href = "http://del.icio.us/post?url=http://aspadvice.com/blogs/rbirkby/archive/2008/08/08/Fixup-candidates-for-.Net-v4.aspx&amp;amp;;title=Fixup+candidates+for+.Net+v4" target="_blank" title = "Post http://aspadvice.com/blogs/rbirkby/archive/2008/08/08/Fixup-candidates-for-.Net-v4.aspx"&gt;bookmark it!&lt;/a&gt; |  &lt;a href = "http://www.digg.com/submit?url=http://aspadvice.com/blogs/rbirkby/archive/2008/08/08/Fixup-candidates-for-.Net-v4.aspx&amp;amp;;phase=2" target="_blank" title = "Post http://aspadvice.com/blogs/rbirkby/archive/2008/08/08/Fixup-candidates-for-.Net-v4.aspx"&gt;digg it!&lt;/a&gt; |  &lt;a href = "http://reddit.com/submit?url=http://aspadvice.com/blogs/rbirkby/archive/2008/08/08/Fixup-candidates-for-.Net-v4.aspx&amp;amp;title=Fixup+candidates+for+.Net+v4" target="_blank" title = "Post http://aspadvice.com/blogs/rbirkby/archive/2008/08/08/Fixup-candidates-for-.Net-v4.aspx"&gt;reddit!&lt;/a&gt; |  &lt;a href = "http://www.dotnetkicks.com/submit/?url=http://aspadvice.com/blogs/rbirkby/archive/2008/08/08/Fixup-candidates-for-.Net-v4.aspx&amp;amp;;title=Fixup+candidates+for+.Net+v4" target="_blank" title = "Post http://aspadvice.com/blogs/rbirkby/archive/2008/08/08/Fixup-candidates-for-.Net-v4.aspx"&gt;kick it!&lt;/a&gt; |  &lt;a href = "https://favorites.live.com/quickadd.aspx?marklet=1&amp;amp;;mkt=en-us&amp;amp;;url=http://aspadvice.com/blogs/rbirkby/archive/2008/08/08/Fixup-candidates-for-.Net-v4.aspx&amp;amp;;title=Fixup+candidates+for+.Net+v4&amp;amp;;top=1" target="_blank" title = "Post http://aspadvice.com/blogs/rbirkby/archive/2008/08/08/Fixup-candidates-for-.Net-v4.aspx"&gt;live it!&lt;/a&gt;&lt;/div&gt;&lt;img src="http://aspadvice.com/aggbug.aspx?PostID=43605" width="1" height="1"&gt;</content><author><name>rbirkby</name><uri>http://aspadvice.com/members/rbirkby.aspx</uri></author><category term="C#" scheme="http://aspadvice.com/blogs/rbirkby/archive/tags/C_2300_/default.aspx" /><category term="dotnet" scheme="http://aspadvice.com/blogs/rbirkby/archive/tags/dotnet/default.aspx" /><category term=".Net" scheme="http://aspadvice.com/blogs/rbirkby/archive/tags/.Net/default.aspx" /><category term="C#.Next" scheme="http://aspadvice.com/blogs/rbirkby/archive/tags/C_23002E00_Next/default.aspx" /><category term="future" scheme="http://aspadvice.com/blogs/rbirkby/archive/tags/future/default.aspx" /></entry><entry><title>When does FlagsAttribute not mean Flags?</title><link rel="alternate" type="text/html" href="http://aspadvice.com/blogs/rbirkby/archive/2008/06/19/When-does-FlagsAttribute-not-mean-Flags_3F00_.aspx" /><id>http://aspadvice.com/blogs/rbirkby/archive/2008/06/19/When-does-FlagsAttribute-not-mean-Flags_3F00_.aspx</id><published>2008-06-19T09:26:00Z</published><updated>2008-06-19T09:26:00Z</updated><content type="html">&lt;p&gt;In the System.Data namespace, there&amp;#39;s a ConnectionState enumeration. This has values like Open, Closed, Connecting, Fetching to represent the state of a database connection.&lt;/p&gt;&lt;p&gt;I pondered on whether a connection which is &amp;quot;Fetching&amp;quot; is also &amp;quot;Open&amp;quot;. It turns out that ConnectionState is declared with the FlagsAttribute - The &lt;a href="http://www.google.co.uk/codesearch?hl=en&amp;amp;q=ConnectionState+lang:c%23+show:l4pmjbgAMWQ:FaBhfDYSQ8c:A4K5NYRy8I0&amp;amp;sa=N&amp;amp;cd=2&amp;amp;ct=rc&amp;amp;cs_p=http://go-mono.com/sources/mono/mono-1.2.4.tar.bz2&amp;amp;cs_f=mono-1.2.4/mcs/class/System.Data/System.Data/ConnectionState.cs"&gt;mono DocComment&lt;/a&gt; for this enumeration says it best:&lt;/p&gt;&lt;blockquote&gt;&lt;pre&gt;&lt;span id="l40"&gt;&lt;span class="cc"&gt;/// This enumeration has a FlagsAttribute that allows a bitwise combination of its member values.&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;/pre&gt;&lt;/blockquote&gt;&lt;pre&gt;&amp;nbsp;Great - so now I can do something like:&lt;/pre&gt;&lt;blockquote&gt;&lt;pre&gt;if((connection.State &amp;amp; ConectionState.Open)==ConnectionState.Open) ...&lt;br /&gt;&lt;/pre&gt;&lt;/blockquote&gt;&lt;p&gt;Wrong! Further down the &lt;a href="http://msdn.microsoft.com/en-us/library/system.data.connectionstate.aspx"&gt;MSDN documentation for ConnectionState&lt;/a&gt;, tucked away in the Remarks section is the following paragraph:&lt;/p&gt;&lt;blockquote&gt;&lt;p&gt;The values in this enumeration are not designed to be used as a set of flags.&lt;/p&gt;&lt;/blockquote&gt;&lt;p&gt;Great. So the question is, which of the database providers follow the FlagsAttribute, and which follow the documentation comment? Does SQL Server treat ConnectionState as flags? Does the managed Oracle provider? Does Oracle&amp;#39;s ODP.Net provider treat it as flags? etc.&lt;/p&gt;&lt;p&gt;Certainly there are &lt;a href="http://www.google.com/search?q=&amp;quot;State+%26+ConnectionState.Open&amp;quot;"&gt;many people&lt;/a&gt; who treat it like flags. There are equally &lt;a href="http://www.google.com/search?q=&amp;quot;State+%3D%3D+ConnectionState.Open&amp;quot;"&gt;many people&lt;/a&gt; who ignore it.&lt;/p&gt;&lt;p&gt;I think I know this history behind this debacle - if anyone knows for sure, I&amp;#39;d like to know. If you actually look at the ConnectionState definition, you will see that ConnectionState.Closed has a value of 0. This flouts the&lt;a href="http://blogs.msdn.com/kcwalina/archive/2004/05/18/134208.aspx"&gt; .Net Design Guidelines&lt;/a&gt; and I expect it to be raised by FxCop/CodeAnalysis. Go ahead and read that link if you&amp;#39;re not sure why bitwise comparison with 0 is a bad idea. This means there are a lot of &lt;a href="http://forums.microsoft.com/msdn/ShowPost.aspx?PostID=2402164&amp;amp;SiteID=1"&gt;bugs&lt;/a&gt; about due to the use of Bitwise comparison of ConnectionState.Closed. So I suspect that the System.Data team realized they&amp;#39;d made a mistake and was unable to retroactively remove the FlagsAttribute - so their approach was to document the issue in an obscure remark.&lt;br /&gt;&lt;/p&gt;
&lt;div class = "shareblock"&gt;&lt;strong&gt;Share this post:&lt;/strong&gt; &lt;a href = "mailto:?body=Thought you might like this: http://aspadvice.com/blogs/rbirkby/archive/2008/06/19/When-does-FlagsAttribute-not-mean-Flags_3F00_.aspx&amp;amp;;subject=When+does+FlagsAttribute+not+mean+Flags%3f" target="_blank" title = "Post http://aspadvice.com/blogs/rbirkby/archive/2008/06/19/When-does-FlagsAttribute-not-mean-Flags_3F00_.aspx"&gt;email it!&lt;/a&gt; |  &lt;a href = "http://del.icio.us/post?url=http://aspadvice.com/blogs/rbirkby/archive/2008/06/19/When-does-FlagsAttribute-not-mean-Flags_3F00_.aspx&amp;amp;;title=When+does+FlagsAttribute+not+mean+Flags%3f" target="_blank" title = "Post http://aspadvice.com/blogs/rbirkby/archive/2008/06/19/When-does-FlagsAttribute-not-mean-Flags_3F00_.aspx"&gt;bookmark it!&lt;/a&gt; |  &lt;a href = "http://www.digg.com/submit?url=http://aspadvice.com/blogs/rbirkby/archive/2008/06/19/When-does-FlagsAttribute-not-mean-Flags_3F00_.aspx&amp;amp;;phase=2" target="_blank" title = "Post http://aspadvice.com/blogs/rbirkby/archive/2008/06/19/When-does-FlagsAttribute-not-mean-Flags_3F00_.aspx"&gt;digg it!&lt;/a&gt; |  &lt;a href = "http://reddit.com/submit?url=http://aspadvice.com/blogs/rbirkby/archive/2008/06/19/When-does-FlagsAttribute-not-mean-Flags_3F00_.aspx&amp;amp;title=When+does+FlagsAttribute+not+mean+Flags%3f" target="_blank" title = "Post http://aspadvice.com/blogs/rbirkby/archive/2008/06/19/When-does-FlagsAttribute-not-mean-Flags_3F00_.aspx"&gt;reddit!&lt;/a&gt; |  &lt;a href = "http://www.dotnetkicks.com/submit/?url=http://aspadvice.com/blogs/rbirkby/archive/2008/06/19/When-does-FlagsAttribute-not-mean-Flags_3F00_.aspx&amp;amp;;title=When+does+FlagsAttribute+not+mean+Flags%3f" target="_blank" title = "Post http://aspadvice.com/blogs/rbirkby/archive/2008/06/19/When-does-FlagsAttribute-not-mean-Flags_3F00_.aspx"&gt;kick it!&lt;/a&gt; |  &lt;a href = "https://favorites.live.com/quickadd.aspx?marklet=1&amp;amp;;mkt=en-us&amp;amp;;url=http://aspadvice.com/blogs/rbirkby/archive/2008/06/19/When-does-FlagsAttribute-not-mean-Flags_3F00_.aspx&amp;amp;;title=When+does+FlagsAttribute+not+mean+Flags%3f&amp;amp;;top=1" target="_blank" title = "Post http://aspadvice.com/blogs/rbirkby/archive/2008/06/19/When-does-FlagsAttribute-not-mean-Flags_3F00_.aspx"&gt;live it!&lt;/a&gt;&lt;/div&gt;&lt;img src="http://aspadvice.com/aggbug.aspx?PostID=43318" width="1" height="1"&gt;</content><author><name>rbirkby</name><uri>http://aspadvice.com/members/rbirkby.aspx</uri></author><category term="Database" scheme="http://aspadvice.com/blogs/rbirkby/archive/tags/Database/default.aspx" /><category term=".Net" scheme="http://aspadvice.com/blogs/rbirkby/archive/tags/.Net/default.aspx" /></entry><entry><title>The CLR garbage collector is in need of help</title><link rel="alternate" type="text/html" href="http://aspadvice.com/blogs/rbirkby/archive/2008/06/12/The-CLR-garbage-collector-is-in-need-of-help.aspx" /><id>http://aspadvice.com/blogs/rbirkby/archive/2008/06/12/The-CLR-garbage-collector-is-in-need-of-help.aspx</id><published>2008-06-12T10:54:00Z</published><updated>2008-06-12T10:54:00Z</updated><content type="html">&lt;p&gt;Back in 2000 when the CLR was first shown it&amp;#39;s generational garbage collector was fairly cutting edge. But it&amp;#39;s weaknesses show it&amp;#39;s age - and it desperately needs updating. &lt;/p&gt;&lt;p&gt;Here&amp;#39;s an example of just one of the ways the current GC (.Net 3.5) doesn&amp;#39;t work:&lt;/p&gt;&lt;p&gt;A .Net process with a number of threads has just saved a large amount of data to a database. All of these threads could potentially allocate memory which causes a GC collection. However, saving the data to the database is a fairly long operation and thus the data &lt;a href="http://blogs.msdn.com/ricom/archive/2003/12/04/41281.aspx"&gt;gets promoted&lt;/a&gt; into the GC&amp;#39;s generation 2. &lt;/p&gt;&lt;p&gt;After saving the data, the .Net process waits until it&amp;#39;s instructed to do some more work. However, because a large amount of data has been promoted into Gen2, it just sits there until sufficient new allocations cause a Gen2 GC collection. The problem is that if no new work happens for a long time (hours), these unreachable objects take up (virtual) address space. Yes, NT will swap it out to disk as virtual memory. But it&amp;#39;s still there.&lt;/p&gt;&lt;p&gt;The GC really needs a timer, which periodically checks if no GCs have happened recently and the process has consumed very little CPU, then perform a Gen2 collection. &lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;Aside: Does anyone know how to trigger a GC.Collect() on a process from a different process, or from inside WinDbg? One of the problems with WinDbg/SOS is figuring out just which objects are reachable - you would have to !gcroot every possible object just to figure out which are the reachable ones.&lt;br /&gt;&lt;/p&gt;
&lt;div class = "shareblock"&gt;&lt;strong&gt;Share this post:&lt;/strong&gt; &lt;a href = "mailto:?body=Thought you might like this: http://aspadvice.com/blogs/rbirkby/archive/2008/06/12/The-CLR-garbage-collector-is-in-need-of-help.aspx&amp;amp;;subject=The+CLR+garbage+collector+is+in+need+of+help" target="_blank" title = "Post http://aspadvice.com/blogs/rbirkby/archive/2008/06/12/The-CLR-garbage-collector-is-in-need-of-help.aspx"&gt;email it!&lt;/a&gt; |  &lt;a href = "http://del.icio.us/post?url=http://aspadvice.com/blogs/rbirkby/archive/2008/06/12/The-CLR-garbage-collector-is-in-need-of-help.aspx&amp;amp;;title=The+CLR+garbage+collector+is+in+need+of+help" target="_blank" title = "Post http://aspadvice.com/blogs/rbirkby/archive/2008/06/12/The-CLR-garbage-collector-is-in-need-of-help.aspx"&gt;bookmark it!&lt;/a&gt; |  &lt;a href = "http://www.digg.com/submit?url=http://aspadvice.com/blogs/rbirkby/archive/2008/06/12/The-CLR-garbage-collector-is-in-need-of-help.aspx&amp;amp;;phase=2" target="_blank" title = "Post http://aspadvice.com/blogs/rbirkby/archive/2008/06/12/The-CLR-garbage-collector-is-in-need-of-help.aspx"&gt;digg it!&lt;/a&gt; |  &lt;a href = "http://reddit.com/submit?url=http://aspadvice.com/blogs/rbirkby/archive/2008/06/12/The-CLR-garbage-collector-is-in-need-of-help.aspx&amp;amp;title=The+CLR+garbage+collector+is+in+need+of+help" target="_blank" title = "Post http://aspadvice.com/blogs/rbirkby/archive/2008/06/12/The-CLR-garbage-collector-is-in-need-of-help.aspx"&gt;reddit!&lt;/a&gt; |  &lt;a href = "http://www.dotnetkicks.com/submit/?url=http://aspadvice.com/blogs/rbirkby/archive/2008/06/12/The-CLR-garbage-collector-is-in-need-of-help.aspx&amp;amp;;title=The+CLR+garbage+collector+is+in+need+of+help" target="_blank" title = "Post http://aspadvice.com/blogs/rbirkby/archive/2008/06/12/The-CLR-garbage-collector-is-in-need-of-help.aspx"&gt;kick it!&lt;/a&gt; |  &lt;a href = "https://favorites.live.com/quickadd.aspx?marklet=1&amp;amp;;mkt=en-us&amp;amp;;url=http://aspadvice.com/blogs/rbirkby/archive/2008/06/12/The-CLR-garbage-collector-is-in-need-of-help.aspx&amp;amp;;title=The+CLR+garbage+collector+is+in+need+of+help&amp;amp;;top=1" target="_blank" title = "Post http://aspadvice.com/blogs/rbirkby/archive/2008/06/12/The-CLR-garbage-collector-is-in-need-of-help.aspx"&gt;live it!&lt;/a&gt;&lt;/div&gt;&lt;img src="http://aspadvice.com/aggbug.aspx?PostID=43092" width="1" height="1"&gt;</content><author><name>rbirkby</name><uri>http://aspadvice.com/members/rbirkby.aspx</uri></author><category term="dotnet" scheme="http://aspadvice.com/blogs/rbirkby/archive/tags/dotnet/default.aspx" /><category term="memory" scheme="http://aspadvice.com/blogs/rbirkby/archive/tags/memory/default.aspx" /><category term="gc" scheme="http://aspadvice.com/blogs/rbirkby/archive/tags/gc/default.aspx" /></entry><entry><title>Windows Geniune Disadvantage</title><link rel="alternate" type="text/html" href="http://aspadvice.com/blogs/rbirkby/archive/2008/06/10/Windows-Geniune-Disadvantage.aspx" /><id>http://aspadvice.com/blogs/rbirkby/archive/2008/06/10/Windows-Geniune-Disadvantage.aspx</id><published>2008-06-10T09:51:00Z</published><updated>2008-06-10T09:51:00Z</updated><content type="html">&lt;p&gt;---------------------------&lt;br /&gt;Windows Genuine Advantage&lt;br /&gt;---------------------------&lt;br /&gt;Code not available. The validation code could not be obtained. This may be due to technical difficulties, or you may be running an unsupported operating system. Please close this window and attempt the validation process again, or use the Back button in your Web browser to return to the download details page. [Error code: 0x80072ee7]&lt;br /&gt;---------------------------&lt;br /&gt;OK&amp;nbsp;&amp;nbsp; &lt;br /&gt;---------------------------&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;Why does Microsoft insist on making my life difficult? &lt;br /&gt;&lt;/p&gt;
&lt;div class = "shareblock"&gt;&lt;strong&gt;Share this post:&lt;/strong&gt; &lt;a href = "mailto:?body=Thought you might like this: http://aspadvice.com/blogs/rbirkby/archive/2008/06/10/Windows-Geniune-Disadvantage.aspx&amp;amp;;subject=Windows+Geniune+Disadvantage" target="_blank" title = "Post http://aspadvice.com/blogs/rbirkby/archive/2008/06/10/Windows-Geniune-Disadvantage.aspx"&gt;email it!&lt;/a&gt; |  &lt;a href = "http://del.icio.us/post?url=http://aspadvice.com/blogs/rbirkby/archive/2008/06/10/Windows-Geniune-Disadvantage.aspx&amp;amp;;title=Windows+Geniune+Disadvantage" target="_blank" title = "Post http://aspadvice.com/blogs/rbirkby/archive/2008/06/10/Windows-Geniune-Disadvantage.aspx"&gt;bookmark it!&lt;/a&gt; |  &lt;a href = "http://www.digg.com/submit?url=http://aspadvice.com/blogs/rbirkby/archive/2008/06/10/Windows-Geniune-Disadvantage.aspx&amp;amp;;phase=2" target="_blank" title = "Post http://aspadvice.com/blogs/rbirkby/archive/2008/06/10/Windows-Geniune-Disadvantage.aspx"&gt;digg it!&lt;/a&gt; |  &lt;a href = "http://reddit.com/submit?url=http://aspadvice.com/blogs/rbirkby/archive/2008/06/10/Windows-Geniune-Disadvantage.aspx&amp;amp;title=Windows+Geniune+Disadvantage" target="_blank" title = "Post http://aspadvice.com/blogs/rbirkby/archive/2008/06/10/Windows-Geniune-Disadvantage.aspx"&gt;reddit!&lt;/a&gt; |  &lt;a href = "http://www.dotnetkicks.com/submit/?url=http://aspadvice.com/blogs/rbirkby/archive/2008/06/10/Windows-Geniune-Disadvantage.aspx&amp;amp;;title=Windows+Geniune+Disadvantage" target="_blank" title = "Post http://aspadvice.com/blogs/rbirkby/archive/2008/06/10/Windows-Geniune-Disadvantage.aspx"&gt;kick it!&lt;/a&gt; |  &lt;a href = "https://favorites.live.com/quickadd.aspx?marklet=1&amp;amp;;mkt=en-us&amp;amp;;url=http://aspadvice.com/blogs/rbirkby/archive/2008/06/10/Windows-Geniune-Disadvantage.aspx&amp;amp;;title=Windows+Geniune+Disadvantage&amp;amp;;top=1" target="_blank" title = "Post http://aspadvice.com/blogs/rbirkby/archive/2008/06/10/Windows-Geniune-Disadvantage.aspx"&gt;live it!&lt;/a&gt;&lt;/div&gt;&lt;img src="http://aspadvice.com/aggbug.aspx?PostID=43025" width="1" height="1"&gt;</content><author><name>rbirkby</name><uri>http://aspadvice.com/members/rbirkby.aspx</uri></author><category term="microsoft" scheme="http://aspadvice.com/blogs/rbirkby/archive/tags/microsoft/default.aspx" /><category term="windows" scheme="http://aspadvice.com/blogs/rbirkby/archive/tags/windows/default.aspx" /></entry><entry><title>Refactoring</title><link rel="alternate" type="text/html" href="http://aspadvice.com/blogs/rbirkby/archive/2008/06/03/Refactoring.aspx" /><id>http://aspadvice.com/blogs/rbirkby/archive/2008/06/03/Refactoring.aspx</id><published>2008-06-03T13:25:00Z</published><updated>2008-06-03T13:25:00Z</updated><content type="html">&lt;p&gt;I&amp;#39;m doing a lot of porting and refactoring at the moment. I&amp;#39;ve come to the conclusion that porting from a dynamically typed language to a statically typed language is an order of magnitude more difficult than doing the reverse.&lt;/p&gt;&lt;p&gt;Refactoring is an interesting game. There are some very easy refactorings - especially with the &lt;a href="http://www.jetbrains.com/resharper/"&gt;toolsets &lt;/a&gt;available to us nowadays. However, there are some extremely difficult refactorings. I&amp;#39;ve found the most difficult to refactor methods have one or more of these 3 aspects:&lt;br /&gt; &lt;/p&gt;&lt;p&gt;1) It has &lt;a href="http://www.refactoring.com/catalog/extractMethod.html"&gt;long methods&lt;/a&gt; (&amp;gt;40 lines)&lt;br /&gt;2) The method &lt;a href="http://www.refactoring.com/catalog/splitTemporaryVariable.html"&gt;shares a variable&lt;/a&gt; for different things&lt;br /&gt;3) &lt;a href="http://www.refactoring.com/catalog/splitLoop.html"&gt;Loops do more than 1 thing&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;1) causes 2) - so eliminating 1) means that 2) doesn&amp;#39;t happen. &lt;br /&gt;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;br /&gt;I sure wish the &lt;a href="http://steve-yegge.blogspot.com/2007/02/next-big-language.html"&gt;NextBigLanguage &lt;/a&gt;has an upper bound on the lines/method it can parse.&lt;br /&gt;&amp;nbsp;&lt;/p&gt;
&lt;div class = "shareblock"&gt;&lt;strong&gt;Share this post:&lt;/strong&gt; &lt;a href = "mailto:?body=Thought you might like this: http://aspadvice.com/blogs/rbirkby/archive/2008/06/03/Refactoring.aspx&amp;amp;;subject=Refactoring" target="_blank" title = "Post http://aspadvice.com/blogs/rbirkby/archive/2008/06/03/Refactoring.aspx"&gt;email it!&lt;/a&gt; |  &lt;a href = "http://del.icio.us/post?url=http://aspadvice.com/blogs/rbirkby/archive/2008/06/03/Refactoring.aspx&amp;amp;;title=Refactoring" target="_blank" title = "Post http://aspadvice.com/blogs/rbirkby/archive/2008/06/03/Refactoring.aspx"&gt;bookmark it!&lt;/a&gt; |  &lt;a href = "http://www.digg.com/submit?url=http://aspadvice.com/blogs/rbirkby/archive/2008/06/03/Refactoring.aspx&amp;amp;;phase=2" target="_blank" title = "Post http://aspadvice.com/blogs/rbirkby/archive/2008/06/03/Refactoring.aspx"&gt;digg it!&lt;/a&gt; |  &lt;a href = "http://reddit.com/submit?url=http://aspadvice.com/blogs/rbirkby/archive/2008/06/03/Refactoring.aspx&amp;amp;title=Refactoring" target="_blank" title = "Post http://aspadvice.com/blogs/rbirkby/archive/2008/06/03/Refactoring.aspx"&gt;reddit!&lt;/a&gt; |  &lt;a href = "http://www.dotnetkicks.com/submit/?url=http://aspadvice.com/blogs/rbirkby/archive/2008/06/03/Refactoring.aspx&amp;amp;;title=Refactoring" target="_blank" title = "Post http://aspadvice.com/blogs/rbirkby/archive/2008/06/03/Refactoring.aspx"&gt;kick it!&lt;/a&gt; |  &lt;a href = "https://favorites.live.com/quickadd.aspx?marklet=1&amp;amp;;mkt=en-us&amp;amp;;url=http://aspadvice.com/blogs/rbirkby/archive/2008/06/03/Refactoring.aspx&amp;amp;;title=Refactoring&amp;amp;;top=1" target="_blank" title = "Post http://aspadvice.com/blogs/rbirkby/archive/2008/06/03/Refactoring.aspx"&gt;live it!&lt;/a&gt;&lt;/div&gt;&lt;img src="http://aspadvice.com/aggbug.aspx?PostID=42857" width="1" height="1"&gt;</content><author><name>rbirkby</name><uri>http://aspadvice.com/members/rbirkby.aspx</uri></author><category term="C#" scheme="http://aspadvice.com/blogs/rbirkby/archive/tags/C_2300_/default.aspx" /><category term="dotnet" scheme="http://aspadvice.com/blogs/rbirkby/archive/tags/dotnet/default.aspx" /></entry><entry><title>Code Smells in C#</title><link rel="alternate" type="text/html" href="http://aspadvice.com/blogs/rbirkby/archive/2008/05/12/Code-Smells-in-C_2300_.aspx" /><id>http://aspadvice.com/blogs/rbirkby/archive/2008/05/12/Code-Smells-in-C_2300_.aspx</id><published>2008-05-12T16:11:00Z</published><updated>2008-05-12T16:11:00Z</updated><content type="html">&lt;p&gt;A lot of my development is done with &lt;a href="http://en.wikipedia.org/wiki/Code_smell"&gt;Code Smells&lt;/a&gt;. Whether I&amp;#39;m working on my own code or refactoring someone elses code, if I see some code and it smells funny, then I investigate further.&lt;/p&gt;&lt;p&gt;Recently I&amp;#39;ve come to realize there&amp;#39;s a code smell which we can blame Microsoft (&lt;a href="http://en.wikipedia.org/wiki/Anders_Hejlsberg"&gt;Anders&lt;/a&gt;) for!&amp;nbsp; &lt;br /&gt;&lt;br /&gt;&lt;b&gt;C# Code Regions.&lt;/b&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;Back in the early days of .Net (ie 2000-2003), I used to moderately region my code. But since reading Martin Fowler&amp;#39;s seminal &lt;a href="http://www.refactoring.com/"&gt;Refactoring&lt;/a&gt; book where the concept of Code Smells was introduced, I found that I didn&amp;#39;t need C# Regions.&lt;/p&gt;&lt;p&gt;&lt;b&gt;So why are regions a Code Smell?&lt;/b&gt;&lt;/p&gt;&lt;p&gt;There are two types of regioning I&amp;#39;ve seen in code. Regions that group methods, properties, member variables, constructors etc together, and those which collapse a block of code. I&amp;#39;ll deal with each separately.&lt;/p&gt;&lt;p&gt;&lt;b&gt;Using Regions to group members.&lt;/b&gt;&lt;/p&gt;&lt;p&gt;In many companies, its commonplace (and even enforced practice) to group similar class members together and place a region block around them. I&amp;#39;ve even seen this as a coding doctrine inside Microsoft. The problem is that Visual Studio already has a facility to do this automatically. And it&amp;#39;s been around in VS since it was called VJ++ and before that in VC. It&amp;#39;s called the Class View window, accessed with the shift-ctrl-C shortcut. So why anyone would care about building a class &amp;quot;DOM&amp;quot; into their code using Regions, rather than rely on the Class View window I have no idea. Perhaps they&amp;#39;re using Notepad?&lt;/p&gt;&lt;p&gt;&lt;b&gt;Using Regions to hide blocks within a method.&lt;/b&gt;&lt;/p&gt;&lt;p&gt;This is when it gets really nasty. I&amp;#39;ve seen multi-hundred line long methods containing regions, and subregions and sub-subregions. I&amp;#39;ve seen switch() statements wrapped in a region, then each individual case have a region, then subregions inside of the region inside of the case. Switch statements are &lt;a href="http://c2.com/cgi/wiki?SwitchStatementsSmell"&gt;already&lt;/a&gt; a Code Smell, but having region after region after region is a sure-fire way of telling you the method is too long.&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;br /&gt;So, please, can we all resolve to stop using Regions?&lt;/p&gt;&lt;p&gt;Interestingly, there are many features that Java has started copying from C# - but regions were not one of those. Perhaps in C# v4 Microsoft can right the wrong and deprecate regions?&lt;br /&gt;&lt;/p&gt;
&lt;div class = "shareblock"&gt;&lt;strong&gt;Share this post:&lt;/strong&gt; &lt;a href = "mailto:?body=Thought you might like this: http://aspadvice.com/blogs/rbirkby/archive/2008/05/12/Code-Smells-in-C_2300_.aspx&amp;amp;;subject=Code+Smells+in+C%23" target="_blank" title = "Post http://aspadvice.com/blogs/rbirkby/archive/2008/05/12/Code-Smells-in-C_2300_.aspx"&gt;email it!&lt;/a&gt; |  &lt;a href = "http://del.icio.us/post?url=http://aspadvice.com/blogs/rbirkby/archive/2008/05/12/Code-Smells-in-C_2300_.aspx&amp;amp;;title=Code+Smells+in+C%23" target="_blank" title = "Post http://aspadvice.com/blogs/rbirkby/archive/2008/05/12/Code-Smells-in-C_2300_.aspx"&gt;bookmark it!&lt;/a&gt; |  &lt;a href = "http://www.digg.com/submit?url=http://aspadvice.com/blogs/rbirkby/archive/2008/05/12/Code-Smells-in-C_2300_.aspx&amp;amp;;phase=2" target="_blank" title = "Post http://aspadvice.com/blogs/rbirkby/archive/2008/05/12/Code-Smells-in-C_2300_.aspx"&gt;digg it!&lt;/a&gt; |  &lt;a href = "http://reddit.com/submit?url=http://aspadvice.com/blogs/rbirkby/archive/2008/05/12/Code-Smells-in-C_2300_.aspx&amp;amp;title=Code+Smells+in+C%23" target="_blank" title = "Post http://aspadvice.com/blogs/rbirkby/archive/2008/05/12/Code-Smells-in-C_2300_.aspx"&gt;reddit!&lt;/a&gt; |  &lt;a href = "http://www.dotnetkicks.com/submit/?url=http://aspadvice.com/blogs/rbirkby/archive/2008/05/12/Code-Smells-in-C_2300_.aspx&amp;amp;;title=Code+Smells+in+C%23" target="_blank" title = "Post http://aspadvice.com/blogs/rbirkby/archive/2008/05/12/Code-Smells-in-C_2300_.aspx"&gt;kick it!&lt;/a&gt; |  &lt;a href = "https://favorites.live.com/quickadd.aspx?marklet=1&amp;amp;;mkt=en-us&amp;amp;;url=http://aspadvice.com/blogs/rbirkby/archive/2008/05/12/Code-Smells-in-C_2300_.aspx&amp;amp;;title=Code+Smells+in+C%23&amp;amp;;top=1" target="_blank" title = "Post http://aspadvice.com/blogs/rbirkby/archive/2008/05/12/Code-Smells-in-C_2300_.aspx"&gt;live it!&lt;/a&gt;&lt;/div&gt;&lt;img src="http://aspadvice.com/aggbug.aspx?PostID=42130" width="1" height="1"&gt;</content><author><name>rbirkby</name><uri>http://aspadvice.com/members/rbirkby.aspx</uri></author><category term="C#" scheme="http://aspadvice.com/blogs/rbirkby/archive/tags/C_2300_/default.aspx" /><category term="dotnet" scheme="http://aspadvice.com/blogs/rbirkby/archive/tags/dotnet/default.aspx" /><category term="Java" scheme="http://aspadvice.com/blogs/rbirkby/archive/tags/Java/default.aspx" /></entry><entry><title>Caching and SOAP</title><link rel="alternate" type="text/html" href="http://aspadvice.com/blogs/rbirkby/archive/2008/03/27/Caching-and-SOAP.aspx" /><id>http://aspadvice.com/blogs/rbirkby/archive/2008/03/27/Caching-and-SOAP.aspx</id><published>2008-03-27T11:12:00Z</published><updated>2008-03-27T11:12:00Z</updated><content type="html">&lt;p&gt;If you&amp;#39;re making a SOAP request (in this case with the &lt;a href="http://www.microsoft.com/downloads/details.aspx?FamilyId=C943C0DD-CEEC-4088-9753-86F052EC8450"&gt;SOAP toolkit&lt;/a&gt;), and you get:&amp;nbsp;&lt;/p&gt;&lt;p&gt;&amp;quot;WSDLReader:Loading of the WSDL file failed HRESULT=0x80070057: The parameter is incorrect.&amp;quot;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;during the MSSoapInit() call, check that you haven&amp;#39;t added a cache-control:no-cache custom header to IIS, or that HttpExpires isn&amp;#39;t set to zero days.&lt;br /&gt;&amp;nbsp;&lt;/p&gt;
&lt;div class = "shareblock"&gt;&lt;strong&gt;Share this post:&lt;/strong&gt; &lt;a href = "mailto:?body=Thought you might like this: http://aspadvice.com/blogs/rbirkby/archive/2008/03/27/Caching-and-SOAP.aspx&amp;amp;;subject=Caching+and+SOAP" target="_blank" title = "Post http://aspadvice.com/blogs/rbirkby/archive/2008/03/27/Caching-and-SOAP.aspx"&gt;email it!&lt;/a&gt; |  &lt;a href = "http://del.icio.us/post?url=http://aspadvice.com/blogs/rbirkby/archive/2008/03/27/Caching-and-SOAP.aspx&amp;amp;;title=Caching+and+SOAP" target="_blank" title = "Post http://aspadvice.com/blogs/rbirkby/archive/2008/03/27/Caching-and-SOAP.aspx"&gt;bookmark it!&lt;/a&gt; |  &lt;a href = "http://www.digg.com/submit?url=http://aspadvice.com/blogs/rbirkby/archive/2008/03/27/Caching-and-SOAP.aspx&amp;amp;;phase=2" target="_blank" title = "Post http://aspadvice.com/blogs/rbirkby/archive/2008/03/27/Caching-and-SOAP.aspx"&gt;digg it!&lt;/a&gt; |  &lt;a href = "http://reddit.com/submit?url=http://aspadvice.com/blogs/rbirkby/archive/2008/03/27/Caching-and-SOAP.aspx&amp;amp;title=Caching+and+SOAP" target="_blank" title = "Post http://aspadvice.com/blogs/rbirkby/archive/2008/03/27/Caching-and-SOAP.aspx"&gt;reddit!&lt;/a&gt; |  &lt;a href = "http://www.dotnetkicks.com/submit/?url=http://aspadvice.com/blogs/rbirkby/archive/2008/03/27/Caching-and-SOAP.aspx&amp;amp;;title=Caching+and+SOAP" target="_blank" title = "Post http://aspadvice.com/blogs/rbirkby/archive/2008/03/27/Caching-and-SOAP.aspx"&gt;kick it!&lt;/a&gt; |  &lt;a href = "https://favorites.live.com/quickadd.aspx?marklet=1&amp;amp;;mkt=en-us&amp;amp;;url=http://aspadvice.com/blogs/rbirkby/archive/2008/03/27/Caching-and-SOAP.aspx&amp;amp;;title=Caching+and+SOAP&amp;amp;;top=1" target="_blank" title = "Post http://aspadvice.com/blogs/rbirkby/archive/2008/03/27/Caching-and-SOAP.aspx"&gt;live it!&lt;/a&gt;&lt;/div&gt;&lt;img src="http://aspadvice.com/aggbug.aspx?PostID=40740" width="1" height="1"&gt;</content><author><name>rbirkby</name><uri>http://aspadvice.com/members/rbirkby.aspx</uri></author><category term="asp.net" scheme="http://aspadvice.com/blogs/rbirkby/archive/tags/asp.net/default.aspx" /><category term="wsdl" scheme="http://aspadvice.com/blogs/rbirkby/archive/tags/wsdl/default.aspx" /><category term="IIS" scheme="http://aspadvice.com/blogs/rbirkby/archive/tags/IIS/default.aspx" /><category term="SOAP" scheme="http://aspadvice.com/blogs/rbirkby/archive/tags/SOAP/default.aspx" /></entry><entry><title>Silverlight Sudoku with LINQ</title><link rel="alternate" type="text/html" href="http://aspadvice.com/blogs/rbirkby/archive/2007/08/23/Silverlight-Sudoku-with-LINQ.aspx" /><link rel="enclosure" type="text/plain" length="19278" href="http://aspadvice.com/blogs/rbirkby/attachment/34077.ashx" /><id>http://aspadvice.com/blogs/rbirkby/archive/2007/08/23/Silverlight-Sudoku-with-LINQ.aspx</id><published>2007-08-23T07:30:00Z</published><updated>2007-08-23T07:30:00Z</updated><content type="html">&lt;p&gt;A couple of months ago I came across a very clever &lt;a href="http://www.norvig.com/sudoku.html"&gt;Sudoku solver&lt;/a&gt; written by &lt;a href="http://www.norvig.com/"&gt;Peter Norvig&lt;/a&gt;. Peter had written the solver using Python. The solver was special as it solved by constraint propagation using &lt;a href="http://en.wikipedia.org/wiki/List_comprehension"&gt;list comprehensions&lt;/a&gt; and generator expressions making it extremely fast and very memory frugal. It turns out that the new &lt;a href="http://msdn.microsoft.com/msdnmag/issues/07/06/CSharp30/default.aspx"&gt;LINQ &lt;/a&gt;feature of C# v3 is basically list comprehensions and generator expressions by another name.&lt;/p&gt;&lt;p&gt;&lt;a href="http://weblogs.mozillazine.org/roadmap/"&gt;Brendan Eich&lt;/a&gt;, the creator of JavaScript &lt;a href="https://bugzilla.mozilla.org/show_bug.cgi?id=380237"&gt;had&lt;/a&gt; &lt;a href="https://bugzilla.mozilla.org/attachment.cgi?id=266577"&gt;ported &lt;/a&gt;the original Python implementation to &lt;a href="http://ejohn.org/blog/javascript-18-progress/"&gt;JavaScript&lt;/a&gt; and I thought it would be a good idea to try to port it to C# v3. You can check out the code &lt;a href="http://aspadvice.com/blogs/rbirkby/attachment/34077.ashx"&gt;here&lt;/a&gt;.&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;br /&gt;I always had a vague plan to wrap the solver in a Silverlight front-end for added WOW factor, but it never really materialized. Fast forward two months and &lt;a href="http://blogs.msdn.com/delay/"&gt;David Anson&lt;/a&gt; &lt;a href="http://blogs.msdn.com/delay/archive/2007/08/21/time-for-a-little-fun-and-games-silverlight-helps-play-sudoku.aspx"&gt;posts&lt;/a&gt; a Silverlight-based Sudoku game on his blog. This gave me the perfect excuse to integrate the LINQ-based solver into his codebase. I extended David&amp;#39;s code to respond to the Escape key and complete the board with the first solution found. You can play with it online &lt;a href="http://www.thundermain.com/SilverlightSudokuHelper/Default.html"&gt;here&lt;/a&gt;, or download the code &lt;a href="http://www.thundermain.com/SilverlightSudokuHelper.zip"&gt;here&lt;/a&gt;. Have fun!&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;a href="http://www.thundermain.com/SilverlightSudokuHelper/Default.html"&gt;&lt;img src="http://blogs.msdn.com/delay/attachment/4497186.ashx" height="454" width="410" /&gt;&lt;/a&gt;&lt;/p&gt;&lt;p&gt;&amp;nbsp;To solve a game, give the Silverlight board the input focus and hit the escape key.&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;div class = "shareblock"&gt;&lt;strong&gt;Share this post:&lt;/strong&gt; &lt;a href = "mailto:?body=Thought you might like this: http://aspadvice.com/blogs/rbirkby/archive/2007/08/23/Silverlight-Sudoku-with-LINQ.aspx&amp;amp;;subject=Silverlight+Sudoku+with+LINQ" target="_blank" title = "Post http://aspadvice.com/blogs/rbirkby/archive/2007/08/23/Silverlight-Sudoku-with-LINQ.aspx"&gt;email it!&lt;/a&gt; |  &lt;a href = "http://del.icio.us/post?url=http://aspadvice.com/blogs/rbirkby/archive/2007/08/23/Silverlight-Sudoku-with-LINQ.aspx&amp;amp;;title=Silverlight+Sudoku+with+LINQ" target="_blank" title = "Post http://aspadvice.com/blogs/rbirkby/archive/2007/08/23/Silverlight-Sudoku-with-LINQ.aspx"&gt;bookmark it!&lt;/a&gt; |  &lt;a href = "http://www.digg.com/submit?url=http://aspadvice.com/blogs/rbirkby/archive/2007/08/23/Silverlight-Sudoku-with-LINQ.aspx&amp;amp;;phase=2" target="_blank" title = "Post http://aspadvice.com/blogs/rbirkby/archive/2007/08/23/Silverlight-Sudoku-with-LINQ.aspx"&gt;digg it!&lt;/a&gt; |  &lt;a href = "http://reddit.com/submit?url=http://aspadvice.com/blogs/rbirkby/archive/2007/08/23/Silverlight-Sudoku-with-LINQ.aspx&amp;amp;title=Silverlight+Sudoku+with+LINQ" target="_blank" title = "Post http://aspadvice.com/blogs/rbirkby/archive/2007/08/23/Silverlight-Sudoku-with-LINQ.aspx"&gt;reddit!&lt;/a&gt; |  &lt;a href = "http://www.dotnetkicks.com/submit/?url=http://aspadvice.com/blogs/rbirkby/archive/2007/08/23/Silverlight-Sudoku-with-LINQ.aspx&amp;amp;;title=Silverlight+Sudoku+with+LINQ" target="_blank" title = "Post http://aspadvice.com/blogs/rbirkby/archive/2007/08/23/Silverlight-Sudoku-with-LINQ.aspx"&gt;kick it!&lt;/a&gt; |  &lt;a href = "https://favorites.live.com/quickadd.aspx?marklet=1&amp;amp;;mkt=en-us&amp;amp;;url=http://aspadvice.com/blogs/rbirkby/archive/2007/08/23/Silverlight-Sudoku-with-LINQ.aspx&amp;amp;;title=Silverlight+Sudoku+with+LINQ&amp;amp;;top=1" target="_blank" title = "Post http://aspadvice.com/blogs/rbirkby/archive/2007/08/23/Silverlight-Sudoku-with-LINQ.aspx"&gt;live it!&lt;/a&gt;&lt;/div&gt;&lt;img src="http://aspadvice.com/aggbug.aspx?PostID=34077" width="1" height="1"&gt;</content><author><name>rbirkby</name><uri>http://aspadvice.com/members/rbirkby.aspx</uri></author><category term="silverlight dotnet sudoku linq" scheme="http://aspadvice.com/blogs/rbirkby/archive/tags/silverlight+dotnet+sudoku+linq/default.aspx" /></entry><entry><title>Silverlight crashing</title><link rel="alternate" type="text/html" href="http://aspadvice.com/blogs/rbirkby/archive/2007/04/30/Silverlight-crashing.aspx" /><id>http://aspadvice.com/blogs/rbirkby/archive/2007/04/30/Silverlight-crashing.aspx</id><published>2007-04-30T17:14:00Z</published><updated>2007-04-30T17:14:00Z</updated><content type="html">&lt;p&gt;So I&amp;#39;m sat here watching the Mix07 keynote, 45 minutes after Ray Ozzie first got to the stage. I download the Silverlight Beta for Mac and install it.&lt;/p&gt;&lt;p&gt;Firefox has crashed 4 times while trying to view the Silverlight demos on microsoft.com/silverlight. This is getting really frustrating trying to review the new features.&lt;br /&gt;&amp;nbsp;&lt;/p&gt;
&lt;div class = "shareblock"&gt;&lt;strong&gt;Share this post:&lt;/strong&gt; &lt;a href = "mailto:?body=Thought you might like this: http://aspadvice.com/blogs/rbirkby/archive/2007/04/30/Silverlight-crashing.aspx&amp;amp;;subject=Silverlight+crashing" target="_blank" title = "Post http://aspadvice.com/blogs/rbirkby/archive/2007/04/30/Silverlight-crashing.aspx"&gt;email it!&lt;/a&gt; |  &lt;a href = "http://del.icio.us/post?url=http://aspadvice.com/blogs/rbirkby/archive/2007/04/30/Silverlight-crashing.aspx&amp;amp;;title=Silverlight+crashing" target="_blank" title = "Post http://aspadvice.com/blogs/rbirkby/archive/2007/04/30/Silverlight-crashing.aspx"&gt;bookmark it!&lt;/a&gt; |  &lt;a href = "http://www.digg.com/submit?url=http://aspadvice.com/blogs/rbirkby/archive/2007/04/30/Silverlight-crashing.aspx&amp;amp;;phase=2" target="_blank" title = "Post http://aspadvice.com/blogs/rbirkby/archive/2007/04/30/Silverlight-crashing.aspx"&gt;digg it!&lt;/a&gt; |  &lt;a href = "http://reddit.com/submit?url=http://aspadvice.com/blogs/rbirkby/archive/2007/04/30/Silverlight-crashing.aspx&amp;amp;title=Silverlight+crashing" target="_blank" title = "Post http://aspadvice.com/blogs/rbirkby/archive/2007/04/30/Silverlight-crashing.aspx"&gt;reddit!&lt;/a&gt; |  &lt;a href = "http://www.dotnetkicks.com/submit/?url=http://aspadvice.com/blogs/rbirkby/archive/2007/04/30/Silverlight-crashing.aspx&amp;amp;;title=Silverlight+crashing" target="_blank" title = "Post http://aspadvice.com/blogs/rbirkby/archive/2007/04/30/Silverlight-crashing.aspx"&gt;kick it!&lt;/a&gt; |  &lt;a href = "https://favorites.live.com/quickadd.aspx?marklet=1&amp;amp;;mkt=en-us&amp;amp;;url=http://aspadvice.com/blogs/rbirkby/archive/2007/04/30/Silverlight-crashing.aspx&amp;amp;;title=Silverlight+crashing&amp;amp;;top=1" target="_blank" title = "Post http://aspadvice.com/blogs/rbirkby/archive/2007/04/30/Silverlight-crashing.aspx"&gt;live it!&lt;/a&gt;&lt;/div&gt;&lt;img src="http://aspadvice.com/aggbug.aspx?PostID=29364" width="1" height="1"&gt;</content><author><name>rbirkby</name><uri>http://aspadvice.com/members/rbirkby.aspx</uri></author><category term="silverlight dotnet macos firefox" scheme="http://aspadvice.com/blogs/rbirkby/archive/tags/silverlight+dotnet+macos+firefox/default.aspx" /></entry><entry><title>Silverlight</title><link rel="alternate" type="text/html" href="http://aspadvice.com/blogs/rbirkby/archive/2007/04/16/Silverlight.aspx" /><id>http://aspadvice.com/blogs/rbirkby/archive/2007/04/16/Silverlight.aspx</id><published>2007-04-16T21:06:00Z</published><updated>2007-04-16T21:06:00Z</updated><content type="html">&lt;p&gt;As has been &lt;a href="http://blogs.msdn.com/somasegar/archive/2007/04/15/silverlight-the-next-generation-web-media-experiences.aspx"&gt;blogged&lt;/a&gt; all &lt;a href="http://blogs.msdn.com/jstegman/archive/2007/04/16/wpf-e-codename-is-now-silverlight.aspx"&gt;over&lt;/a&gt; &lt;a href="http://blogs.msdn.com/mharsh/archive/2007/04/16/microsoft-silverlight.aspx"&gt;the&lt;/a&gt; &lt;a href="http://blogs.msdn.com/lokeuei/archive/2007/04/16/microsoft-announces-silverlight.aspx"&gt;place&lt;/a&gt;, WPF/E has been renamed &lt;a href="http://www.microsoft.com/silverlight"&gt;Silverlight&lt;/a&gt; (Note: lower case &amp;#39;L&amp;#39;).&lt;/p&gt;&lt;p&gt;&lt;a href="http://blogs.msdn.com/tims/archive/2007/04/15/introducing-microsoft-silverlight.aspx"&gt;Some&lt;/a&gt; &lt;a href="http://blog.hackedbrain.com/archive/2007/04/16/6098.aspx"&gt;people&lt;/a&gt; say there&amp;#39;s more to come at &lt;a href="http://visitmix.com/"&gt;MIX07&lt;/a&gt;. Well, I think I&amp;#39;ve discovered what the secret is. It&amp;#39;s hidden inside of the Silverlight promo &lt;a href="http://go.microsoft.com/fwlink/?LinkID=87851&amp;amp;clcid=0%C3%97409"&gt;video&lt;/a&gt;. Silverlight is written in Java! Don&amp;#39;t believe me? Take a look at a frame grab from the promo video, clearly showing Silverlight&amp;#39;s use of SAX, the javax namespace and use of Java API&amp;#39;s like vector.addElement.&lt;/p&gt;&lt;a href="http://lh5.google.com/image/rbirkby/RiPjN6h66YI/AAAAAAAAAKM/deDtVPDNQpg/s800/silverlight.jpg"&gt;&lt;img src="http://lh5.google.com/image/rbirkby/RiPjN6h66YI/AAAAAAAAAKM/deDtVPDNQpg/s144/silverlight.jpg" /&gt;&lt;/a&gt;
&lt;div class = "shareblock"&gt;&lt;strong&gt;Share this post:&lt;/strong&gt; &lt;a href = "mailto:?body=Thought you might like this: http://aspadvice.com/blogs/rbirkby/archive/2007/04/16/Silverlight.aspx&amp;amp;;subject=Silverlight" target="_blank" title = "Post http://aspadvice.com/blogs/rbirkby/archive/2007/04/16/Silverlight.aspx"&gt;email it!&lt;/a&gt; |  &lt;a href = "http://del.icio.us/post?url=http://aspadvice.com/blogs/rbirkby/archive/2007/04/16/Silverlight.aspx&amp;amp;;title=Silverlight" target="_blank" title = "Post http://aspadvice.com/blogs/rbirkby/archive/2007/04/16/Silverlight.aspx"&gt;bookmark it!&lt;/a&gt; |  &lt;a href = "http://www.digg.com/submit?url=http://aspadvice.com/blogs/rbirkby/archive/2007/04/16/Silverlight.aspx&amp;amp;;phase=2" target="_blank" title = "Post http://aspadvice.com/blogs/rbirkby/archive/2007/04/16/Silverlight.aspx"&gt;digg it!&lt;/a&gt; |  &lt;a href = "http://reddit.com/submit?url=http://aspadvice.com/blogs/rbirkby/archive/2007/04/16/Silverlight.aspx&amp;amp;title=Silverlight" target="_blank" title = "Post http://aspadvice.com/blogs/rbirkby/archive/2007/04/16/Silverlight.aspx"&gt;reddit!&lt;/a&gt; |  &lt;a href = "http://www.dotnetkicks.com/submit/?url=http://aspadvice.com/blogs/rbirkby/archive/2007/04/16/Silverlight.aspx&amp;amp;;title=Silverlight" target="_blank" title = "Post http://aspadvice.com/blogs/rbirkby/archive/2007/04/16/Silverlight.aspx"&gt;kick it!&lt;/a&gt; |  &lt;a href = "https://favorites.live.com/quickadd.aspx?marklet=1&amp;amp;;mkt=en-us&amp;amp;;url=http://aspadvice.com/blogs/rbirkby/archive/2007/04/16/Silverlight.aspx&amp;amp;;title=Silverlight&amp;amp;;top=1" target="_blank" title = "Post http://aspadvice.com/blogs/rbirkby/archive/2007/04/16/Silverlight.aspx"&gt;live it!&lt;/a&gt;&lt;/div&gt;&lt;img src="http://aspadvice.com/aggbug.aspx?PostID=29051" width="1" height="1"&gt;</content><author><name>rbirkby</name><uri>http://aspadvice.com/members/rbirkby.aspx</uri></author><category term="C#" scheme="http://aspadvice.com/blogs/rbirkby/archive/tags/C_2300_/default.aspx" /><category term="dotnet" scheme="http://aspadvice.com/blogs/rbirkby/archive/tags/dotnet/default.aspx" /><category term="WPF" scheme="http://aspadvice.com/blogs/rbirkby/archive/tags/WPF/default.aspx" /><category term="WPF/E" scheme="http://aspadvice.com/blogs/rbirkby/archive/tags/WPF_2F00_E/default.aspx" /><category term="Silverlight" scheme="http://aspadvice.com/blogs/rbirkby/archive/tags/Silverlight/default.aspx" /><category term="Java" scheme="http://aspadvice.com/blogs/rbirkby/archive/tags/Java/default.aspx" /><category term="Mix07" scheme="http://aspadvice.com/blogs/rbirkby/archive/tags/Mix07/default.aspx" /></entry><entry><title>The trouble with dynamic languages</title><link rel="alternate" type="text/html" href="http://aspadvice.com/blogs/rbirkby/archive/2007/01/22/The-trouble-with-dynamic-languages.aspx" /><id>http://aspadvice.com/blogs/rbirkby/archive/2007/01/22/The-trouble-with-dynamic-languages.aspx</id><published>2007-01-22T19:51:00Z</published><updated>2007-01-22T19:51:00Z</updated><content type="html">&lt;p&gt;Javascript is a &lt;a href="http://en.wikipedia.org/wiki/Dynamic_language"&gt;dynamic language&lt;/a&gt;. And that&amp;#39;s a problem. On the one hand it allows you virtually unlimited ability to play with data structures and mold them to your own design. On the other, it presents the virtually insurmountable problem of testability.&lt;/p&gt;&lt;p&gt;You see, a dynamic language delays the checks which are performed by a static language during compilation until runtime. So you have no idea whether your code is correct until it is executed. The usual answer to this is to write unit tests. But the people who say this tend to gloss over the difficulty of getting 100% unit test coverage. 70% coverage is usually considered a very high test rate. And then there&amp;#39;s the difficulty of getting the coverage metrics themselves. At the time of writing, there is &lt;a href="http://www.softwareverify.com/javascript/coverage/index.html"&gt;only one&lt;/a&gt; Javascript/browser code coverage tool around. Hopefully all the hype surrounding AJAX will encourage more of these tools to be written.&lt;/p&gt;&lt;p&gt;One tool that is available now is &lt;a href="http://www.javascriptlint.com/"&gt;JavascriptLint&lt;/a&gt;. Lint was the tool you may have used many years ago to statically analyze your C source code for common programming errors not picked up by the compiler. So JavascriptLint does the same but for Javascript. It&amp;#39;s based on SpiderMonkey, the C-based Javascript engine in Firefox. So you can be sure it&amp;#39;s rock solid with zero false positives. It&amp;#39;s a fantastic tool to help AJAX programming as it seamlessly integrates into your favorite IDE as an external tool. Some of the errors it picks up on are:&lt;/p&gt;&lt;ul&gt;&lt;li&gt;&lt;a href="http://blogs.msdn.com/ericlippert/archive/2004/02/02/66334.aspx"&gt;Missing semicolons&lt;/a&gt;.&lt;/li&gt;&lt;li&gt;&lt;a href="http://groups.google.com/groups?q=parseint%20octal"&gt;Unintended use of octal&lt;/a&gt; where decimal was intended&lt;/li&gt;&lt;li&gt;Automatic type coercion&lt;/li&gt;&lt;li&gt;Undeclared variables&lt;/li&gt;&lt;li&gt;Redeclared variables&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;Some of these are only available with the tool in Option Explicit mode. Even if it doesn&amp;#39;t spot outright bugs in your code, the checks for type coercion and missing semicolons are performance bugs in your code.&lt;br /&gt;&lt;/p&gt;&lt;p&gt;The benefits of JavascriptLint are so conclusive it gets run over my code several times per day.&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;div class = "shareblock"&gt;&lt;strong&gt;Share this post:&lt;/strong&gt; &lt;a href = "mailto:?body=Thought you might like this: http://aspadvice.com/blogs/rbirkby/archive/2007/01/22/The-trouble-with-dynamic-languages.aspx&amp;amp;;subject=The+trouble+with+dynamic+languages" target="_blank" title = "Post http://aspadvice.com/blogs/rbirkby/archive/2007/01/22/The-trouble-with-dynamic-languages.aspx"&gt;email it!&lt;/a&gt; |  &lt;a href = "http://del.icio.us/post?url=http://aspadvice.com/blogs/rbirkby/archive/2007/01/22/The-trouble-with-dynamic-languages.aspx&amp;amp;;title=The+trouble+with+dynamic+languages" target="_blank" title = "Post http://aspadvice.com/blogs/rbirkby/archive/2007/01/22/The-trouble-with-dynamic-languages.aspx"&gt;bookmark it!&lt;/a&gt; |  &lt;a href = "http://www.digg.com/submit?url=http://aspadvice.com/blogs/rbirkby/archive/2007/01/22/The-trouble-with-dynamic-languages.aspx&amp;amp;;phase=2" target="_blank" title = "Post http://aspadvice.com/blogs/rbirkby/archive/2007/01/22/The-trouble-with-dynamic-languages.aspx"&gt;digg it!&lt;/a&gt; |  &lt;a href = "http://reddit.com/submit?url=http://aspadvice.com/blogs/rbirkby/archive/2007/01/22/The-trouble-with-dynamic-languages.aspx&amp;amp;title=The+trouble+with+dynamic+languages" target="_blank" title = "Post http://aspadvice.com/blogs/rbirkby/archive/2007/01/22/The-trouble-with-dynamic-languages.aspx"&gt;reddit!&lt;/a&gt; |  &lt;a href = "http://www.dotnetkicks.com/submit/?url=http://aspadvice.com/blogs/rbirkby/archive/2007/01/22/The-trouble-with-dynamic-languages.aspx&amp;amp;;title=The+trouble+with+dynamic+languages" target="_blank" title = "Post http://aspadvice.com/blogs/rbirkby/archive/2007/01/22/The-trouble-with-dynamic-languages.aspx"&gt;kick it!&lt;/a&gt; |  &lt;a href = "https://favorites.live.com/quickadd.aspx?marklet=1&amp;amp;;mkt=en-us&amp;amp;;url=http://aspadvice.com/blogs/rbirkby/archive/2007/01/22/The-trouble-with-dynamic-languages.aspx&amp;amp;;title=The+trouble+with+dynamic+languages&amp;amp;;top=1" target="_blank" title = "Post http://aspadvice.com/blogs/rbirkby/archive/2007/01/22/The-trouble-with-dynamic-languages.aspx"&gt;live it!&lt;/a&gt;&lt;/div&gt;&lt;img src="http://aspadvice.com/aggbug.aspx?PostID=26548" width="1" height="1"&gt;</content><author><name>rbirkby</name><uri>http://aspadvice.com/members/rbirkby.aspx</uri></author><category term="Javascript" scheme="http://aspadvice.com/blogs/rbirkby/archive/tags/Javascript/default.aspx" /></entry><entry><title>What language was ASP.Net originally written in?</title><link rel="alternate" type="text/html" href="http://aspadvice.com/blogs/rbirkby/archive/2006/11/28/What-language-was-ASP.Net-originally-written-in_3F00_.aspx" /><id>http://aspadvice.com/blogs/rbirkby/archive/2006/11/28/What-language-was-ASP.Net-originally-written-in_3F00_.aspx</id><published>2006-11-28T10:16:00Z</published><updated>2006-11-28T10:16:00Z</updated><content type="html">&lt;p&gt;In &lt;a href="http://wm.microsoft.com/ms/msdn/visualcsharp/peter_hallam_2006_11/PeterHallam01.wmv" title="this video"&gt;this video&lt;/a&gt;, Peter Hallam, one of the original C# designers talks about a new C# v3 feature, but also says that WinForms was the original consumer of the C# language.&lt;/p&gt;&lt;p&gt;This totally contradicts my understanding. I thought that ASP.Net (XSP) was the original team using C# and that WinForms (WFC as it was) was only ported to C# from Java over the winter of 1999/2000 by &lt;a href="http://www.simplegeek.com/" title="Chris Anderson"&gt;Chris Anderson&lt;/a&gt;. &lt;/p&gt;&lt;p&gt;Am I wrong?&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&lt;/p&gt;
&lt;div class = "shareblock"&gt;&lt;strong&gt;Share this post:&lt;/strong&gt; &lt;a href = "mailto:?body=Thought you might like this: http://aspadvice.com/blogs/rbirkby/archive/2006/11/28/What-language-was-ASP.Net-originally-written-in_3F00_.aspx&amp;amp;;subject=What+language+was+ASP.Net+originally+written+in%3f" target="_blank" title = "Post http://aspadvice.com/blogs/rbirkby/archive/2006/11/28/What-language-was-ASP.Net-originally-written-in_3F00_.aspx"&gt;email it!&lt;/a&gt; |  &lt;a href = "http://del.icio.us/post?url=http://aspadvice.com/blogs/rbirkby/archive/2006/11/28/What-language-was-ASP.Net-originally-written-in_3F00_.aspx&amp;amp;;title=What+language+was+ASP.Net+originally+written+in%3f" target="_blank" title = "Post http://aspadvice.com/blogs/rbirkby/archive/2006/11/28/What-language-was-ASP.Net-originally-written-in_3F00_.aspx"&gt;bookmark it!&lt;/a&gt; |  &lt;a href = "http://www.digg.com/submit?url=http://aspadvice.com/blogs/rbirkby/archive/2006/11/28/What-language-was-ASP.Net-originally-written-in_3F00_.aspx&amp;amp;;phase=2" target="_blank" title = "Post http://aspadvice.com/blogs/rbirkby/archive/2006/11/28/What-language-was-ASP.Net-originally-written-in_3F00_.aspx"&gt;digg it!&lt;/a&gt; |  &lt;a href = "http://reddit.com/submit?url=http://aspadvice.com/blogs/rbirkby/archive/2006/11/28/What-language-was-ASP.Net-originally-written-in_3F00_.aspx&amp;amp;title=What+language+was+ASP.Net+originally+written+in%3f" target="_blank" title = "Post http://aspadvice.com/blogs/rbirkby/archive/2006/11/28/What-language-was-ASP.Net-originally-written-in_3F00_.aspx"&gt;reddit!&lt;/a&gt; |  &lt;a href = "http://www.dotnetkicks.com/submit/?url=http://aspadvice.com/blogs/rbirkby/archive/2006/11/28/What-language-was-ASP.Net-originally-written-in_3F00_.aspx&amp;amp;;title=What+language+was+ASP.Net+originally+written+in%3f" target="_blank" title = "Post http://aspadvice.com/blogs/rbirkby/archive/2006/11/28/What-language-was-ASP.Net-originally-written-in_3F00_.aspx"&gt;kick it!&lt;/a&gt; |  &lt;a href = "https://favorites.live.com/quickadd.aspx?marklet=1&amp;amp;;mkt=en-us&amp;amp;;url=http://aspadvice.com/blogs/rbirkby/archive/2006/11/28/What-language-was-ASP.Net-originally-written-in_3F00_.aspx&amp;amp;;title=What+language+was+ASP.Net+originally+written+in%3f&amp;amp;;top=1" target="_blank" title = "Post http://aspadvice.com/blogs/rbirkby/archive/2006/11/28/What-language-was-ASP.Net-originally-written-in_3F00_.aspx"&gt;live it!&lt;/a&gt;&lt;/div&gt;&lt;img src="http://aspadvice.com/aggbug.aspx?PostID=24972" width="1" height="1"&gt;</content><author><name>rbirkby</name><uri>http://aspadvice.com/members/rbirkby.aspx</uri></author><category term="C#" scheme="http://aspadvice.com/blogs/rbirkby/archive/tags/C_2300_/default.aspx" /><category term="dotnet" scheme="http://aspadvice.com/blogs/rbirkby/archive/tags/dotnet/default.aspx" /><category term="asp.net" scheme="http://aspadvice.com/blogs/rbirkby/archive/tags/asp.net/default.aspx" /></entry><entry><title>Client-side validation in Firefox</title><link rel="alternate" type="text/html" href="http://aspadvice.com/blogs/rbirkby/archive/2006/11/01/Client_2D00_side-validation-in-Firefox.aspx" /><id>http://aspadvice.com/blogs/rbirkby/archive/2006/11/01/Client_2D00_side-validation-in-Firefox.aspx</id><published>2006-11-01T07:49:00Z</published><updated>2006-11-01T07:49:00Z</updated><content type="html">&lt;p&gt;Recently, I was faced with a problem whereby client-side validation of controls failed to work in &lt;a href="http://www.mozilla.org/"&gt;Firefox&lt;/a&gt;. Only server-side validation was working. Client side validation was working fine in IE.&lt;/p&gt;&lt;p&gt;This was puzzling as everything I read said that ASP.Net v2 supported client-side validation in Firefox. No amount of Googling helped to identify the problem, so I had to track it down from scratch - and the results were quite interesting. If you have &lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;span style="font-size:10pt;font-family:'Courier New';color:blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="font-size:10pt;font-family:'Courier New';color:maroon;"&gt;xhtmlConformance&lt;/span&gt;&lt;span style="font-size:10pt;font-family:'Courier New';color:blue;"&gt;
&lt;/span&gt;&lt;span style="font-size:10pt;font-family:'Courier New';color:red;"&gt;mode&lt;/span&gt;&lt;span style="font-size:10pt;font-family:'Courier New';color:blue;"&gt;=&lt;/span&gt;&lt;span style="font-size:10pt;font-family:'Courier New';"&gt;&amp;quot;&lt;span style="color:blue;"&gt;Legacy&lt;/span&gt;&amp;quot;&lt;span style="color:blue;"&gt;/&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p&gt;set in your web.config, then client-side validation is disabled in firefox. &lt;/p&gt;&lt;p&gt;To see why, we have to jump down into the validation framework that ASP.Net sends to the web browser. The actual Javascript validation function looks like:

&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;span style="font-size:10pt;font-family:'Courier New';color:blue;"&gt;function&lt;/span&gt;&lt;span style="font-size:10pt;font-family:'Courier New';"&gt;
ValidatorValidate(val) { &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class="MsoNormal"&gt;&lt;span style="font-size:10pt;font-family:'Courier New';"&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;val.isvalid = &lt;span style="color:blue;"&gt;true&lt;/span&gt;;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class="MsoNormal"&gt;&lt;span style="font-size:10pt;font-family:'Courier New';"&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color:blue;"&gt;if&lt;/span&gt;
(val.enabled != &lt;span style="color:blue;"&gt;false&lt;/span&gt;) {&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class="MsoNormal"&gt;&lt;span style="font-size:10pt;font-family:'Courier New';"&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color:blue;"&gt;if&lt;/span&gt; (&lt;span style="color:blue;"&gt;typeof&lt;/span&gt;(val.evaluationfunction) == &lt;span style="color:maroon;"&gt;&amp;quot;function&amp;quot;&lt;/span&gt;) {&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class="MsoNormal"&gt;&lt;span style="font-size:10pt;font-family:'Courier New';"&gt;&lt;span&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; &lt;/span&gt;val.isvalid =
val.evaluationfunction(val); &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class="MsoNormal"&gt;&lt;span style="font-size:10pt;font-family:'Courier New';"&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class="MsoNormal"&gt;&lt;span style="font-size:10pt;font-family:'Courier New';"&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class="MsoNormal"&gt;&lt;span style="font-size:10pt;font-family:'Courier New';"&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;ValidatorUpdateDisplay(val);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class="MsoNormal"&gt;&lt;span style="font-size:10pt;font-family:'Courier New';"&gt;}&lt;/span&gt;&lt;/p&gt;

&lt;p&gt;Using &lt;a href="http://www.mozilla.org/projects/venkman/"&gt;Venkman&lt;/a&gt;, I was able to see that val.evaluationfunction wasn&amp;#39;t a function at all, therefore the page wasn&amp;#39;t getting validated because of this. A bit more searching found that this evaluationfunction is an expando attribute. In ASP.Net v1, this expando is an IE-only HTML expando, defined directly in the HTML markup. In ASP.Net v2, this is a Javascript expando attribute, defined on the DOM via Javascript, and therefore compatible with both IE and Firefox. &lt;/p&gt;&lt;p&gt;For example, the &lt;a href="http://msdn2.microsoft.com/en-us/system.web.ui.webcontrols.requiredfieldvalidator.aspx"&gt;RequiredFieldValidator&lt;/a&gt; calls &lt;a href="http://msdn2.microsoft.com/en-us/library/system.web.ui.clientscriptmanager.registerexpandoattribute.aspx"&gt;RegisterExpandoAttribute&lt;/a&gt;. You can call this method yourself like:&lt;br /&gt;

&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;span style="font-size:10pt;font-family:'Courier New';"&gt;Page.ClientScript.RegisterExpandoAttribute(TextBox1.ClientID,
&lt;span style="color:maroon;"&gt;&amp;quot;value&amp;quot;&lt;/span&gt;, TextBox1.Text);&lt;/span&gt;&lt;/p&gt;



&lt;p&gt;&amp;nbsp;This produces a block of Javascript just before the closing &lt;span style="font-size:10pt;font-family:'Courier New';color:blue;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="font-size:10pt;font-family:'Courier New';color:maroon;"&gt;form&lt;/span&gt;&lt;span style="font-size:10pt;font-family:'Courier New';color:blue;"&gt;&amp;gt;&lt;/span&gt; tag like:&lt;br /&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;span style="font-size:10pt;font-family:'Courier New';color:blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="font-size:10pt;font-family:'Courier New';color:maroon;"&gt;script&lt;/span&gt;&lt;span style="font-size:10pt;font-family:'Courier New';"&gt; &lt;span style="color:red;"&gt;type&lt;/span&gt;&lt;span style="color:blue;"&gt;=&amp;quot;text/javascript&amp;quot;&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class="MsoNormal"&gt;&lt;span style="font-size:10pt;font-family:'Courier New';"&gt;&amp;lt;!--&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class="MsoNormal"&gt;&lt;span style="font-size:10pt;font-family:'Courier New';color:blue;"&gt;var&lt;/span&gt;&lt;span style="font-size:10pt;font-family:'Courier New';"&gt; TextBox1 =
document.all ? document.all[&lt;span style="color:maroon;"&gt;&amp;quot;TextBox1&amp;quot;&lt;/span&gt;]
: document.getElementById(&lt;span style="color:maroon;"&gt;&amp;quot;TextBox1&amp;quot;&lt;/span&gt;);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class="MsoNormal"&gt;&lt;span style="font-size:10pt;font-family:'Courier New';"&gt;TextBox1.value
= &lt;span style="color:maroon;"&gt;&amp;quot;&amp;quot;&lt;/span&gt;;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class="MsoNormal"&gt;&lt;span style="font-size:10pt;font-family:'Courier New';color:green;"&gt;// --&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class="MsoNormal"&gt;&lt;span style="font-size:10pt;font-family:'Courier New';color:blue;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="font-size:10pt;font-family:'Courier New';color:maroon;"&gt;script&lt;/span&gt;&lt;span style="font-size:10pt;font-family:'Courier New';color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class="MsoNormal"&gt;where &amp;quot;value&amp;quot; has become the new expando attribute. In the case of the RequiredFieldValidator, the expando name is&amp;quot; evaluationfunction&amp;quot; and it is added to the &lt;span style="font-size:10pt;font-family:'Courier New';color:blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="font-size:10pt;font-family:'Courier New';color:maroon;"&gt;span&lt;/span&gt;&lt;span style="font-size:10pt;font-family:'Courier New';color:blue;"&gt;&amp;gt; &lt;/span&gt;representing the control at runtime. &lt;br /&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;It turned out that this block of Javascript wasn&amp;#39;t being sent to Firefox in my situation, and I didn&amp;#39;t know why. Instead, the evaluationfunction expando attribute was being rendered directly on the&lt;span style="font-size:10pt;font-family:'Courier New';color:blue;"&gt; &amp;lt;&lt;/span&gt;&lt;span style="font-size:10pt;font-family:'Courier New';color:maroon;"&gt;span&lt;/span&gt;&lt;span style="font-size:10pt;font-family:'Courier New';color:blue;"&gt;&amp;gt; &lt;/span&gt;element in HTML.&lt;br /&gt;&lt;/p&gt;

&lt;p&gt;So after good deal of decompilation using &lt;a href="http://www.lutzroeder.com/"&gt;Reflector&lt;/a&gt;, and debugging using Reflection Invokeing of private methods, I discovered the problem was that RegisterExpandoAttribute checks the &lt;a href="http://msdn2.microsoft.com/en-US/library/ms178159.aspx"&gt;XHTML Rendering Mode&lt;/a&gt; prior to generating the Javascript and if that rendering mode is set to &lt;a href="http://msdn2.microsoft.com/en-us/library/ms228268.aspx"&gt;Legacy&lt;/a&gt;, then the expando is rendered directly onto the &lt;span style="font-size:10pt;font-family:'Courier New';color:blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="font-size:10pt;font-family:'Courier New';color:maroon;"&gt;span&lt;/span&gt;&lt;span style="font-size:10pt;font-family:'Courier New';color:blue;"&gt;&amp;gt;&lt;/span&gt; element and no Javascript code is rendered. The result of this is to prevent Firefox from performing client-side validation when Legacy XHTML mode is set.&lt;br /&gt;&lt;/p&gt;&lt;p&gt;I have no idea why the ASP.Net team chose to do this for validation. Perhaps the Legacy XHTML setting should have been called &amp;quot;ASPNetv1Conformance&amp;quot; because that&amp;#39;s actually what it does. The docs for Legacy mode state:&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&amp;quot;Reverts a number of rendering changes made for conformance to the v1.1 
rendering behavior.&amp;quot;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;div class = "shareblock"&gt;&lt;strong&gt;Share this post:&lt;/strong&gt; &lt;a href = "mailto:?body=Thought you might like this: http://aspadvice.com/blogs/rbirkby/archive/2006/11/01/Client_2D00_side-validation-in-Firefox.aspx&amp;amp;;subject=Client-side+validation+in+Firefox" target="_blank" title = "Post http://aspadvice.com/blogs/rbirkby/archive/2006/11/01/Client_2D00_side-validation-in-Firefox.aspx"&gt;email it!&lt;/a&gt; |  &lt;a href = "http://del.icio.us/post?url=http://aspadvice.com/blogs/rbirkby/archive/2006/11/01/Client_2D00_side-validation-in-Firefox.aspx&amp;amp;;title=Client-side+validation+in+Firefox" target="_blank" title = "Post http://aspadvice.com/blogs/rbirkby/archive/2006/11/01/Client_2D00_side-validation-in-Firefox.aspx"&gt;bookmark it!&lt;/a&gt; |  &lt;a href = "http://www.digg.com/submit?url=http://aspadvice.com/blogs/rbirkby/archive/2006/11/01/Client_2D00_side-validation-in-Firefox.aspx&amp;amp;;phase=2" target="_blank" title = "Post http://aspadvice.com/blogs/rbirkby/archive/2006/11/01/Client_2D00_side-validation-in-Firefox.aspx"&gt;digg it!&lt;/a&gt; |  &lt;a href = "http://reddit.com/submit?url=http://aspadvice.com/blogs/rbirkby/archive/2006/11/01/Client_2D00_side-validation-in-Firefox.aspx&amp;amp;title=Client-side+validation+in+Firefox" target="_blank" title = "Post http://aspadvice.com/blogs/rbirkby/archive/2006/11/01/Client_2D00_side-validation-in-Firefox.aspx"&gt;reddit!&lt;/a&gt; |  &lt;a href = "http://www.dotnetkicks.com/submit/?url=http://aspadvice.com/blogs/rbirkby/archive/2006/11/01/Client_2D00_side-validation-in-Firefox.aspx&amp;amp;;title=Client-side+validation+in+Firefox" target="_blank" title = "Post http://aspadvice.com/blogs/rbirkby/archive/2006/11/01/Client_2D00_side-validation-in-Firefox.aspx"&gt;kick it!&lt;/a&gt; |  &lt;a href = "https://favorites.live.com/quickadd.aspx?marklet=1&amp;amp;;mkt=en-us&amp;amp;;url=http://aspadvice.com/blogs/rbirkby/archive/2006/11/01/Client_2D00_side-validation-in-Firefox.aspx&amp;amp;;title=Client-side+validation+in+Firefox&amp;amp;;top=1" target="_blank" title = "Post http://aspadvice.com/blogs/rbirkby/archive/2006/11/01/Client_2D00_side-validation-in-Firefox.aspx"&gt;live it!&lt;/a&gt;&lt;/div&gt;&lt;img src="http://aspadvice.com/aggbug.aspx?PostID=23784" width="1" height="1"&gt;</content><author><name>rbirkby</name><uri>http://aspadvice.com/members/rbirkby.aspx</uri></author><category term="dotnet" scheme="http://aspadvice.com/blogs/rbirkby/archive/tags/dotnet/default.aspx" /><category term="asp.net" scheme="http://aspadvice.com/blogs/rbirkby/archive/tags/asp.net/default.aspx" /><category term="xhtml" scheme="http://aspadvice.com/blogs/rbirkby/archive/tags/xhtml/default.aspx" /><category term="expando" scheme="http://aspadvice.com/blogs/rbirkby/archive/tags/expando/default.aspx" /><category term="html" scheme="http://aspadvice.com/blogs/rbirkby/archive/tags/html/default.aspx" /><category term="validation" scheme="http://aspadvice.com/blogs/rbirkby/archive/tags/validation/default.aspx" /></entry></feed>