If an anomaly occurs when it seems that on some machines that did not have Windows Update, for a VERY long time when the .NET Framework 2.0 did not have the specific overload available in it.
AutoResetEvent.WaitOne (int32) does not seem to exist in the earlier version. According to MS documentation, this method has always been there, but obviously it is not. If you call AutoResetEvent.WaitOne (int32, boolean), this is normal.
When you call this method, it causes the application to crash completely without any chance of catching an exception, etc.
I came up with a workaround for him, but wondered how people encourage their users to update their computers to the latest service packs, etc.?
Is it better to accept that they will not be updated and encoded accordingly, or force them to be updated without starting the program.
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
source
share