Click here to Skip to main content
15,886,629 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
C#
// The following code works on some Windows computers, 32 and 64 bit
//  and not on other computers of the same 32 and 64 bit.
try
{
    WinDevicesWiFi.GetUSBDevices();
    // This searches for all MCP2200 Microchip devices by VID.
}
catch
{
    MessageBox.Show("The exception error is caused by" +
        "WinDevicesWiFi.GetUSBDevices() );
}
Posted
Updated 1-Oct-14 16:20pm
v2
Comments
Sergey Alexandrovich Kryukov 1-Oct-14 19:48pm    
In case, "doesn't work", how it looks, exactly? And what happens if there are no such devices?
—SA
JimOr 1-Oct-14 23:33pm    
When I get the error it seems that the winusb.sys is either not loaded or corrupt.
The project has been compiled on Visual C# 2010, and work on 3 out of the 4 computers I have.
Now I am testing the project on Visual C# 2013. (thinking it might work better)
The program on a Win8 computer works very well, but on my new Lenovo Laptop, Win8, it throws the exception.
Thanks Kindly, Jim
Sergey Alexandrovich Kryukov 2-Oct-14 0:23am    
Did you try to reinstall the OS in question?
—SA
JimOr 2-Oct-14 8:37am    
Sergey: Thank you for the OS suggestion.
I did that but it did not help this problem.
So I downloaded Visual C# Express 2013.
Recompiled the project, but had the same results.

Bernhard: Thank you for the suggestion about Windows Management Instrumentation (WMI)
I will search Google for repairing WMI.
However, the computer that gets the error is a NEW Win 8 Laptop.
The 3 test computers are XP Pro, Win 7, Win 8. The 4th is Win 8.1

I do thank everyone for the help and suggestions.
When I find the total answer i will post it here on Code Project.

1 solution

Quote:
searches ... by VID
When it comes to the Vendor ID (VID), Windows Management Instrumentation (WMI) uses to be involved. And it does happen rather often that WMI is corrupt.
Hence I suggest to repair WMI on the computers showing an exception. Google/Bing etc. will help you find out the steps for that procedure.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900