fiskaltrust / middleware-interface-dotnet

A NuGet package that can be used to include the free fiskaltrust Middleware into POS systems.
https://docs.fiskaltrust.cloud
MIT License
4 stars 9 forks source link

Linux x64 / Unhandled Exception: Serilog.Sinks.SystemConsole.Themes.SystemConsoleThemes #38

Closed ticktoo closed 3 years ago

ticktoo commented 3 years ago

When trying to start the Middleware, the following stacktrace appears:

#> mono ./fiskaltrust.exe -cashboxid=[...]  -accesstoken= [...] -sandbox -logfile ./logfile.txt -test

Unhandled Exception:
System.TypeInitializationException: The type initializer for 'Serilog.Sinks.SystemConsole.Themes.SystemConsoleThemes' threw an exception. ---> System.InvalidProgramException: Invalid IL code in System.Linq.Enumerable:ToDictionary<System.Collections.Generic.KeyValuePair`2<Serilog.Sinks.SystemConsole.Themes.ConsoleThemeStyle, Serilog.Sinks.SystemConsole.Themes.SystemConsoleThemeStyle>, Serilog.Sinks.SystemConsole.Themes.ConsoleThemeStyle, Serilog.Sinks.SystemConsole.Themes.SystemConsoleThemeStyle> (System.Collections.Generic.IEnumerable`1<System.Collections.Generic.KeyValuePair`2<Serilog.Sinks.SystemConsole.Themes.ConsoleThemeStyle, Serilog.Sinks.SystemConsole.Themes.SystemConsoleThemeStyle>>,System.Func`2<System.Collections.Generic.KeyValuePair`2<Serilog.Sinks.SystemConsole.Themes.ConsoleThemeStyle, Serilog.Sinks.SystemConsole.Themes.SystemConsoleThemeStyle>, Serilog.Sinks.SystemConsole.Themes.ConsoleThemeStyle>,System.Func`2<System.Collections.Generic.KeyValuePair`2<Serilog.Sinks.SystemConsole.Themes.ConsoleThemeStyle, Serilog.Sinks.SystemConsole.Themes.SystemConsoleThemeStyle>, Serilog.Sinks.SystemConsole.Themes.SystemConsoleThemeStyle>): method body is empty.

  at Serilog.Sinks.SystemConsole.Themes.SystemConsoleTheme..ctor (System.Collections.Generic.IReadOnlyDictionary`2[TKey,TValue] styles) [0x00014] in <0d35b79e206a48c19c77b089a3a1e0b2>:0 
  at Serilog.Sinks.SystemConsole.Themes.SystemConsoleThemes..cctor () [0x00203] in <0d35b79e206a48c19c77b089a3a1e0b2>:0 
   --- End of inner exception stack trace ---
  at Serilog.ConsoleLoggerConfigurationExtensions.Console (Serilog.Configuration.LoggerSinkConfiguration sinkConfiguration, Serilog.Events.LogEventLevel restrictedToMinimumLevel, System.String outputTemplate, System.IFormatProvider formatProvider, Serilog.Core.LoggingLevelSwitch levelSwitch, System.Nullable`1[T] standardErrorFromLevel, Serilog.Sinks.SystemConsole.Themes.ConsoleTheme theme) [0x00030] in <0d35b79e206a48c19c77b089a3a1e0b2>:0 
  at fiskaltrust.service.launcher.Extensions.LoggingExtensions.SetGlobalLogger (System.String logFile, Microsoft.Extensions.Logging.LogLevel verbosity, System.String package) [0x00014] in <a905ad260aa841eabb33fbe2f4245f94>:0 
  at fiskaltrust.service.launcher.Program.Main (System.String[] args) [0x0000d] in <a905ad260aa841eabb33fbe2f4245f94>:0 
[ERROR] FATAL UNHANDLED EXCEPTION: System.TypeInitializationException: The type initializer for 'Serilog.Sinks.SystemConsole.Themes.SystemConsoleThemes' threw an exception. ---> System.InvalidProgramException: Invalid IL code in System.Linq.Enumerable:ToDictionary<System.Collections.Generic.KeyValuePair`2<Serilog.Sinks.SystemConsole.Themes.ConsoleThemeStyle, Serilog.Sinks.SystemConsole.Themes.SystemConsoleThemeStyle>, Serilog.Sinks.SystemConsole.Themes.ConsoleThemeStyle, Serilog.Sinks.SystemConsole.Themes.SystemConsoleThemeStyle> (System.Collections.Generic.IEnumerable`1<System.Collections.Generic.KeyValuePair`2<Serilog.Sinks.SystemConsole.Themes.ConsoleThemeStyle, Serilog.Sinks.SystemConsole.Themes.SystemConsoleThemeStyle>>,System.Func`2<System.Collections.Generic.KeyValuePair`2<Serilog.Sinks.SystemConsole.Themes.ConsoleThemeStyle, Serilog.Sinks.SystemConsole.Themes.SystemConsoleThemeStyle>, Serilog.Sinks.SystemConsole.Themes.ConsoleThemeStyle>,System.Func`2<System.Collections.Generic.KeyValuePair`2<Serilog.Sinks.SystemConsole.Themes.ConsoleThemeStyle, Serilog.Sinks.SystemConsole.Themes.SystemConsoleThemeStyle>, Serilog.Sinks.SystemConsole.Themes.SystemConsoleThemeStyle>): method body is empty.

  at Serilog.Sinks.SystemConsole.Themes.SystemConsoleTheme..ctor (System.Collections.Generic.IReadOnlyDictionary`2[TKey,TValue] styles) [0x00014] in <0d35b79e206a48c19c77b089a3a1e0b2>:0 
  at Serilog.Sinks.SystemConsole.Themes.SystemConsoleThemes..cctor () [0x00203] in <0d35b79e206a48c19c77b089a3a1e0b2>:0 
   --- End of inner exception stack trace ---
  at Serilog.ConsoleLoggerConfigurationExtensions.Console (Serilog.Configuration.LoggerSinkConfiguration sinkConfiguration, Serilog.Events.LogEventLevel restrictedToMinimumLevel, System.String outputTemplate, System.IFormatProvider formatProvider, Serilog.Core.LoggingLevelSwitch levelSwitch, System.Nullable`1[T] standardErrorFromLevel, Serilog.Sinks.SystemConsole.Themes.ConsoleTheme theme) [0x00030] in <0d35b79e206a48c19c77b089a3a1e0b2>:0 
  at fiskaltrust.service.launcher.Extensions.LoggingExtensions.SetGlobalLogger (System.String logFile, Microsoft.Extensions.Logging.LogLevel verbosity, System.String package) [0x00014] in <a905ad260aa841eabb33fbe2f4245f94>:0 
  at fiskaltrust.service.launcher.Program.Main (System.String[] args) [0x0000d] in <a905ad260aa841eabb33fbe2f4245f94>:0

Unfortunately, logfile.txt doesn't even get created. /usr/share/fiskaltrust/service/ directory is empty. mono-complete has been installed via APT. mono JIT is 4.6.2 on Ubuntu 18.04 LTS x64 / de.

I interpret this stacktrace, that the colors in the cli output won't work. How can I avoid this?

Kind regards, Sebastian Kraus

ticktoo commented 3 years ago

Fixed this by upgrading mono from 4.6.2 to 6.12.0.122 according to mono-project.com

TSchmiedlechner commented 3 years ago

Great to hear, thanks for adding your solution! 🙂