<?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/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Mike Plate &#187; .NET</title>
	<atom:link href="http://www.mikeplate.com/category/dotnet/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.mikeplate.com</link>
	<description>Freelance web and mobile developer</description>
	<lastBuildDate>Tue, 17 Aug 2010 20:12:19 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>MissingMethodException and WaitOne</title>
		<link>http://www.mikeplate.com/missingmethodexception-and-waitone/</link>
		<comments>http://www.mikeplate.com/missingmethodexception-and-waitone/#comments</comments>
		<pubDate>Fri, 26 Sep 2008 14:36:47 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[.NET]]></category>

		<guid isPermaLink="false">http://mikeplate.wordpress.com/?p=12</guid>
		<description><![CDATA[A customer complained today about a WinForms application written for .NET 2.0 that crashed. It turns out that on the customer&#8217;s computer, a MissingMethodException is thrown when calling: bool signal = WaitHandle.WaitOne(0); Well, it works fine on my computer and I was certain that the project settings in Visual Studio 2008 was set to .NET [...]]]></description>
			<content:encoded><![CDATA[<p>A customer complained today about a WinForms application written for .NET 2.0 that crashed. It turns out that on the customer&#8217;s computer, a MissingMethodException is thrown when calling:</p>
<blockquote><p>bool signal = WaitHandle.WaitOne(0);</p></blockquote>
<p>Well, it works fine on my computer and I was certain that the project settings in Visual Studio 2008 was set to .NET version 2.0 and that the customer has that version of .NET installed. It is a system method, so it should be there, shouldn&#8217;t it?</p>
<p>Not so. Turns out, if I&#8217;m not mistaken here, that this a new overload of the WaitOne method that was introduced in .NET 2.0 SP2. There are several overloads of this method, and the two I was having trouble choosing between was:</p>
<blockquote><p>bool WaitOne(int millisecondsTimeout, bool exitContext);<br />
bool WaitOne(int millisecondsTimeout);</p></blockquote>
<p>I must confess that I&#8217;m not entirely sure what exitContext means and the difference in supplying true or false. So out of laziness, when Visual Studio presented me with these choices, I chose the latter without the bool argument. Bad choice!</p>
<p>From what I understand this overload was actually added in .NET Framework 2.0 Service Pack 2. However it seems that SP2 is not installed by Windows Update and isn&#8217;t even available as a separate download. It is only available as part of .NET Framework 3.5 Service Pack 1.</p>
<p>You might know about the confusion about .NET Framework versions that seems to have replaced the old COM based dll hell. I&#8217;m probably not the best person to explain it and I sure use my own terminology. However, I&#8217;m going to give it a shot:</p>
<p>The thing is that one differentiates between the &#8220;core&#8221; .NET and &#8220;extensions&#8221; to .NET. Since version 3.0 of .NET no new versions has been created for the &#8220;core&#8221;. All libraries from version 3.0 and up are &#8220;extensions&#8221; and they all depend on the &#8220;core&#8221;. The &#8220;core&#8221; .NET is therefore still in version 2.0. However, I guess some bugs might have been discovered but also I&#8217;m guessing that while building the &#8220;extensions&#8221; a need for some updates in the &#8220;core&#8221; arised, which is why the &#8220;core&#8221; still had to be changed. And this lead to the release of service packs for the &#8220;core&#8221;. The result is that the package known as &#8220;.NET 3.5 SP1&#8243; includes an update to the core known as &#8220;.NET 2.0 SP2&#8243;.</p>
<p>Anyway, there are two &#8220;fixes&#8221; for my problem:</p>
<ul>
<li>Supply a boolean as the second argument to WaitOne in all my code.</li>
<li>Require .NET 3.5 SP1 to run the application.</li>
</ul>
<p>I chose the first one.</p>
<p>To Visual Studio, one might request that you had warned me about this. There is a generation of warnings when building applications where you use certain classes and methods that &#8220;should not be used anymore&#8221;. I guess this is the opposite, but should still warrant a warning?</p>
<p>Note: Please make a comment if you have a better understanding of this issue than I have. I can&#8217;t say I have verified all my findings.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.mikeplate.com/missingmethodexception-and-waitone/feed/</wfw:commentRss>
		<slash:comments>12</slash:comments>
		</item>
	</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Minified using disk
Page Caching using disk (enhanced)

Served from: www.mikeplate.com @ 2010-09-07 11:56:36 -->