datalust / serilog-sinks-seq

A Serilog sink that writes events to the Seq structured log server
https://datalust.co/seq
Apache License 2.0
225 stars 50 forks source link

Incompatibility between Serilog.Sinks.Seq 7.0.0 and Serilog.Sinks.Elasticsearch 9.0.3 #213

Closed david-yaari closed 4 months ago

david-yaari commented 6 months ago

The above versions are the latest at the time of writing (12 Mar 2024).

If you reference in your project the latest version of Serilog.Sinks.Seq and Serilog.Sinks.Elasticsearch you get this runtime error:

System.TypeLoadException : Could not load type 'Serilog.Sinks.Elasticsearch.ElasticsearchSink' from assembly 'Serilog.Sinks.Elasticsearch, Version=9.0.3.0, Culture=neutral, PublicKeyToken=24c2f752a8e58a10' because the parent type is sealed.

It seems that the problem is in this:

As a workaround I downgraded Serilog.Sinks.Seq to version 6.0.0. (this version is using Serilog.Sinks.PeriodicBatching (>= 3.1.0))

I would like to use the latest version of Seq.

Can you fix this please?

nblumhardt commented 6 months ago

The fix for this was merged in https://github.com/serilog-contrib/serilog-sinks-elasticsearch/pull/579, I am not sure where the Elasticsearch sink preview releases are published but hopefully one will be on the way soon.

profet23 commented 6 months ago

We are also seeing this with Serilog.Sinks.AwsCloudWatch

Unhandled exception. System.TypeLoadException: Could not load type 'Serilog.Sinks.AwsCloudWatch.CloudWatchLogSink' from assembly 'Serilog.Sinks.AwsCloudWatch, Version=4.0.182.0, Culture=neutral, PublicKeyToken=23b095b16108dcf5' because the parent type is sealed.

nblumhardt commented 6 months ago

v10 of Serilog.Sinks.Elasticsearch is now published.

Hi @profet23 - is this the sink you're using? I can PR a fix over there if so: https://github.com/Cimpress-MCP/serilog-sinks-awscloudwatch

profet23 commented 6 months ago

v10 of Serilog.Sinks.Elasticsearch is now published.

Hi @profet23 - is this the sink you're using? I can PR a fix over there if so: https://github.com/Cimpress-MCP/serilog-sinks-awscloudwatch

That's the one. Thank you.

nblumhardt commented 4 months ago

This is also fixed in v7.0.1 of this sink