Exemplo n.º 1
0
        public static string GetCommandLine(System.Diagnostics.Process process)
        {
            if (System.Environment.OSVersion.Platform == System.PlatformID.Unix)
            {
                return(UnixProcess.GetCommandLine(process));
            }

            return(WindowsProcess.GetCommandLine(process));
        } // End Function GetCommandLine
Exemplo n.º 2
0
        } // End Function GetCommandLine

        public static void KillProcessAndChildren(int pid)
        {
            if (System.Environment.OSVersion.Platform == System.PlatformID.Unix)
            {
                UnixProcess.KillProcessAndChildren(pid);
            }
            else
            {
                WindowsProcess.KillProcessAndChildren(pid);
            }
        } // End Sub KillProcessAndChildren
Exemplo n.º 3
0
        public static void UnhandledExceptionHandler(object ex)
        {
            try
            {
                if (ex == null)
                {
                    var stackTrace = Environment.StackTrace;
                    Logger.Error("Unhandled exception but did not have exception object. Stack trace:", stackTrace);
                    return;
                }

                if (!(ex is Exception))
                {
                    Logger.Error("Unhandled exception. Object was not exception. {0}", ex);
                    return;
                }

                var aggregateException = ex as AggregateException;
                if (aggregateException != null)
                {
                    Logger.ErrorException("Unhandled exception aggregate", aggregateException);
                    foreach (var innerException in aggregateException.Flatten().InnerExceptions)
                    {
                        Logger.ErrorException("Aggregate inner exception", innerException);
                    }
                    return;
                }

                Logger.ErrorException("Unhandled exception", (Exception)ex);
            }
            finally
            {
                if (Global.IsRunningOnMono())
                {
                    UnixProcess.GetCurrentProcess().Kill();
                }
                else
                {
                    Environment.FailFast("Unhandled exception.. failing fast.");
                }
            }
        }