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

Visual Studio shows and error though the YAML file is correct #147

Open alex-piccione opened 5 years ago

alex-piccione commented 5 years ago

I have this YAML:

Bitstamp: 
    "XRP address": "rDsbeomae4FXwgQTJp9Rs64Qg9vDiTCdBv"
    API: 
        "BaseUrl": https://www.bitstamp.net/api/v2/
https://guides.github.com/features/mastering-markdown/
        "PublicKey": "***"
        "SecretKey": "***"
        "CustomerId": 012345
        Routes: 
            "Ticker": "ticker/{0}/"
            "Balance": "balance/"
            "Balance CurrencyPair": "balance/{0}/"
            "Transactions": "user_transactions/"
            "XRP Withdrawal": "xrp_withdrawal/"
            "BuyLimitOrder": "buy/{currency_pair}/"
            "BuyMarketOrder": "buy/market/{currency_pair}/"
            "OrderStatus": https://www.bitstamp.net/api/order_status/        
        "XRP minimum withdrawal": 20

Binance: 
    API: 
        Base URL: https://api.binance.com
        Public Key: "***"
        Secret key: "***"
        Routes:
            "GET Ping": "/api/v1/ping"
            "GET Price": "/api/v3/ticker/price"
            "GET Market data": "/api/v1/depth"
            "POST Withdraw": "/wapi/v3/withdraw.html"

In VS I have this: type Configuration = YamlConfig<"configuration.yaml">

and VS shows this error on that line:

:x: Incorrect instance type     Parameter name: obj

So from that line configuration is not recognized an I have many errors and I don't have intellisense. This make impossible to write/change code.

I can run thew code and tehere are no errorsa at runtime.

This issue (and/or similar) disappears when you close and reopen VS.
Initially the YAML contained only the Bitstamp section.
I added the Binance section after with an error (a missing double quote after a string: "aaaaaa )
Assigning YamlConfig to a different variable works, type aaa = YamlConfig<"configuration.yaml"> thus is like it does not refresh/reload/reparse the yaml whern something change.

Latest version of .Net Core (2.1), Visual Studio 2017 (19.x) and FSharp (4.5.4) FSharp.Configuration v 1.5.0

Thanks

alex-piccione commented 5 years ago

Another example:

SSSSS:
    initial amount: 100
    sell percentage threshold: 2.0
    price check frequency in seconds: 60
    buy amont in USD: 100 
PPPPP: 
    ticker cache: 15
    account number: "123456"
    public key: "aaa"
    secret key: "bbb"

type Configuration = YamlConfig<"configuration.yaml", true, "", false>

VS 2019 .Net core 2.2 FSharp.Configuration 1.5.0 FSharp.Core 4.6.2