Skip to content

Bug upgrading SQLProvider to latest SDK #138

@dsyme

Description

@dsyme

Description

See #135 (comment)

Copied below

Yes. To reproduce this problem, there is a branch: https://github.com/fsprojects/SQLProvider/tree/providedtypes-expr

SQLProvider has multiple database connections to different databases.
So there is an utility function to fetch runtime connection string from cache.

  • Previous commit uses the old API for this expression, run build.cmd and it works.
  • The last commit uses the new API for this expression, run build.cmd and it fails.

We are using directly this project's files, they are located after a build at:
paket-files\sourcefiles\fsprojects\FSharp.TypeProviders.SDK\src\

It fails on runtime while running test from solution SQLProvider.Tests.sln file QueryTests.fs.
Those can be also debugged with F# interactive.

The error: Exception of type 'System.Collections.Generic.KeyNotFoundException' was thrown. from

gtd.Metadata.Methods.FindByNameAndArity(name, types.Length)
 
|> Array.find (fun md -> eqTypesAndILTypesWithInst types args md.ParameterTypes)

...but the real problem is at recursive expression tree parsing, where it tries to parse different kind of logics to Microsoft.FSharp.Quotations.FSharpExpr.
This time it fails to PrintFormat which comes from source code node "failwithf" but if the quotation would be different, it would fail to something else.

For SQLProvider this was a minor problem, I just excluded those overrides from .NET Standard version as their usage is so minor anyways, and kind of anti-pattern, but on the other hand I would like to maintain the old features for backward-compatibility.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions