-
Notifications
You must be signed in to change notification settings - Fork 71
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SqlEnumProvider breaks VS 2019 #410
Comments
@MrGodlike6 thanks for the extensive bug report. What I remember on top of my head is that SqlEnumProvider relies on some ADO.NET APIs that the two other type providers are not relying on: FSharp.Data.SqlClient/src/SqlClient.DesignTime/SqlEnumProvider.fs Lines 65 to 82 in eb45a54
It seems you are running under .net 5, but I'm not sure if it loads the provider which is compiled with USE_SYSTEM_DATA_COMMON_DBPROVIDERFACTORIES or not, which has impact on the code above. Another thing is that SqlEnumProvider is the only one being a generative type provider (rather than erased one) and I'm not sure if it has impact on the usage of this library under .net 5 runtime. I don't have time to investigate right now, but one thing to test would be if the code surounding db provider factories works properly outside the context of a type provider, and of course, running through the issue with debugger attached to the editor instanciating/running the provider. Thanks again for the report and all the references. |
Looks like the provider must be compiled for the latest .NET in order to make this work |
Issue Summary
While testing out F# for WebApi development I picked "FSharp.Data.SqlClient" for SQL access. I've based this on the "Get programming with F#" book. The book has working examples that use this library, although they are in .NET 4.0.
On latest VS 2019 and with .NET 5, using SqlEnumProvider inside a project works but referencing that project breaks VS .
Anything coming from that project (namespace, module, etc.) is marked FS0039 (not defined). The solution builds and runs as expected but VS marks everything from that project as not defined.
To Reproduce
The full repository I use is found here. Relevant files are AccountRepository from WebApiTest.Repositories.SqlServer and CompositionRoot from WebApiTest.WebApi.
The solution and DB schema is based on the one from the book, can be found here. (.NET 4.0)
SqlProgrammabilityProvider and SqlCommandProvider work like a charm. And if I comment out the SqlEnumProvider line, VS sees everything from that project.
Steps to reproduce the behavior:
Error
Here is an image with the problem area:
What I've tried so far:
I've opened a thread on StackOverflow here and someone else reproduced this.
I've also opened the resulting .dll file for the repository with dotPeek from JetBrains and the namespace/module/code is there.
And what I've observed is that SqlEnumProvider does not provide IntelliSense for the SQL query, only the command one does. SqlEnumProvider shows query errors only on project build. Is this normal?
Expected behavior
Referencing a project that uses SqlEnumProvider should work.
What you can do
The text was updated successfully, but these errors were encountered: