demetrixbio / FSharp.Data.Npgsql

F# type providers to support statically typed access to input parameters and result set of sql statement in idiomatic F# way. Data modifications via statically typed tables.
Apache License 2.0
128 stars 15 forks source link

'AllParametersOptional = true' doesn't work at design-time on Linux, .netcore2.2 #69

Closed ogolovin closed 4 years ago

ogolovin commented 4 years ago

Hi,

The following code (taken from examples on main page)

use conn = new Npgsql.NpgsqlConnection(DbConnStr) in conn.Open()
use cmd = new FSharp.Data.Npgsql.NpgsqlCommand<"
                            SELECT coalesce(@x, 'Empty') AS x"
                        , Connection = DbConnStr
                        , AllParametersOptional = true
                        , SingleRow = true>(DbConnStr)
cmd.Execute( Some "test" )

compiles successfully, but gives me the following error in IDE: internal error: destNullableTy: not a Nullable type (Failure) F# Compiler (73)

This error renders all code in red and overwrites any other errors that language server may have generated.

If AllParametersOptional is set to false - everything works in IDE.

The behaviour is the same if i'm using .CreateCommand<...> type. I also tried to use both net and netcore for FsAutoComplete - results are the same.

I'm using VS Code with Ionide on CentOS 7.

mono --version
Mono JIT compiler version 6.8.0.105 (tarball Tue Feb  4 19:25:27 UTC 2020)
dotnet --version
2.2.402

FSharp.Data.Npgsql is 0.1.50-beta Target platform of project is netcoreapp2.2

kerams commented 4 years ago

FSAC recommends having SDK 3.0+ (your project can still target 2.2, that's fine). Have you tried it?

kerams commented 4 years ago

Ah, here you go https://github.com/dotnet/fsharp/issues/8646. The TP is not the problem. You can work around it by downgrading Ionide for the time being (https://github.com/dotnet/fsharp/issues/8646#issuecomment-593720630)

ogolovin commented 4 years ago

Thanks, downgrading Ionide worked for me!

TIHan commented 4 years ago

As a note: https://github.com/dotnet/fsharp/pull/8655 should fix it once approved by Don.