Esempio n. 1
0
        /// <summary>
        ///     Installs a post mortem debugger in the current process which handles the given failures.
        ///     Should a failure occur, a minidump is written automatically.
        /// </summary>
        /// <param name="suppressErrorWindows"></param>
        /// <param name="interceptUnhandledExceptions"></param>
        /// <param name="handleCrtAsserts"></param>
        /// <param name="handleCrtPurecalls"></param>
        /// <param name="crtVersions"></param>
        /// <returns></returns>
        public static bool InstallPostmortemDebugger(bool suppressErrorWindows,
                                                     bool interceptUnhandledExceptions,
                                                     bool handleCrtAsserts,
                                                     bool handleCrtPurecalls,
                                                     CRuntimeVersions crtVersions)
        {
            try
            {
                if (!_installPostmortemDebugger(suppressErrorWindows,
                                                interceptUnhandledExceptions,
                                                handleCrtAsserts,
                                                handleCrtPurecalls,
                                                crtVersions))
                {
                    var err = Marshal.GetLastWin32Error();
                    Log.ErrorFormat("Unable to install the post-mortem debugger for unhandled exceptions: {0}",
                                    err);
                    return(false);
                }

                return(true);
            }
            catch (Exception e)
            {
                Log.ErrorFormat("Unable to install the post-mortem debugger for unhandled exceptions: {0}",
                                e);
                return(false);
            }
        }
Esempio n. 2
0
 private static extern bool _installPostmortemDebugger(bool suppressErrorWindows,
                                                       bool interceptUnhandledExceptions,
                                                       bool handleCrtAsserts,
                                                       bool handleCrtPurecalls,
                                                       CRuntimeVersions crtVersions);