juliuskoval / NLog.Targets.OpenTelemetryProtocol

1 stars 4 forks source link

Error on LogManager.LoadConfiguration #16

Closed richbeales closed 1 month ago

richbeales commented 2 months ago

Hi, whether I use code or an nlog.config file to initialise the logger I'm receiving the below error - any ideas?

MethodAccessException: Attempt by method 'NLog.Targets.OtlpTarget..ctor()' to access method 'System.Collections.Concurrent.ConcurrentDictionary2<System.Canon,System.Canon>..ctor(System.Collections.Generic.IEqualityComparer1<System.__Canon>)' failed.

.NET 4.8 web (ASP.net MVC) project.

Thanks

juliuskoval commented 2 months ago

Hi, the logging API in the OpenTelemetry package is not considered stable yet, so it is internal in stable releases and public in prerelease versions of the package. This project uses the version 1.8.0-beta.1, so if your project has a reference to a stable version of OpenTelemetry higher than that, you will get a runtime error because OpenTelemetry.dll in the bin folder won't contain the required public methods.

juliuskoval commented 2 months ago

I published a new version of the package, which has a reference to OpenTelemetry.Exporter.OpenTelemetryProtocol version 1.9.0-alpha.1, which is the latest version.

richbeales commented 1 month ago

This works with 1.9.0-alpha1 thanks