Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

does not work on Windows 7 enterprise sp1 #56

Closed
songjiefa opened this issue Jun 1, 2022 · 6 comments
Closed

does not work on Windows 7 enterprise sp1 #56

songjiefa opened this issue Jun 1, 2022 · 6 comments

Comments

@songjiefa
Copy link

The Win7 OS only install .net 6 runtime, and my code reference DeviceId.Windows.Mmi.
When I try to get device id, it throw error message as below, and I found the relate issue of mmi PowerShell/MMI#43

Time:2022-06-01 11:50:32.6242
Software version: 1.0.0.0
Operating system information:
Message:
Microsoft.Management.Infrastructure.CimException: FAILED
at Microsoft.Management.Infrastructure.CimException.ThrowIfMiResultFailure(MiResult result, String errorMessage, InstanceHandle errorData)
at Microsoft.Management.Infrastructure.CimException.ThrowIfMiResultFailure(MiResult result, InstanceHandle errorData)
at Microsoft.Management.Infrastructure.CimSession.Create(String computerName, CimSessionOptions sessionOptions)
at DeviceId.Windows.Mmi.Components.MmiSystemDriveSerialNumberDeviceIdComponent.GetValue()
at DeviceId.Formatters.HashDeviceIdFormatter.<>c.b__3_1(KeyValuePair2 x) at System.Linq.Enumerable.SelectIPartitionIterator2.PreallocatingToArray(Int32 count)
at System.Linq.Enumerable.SelectIPartitionIterator2.ToArray() at System.Linq.Enumerable.ToArray[TSource](IEnumerable1 source)
at DeviceId.Formatters.HashDeviceIdFormatter.GetDeviceId(IDictionary2 components) at DeviceId.DeviceIdBuilder.ToString() at Microsoft.Practices.EnterpriseLibrary.Security.SerialKeyManager.GetDeviceId(String productName, String productVersion) at Omec.ResistanceCounter.ViewModels.Common.SerialNumberHelper.GetCurrentMachineSerialNumber(String productName, String productVersion) in C:\Projects\ResistanceCounter\Omec.ResistanceCounter\Omec.ResistanceCounter.ViewModels\Common\SerialNumberHelper.cs:line 28 at Microsoft.Management.Infrastructure.CimException.ThrowIfMiResultFailure(MiResult result, String errorMessage, InstanceHandle errorData) at Microsoft.Management.Infrastructure.CimException.ThrowIfMiResultFailure(MiResult result, InstanceHandle errorData) at Microsoft.Management.Infrastructure.CimSession.Create(String computerName, CimSessionOptions sessionOptions) at DeviceId.Windows.Mmi.Components.MmiSystemDriveSerialNumberDeviceIdComponent.GetValue() at DeviceId.Formatters.HashDeviceIdFormatter.<>c.<GetDeviceId>b__3_1(KeyValuePair2 x)
at System.Linq.Enumerable.SelectIPartitionIterator2.PreallocatingToArray(Int32 count) at System.Linq.Enumerable.SelectIPartitionIterator2.ToArray()
at System.Linq.Enumerable.ToArray[TSource](IEnumerable1 source) at DeviceId.Formatters.HashDeviceIdFormatter.GetDeviceId(IDictionary2 components)
at DeviceId.DeviceIdBuilder.ToString()
at Microsoft.Practices.EnterpriseLibrary.Security.SerialKeyManager.GetDeviceId(String productName, String productVersion)
at Omec.ResistanceCounter.ViewModels.Common.SerialNumberHelper.GetCurrentMachineSerialNumber(String productName, String productVersion) in C:\Projects\ResistanceCounter\Omec.ResistanceCounter\Omec.ResistanceCounter.ViewModels\Common\SerialNumberHelper.cs:line 28

@wagenheimer
Copy link

wagenheimer commented Jun 24, 2022

I have the same problem.

System.IO.FileNotFoundException: Could not load file or assembly 'DeviceId, Version=6.2.0.0, Culture=neutral, PublicKeyToken=f755c371b5c59c52'.

@greendimka
Copy link

@songjiefa , @wagenheimer - can you specify the versions of DeviceId you use? Including versions of DeviceId.Windows.Mmi and .NET you use.

@songjiefa
Copy link
Author

DeviceId.Windows.Mmi & DeviceId.Windows & DeviceId =>6.2.0.0
.net runtime => 6.0.1

@MatthewKing
Copy link
Owner

Can you use DeviceId.Windows.Wmi instead?

@songjiefa
Copy link
Author

I use DeviceId.Windows.Wmi build WPF software with .net 6 runtime, it need package .net 6 runtime into my installer, and will throw above error in some windows 7 sp1 OS, which haven't install .net framework runtime, so I also need package .net framework 4.8 into my installer(and have to turn on .net framework 3.5) .
This is weird.

@MatthewKing
Copy link
Owner

Ah yep, if you're installing on a system that doesn't have .NET Framework at all then you'll need MMI rather than WMI.
That's as far as I can help you, though. If MMI isn't working on your (out of support) OS then you'll need to raise an issue there. Or use DeviceId features that don't rely on WMI/MMI.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants