diff --git a/Samples/Samples/View/DeviceInfoPage.xaml b/Samples/Samples/View/DeviceInfoPage.xaml
index 9b9fcc006..a7ca78225 100644
--- a/Samples/Samples/View/DeviceInfoPage.xaml
+++ b/Samples/Samples/View/DeviceInfoPage.xaml
@@ -17,6 +17,7 @@
+
diff --git a/Samples/Samples/ViewModel/DeviceInfoViewModel.cs b/Samples/Samples/ViewModel/DeviceInfoViewModel.cs
index dea35513e..8594f0d2e 100644
--- a/Samples/Samples/ViewModel/DeviceInfoViewModel.cs
+++ b/Samples/Samples/ViewModel/DeviceInfoViewModel.cs
@@ -12,7 +12,9 @@ public class DeviceInfoViewModel : BaseViewModel
public string Name => DeviceInfo.Name;
- public string Version => DeviceInfo.VersionString;
+ public string VersionString => DeviceInfo.VersionString;
+
+ public string Version => DeviceInfo.Version.ToString();
public string Platform => DeviceInfo.Platform;
diff --git a/Tests/Utils_Tests.cs b/Tests/Utils_Tests.cs
new file mode 100644
index 000000000..075e4c7cb
--- /dev/null
+++ b/Tests/Utils_Tests.cs
@@ -0,0 +1,19 @@
+using Xamarin.Essentials;
+using Xunit;
+
+namespace Tests
+{
+ public class Utils_Tests
+ {
+ [Theory]
+ [InlineData("9", "9.0", 9, 0)]
+ [InlineData("9.0", "9.0", 9, 0)]
+ public void ParseVersion(string input, string expected, int major, int minor)
+ {
+ var version = Utils.ParseVersion(input);
+ Assert.Equal(expected, version.ToString());
+ Assert.Equal(major, version.Major);
+ Assert.Equal(minor, version.Minor);
+ }
+ }
+}
diff --git a/Xamarin.Essentials/Types/Shared/Utils.shared.cs b/Xamarin.Essentials/Types/Shared/Utils.shared.cs
index 09af1a1fb..ea78ab85a 100644
--- a/Xamarin.Essentials/Types/Shared/Utils.shared.cs
+++ b/Xamarin.Essentials/Types/Shared/Utils.shared.cs
@@ -14,6 +14,9 @@ internal static Version ParseVersion(string version)
if (Version.TryParse(version, out var number))
return number;
+ if (int.TryParse(version, out var major))
+ return new Version(major, 0);
+
return new Version(0, 0);
}