Giorgi / DuckDB.NET

Bindings and ADO.NET Provider for DuckDB
https://duckdb.net
MIT License
338 stars 61 forks source link

DuckDBOpen "CS8625 - Cannot convert null literal to non-nullable reference type" #164

Closed bardware closed 6 months ago

bardware commented 6 months ago

I copied your sample code into a new DotNET 8 C#12 project and got an error

var result = NativeMethods.Startup.DuckDBOpen(null, out var database);

This resulted in the error CS8625 - Cannot convert null literal to non-nullable reference type.

I modified the call to use the overload with 4 arguments to look like and this works.

var result = NativeMethods.Startup.DuckDBOpen(null, out var database, oC, out var iErr);

Is there a reason the first argument is marked nullable in one of the two overloads?

Giorgi commented 6 months ago

@bardware It should be nullable in both cases.

Giorgi commented 6 months ago

Fixed in develop.