terminal/src/cascadia/TerminalApp/init.cpp
Dustin L. Howett cd768934be
Hook up the WIL fallback error tracer in Terminal (#7864)
This pull request introduces (a very, very stripped-down copy of) the
WIL fallback error reporter.

It emits error records, usually immediately before the application
implodes, into the event stream.

This should improve diagnosability of issues that take Terminal down,
and allow us to give out a .wprp file to gather traces from users.
2020-10-09 22:20:12 +00:00

37 lines
1.1 KiB
C++

// Copyright (c) Microsoft Corporation
// Licensed under the MIT license.
#include "pch.h"
#include <LibraryResources.h>
#include <WilErrorReporting.h>
// Note: Generate GUID using TlgGuid.exe tool
TRACELOGGING_DEFINE_PROVIDER(
g_hTerminalAppProvider,
"Microsoft.Windows.Terminal.App",
// {24a1622f-7da7-5c77-3303-d850bd1ab2ed}
(0x24a1622f, 0x7da7, 0x5c77, 0x33, 0x03, 0xd8, 0x50, 0xbd, 0x1a, 0xb2, 0xed),
TraceLoggingOptionMicrosoftTelemetry());
BOOL WINAPI DllMain(HINSTANCE hInstDll, DWORD reason, LPVOID /*reserved*/)
{
switch (reason)
{
case DLL_PROCESS_ATTACH:
DisableThreadLibraryCalls(hInstDll);
TraceLoggingRegister(g_hTerminalAppProvider);
Microsoft::Console::ErrorReporting::EnableFallbackFailureReporting(g_hTerminalAppProvider);
break;
case DLL_PROCESS_DETACH:
if (g_hTerminalAppProvider)
{
TraceLoggingUnregister(g_hTerminalAppProvider);
}
break;
}
return TRUE;
}
UTILS_DEFINE_LIBRARY_RESOURCE_SCOPE(L"TerminalApp/Resources")