MatthewKing / DeviceId

A simple library providing functionality to generate a 'device ID' that can be used to uniquely identify a computer.
MIT License
722 stars 118 forks source link

Using package DeviceId.Wmi - MotherboardSerialNumber gives WPF scroll issues #77

Closed PepijnHogervorst closed 8 months ago

PepijnHogervorst commented 8 months ago

For a full stack WPF application with multiple projects the DeviceId.Wmi library for some reason gives touch scroll issues when used.

Adding the library as Nuget package to my Infrastructure layer project would make my WPF UI layer project give touch scroll issues. The touch still works but the scrollviewer in particular could not easily be scrolled anymore (PanningMode is set to Both).

I have created a simple project where the issue is active: TestTouchScroll-issue.zip. If you comment the lines in the MainWindow.xaml.cs - line 15 to 18 the problem is fixed. So it has to do something with the .AddMotherboardSerialNumber() or .AddMachineGuid() method that is called. I also found out that removing the MotherboardSerialNumber method fixes the issue. (the MachineGuid method doesn't use the Wmi library, i suspect the problem to lie in the Wmi library).

Hopefully this information is useful enough and feel free to ask for more information if required! Thank you in advance! Great library never the less!

Cheers, Pepijn

MatthewKing commented 8 months ago

That's a very strange one!

Doing a bit of research, I see the following similar issues:

I notice a workaround is posted in those issues. Does using that workaround help for your case?

Cheers

PepijnHogervorst commented 8 months ago

Thank you for the quick response. The workaround (adding _ = Tablet.TabletDevices; to the ) does work for the TestTouchScroll project but unfortunately not for the full stack application I am working on. The startup there is more complex (using async). For now I will not use the MotherboardSerialNumber anymore to work around this issue!