If have come across an anomaly where it seems that some machines that have not had a Windows Update applied to them in a VERY long time that the .NET Framework 2.0 didn't have a specific overload available in it.
AutoResetEvent.WaitOne(int32) appears to be non existant under an early revision. According to MS documentation this method has always been there, but obviously it isn't. If you call AutoResetEvent.WaitOne(int32, boolean) it's fine.
When you call this method is causes the application to completely crash without any chance of catching an exception etc.
I have come up with a workaround for it, but wondered how people encourage their users to update their machines to the latest service packs etc.?
Is it best to accept that they won't update and code accordingly, or force them to update by not letting the program start.
Dim au As System.Threading.AutoResetEvent
au = New System.Threading.AutoResetEvent(False)
Dim themethods() As MethodInfo
themethods = au.GetType.GetMethods()
Dim found As Boolean
For Each m As MethodInfo In themethods
If String.Equals(m.Name, "WaitOne", StringComparison.OrdinalIgnoreCase) Then
Dim params() As ParameterInfo
params = m.GetParameters
If params.Length = 1 Then
If params(0).ParameterType Is GetType(Integer) Then
found = True
Exit For
End If
End If
End If
Next
Dim allowRun As Boolean = True
If Not found Then
ApplicationLog.Write("This system is running an old version of the Microsoft .NET Framework, please update with Windows Update to prevent errors.")
If MessageBox.Show("This system is running an old version of the Microsoft .NET Framework, please update with Windows Update to prevent errors.", "Old Version of .NET Framework", MessageBoxButtons.OKCancel, MessageBoxIcon.Error, MessageBoxDefaultButton.Button2) = DialogResult.Cancel Then
allowRun = False
End If
End If