Skip to content

LoggerSinkConfiguration.Wrap() fails to dispose wrapped sinks in some scenarios #1463

@JanEggers

Description

@JanEggers

Description
When using async sinks with multiple sinks dispose does not work.
The async sink tries to dispose its childs but the child is a SafeAggregateSink that is not disposable and therefore breaking the cleanup. as SafeAggregateSink is part of the core I opened the bug here.

Reproduction

var logger = new Configuration().WriteTo.Async(a => a.WriteTo.File("test.log").WriteTo.Console()).CreateLogger();
logger.Dispose();

 logger = new Configuration().WriteTo.Async(a => a.WriteTo.File("test.log")).CreateLogger();  // throws file in use exception

Expected behavior
the first logger should be disposed correctly

Relevant package, tooling and runtime versions
serilog.core

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions