Fix CompareInfo.Version on Windows (dotnet/coreclr#12330)
authorTarek Mahmoud Sayed <tarekms@microsoft.com>
Fri, 16 Jun 2017 22:53:03 +0000 (15:53 -0700)
committerGitHub <noreply@github.com>
Fri, 16 Jun 2017 22:53:03 +0000 (15:53 -0700)
We call Windows to get the sort version. We call Windows passing the structure NlsVersionInfoEx but Windows expect we have to initialize the size of this structure which we are missing.

Commit migrated from https://github.com/dotnet/coreclr/commit/660a3e67071e0273eaffe44cf08b72ed675c3ddc

src/coreclr/src/mscorlib/src/System/Globalization/CompareInfo.Windows.cs

index eb4dc56..0df5463 100644 (file)
@@ -469,6 +469,7 @@ namespace System.Globalization
             Debug.Assert(!_invariantMode);
 
             Interop.Kernel32.NlsVersionInfoEx nlsVersion = new Interop.Kernel32.NlsVersionInfoEx();
+            nlsVersion.dwNLSVersionInfoSize = Marshal.SizeOf(typeof(Interop.Kernel32.NlsVersionInfoEx));
             Interop.Kernel32.GetNLSVersionEx(Interop.Kernel32.COMPARE_STRING, _sortName, &nlsVersion);
             return new SortVersion(
                         nlsVersion.dwNLSVersion,