Using Npgsql 5.0.7 via nuget on .NET 4.8 gives MissingMethodException in ChannelReader
See original GitHub issueException:
Method not found: 'System.Threading.Tasks.ValueTask`1<Boolean> System.Threading.Channels.ChannelReader`1.WaitToReadAsync(System.Threading.CancellationToken)'.
Stacktrace:
at Npgsql.ConnectorPool.<>c__DisplayClass38_0.<<Rent>g__RentAsync|0>d.MoveNext()
at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.Start[TStateMachine](TStateMachine& stateMachine)
at Npgsql.ConnectorPool.<>c__DisplayClass38_0.<Rent>g__RentAsync|0()
at Npgsql.ConnectorPool.Rent(NpgsqlConnection conn, NpgsqlTimeout timeout, Boolean async, CancellationToken cancellationToken)
at Npgsql.NpgsqlConnection.<>c__DisplayClass41_0.<<Open>g__OpenAsync|0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Npgsql.NpgsqlConnection.Open()
at SD.LLBLGen.Pro.Gui.Controls.WizardPages.MetaDataRetrievalWizard_Step_ConnectionData.TestConnectionData(Boolean showSuccess) in C:\MyProjects\VS.NET Projects\LLBLGen Pro v5.9\Designer\Gui\Controls\WizardPages\MetaDataRetrievalWizard_Step_ConnectionData.cs:line 245
It’s in my driver, where I obtain the factory using NpgsqlFactory.Instance
as I now directly reference the Nuget package. I compile against 4.8 (against 4.7.2 same issue). I copy all necessary files to the output folder, app using the driver is running on .net 4.8, I checked. All I do is obtaining a connection from the factory and then call Open.
I am using this route because Npgsql doesn’t ship an msi anymore so I have to reference the Npgsql package directly to make my users not have to fight where to get the files.
I have no idea what to do nor what I’m doing wrong. It looks like I have to reference another package somewhere but which one is a blur to me.
Issue Analytics
- State:
- Created 2 years ago
- Comments:25 (22 by maintainers)
Top Results From Across the Web
Npgsql 5.0.7
Version Downloads Last updated
8.0.0‑preview.4 38,240 3 months ago
8.0.0‑preview.3 19,308 4 months ago
8.0.0‑preview.2 24,685 5 months ago
Read more >System.MissingMethodException: Method not found?
I just ran into this on a .NET MVC project. The root cause was conflicting versions of NuGet packages. I had a solution...
Read more >Npgsql does not work with add-ins
I have added to my add-in a nuget package for Npgsql. I am working with Pro 2.6.2 The latest verison i.e. NuGet\Install-Package Npgsql...
Read more >Please stop lying about .NET Standard 2.0 support!
In this post I have a bit of a rant about Microsoft's NuGet packages lying about supporting .NET Standard 2.0 when they kinda...
Read more >NuGet Error NU1100
Solution 1. Open the project file and examine the list of its dependencies. Check that each dependency exists on the package sources you're ......
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
OK, took a look.
After building everything successfully, running NpgsqlRepro.exe failed with:
Looking at the actual System.Runtime.CompilerServices.Unsafe.dll deployed in Drivers\PostgreSQL, it had a version of 6.0.0, so I amended the binding redirects. When that didn’t work, I noticed that the
<dependentAssembly>
directives are outside of the<assemblyBinding>
node - so I moved them in. At this point the program connected, but threw another runtime binding redirect exception for System.Text.Json, after I added that everything worked…There already was a 6-month gap there, I’d like to make sure this gets closed this time 😉