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

NRE in Sqlite's 3 preview 5 #16044

Closed
Tragetaschen opened this issue Jun 12, 2019 · 0 comments · Fixed by #16053
Closed

NRE in Sqlite's 3 preview 5 #16044

Tragetaschen opened this issue Jun 12, 2019 · 0 comments · Fixed by #16053
Assignees
Labels
area-adonet-sqlite closed-fixed The issue has been fixed and is/will be included in the release indicated by the issue milestone. customer-reported type-bug
Milestone

Comments

@Tragetaschen
Copy link
Contributor

I have migrated my existing .NET core application to .NET Core 3.0 Preview 5 and also updated Microsoft.Data.Sqlite from 2.2.4 to 3.0.0-preview5.19227.1. With the new version, I'm getting a NullReferenceException I didn't get before.

In my constructor, I build a command:

saveCommand = connection.CreateCommand();
saveCommand.CommandText = @"INSERT INTO ...";
saveCommand.Parameters.Add(new SqliteParameter("@p0", null));
//...
saveCommand.Prepare();

and later, I issue that command:

saveCommand.Parameters[0].Value = 0; // actual data
//...
try
{
    await saveCommand.ExecuteScalarAsync();
}
catch (Exception e)
{
    Environment.FailFast("Database work failed", e);
}

With preview5, I'm consistently hitting that FailFast with the exception

Exception details:
System.NullReferenceException: Object reference not set to an instance of an object.
   at Microsoft.Data.Sqlite.SqliteDataReader.Read()
   at Microsoft.Data.Sqlite.SqliteCommand.ExecuteScalar()
   at System.Data.Common.DbCommand.ExecuteScalarAsync(CancellationToken cancellationToken)
--- End of stack trace from previous location where exception was thrown ---
   at myCode.Save

Using 2.2.4 instead of the preview still works fine on netcoreapp3.0

Further technical details

EF Core version: 3.0.0-preview5.19227.1
Database Provider: Microsoft.Data.Sqlite
Operating system: Linux/arm
IDE: VS 16.1.1

@bricelam bricelam self-assigned this Jun 12, 2019
@bricelam bricelam added the closed-fixed The issue has been fixed and is/will be included in the release indicated by the issue milestone. label Jun 12, 2019
@ajcvickers ajcvickers modified the milestones: 3.0.0, 3.0.0-preview7 Jul 2, 2019
@ajcvickers ajcvickers modified the milestones: 3.0.0-preview7, 3.0.0 Nov 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-adonet-sqlite closed-fixed The issue has been fixed and is/will be included in the release indicated by the issue milestone. customer-reported type-bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants