runtime: Environment.FailFast not capturing message and exception details to Windows Event Log

Runtime Environment OS Name: Windows OS Version: 10.0.14393 OS Platform: Windows RID: win10-x64 Base Path: C:\Program Files\dotnet\sdk\2.0.0\

Microsoft .NET Core Shared Framework Host Version : 2.0.0 Build : e8b8861ac7faf042c87a5c2f9f2d04c98b69f28d

Repro

    private static void Main(string[] args)
    {
        Environment.FailFast("Something bad happened");
    }

On .NET Framework 4.6.1 the runtime creates the following event in the Application event log with the following details:

  • Event ID: 1025
  • Event source: .NET Runtime
  • The message passed to FailFast (eg. “Something bad happened”)

On .NET Core 2.0 no such event is logged. The only event is the generic windows Application Error (1000 event) which does not contain the stack trace or message passed to FailFast.

Has this been done for cross-platform reasons, ie. Unix has no Windows Event Log? The event that gets logged on net461 is very useful and it would be good to have the same level of information on netcoreapp20.

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Comments: 16 (11 by maintainers)

Most upvoted comments

Should be fixed with dotnet/coreclr#16875.

@lakeman

Related problem, Environment.FailFast(System.String, System.Exception) is logging the message, but not the details of the exception.

This sholud be fixed in 2.1

This was done for Windows Phone for some reason. I do not see a reason why it cannot be re-enabled for .NET Core.

Note that there are likely more changes required than just deleting this ifdef to make it work well. E.g. the if (pThread->GetDomain()->IsDefaultDomain()) path in DoReportForUnhandledException should be deleted. Ideally, everything around CrossAppDomainMarshaledException would be deleted too.