SQLProvider
SQLProvider copied to clipboard
Intellisense failure and random errors after sometime (VS 2019)
Description
When the project is opened for a while (variable time - some time 10 mins, others 30 mins depending on what is done), the following issues are seen (can be in any combination)
1 The members are reported as undefined
The field, constructor or member 'Procedures' is not definedThe field, constructor or member 'Dbo' is not defined
2 Error at db.Procedures.uspxxxx.Invoke. Says The member of object constructor 'Invoke' takes 0 argument(s) but is here given x. The required signature is 'FSharp.Data.Sql.SqlDataProvider<...>.dataContext.Procedures.DboUspxxx.Result.Invoke(): Unit
3 Error creating SQL. Says connection string is not set. This has happened only twice or so.
I've tried with and without ContextSchemaPath. Issue 2 seems to happen more often with ContextSchemaPath set.
I do not have these issues with a previous project but that has a relatively small db. This current db has a lot of stored procedures, functions, view and tables. Not sure if that can be a factor. When it starts project builds. After sometime, project fails to build. What am I doing wrong?
Repro steps
Please provide the steps required to reproduce the problem
-
Add TP to project
-
Continue coding as always and leave window idle for a while
-
Check the Error List window for any database related errors
Expected behavior
Intellisense works and code compiles
Actual behavior
For issue 1, project builds successfully. After sometime, it fails to build and shows the errors.
For issues 2 and 3, project does not build at all
db.Procedures. does not yield any intellisense
Known workarounds
Restart Visual Studio whenever project can't build.
Related information
- Used database: SQL Server
- Operating system: Windows 10
- Branch: 1.1.62
- .NET Runtime, CoreCLR or Mono Version: 4.6.1, .NET Standard 2.0
- Performance information, links to performance testing scripts
Thanks for reporting. I'll try to see what goes wrong but I expect this one is not easy to debug.
Did you have network connection lost? The TypeProvider SDK has been updated, is this still happening?
Also, on runtime you can do simple manual reconnection like this: https://github.com/fsprojects/SQLProvider/issues/397#issuecomment-296618798