Skip to content

DbEntityValidationException logs include lazy loaded navigation properties #956

@DavidJohnWilliams

Description

@DavidJohnWilliams

Describe the bug

When a DbEntityValidationException is thrown the EntityValidationErrors.Entry.Entity is logged including all navigation properties.

Steps to reproduce

  1. Enrich.WithExceptionDetails
  2. Cause a 'DbEntityValidationException'
  3. Entire entity graph is included in log (including navigation properties which query the database)

Here is a basic app for repo:
Serilog.Exceptions.EntityFramework.zip

Expected behaviour

Entities are not destructured

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugIssues describing a bug or pull requests fixing a bug.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions