Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
jimSampica opened this issue Jan 28, 2022 · 5 comments · Fixed by #184
Closed

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

jimSampica opened this issue Jan 28, 2022 · 5 comments · Fixed by #184
Assignees

Comments

@jimSampica
Copy link

jimSampica commented Jan 28, 2022

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 EEParker added the stale label Apr 3, 2024
@EEParker
Copy link
Collaborator

EEParker commented Apr 3, 2024

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

@EEParker EEParker closed this as completed Apr 3, 2024
@ipetrouchtchak-fi
Copy link

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

@EEParker
Copy link
Collaborator

EEParker commented Apr 4, 2024

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

@EEParker EEParker reopened this Apr 4, 2024
@EEParker EEParker self-assigned this Apr 4, 2024
@VictorioBerra
Copy link
Member

Thank you for the repro 🙏 @jamesSampica

@EEParker
Copy link
Collaborator

EEParker commented Apr 6, 2024

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.

EEParker added a commit that referenced this issue Apr 9, 2024
* Create unit tests for TCP collector.

* Signing assembly breaks Splunk TCP collector.

Switch to ProjectReference

* Alternative solution

Embedding sources from Splunk.Loggin.Common

* Add target for net6.0 & net8.0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants