Serilog.Exceptions: TypeLoadException w/ Mono 4.2.3

I’m trying to use Serilog.Exceptions 1.1.0 with Serilog 1.5.14 and Mono 4.2.3 but every time I try to run .Enrich.WithExceptionDetails using either the .NET 4.0 or 4.5 dlls (matching Serilog and Serilog.Exceptions of course) I’m getting a TypeLoadException.

Here is a stack trace:

   SetUp : System.TypeLoadException : Could not resolve type with token 01000058
  at Serilog.Exceptions.Destructurers.ExceptionEnricher..ctor (IEnumerable`1 destructurers) <0x41a1fe80 + 0x000e4> in <filename unknown>:0 
  at Serilog.Exceptions.Destructurers.ExceptionEnricher..ctor (Serilog.Exceptions.Destructurers.IExceptionDestructurer[] destructurers) <0x41a1fe50 + 0x00013> in <filename unknown>:0 
  at Serilog.Exceptions.Destructurers.ExceptionEnricher..ctor () <0x41a1fe10 + 0x0001f> in <filename unknown>:0 
  at Serilog.Exceptions.LoggerEnrichmentConfigurationExtensions.WithExceptionDetails (Serilog.Configuration.LoggerEnrichmentConfiguration loggerEnrichmentConfiguration) <0x41a1fb60 + 0x0005b> in <filename unknown>:0 
  at MyApp.InitializeGlobalLogger () <0x41a1a5d0 + 0x0014b> in <filename unknown>:0 
  at SetUpFixture..ctor () <0x41a1a580 + 0x0000b> in <filename unknown>:0 
  at (wrapper managed-to-native) System.Reflection.MonoCMethod:InternalInvoke (System.Reflection.MonoCMethod,object,object[],System.Exception&)
  at System.Reflection.MonoCMethod.InternalInvoke (System.Object obj, System.Object[] parameters) <0x4183a250 + 0x00045> in <filename unknown>:0 

and some version info:

Mono JIT compiler version 4.2.3 (Stable 4.2.3.4/832de4b Wed Mar 16 13:19:08 UTC 2016)
Copyright (C) 2002-2014 Novell, Inc, Xamarin Inc and Contributors. www.mono-project.com
    TLS:           __thread
    SIGSEGV:       altstack
    Notifications: epoll
    Architecture:  amd64
    Disabled:      none
    Misc:          softdebug 
    LLVM:          supported, not enabled.
    GC:            sgen

If Serilog.Exceptions uses P/Invokes then that is certainly the issue as these are not supported by Mono. Thanks for taking a look, and let me know if I can provide more information.

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Reactions: 1
  • Comments: 19 (18 by maintainers)

Most upvoted comments

The ground has shifted again.

netstandard 2.0 will add support for Mono. If we target that, then Mono support will be assured and we won’t have to do reflection in SqlExceptionDestructurer. I say we wait for official Mono support.

Also, by then xproj to csproj will be complete, and the Tooling bug stopping our Travis CI builds from successfully running xUnit tests on Mono will be fixed.