fsprojects-archive / zzarchive-FSharpCommunityTemplates

Templates for F# projects, by the F# community, for use in Visual Studio, Xamarin Studio and other editors
MIT License
103 stars 27 forks source link

"Input string was not in a correct format" error #4

Closed dmohl closed 10 years ago

dmohl commented 11 years ago

The following issues have been reported on http://visualstudiogallery.msdn.microsoft.com/e0907c99-bb04-4eb8-9692-9333d5ff4399/view/Discussions and reposted here:

When my date/time format is set to "Norwegian (Bokmål)" in the regional settings, trying to create a new F# Empty Windows App stops with the error "Input string is not in a correct format". I can work around it by changing the format to "English (United States)"

This also occurs with the Polish locale on VS2013 RTM and Win7.

SoulFireMage commented 10 years ago

This happens with my default UK installation of VS2013 premium. At time of writing I've yet to see how to alter the local format!

SoulFireMage commented 10 years ago

debugcap

I managed to debug it and capture this if it helps anyone, am fiddling with it myself :)

SoulFireMage commented 10 years ago

Yay...I fixed it - I think :) Well, on my local machine. Having learnt in the past, for now I'd rather give the line to someone else to verity and include. I changed the Double.Parse to the TryParse but had to split the tuple out.

As I've never contributed properly on GitHub before and I've copied the source off to mess with, for now, can I offer this? File: TemplateWizard.fs this.targetFramework <- Double.TryParse replacementsDictionary.["$targetframeworkversion$"] |> snd

instead of:

this.targetFramework <- Double.Parse replacementsDictionary.["$targetframeworkversion$"]

ovatsus commented 10 years ago

Double.TryParse will assign targetFramework a tuple of double*bool, which is not what you want here. You should do Double.Parse(replacementsDictionary.["$targetframeworkversion$"], CultureInfo.InvariantCulture) instead.

SoulFireMage commented 10 years ago

Thanks ovatsus - that was one reason why I didn't interfere with the repository. The way I've done it splits the tuple (bool*double) to the second member (|> snd) which is a work around to allow use of the TryParse member.

dmohl commented 10 years ago

Thanks guys. I've made an update, tested, and pushed a new version to the gallery.

SoulFireMage - Would you mind verifying that version 1.11 works for you as well?

SoulFireMage commented 10 years ago

Hi Daniel

It works on my untouched VS installation, thank you! :)

dmohl commented 10 years ago

Great, thanks!