Skip to content
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

Missing method exception, .NET 5 #8881

Closed
kerams opened this issue Apr 4, 2020 · 9 comments · Fixed by #8963
Closed

Missing method exception, .NET 5 #8881

kerams opened this issue Apr 4, 2020 · 9 comments · Fixed by #8963
Assignees
Labels
Milestone

Comments

@kerams
Copy link
Contributor

kerams commented Apr 4, 2020

Create a console application targeting netcoreapp5.0, install the 5.0.100-preview.2.20176.6 SDK, and reference https://www.nuget.org/packages/FSharp.Data.Npgsql/0.2.6-beta. Finally make sure to have a live instance of Postgres available.

type P = FSharp.Data.Npgsql.NpgsqlConnection<"host=localhost;port=5432;username=postgres">

[<EntryPoint>]
let main argv =
    let x = P.CreateCommand<"select 1">("localhost:5432")
    let r = x.Execute()
    0

dotnet run this.

Expected behavior

Program executes fine.

Actual behavior

Unhandled exception. System.MissingMethodException: Method not found: 'System.Type System.Type.GetType(System.String, System.Boolean)'.
   at Tests.main(String[] argv)
  • Windows 10
  • .NET 5.0.100-preview.2.20176.6

Apologies if this turns out to be a problem in the type provider.

@abelbraaksma
Copy link
Contributor

abelbraaksma commented Apr 5, 2020

In the rare cases that I had such exceptions, they were due to problems with assembly resolution (for instance, nugetting System.Memory and referencing System.Collections.Generic.Immutable leads to similar problems). Is it possible that that's the case here?

The resolution on such cases can be to check if a specific version is referenced which is upwards incompatible. Then make it generic, and add a binding redirect to the higher version.

(that's as a workaround, the error as displayed shouldn't appear at all, I think)

@kerams
Copy link
Contributor Author

kerams commented Apr 6, 2020

I don't think so? This sample only references FSharp.Data.Npgsql, which depends on Npgsql and Npgsql.LegacyPostgis.

@cartermp
Copy link
Contributor

cartermp commented Apr 9, 2020

Possibly related as well: #8913

I suspect there is a regression going on the core type provider mechanism that is leading to these issues

@OnurGumus
Copy link
Contributor

OnurGumus commented Apr 12, 2020

I have observed the same behavior with VS 2019 preview, not using. Net 5, along with fsharp sql provider. Same code runs with normal vs and vs preview compiled code doesn't work. Using. Net core 3.1.102 sdk

@KevinRansom
Copy link
Member

@OnurGumus ,
could you give us a small repro, the FSharp.Data type provider seems to work fine on DotNet 5.0.

So I will need to see the failure to try and figure out wht SqlDataProvider and perhaps NPgsql have an issue.

@kerams, I have not used postgressql in my life, however, I downloaded and installed it, but it complained about not having the postgres role.

Could you provide me with a simple from the start set of install instructions, that will allow me to reproduce your issue.

Thanks

Kevin

@KevinRansom
Copy link
Member

Actually Phillip, seems to have provided one here: #8743.

@kerams
Copy link
Contributor Author

kerams commented Apr 13, 2020

@KevinRansom, yes, that one's for FSharp.Data. For FSharp.Data.Npgsql, just launch a Docker container (in WSL for instance) using docker run --rm -p 5432:5432 -e POSTGRES_PASSWORD=postgres postgres:12-alpine and change the connection string in the sample on the top "host=localhost;port=5432;username=postgres; password=postgres"

@OnurGumus
Copy link
Contributor

@KevinRansom it's not dotNet problem. It's Visual studio preview problem. I have never installed dotnet 5. Same code runs fine when compiled with rtm but not when compiled with preview. Sample project https://github.com/OnurGumus/FBlazorShop

@KevinRansom
Copy link
Member

@OnurGumus, I think the bug is in master branch and dev16.6 branch, the dev 16.5 branch doesn't have it. I have a suspicion about what caused it, and I will work on a fix this week.

Kevin

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants