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

"Could not load file or assembly 'Splunk.Logging.Common', Version 1.0.0.0...." #155

Closed jamesSampica closed 7 months ago

jamesSampica commented 2 years ago

I've got a .net framework v4.6.2 console app that I'm trying to configure splunk tcp v1.5 with.

I installed the package and configured it using the following code...

var log = new LoggerConfiguration()
                .WriteTo.SplunkViaTcp(
                    new Serilog.Sinks.Splunk.SplunkTcpSinkConnectionInfo("127.0.0.1", 10001),
                    restrictedToMinimumLevel: LevelAlias.Minimum,
                    formatProvider: null,
                    renderTemplate: true)
                .CreateLogger();

log.Information("Hello World");

it builds/runs but at runtime I get the following exception...

 System.IO.FileLoadException
HResult=0x80131044
Message=Could not load file or assembly 'Splunk.Logging.Common, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. A strongly-named assembly is required. (Exception from HRESULT: 0x80131044)
Source=Serilog.Sinks.Splunk.TCP
StackTrace:
at Serilog.Sinks.Splunk.TcpSink..ctor(SplunkTcpSinkConnectionInfo connectionInfo, ITextFormatter formatter)
at Serilog.LoggerConfigurationSplunkExtensions.SplunkViaTcp(LoggerSinkConfiguration loggerConfiguration, SplunkTcpSinkConnectionInfo connectionInfo, LogEventLevel restrictedToMinimumLevel, IFormatProvider formatProvider, Boolean renderTemplate)
at ConsoleApp1.Program.Main(String[] args)

If I downgrade to Serilog.Sinks.Splunk.TCP v1.2 this does not throw, but v1.4 and v1.5 both throw.

I've attached a repro solution of this to this issue.

ConsoleApp1.zip

EEParker commented 7 months ago

If this issue is still relevant, please comment or reopen so it can be prioritized.

ipetrouchtchak-fi commented 7 months ago

As far a I can tell, this is still an issue.

EEParker commented 7 months ago

Thanks for the feedback, I was able to replicate with a unit test and will prioritize it. image

VictorioBerra commented 7 months ago

Thank you for the repro 🙏 @jamesSampica

EEParker commented 7 months ago

I've been working through this on a branch and it seems to be related to assembly signing and the upstream splunk library not being signed.