runtime: Microsoft.Extensions.Logging.Console.ConsoleLoggerProvider tests failing on non-Windows platforms

    Microsoft.Extensions.Hosting.HostTests.CreateDefaultBuilder_RegistersEventSourceLogger [FAIL]
      System.DllNotFoundException : Unable to load shared library 'kernel32.dll' or one of its dependencies. In order to help diagnose loading problems, consider setting the LD_DEBUG environment variable: libkernel32.dll: cannot open shared object file: No such file or directory
      Stack Trace:
           at Microsoft.Extensions.Logging.Console.ConsoleLoggerProvider.DoesConsoleSupportAnsi()
        /_/src/libraries/Microsoft.Extensions.Logging.Console/src/ConsoleLoggerProvider.cs(50,0): at Microsoft.Extensions.Logging.Console.ConsoleLoggerProvider..ctor(IOptionsMonitor`1 options, IEnumerable`1 formatters)
           at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor, Boolean wrapExceptions)
        /_/src/coreclr/src/System.Private.CoreLib/src/System/Reflection/RuntimeConstructorInfo.cs(348,0): at System.Reflection.RuntimeConstructorInfo.Invoke(BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 17 (17 by maintainers)

Commits related to this issue

Most upvoted comments

I do not think that #39209 is the problem. I believe that the problem is how this is calling P/Invokes with SuppressGCTransitionAttribute.

One of the side-effects of SuppressGCTransitionAttribute is that the JIT will load the target eagerly to minimize overhead. It means that it does not compose well with platform specific checks in platform neutral assemblies.

I think this assembly should be either made platform specific (without the IsOSPlatform checks), or the use of SuppressGCTransitionAttribute should be ifdefed out in this assembly.