Skip to content

Error Could not load file or assembly 'Serilog.Exceptions, Culture=neutral, PublicKeyToken=null' #922

@albertoferrazzoli

Description

@albertoferrazzoli

Describe the bug

When Serilog.Exceptions is configured only in appsettings.json (not in code) we get a runtime load error
Could not load file or assembly 'Serilog.Exceptions, Culture=neutral, PublicKeyToken=null'
As Serilog.Exceptions have a strong name, PublicKeyToken != null and CLR cannot find proper assembly to load.

Steps to reproduce

  1. configure appsettings.json to load Serilog.Exceptions
    "Serilog": {
    "Using": [ "Serilog.Exceptions" ],
    "Enrich": [
    "WithExceptionDetails",
    ]
    }
  2. Ensure to not explicitly declare WithExceptionDetails in code to avoid explicit load os Serilog.Exceptions assembly
  3. Start the application

Expected behaviour

We expect the application to start when Serilog.Exceptions is configured only in appsettings.json.

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