I am trying to log all unexpected exceptions in my .NET Core App. I have set up Sentry in my exception handling middleware. when i try and log the exception message using SentrySDK.CapetureMessage(e.Message), it works and shows up in the sentry dashboard. However when i try to log the actual exception using SentrySDK.CapetureException(e) it doesnt log anything and throws an error:
fail: Sentry.ISentryClient[0]
An error occurred when capturing the event System.IO.FileLoadException: Could not load file or assembly 'System.Reflection.Metadata, Version=5.0.0.0, Culture=neutral, PublicKeyToken=xx'. The located assembly's manifest definition does not match the assembly reference. (0x80131040)
File name: 'System.Reflection.Metadata, Version=5.0.0.0, Culture=neutral, PublicKeyToken=xx'
Weirdly enough, the exceptions do get logged when i call SentrySDK.CapetureException(e) outside of my Middleware exception handler. Been stuck on this a while, any help would be appreciated.