Object Null Ref when save changes adding new entity

Discussion of open issues, suggestions and bugs regarding Entity Framework support in ADO.NET Data providers
Post Reply
thoho
Posts: 6
Joined: Mon 11 Jul 2016 07:05

Object Null Ref when save changes adding new entity

Post by thoho » Mon 11 Jul 2016 07:14

Object reference not set to an instance of an object

Code: Select all

at Devart.Common.Entity.ak.l()
   at Microsoft.EntityFrameworkCore.Storage.RelationalLoggerExtensions.LogCommandExecuted(ISensitiveDataLogger logger, DbCommand command, Int64 startTimestamp, Int64 currentTimestamp)
   at Microsoft.EntityFrameworkCore.Storage.Internal.RelationalCommand.Execute(IRelationalConnection connection, String executeMethod, IReadOnlyDictionary`2 parameterValues, Boolean openConnection, Boolean closeConnection)
   at Microsoft.EntityFrameworkCore.Storage.Internal.RelationalCommand.ExecuteReader(IRelationalConnection connection, IReadOnlyDictionary`2 parameterValues, Boolean manageConnection)
   at Microsoft.EntityFrameworkCore.Update.ReaderModificationCommandBatch.Execute(IRelationalConnection connection)
Reproduce step:
Devart.Data.MySql.Entity.EFCore.dll, 8.6.687.0
net451, dotnet core 1.0.0-RTM

_dbcontext.Registrations.Add(new ABC{
Name = "abc",
// Username = ?, Not null column, but not define required
});
_dbcontext.SaveChanges();

Expected: MySQL error message
Actual: Object reference not set to an instance of an object

Shalex
Site Admin
Posts: 9543
Joined: Thu 14 Aug 2008 12:44

Re: Object Null Ref when save changes adding new entity

Post by Shalex » Wed 13 Jul 2016 16:55

Thank you for the report. We are processing your request.

Shalex
Site Admin
Posts: 9543
Joined: Thu 14 Aug 2008 12:44

Re: Object Null Ref when save changes adding new entity

Post by Shalex » Mon 18 Jul 2016 15:46

We cannot reproduce the issue in our environment. Please send us a small test project with the corresponding DDL/DML script for reproducing.

In case of >2MB attachment, we recommend either using some file exchange server (send us the corresponding link) or uploading a test project to our FTP server (the credentials will be provided by email request).

thoho
Posts: 6
Joined: Mon 11 Jul 2016 07:05

Re: Object Null Ref when save changes adding new entity

Post by thoho » Thu 28 Jul 2016 01:22

I got supported.

Root cause:
We have reproduced System.NullReferenceException when EF Core logging is enabled (https://docs.efproject.net/en/latest/mi ... gging.html).

Temporary workaround:
Please disable EF Core logging and use the dbMonitor tool (http://www.devart.com/dotconnect/mysql/ ... nitor.html).

Cheers

Shalex
Site Admin
Posts: 9543
Joined: Thu 14 Aug 2008 12:44

Re: Object Null Ref when save changes adding new entity

Post by Shalex » Thu 11 Aug 2016 15:34

The bug with using EF Core logging is fixed in the newest (8.6.714) build of dotConnect for MySQL.

Post Reply