Closed NikolayUvarov closed 5 years ago
@NikolayUvarov thanks for posting. Can you please turn on break on all exceptions, and show me a screenshot of where the code is breaking? Also the stack trace.
Here the small project with test code that works in win7 but fails in win10. I see that after call var devices = await DeviceManager.Current.GetDevicesAsync(deviceDefinitions); device|count = 0.
So the problem is not in exception itself, but in silently getting no devices in win10.
System.NullReferenceException
HResult=0x80004003
Message = Null reference.
Source = DeviceTerminal
Stack trace:
в DeviceTerminal.Form1.
WindowsHidDeviceFactory.Register(); I have just found that code below does not show my device in win10. I think that is the problem.
var devices1 = await DeviceManager.Current.GetConnectedDeviceDefinitionsAsync(null);
Console.WriteLine("Currently connected devices: ");
foreach (var device in devices1)
{
//Console.WriteLine(device.DeviceId);
Program.form1.textBox1_log.Invoke(new Action(() => Program.form1.textBox1_log.AppendText("\r\nGot string:\r\n" + device.DeviceId)));
}
BTW, I've just checked that is not security issue of win10 - device hid lister shows about 15 devices, but the code above only two.
@NikolayUvarov please register a Logger in the WindowsHidDeviceFactory.Register() method.
Watch the debug output window and see what turns up.
Also please include the screenshots etc.
@NikolayUvarov this is how you register a logger:
@NikolayUvarov any progress?
Have you tried cloning this repo, and debugging the libraries here?
Currently I have added logger but I do not see any additional error messages. I have noticed, that example which displaying list of usb devises shows only two of them. I fuguered out that is not security issue because I can access device via an vb app on win10.
My c# app gets no errors except it simply does not see a range of usb hid devices under win10. And on win7 all work just perfect.
On Sun, Jul 7, 2019, 04:16 Christian Findlay notifications@github.com wrote:
@NikolayUvarov https://github.com/NikolayUvarov any progress?
Have you tried cloning this repo, and debugging the libraries here?
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/MelbourneDeveloper/Device.Net/issues/71?email_source=notifications&email_token=AB432NKKPUSWGWARXKKJUHLP6E7YNA5CNFSM4H4SWZW2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODZLC3AQ#issuecomment-508964226, or mute the thread https://github.com/notifications/unsubscribe-auth/AB432NJE2XZYO3EO2DGQCYDP6E7YNANCNFSM4H4SWZWQ .
@NikolayUvarov it's probably different API behaviour between windows 7 and 10.
You will need to debug. Please clone the repo , turn on break on all exceptions and debug to see what happens.
@NikolayUvarov , sorry about the short reply last time. I want to help you get this working. I am just very busy trying to get the changes done for 3.0 . Here is what I need you to do so I can diagnose the problem:
Thank you very much! Curriently I am abroad, will be able to check all stuff this weekend (or maximum beginning of the next week).
вс, 14 июл. 2019 г. в 03:59, Christian Findlay notifications@github.com:
@NikolayUvarov https://github.com/NikolayUvarov , sorry about the short reply last time. I want to help you get this working. I am just very busy trying to get the changes done for 3.0 https://github.com/MelbourneDeveloper/Device.Net/projects/8 . Here is what I need you to do so I can diagnose the problem:
- Use Windows 10
- Clone this repo
- In your project, drop all the NuGet package references for this repo
- Add the projects from this repo that you need one by one to your solution (instead of the NuGet packages)
- Turn on break on all exceptions. I have written a guide just for you here https://christianfindlay.com/2019/07/14/visual-studio-break-on-all-exceptions/ .
- Run the app
- Take screenshots, and copy the ToString() of any Exceptions you see
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/MelbourneDeveloper/Device.Net/issues/71?email_source=notifications&email_token=AB432NLN26RNWEQX2ZX7RSLP7J26HA5CNFSM4H4SWZW2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODZ34BGY#issuecomment-511164571, or mute the thread https://github.com/notifications/unsubscribe-auth/AB432NPMB2LZDDAKZC3IJVDP7J26HANCNFSM4H4SWZWQ .
I am also getting Device count 0. Doing as @MelbourneDeveloper said:
System.Exception
HResult=0x80131500
Message=Could not get Hid Attributes (Call HidD_GetAttributes). Error code: 6
Source=Device.Net
StackTrace:
at Device.Net.Windows.WindowsDeviceBase.HandleError(Boolean isSuccess, String message) in ...\Device.Net-master\src\Device.Net\Windows\WindowsDeviceBase.cs:line 36
@aurirjr some of the information is chopped off there. Please follow the steps for breaking on all exceptions here: https://christianfindlay.com/2019/07/14/visual-studio-break-on-all-exceptions/ and then wind back the call stack by one frame when you hit the exception. Then take a screenshot and post it here.
However, this is a pretty common API error. It just means that the library tried to get the details for a device, but the API call failed. The device probably cannot be queried.
Sry It was chopped off. I will redo the procedure.
I was analyzing yesterday and APICalls.CreateFile returned a SafeFileHandle just fine, with a valid Handle. The error code 87 was returned by HidD_GetManufacturerString.
The device is an HID-compliant mouse, and It probably cannot be queried in Windows 10 for security reasons. With HIDSharp, TryOpen also doesn't work, as this case https://forum.zer7.com/topic/10122/ . I don't know if there is a workaround.
I noticed, that in the example provided by MD I see the full list of usb devices. When I use it in my app I am getting just empty list.
But for some reason I cannot get the full device list in my App.
Our goal to understand why such a difference.
I do not think that our issue is not security issue because I can easily interact with same device via another application.
чт, 18 июл. 2019 г. в 19:12, aurirjr notifications@github.com:
Sry It was chopped off. I will redo the procedure.
I was analyzing yesterday and APICalls.CreateFile returned a SafeFileHandle just fine, with a valid Handle. The error code 87 was returned by HidD_GetManufacturerString.
The device is an HID-compliant mouse, and It probably cannot be queried in Windows 10 for security reasons. With HIDSharp, TryOpen also doesn't work, as this case https://forum.zer7.com/topic/10122/ . I don't know if there is a workaround.
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/MelbourneDeveloper/Device.Net/issues/71?email_source=notifications&email_token=AB432NJDHBP37MHMYSYT76DQACI6VA5CNFSM4H4SWZW2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD2I7ZJY#issuecomment-512883879, or mute the thread https://github.com/notifications/unsubscribe-auth/AB432NMCV6LJXXVK7XCLJC3QACI6VANCNFSM4H4SWZWQ .
@NikolayUvarov
I do not think that our issue is not security issue because I can easily interact with same device via another application.
It's possible that there are multiple device ids in the system for the same device. For example, there may be a USB Id, and a Hid Id. It's possible that the Hid Id fails while the USB one works fine.
Do you see any USB device Ids?
Usb.Net has some issues with USB right now. I'm working hard to fix those and version 3.0 should be much more stable with USB.
@aurirjr some devices just fail for some reason. If you find any library that is able to connect to it, please let me know.
@NikolayUvarov this issue will be closed soon. Please write back if you'd like to continue the discussion.
so I think we should wait for version 3 and then check in on win7/10
On Sat, Jul 20, 2019, 11:37 Christian Findlay notifications@github.com wrote:
I do not think that our issue is not security issue because I can easily interact with same device via another application.
It's possible that there are multiple device ids in the system. For example, there may be a USB Id, and a Hid Id. It's possible that the Hid Id fails while the USB one works fine.
Do you see any USB device Ids?
Usb.Net has some issues with USB right now. I'm working hard to fix those and version 3.0 should be much more stable with USB.
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/MelbourneDeveloper/Device.Net/issues/71?email_source=notifications&email_token=AB432NILWRCPZPZ7OIBHR3DQALFEZA5CNFSM4H4SWZW2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD2NJYPQ#issuecomment-513449022, or mute the thread https://github.com/notifications/unsubscribe-auth/AB432NOTCHKONVTEJBD6S5TQALFEZANCNFSM4H4SWZWQ .
@nikolayuvarov V3 has been released. Are you still having the same issue?
Please see this article to help diagnose the issue https://github.com/MelbourneDeveloper/Device.Net/wiki/Debugging,-Logging,-and-Tracing
I did not knew that, thanks! I will report if any and if not also. Thanks again!
вт, 20 авг. 2019 г. в 09:24, Christian Findlay notifications@github.com:
@NikolayUvarov https://github.com/NikolayUvarov V3 has been released. Are you still having the same issue?
Please see this article to help diagnose the issue
https://github.com/MelbourneDeveloper/Device.Net/wiki/Debugging,-Logging,-and-Tracing
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/MelbourneDeveloper/Device.Net/issues/71?email_source=notifications&email_token=AB432NNTAII7PVP5BPSK363QFOEZPA5CNFSM4H4SWZW2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD4VGLNQ#issuecomment-522872246, or mute the thread https://github.com/notifications/unsubscribe-auth/AB432NLUO4D72K7ZQAYJ2W3QFOEZPANCNFSM4H4SWZWQ .
Version 3.0.0 works fine in Win10! Thanks! The issue when I could see my device in win7 and can't in win10 is now resolved.
вт, 20 авг. 2019 г. в 09:33, Nikolay Uvarov nikolay.uvarov@gmail.com:
I did not knew that, thanks! I will report if any and if not also. Thanks again!
вт, 20 авг. 2019 г. в 09:24, Christian Findlay notifications@github.com:
@NikolayUvarov https://github.com/NikolayUvarov V3 has been released. Are you still having the same issue?
Please see this article to help diagnose the issue
https://github.com/MelbourneDeveloper/Device.Net/wiki/Debugging,-Logging,-and-Tracing
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/MelbourneDeveloper/Device.Net/issues/71?email_source=notifications&email_token=AB432NNTAII7PVP5BPSK363QFOEZPA5CNFSM4H4SWZW2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD4VGLNQ#issuecomment-522872246, or mute the thread https://github.com/notifications/unsubscribe-auth/AB432NLUO4D72K7ZQAYJ2W3QFOEZPANCNFSM4H4SWZWQ .
@NikolayUvarov Awesome!
I have simple test form with a textfield and button, visual studio community 2017. This code works perfect in windows7, but the same code in windows10 device is no. I am getting error in line line await myHidDevice.WriteAsync(buffer); showing System.NullReverenceException in DeviceTerminal.Form1.d__4.MoveNext()
This code is copy from the example.
`
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text;