Countly / countly-sdk-windows

Windows Phone & Windows SDK for Countly Analytics
https://count.ly/desktop-analytics
MIT License
25 stars 38 forks source link

Windows 10 version being reported as Windows 8 under .NET Core #23

Open christopher-rtf opened 4 years ago

christopher-rtf commented 4 years ago

Bug The netstd project for countly-sdk-windows uses Environment.OSVersion to request the version of Windows (instead of System.Management like the .NET Framework SDK uses).

Under some installations of Windows 10, this function returns an OS version which is interpreted as Windows 8: {Microsoft Windows NT 6.2.9200.0}

Consequently the metrics in Countly all show the OS users as Windows 8 users (even though they are usingWindows 10)

This bug is in ...\Entities\Device.cs's getOSInfo() function. This bug appears to be affecting more than half of our users.

Tested under Tested under: Windows 10 Pro x64 (May 2020 update), under Parallels

Proposed resolution As .NET Core now supports System.Management (and since I have confirmed that System Management does return the correct version # under Windows 10 and .NET Core), I recommend that the Countly SDK for Windows add the System.Management nuget package to the netstd project and reuse the pre-existing System.Management query code instead.

Notes from Microsoft on Environment.OSVersion (.NET Core 3.1 docs) "The Environment.OSVersion property does not provide a reliable way to identify the exact operating system and its version. Therefore, we do not recommend that you use this method." https://docs.microsoft.com/en-us/dotnet/api/system.environment.osversion?view=netcore-3.1

ArtursKadikis commented 4 years ago

Hello. I think this could give some insight why the windows 10 version was reported as windows 8: https://stackoverflow.com/questions/2819934/detect-windows-version-in-net/2819962#2819962