serilog-contrib / serilog-sinks-splunk

A Serilog sink that writes to Splunk
https://splunk.com
Apache License 2.0
46 stars 47 forks source link

EventCollectorSink relies on sealed type PeriodicBatchingSink #169

Closed vvdb-architecture closed 8 months ago

vvdb-architecture commented 8 months ago

When referencing:

    <PackageReference Include="Serilog.Sinks.Splunk.TCP" Version="1.5.0" />

I have the following message when starting:

Could not load type 'Serilog.Sinks.Splunk.EventCollectorSink' from assembly 'Serilog.Sinks.Splunk, Version=3.6.0.0, Culture=neutral, PublicKeyToken=24c2f752a8e58a10' because the parent type is sealed.

I thought this was a case of "dll hell, .NET style", but no: when I look at the source code of EventCollectorSink, it seems to inherit from PeriodicBatchSink, but that type is sealed.

It turns out that we also reference Serilog.Sinks.Seq, which in turn references Serilog.Sinks.PeriodicBatching version 4.0.0, which is the version that has the sealed type. The latest version of Serilog.Sinks.PeriodicBatching that has the unsealed type is version 2.3.1... so we need to make sure we don't reference a package that transitively references a later version.

For Serilog.Sinks.Seq, this seems to be version 5.1.1

I've made a PR (see below) but this has not been thoroughly tested. Feedback welcome.

VictorioBerra commented 8 months ago

Just ran into this now.