perforce / P4VS

[Officially Supported] VisualStudio plugin for HelixCore
Other
15 stars 6 forks source link

"View in P4V" doesn't work if system locale is not using . as floating point separator #8

Open Twifus opened 2 years ago

Twifus commented 2 years ago

P4V version: 2022.1.226.6529 P4VS version: 2021.2.226.2490 Visual Studio version: VS2019 16.11.15

On my computer, the "View in P4V" feature don't work, reporting an invalid string format. image

It seems the problem comes from this line that cast the P4V.exe version number to double : https://github.com/perforce/P4VS/blob/0e1e7bde0fbc3e93c1cbec66eb67f58274ca86ec/P4VS/P4ScmProvider/P4ScmProvider.cs#L5619 Many users have a system locale that don't use '.' as the floating point separator, and thus parsing of "2022.1" fail.

Just using the en-US locale should be enough to fix the issue: double versionnum = Convert.ToDouble(line, new CultureInfo("en-US"));