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
Runtime System.Exception when ContextSchemaPath is defined #552
Comments
What is the scenario that you want to run cached queries? |
@Thorium I'm confused by your questions. I'm not trying to run a cached query, nor am I specifically using CI. I'm just trying to use the cached provided types without affecting runtime. If there's more information or clarification I can provide, let me know. |
I'm just wondering why would you execute the offline code at runtime? |
Prevents the library from attempting to load the offline schema cache JSON file at runtime (the cache is meant for design time only). See fsprojects#552 and fsprojects#178 (comment)
The offline code, that is the line I encountered the same issue - I have tried a simple patch but it's having odd side effects on Mono, if it's a blocking issue for @keyset I could submit the PR anyway though. |
@piaste I tried that same code change, but that context is used design- and compile-time as well despite the |
@keyset Yeah, I finally figured out the same thing last night. The 'odd behaviour on Mono' I had encountered was just that the cache had been disabled and the MSSQL instance unavailable from the CI server 🤦♂️ The fact that Maybe the correct way is to look at the invocations defined in https://github.com/fsprojects/SQLProvider/blob/master/src/SQLProvider/SqlDesignTime.fs#L729, and only the runtime ones (the ones taking |
#L729: By the way I hate that method as adding parameters causes combinatorial explosion. |
Well, yes. We can just generate all possible combinations of explicit and default parameters. Currently that makes for 32 overloads, which is still tolerable - as in, doesn't seem to slow down Visual Studio. Take a look: it currently tests green. Had to introduce a magic number for This should also solve the issue (passes empty string to EDIT: I realized you probably disliked the explosion in overloads as much as the code smell from all that duplication. If we're changing the signature altogether, I think |
I fixed the stored procedures to work with ContextSchemaPath. But another problem I found out was that when I have a two-project-solution, only the active project's schema is saved when I call the save method. I could deal with this by saving 2 files separately and merging them somehow. How should this work? E.g. Save as is, but when loading, having a semicolon-separator in the context-schema-path static parameter? |
Faced with the similar problem. Without ContextSchemaPath it works well.My version is 1.1.49 |
I fixed my problem by calling design-time SaveContextSchema() for both projects separately (changed the ContextSchemaPath between) to generate 2 different files and then I used F# interactive to call |
Description
When the ContextSchemaPath locally cached schema file is defined and present, SQLProvider returns
System.Exception: !
when performing database operations at runtime.Repro steps
Generate a local schema file with ContextSchemaPath as described in the documentation
Debug the project
Perform a database operation. The following exception is raised:
Expected behavior
The type provider should not attempt to load the ContextSchemaPath at runtime since it is not a data source and will never work. It should only load at design-time and compile-time to allow development and compilation (build server) without a full-time database connection.
Known workarounds
Workarounds are to either not use the ContextSchemaPath at all, or delete the cached schema file each time debugging is needed.
Related information
The text was updated successfully, but these errors were encountered: