In fact there is a simple workaround to get a Windows Version string in its User Agent form (Windows NT 6.x).
To people wondering why we might want to do that : to gather statistics about our users Windows Version and make aware decisions about backward compatibility.
public class OsVersion
{
public static Task<string> GetAsync()
{
var t = new TaskCompletionSource<string>();
var w = new WebView();
w.AllowedScriptNotifyUris = WebView.AnyScriptNotifyUri;
w.NavigateToString("<html />");
NotifyEventHandler h = null;
h = (s, e) =>
{
try
{
var match = Regex.Match(e.Value, @"Windows\s+NT\s+\d+(\.\d+)?");
if (match.Success)
t.SetResult(match.Value);
else
t.SetResult("Unknowm");
}
catch (Exception ex) { t.SetException(ex); }
finally { /* release */ w.ScriptNotify -= h; }
};
w.ScriptNotify += h;
w.InvokeScript("execScript", new[] { "window.external.notify(navigator.appVersion); " });
return t.Task;
}