Closed rocklan closed 7 months ago
Thanks for the heads-up, @rocklan.
Which version are you updating from? Just checking v5.0.0 in this tag that parameter is already there (it wasn't a 6.0.0 addition), I'm wondering if we've made some other subtle change (TFM changes perhaps?) that has had an unintended side-effect for you... :thinking:
That's weird! Upgraded from 5.2.2
to 6.0.0
. And you're correct, in the version of our code that uses 5.2.2 it does have that as an optional param there but it doesn't need the reference to System.Net.Http
. The actual error is:
error CS0012: The type 'HttpMessageHandler' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Net.Http, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'
I just realised that the app itself (asp web framework 4.7.2 app) doesn't directly reference the Serilog.Sinks.Seq
package but instead references a project that has the reference to the Serilog.Sinks.Seq
package. Dunno if that helps or makes a difference.
Ok I've managed to reproduce it.
_ = new LoggerConfiguration().WriteTo.Seq("http://example.com");
packages.config
fileSerilog.Sinks.Seq
version 5.2.3 to class librarypublic void Alert() => Serilog.Log.Warning("Warning");
Serilog.Sinks.Seq
to version 6.0.0error CS0012: The type 'HttpMessageHandler' is defined in an assembly that is not referenced.
Pretty obscure edge case so completely happy if you just want to close the issue :)
Wowsers! Thanks for tracking it down. I don't think we'd pursue changing the method signature at this stage, but hopefully this ticket will at least provide some context for others who hit this issue :+1:
Not a bug but possible documentation request.
Now that the extension method of
Seq()
insideSeqLoggerConfigurationExtensions.cs
now has an optional parameterHttpMessageHandler? messageHandler = null
, this means you must add a reference toSystem.Net.Http
, even if you're not passing amessageHandler
. A bit annoying.I appreciate that v6.0.0 means breaking changes but I couldn't find anywhere where these breaking changes are documented. Maybe worth mentioning somewhere?
(Of course an alternative could be to not use optional params and to overload it instead but I appreciate that might not be something you want to do.)