fsprojects / FSharp.Configuration

The FSharp.Configuration project contains type providers for the configuration of .NET projects.
http://fsprojects.github.io/FSharp.Configuration/
Other
114 stars 63 forks source link

URLs are read in as int from app.config #43

Closed bjartwolf closed 9 years ago

bjartwolf commented 9 years ago

I've tried to configure URIs, suchs as

    <add key="TestUri" value="http://fsharp.org" />

and it is read in as int. I am not sure if it is a good idea to try to parse URIs as URI or not, or if it should be kept as a string, or if the workaround is to use a connection string for it, so as I don't really know what a good spec would be I guess it's better to submit an issue than a failing test...

This passes

    [<Test>] 
    let ``Can read url from the connection strings``() =   
        Settings.ConnectionStrings.TestUrl.GetType() |> should equal typeof<string>   
        Settings.ConnectionStrings.TestUrl |> should equal "http://fsharp.org"

This fails (read in as int)

    [<Test>] 
    let ``Can read url from the config file``() =   
        Settings.ConnectionStrings.TestUrl.GetType() |> should equal typeof<string>   
        Settings.ConnectionStrings.TestUrl |> should equal "http://fsharp.org"
bjartwolf commented 9 years ago

I could also submit some updated documentation on it as a known workaround, if that is better than trying to fix it...?

vasily-kirichenko commented 9 years ago

This is definitely a bug and should be fixed. Thanks for reporting!

vasily-kirichenko commented 9 years ago

Fixed via https://github.com/fsprojects/FSharp.Configuration/commit/13877af477d0f56afc41299cda98464e0f68e017

Published in NuGet 0.4.5