PORTS Forum
Ports and Interfaces => USB => Topic started by: acfasano on August 01, 2013, 04:01:48 pm
-
Hi, Guys,
I have a VB.NET application that runs over Jan Axelson's HID example. It runs fine but the following module keeps issuing an error (It issues an error once every 30 minutes) Mostly the software it works fine:
Friend Function IsWindows98Gold() As Boolean
Try
Dim myEnvironment As OperatingSystem = Environment.OSVersion
' Windows 98 Gold is version 4.10 with a build number less than 2183.
Dim version98SE As New System.Version(4, 10, 2183)
If (Version.op_LessThan(myEnvironment.Version, version98SE) = True) Then
Debug.Write("The OS is Windows 98 Gold.")
Return True
Else
Debug.Write("The OS is more recent than Windows 98 Gold.")
Return False
End If
Catch ex As Exception
DisplayException(MODULE_NAME, ex)
Throw
End Try
End Function
The error reported is:
The runtime has encountered a fatal error. The address of the error was at 0xe5e3f50d, on thread 0x9a8. The error code is 0xc0000005. This error may be a bug in the CLR or in the unsafe or non-verifiable portions of user code. Common sources of this bug include user marshaling errors for COM-interop or PInvoke, which may corrupt the stack.
I tried to avoid the Win98 OP system check by just returning FALSE on the Function but it does not work (I do not understand why)
Would anybody know how to get rid of those errors ?
Thanks
Antonio Fasano
Sao Paulo
Brazil
-
I will look at it, but in the meantime, just comment out any calls to IsWindows98Gold.
-
Hi, Jan,
I tried that. For whatever reason, it does not work. It seems that the software needs the Debug.write command to run ... (It is in that line that the error happens)
I used the solution below. The Debug.Write Line needs to be there. Otherwise the software hangs ... (And I have no clue where is hangs. It happens on the development computer and also on other computers.)
All use WINDOWS 7 32 Bits. vb.net 2010 and NET Frameworks 4.0
The problem happens seldom, but it happens.
Is there any way to remove the debug.write lines from the HID Module ?
Friend Function GetNumberOfInputBuffers _
(ByVal hidDeviceObject As SafeFileHandle, _
ByRef numberOfInputBuffers As Int32) _
As Boolean
Dim success As Boolean = True
Try
Debug.Write("") 'If I comment out this line, the software hangs.
success = HidD_GetNumInputBuffers _
(hidDeviceObject, _
numberOfInputBuffers)
Return success
Catch ex As Exception
DisplayException(MODULE_NAME, ex)
Throw
End Try
End Function
Thanks
Antonio
-
Delete the line.
Or remove the IsWindows98Gold module and all calls to it.
Windows 98 Gold is very old. The most recent version of my HID code doesn't check for it.
-
HI, Jan,
Where can I download the most recent version of the HID software for VB.NET ?
Thanks
Antonio
-
http://www.lvr.com/hidpage.htm#MyExampleCode