You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I received huge log file when DBUpdateException raised. Exception details added Entries of entire DB context along with Models and its attributes. As I am logging complete exception, single log produced 6Mb file.
I found following code in EntityFramework.Exceptions.Common might causing it
private Exception GetException(DbUpdateException ex)
{
T val = ex.GetBaseException() as T;
if (val != null)
{
DatabaseError? databaseError = GetDatabaseError(val);
if (databaseError.HasValue)
{
DatabaseError valueOrDefault = databaseError.GetValueOrDefault();
List entries = ex.Entries.Select((EntityEntry entry) => base.GetOrCreateEntry(entry.Entity, entry.Metadata)).ToList();
return ExceptionFactory.Create(valueOrDefault, ex, entries);
}
}
return null;
}
Include provider and version information
EntityFrameworkCore.Exceptions.SqlServer 3.1.4
EF Core version: 5.0.13
Database provider: (e.g. Microsoft.EntityFrameworkCore.SqlServer)
Target framework: (e.g. .NET 5.0)
Operating system:
IDE: (e.g. Visual Studio 2022 17.0.6)
The text was updated successfully, but these errors were encountered:
Are you using Serilog.Exceptions? If so this could be caused by dotnet/efcore#15214
Even if you aren't you would encounter the same issue if you log the DbUpdateException instance instead of the exception provided by this library. The code you mentioned uses the Entries present on the exception object and doesn't query any entities on it's own.
Hi,
I received huge log file when DBUpdateException raised. Exception details added Entries of entire DB context along with Models and its attributes. As I am logging complete exception, single log produced 6Mb file.
I found following code in EntityFramework.Exceptions.Common might causing it
Include provider and version information
EntityFrameworkCore.Exceptions.SqlServer 3.1.4
EF Core version: 5.0.13
Database provider: (e.g. Microsoft.EntityFrameworkCore.SqlServer)
Target framework: (e.g. .NET 5.0)
Operating system:
IDE: (e.g. Visual Studio 2022 17.0.6)
The text was updated successfully, but these errors were encountered: