question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Update Sentry.NLog to use NLog 5

See original GitHub issue

Package

Sentry.Nlog

.NET Flavor

.NET

.NET Version

4.7.2

OS

Windows

SDK Version

3.17.1

Self-Hosted Sentry Version

No response

Steps to Reproduce

Use the NLog 5 nuget package.

Expected Result

No errors

Actual Result

System.TypeInitializationException
  HResult=0x80131534
  Message=De type-initialisatiefunctie voor automate.logging.NLogLogger heeft een uitzondering veroorzaakt.
  Source=automate.logging
  StackTrace:
   at automate.logging.NLogLogger.Fatal(Exception x, Boolean LogExtern) in D:\sources\automate\automate.logging\NLogLogger.cs:line 214
   at automate.App.ApplicationStartup(Object sender, StartupEventArgs e) in D:\sources\automate\automate\App.xaml.cs:line 1074
   at System.Windows.Application.OnStartup(StartupEventArgs e)
   at System.Windows.Application.<.ctor>b__1_0(Object unused)
   at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
   at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)

  This exception was originally thrown at this call stack:
    [External Code]
    automate.logging.NLogLogger.ConfigureLogger() in NLogLogger.cs
    automate.logging.NLogLogger.NLogLogger() in NLogLogger.cs

Inner Exception 1:
FileLoadException: Kan bestand of assembly NLog, Version=4.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c of een van de afhankelijkheden hiervan niet laden. De manifestdefinitie van de gevonden assembly komt niet overeen met de assembly-verwijzing. (Uitzondering van HRESULT: 0x80131040)

Issue Analytics

  • State:open
  • Created a year ago
  • Comments:11 (9 by maintainers)

github_iconTop GitHub Comments

1reaction
mattjohnsonpintcommented, May 24, 2022

I agree, however that will be a breaking change, so we can do that in the next major release. I’ll mark this as an enhancement to the 4.0.0 milestone.

@mrfatmen - For now, here is the binding redirect to add to your App.config file:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">

      <dependentAssembly>
        <assemblyIdentity name="NLog" publicKeyToken="5120e14c03d0593c" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-5.0.0.0" newVersion="5.0.0.0" />
      </dependentAssembly>

    </assemblyBinding>
  </runtime>
</configuration>

FYI, if you are using Visual Studio’s Nuget GUI and add NLog 5 and then Sentry.NLog, it will add this redirect automatically.

0reactions
bitsandfoxescommented, Aug 11, 2023

Hey @simonmolino, it still might be a little while for the update to land. I’m not sure I understand your setup: You’re building a DLL that has Sentry as a dependency, and when that library gets loaded by Excel you encounter the TypeInitializationException? Could you provide us with a minimal repro?

Read more comments on GitHub >

github_iconTop Results From Across the Web

NLog | Sentry Documentation
Sentry provides an integration with NLog through the Sentry.NLog NuGet package . Installation. Add the Sentry dependency: Package Manager
Read more >
How to connect Sentry to NLog in a .Net 5 project
I'm trying to connect Sentry to NLog. I'd like to write the logs with a level under Warning in a file text and...
Read more >
Sentry.NLog 3.35.0
Official NLog integration for Sentry - Open-source error tracking that helps developers monitor and fix crashes in real time.
Read more >
Sentry.NLog 2.1.5-beta
Official NLog integration for Sentry - Open-source error tracking that helps developers monitor and fix crashes in real time.
Read more >
Config options for NLog's configuration
Config options for NLog's configuration read more... The following types can be configured: ... Database - Writes log messages to the database using...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found