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
127 stars 16 forks source link

Intermittent design-time errors #52

Closed kerams closed 2 years ago

kerams commented 4 years ago

Every once in a while, Visual Studio will show squiggly lines under every single CreateCommand in the project file with error messages like:

The module/namespace
'FSharp.Data.Npgsql.NpgsqlConnection,Connection="Host=localhost;Username=postgres;Password=admin;Database=postgres",Prepare="True".Commands'
from compilation unit 'FSharp.Data.Npgsql' did not contain the namespace, module or type 'CreateCommand,CommandText"query text snip"
A reference to the type
'FSharp.Data.Npgsql.NpgsqlConnection,Connection="Host=localhost;Username=postgres;Password=admin;Database=postgres",Prepare="True".Commands.CreateCommand,CommandText"query text snip",AllParametersOptional"True"'
in assembly 'FSharp.Data.Npgsql' was found, but the type could not be found in that assembly

Unfortunately, I can't say what exactly triggers this behavior, but things usually get back to normal after some typing in the project with the type provider. While this isn't a critical issue as I've never had an actual build fail like this, it's still fairly annoying. Wish I could provide more details that would let us know whether VS or this TP is at fault, but alas.

kerams commented 4 years ago

Having played around some more, this seems to reliably happen when I save some change in a project that the project using FSharp.Data.Npgsql depends on.

daz10000 commented 4 years ago

I’m pretty sure these cases are failure in the underlying fsharp Compiler services. I have occasionally had to restart different editors (vscode, rider) to snap it out, or do a build. The TP pushes the infrastructure pretty hard. One thing is like to do (in my copious free time :() is restructure TP to use less quoted expressions (it needs to generate these but should go to a call ASAP in the expression) because these appear to make the design time machinery work hardest.

Von meinem iPhone gesendet

Am 06.01.2020 um 1:07 AM schrieb kerams notifications@github.com:

 Every once in a while, Visual Studio will show squiggly lines under every single CreateCommand in the project with error messages like:

The module/namespace 'FSharp.Data.Npgsql.NpgsqlConnection,Connection="Host=localhost;Username=postgres;Password=admin;Database=postgres",Prepare="True".Commands' from compilation unit 'FSharp.Data.Npgsql' did not contain the namespace, module or type 'CreateCommand,CommandText"query text snip" A reference to the type 'FSharp.Data.Npgsql.NpgsqlConnection,Connection="Host=localhost;Username=postgres;Password=admin;Database=postgres",Prepare="True".Commands.CreateCommand,CommandText"query text snip",AllParametersOptional"True"' in assembly 'FSharp.Data.Npgsql' was found, but the type could not be found in that assembly Unfortunately, I can't say what exactly triggers this behavior, but things usually get back to normal after some typing in the project with the type provider. While this isn't a critical issue as I've never had an actual build fail like this, it's still fairly annoying. Wish I could provide more details that would let us know whether VS or this TP is at fault, but alas.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or unsubscribe.

daz10000 commented 3 years ago

Btw, the recent overall almost certainly fixed this issue. The problem was with inappropriate cache invalidation and we have seen much more robust behavior since. If you are interested in verifying the current build, I would like to close this.

duki994 commented 12 months ago

@kerams

I get the following:

from compilation unit 'FSharp.Data.Npgsql' did not contain the namespace, module or type 'Record`

It seems to clash with FSharp.Core, especially 7.0.400 version (or any 7.x version). I cannot fix it in any editor, VSCode, VS2022 or JB Rider