コード例 #1
0
        public static void Show(Gtk.Window parent, Exception ex)
        {
            CrashDialog cd = new CrashDialog(parent, ex);

            cd.Run();
            cd.Destroy();
        }
コード例 #2
0
ファイル: EngineManagerDialog.cs プロジェクト: jamesaxl/smuxi
        private void _OnResponse(object sender, Gtk.ResponseArgs e)
        {
            Trace.Call(sender, e);

            try {
#if LOG4NET
                _Logger.Debug("_OnResponse(): ResponseId: " + e.ResponseId);
#endif
                switch ((int)e.ResponseId)
                {
                case 1:
                    _OnConnectButtonPressed();
                    break;

                case 2:
                    _OnEditButtonPressed();
                    break;

                case 3:
                    _OnNewButtonPressed();
                    break;

                case 4:
                    _OnDeleteButtonPressed();
                    break;

                case 5:
                    _OnQuitButtonPressed();
                    break;

                case (int)Gtk.ResponseType.DeleteEvent:
                    _OnDeleteEvent();
                    break;
                }
            } catch (Exception ex) {
#if LOG4NET
                _Logger.Error(ex);
#endif
                CrashDialog.Show(this, ex);
            }
        }
コード例 #3
0
ファイル: Frontend.cs プロジェクト: knocte/smuxi
        public static void ShowException(Gtk.Window parent, Exception ex)
        {
            Trace.Call(parent, ex != null ? ex.GetType() : null);

            if (parent == null) {
                parent = _MainWindow;
            }

            if (!IsGuiThread()) {
                Gtk.Application.Invoke(delegate {
                    ShowException(parent, ex);
                });
                return;
            }

            if (ex is NotImplementedException) {
                // don't quit on NotImplementedException
                ShowError(parent, ex);
                return;
            }

            #if LOG4NET
            _Logger.Error("ShowException(): Exception:", ex);
            #endif

            // HACK: ugly MS .NET throws underlaying SocketException instead of
            // wrapping those into a nice RemotingException, see:
            // http://projects.qnetp.net/issues/show/232
            if (ex is System.Runtime.Remoting.RemotingException ||
                ex is System.Net.Sockets.SocketException) {
                if (_InReconnectHandler || _InCrashHandler) {
                    // one reconnect is good enough and a crash we won't survive
                    return;
                }

                Frontend.ReconnectEngineToGUI();
                return;
            }

            if (_InCrashHandler) {
                // only show not more than one crash dialog, else the user
                // will not be able to copy/paste the stack trace and stuff
                return;
            }
            _InCrashHandler = true;

            // we are using a remote engine, we are not running on Mono and an
            // IConvertible issue happened
            if (!Frontend.IsLocalEngine &&
                Type.GetType("Mono.Runtime") == null &&
                ex is InvalidCastException &&
                ex.Message.Contains("IConvertible")) {
                var msg = _(
                    "A fatal error has been detected because of a protocol incompatibility with the smuxi-server!\n\n" +
                    "Please install Mono on the frontend side so it matches the smuxi-server.\n\n" +
                    "More details about this issue can be found here:\n" +
                    "https://smuxi.im/issues/show/589"
                );
                var dialog = new Gtk.MessageDialog(
                    parent,
                    Gtk.DialogFlags.Modal,
                    Gtk.MessageType.Error,
                    Gtk.ButtonsType.Close,
                    true,
                    msg
                );
                dialog.Run();
                dialog.Destroy();
                Quit();
                return;
            }

            CrashDialog cd = new CrashDialog(parent, ex);
            cd.Run();
            cd.Destroy();

            if (SysDiag.Debugger.IsAttached) {
                // allow the debugger to examine the situation
                //SysDiag.Debugger.Break();
                // HACK: Break() would be nicer but crashes the runtime
                throw ex;
            }

            Quit();
        }
コード例 #4
0
ファイル: CrashDialog.cs プロジェクト: tuukka/smuxi
 public static void Show(Gtk.Window parent, Exception ex)
 {
     CrashDialog cd = new CrashDialog(parent, ex);
     cd.Run();
     cd.Destroy();
 }
コード例 #5
0
        public static void ShowException(Gtk.Window parent, Exception ex)
        {
            Trace.Call(parent, ex != null ? ex.GetType() : null);

            if (parent == null)
            {
                parent = _MainWindow;
            }

            if (!IsGuiThread())
            {
                Gtk.Application.Invoke(delegate {
                    ShowException(parent, ex);
                });
                return;
            }

            if (ex is NotImplementedException)
            {
                // don't quit on NotImplementedException
                ShowError(parent, ex);
                return;
            }

#if LOG4NET
            _Logger.Error("ShowException(): Exception:", ex);
#endif

            // HACK: ugly MS .NET throws underlaying SocketException instead of
            // wrapping those into a nice RemotingException, see:
            // http://projects.qnetp.net/issues/show/232
            if (ex is System.Runtime.Remoting.RemotingException ||
                ex is System.Net.Sockets.SocketException)
            {
                if (_InReconnectHandler || _InCrashHandler)
                {
                    // one reconnect is good enough and a crash we won't survive
                    return;
                }

                Frontend.ReconnectEngineToGUI();
                return;
            }

            if (_InCrashHandler)
            {
                // only show not more than one crash dialog, else the user
                // will not be able to copy/paste the stack trace and stuff
                return;
            }
            _InCrashHandler = true;

            CrashDialog cd = new CrashDialog(parent, ex);
            cd.Run();
            cd.Destroy();

            if (SysDiag.Debugger.IsAttached)
            {
                // allow the debugger to examine the situation
                //SysDiag.Debugger.Break();
                // HACK: Break() would be nicer but crashes the runtime
                throw ex;
            }

            Quit();
        }
コード例 #6
0
ファイル: Frontend.cs プロジェクト: shubhtr/smuxi
        public static void ShowException(Gtk.Window parent, Exception ex)
        {
            Trace.Call(parent, ex != null ? ex.GetType() : null);

            if (parent == null)
            {
                parent = _MainWindow;
            }

            if (!IsGuiThread())
            {
                Gtk.Application.Invoke(delegate {
                    ShowException(parent, ex);
                });
                return;
            }

            if (ex is NotImplementedException)
            {
                // don't quit on NotImplementedException
                ShowError(parent, ex);
                return;
            }

#if LOG4NET
            _Logger.Error("ShowException(): Exception:", ex);
#endif

            // HACK: ugly MS .NET throws underlaying SocketException instead of
            // wrapping those into a nice RemotingException, see:
            // http://projects.qnetp.net/issues/show/232
            if (ex is System.Runtime.Remoting.RemotingException ||
                ex is System.Net.Sockets.SocketException)
            {
                if (_InReconnectHandler || _InCrashHandler)
                {
                    // one reconnect is good enough and a crash we won't survive
                    return;
                }

                Frontend.ReconnectEngineToGUI();
                return;
            }

            if (_InCrashHandler)
            {
                // only show not more than one crash dialog, else the user
                // will not be able to copy/paste the stack trace and stuff
                return;
            }
            _InCrashHandler = true;

            // we are using a remote engine, we are not running on Mono and an
            // IConvertible issue happened
            if (!Frontend.IsLocalEngine &&
                Type.GetType("Mono.Runtime") == null &&
                ex is InvalidCastException &&
                ex.Message.Contains("IConvertible"))
            {
                var msg = _(
                    "A fatal error has been detected because of a protocol incompatibility with the smuxi-server!\n\n" +
                    "Please install Mono on the frontend side so it matches the smuxi-server.\n\n" +
                    "More details about this issue can be found here:\n" +
                    "https://smuxi.im/issues/show/589"
                    );
                var dialog = new Gtk.MessageDialog(
                    parent,
                    Gtk.DialogFlags.Modal,
                    Gtk.MessageType.Error,
                    Gtk.ButtonsType.Close,
                    true,
                    msg
                    );
                dialog.Run();
                dialog.Destroy();
                Quit();
                return;
            }

            CrashDialog cd = new CrashDialog(parent, ex);
            cd.Run();
            cd.Destroy();

            if (SysDiag.Debugger.IsAttached)
            {
                // allow the debugger to examine the situation
                //SysDiag.Debugger.Break();
                // HACK: Break() would be nicer but crashes the runtime
                throw ex;
            }

            Quit();
        }
コード例 #7
0
ファイル: Frontend.cs プロジェクト: txdv/smuxi
        public static void ShowException(Gtk.Window parent, Exception ex)
        {
            Trace.Call(parent, ex != null ? ex.GetType() : null);

            if (parent == null) {
                parent = _MainWindow;
            }

            if (!IsGuiThread()) {
                Gtk.Application.Invoke(delegate {
                    ShowException(parent, ex);
                });
                return;
            }

            #if LOG4NET
            _Logger.Error("ShowException(): Exception:", ex);
            #endif

            // HACK: ugly MS .NET throws underlaying SocketException instead of
            // wrapping those into a nice RemotingException, see:
            // http://projects.qnetp.net/issues/show/232
            if (ex is System.Runtime.Remoting.RemotingException ||
                ex is System.Net.Sockets.SocketException) {
                if (_InReconnectHandler || _InCrashHandler) {
                    // one reconnect is good enough and a crash we won't survive
                    return;
                }
                _InReconnectHandler = true;

                Gtk.MessageDialog md = new Gtk.MessageDialog(parent,
                    Gtk.DialogFlags.Modal, Gtk.MessageType.Error,
                    Gtk.ButtonsType.OkCancel, _("The frontend has lost the connection to the server.\nDo you want to reconnect now?"));
                Gtk.ResponseType res = (Gtk.ResponseType) md.Run();
                md.Destroy();

                if (res == Gtk.ResponseType.Ok) {
                    while (true) {
                        try {
                            Frontend.ReconnectEngineToGUI();
                            // yay, we made it
                            _InReconnectHandler = false;
                            break;
                        } catch (Exception e) {
            #if LOG4NET
                             _Logger.Error("ShowException(): Reconnect failed, exception:", e);
            #endif
                            var msg = _("Reconnecting to the server has failed.\nDo you want to try again?");
                            // the parent window is hidden (MainWindow) at this
                            // point thus modal doesn't make sense here
                            md = new Gtk.MessageDialog(parent,
                                Gtk.DialogFlags.DestroyWithParent,
                                Gtk.MessageType.Error,
                                Gtk.ButtonsType.OkCancel, msg);
                            md.SetPosition(Gtk.WindowPosition.CenterAlways);
                            res = (Gtk.ResponseType) md.Run();
                            md.Destroy();

                            if (res != Gtk.ResponseType.Ok) {
                                // give up
                                Quit();
                                return;
                            }
                        }
                    }
                    return;
                }

                Quit();
                return;
            }

            if (_InCrashHandler) {
                // only show not more than one crash dialog, else the user
                // will not be able to copy/paste the stack trace and stuff
                return;
            }
            _InCrashHandler = true;

            CrashDialog cd = new CrashDialog(parent, ex);
            cd.Run();
            cd.Destroy();

            if (SysDiag.Debugger.IsAttached) {
                // allow the debugger to examine the situation
                //SysDiag.Debugger.Break();
                // HACK: Break() would be nicer but crashes the runtime
                throw ex;
            }

            Quit();
        }
コード例 #8
0
ファイル: Frontend.cs プロジェクト: pacificIT/smuxi
        public static void ShowException(Gtk.Window parent, Exception ex)
        {
            Trace.Call(parent, ex != null ? ex.GetType() : null);

            if (parent == null) {
                parent = _MainWindow;
            }

            if (!IsGuiThread()) {
                Gtk.Application.Invoke(delegate {
                    ShowException(parent, ex);
                });
                return;
            }

            if (ex is NotImplementedException) {
                // don't quit on NotImplementedException
                ShowError(parent, ex);
                return;
            }

            #if LOG4NET
            _Logger.Error("ShowException(): Exception:", ex);
            #endif

            // HACK: ugly MS .NET throws underlaying SocketException instead of
            // wrapping those into a nice RemotingException, see:
            // http://projects.qnetp.net/issues/show/232
            if (ex is System.Runtime.Remoting.RemotingException ||
                ex is System.Net.Sockets.SocketException) {
                if (_InReconnectHandler || _InCrashHandler) {
                    // one reconnect is good enough and a crash we won't survive
                    return;
                }

                Frontend.ReconnectEngineToGUI();
                return;
            }

            if (_InCrashHandler) {
                // only show not more than one crash dialog, else the user
                // will not be able to copy/paste the stack trace and stuff
                return;
            }
            _InCrashHandler = true;

            CrashDialog cd = new CrashDialog(parent, ex);
            cd.Run();
            cd.Destroy();

            if (SysDiag.Debugger.IsAttached) {
                // allow the debugger to examine the situation
                //SysDiag.Debugger.Break();
                // HACK: Break() would be nicer but crashes the runtime
                throw ex;
            }

            Quit();
        }
コード例 #9
0
ファイル: Frontend.cs プロジェクト: RoninBG/smuxi
        public static void ShowException(Gtk.Window parent, Exception ex)
        {
            Trace.Call(parent, ex != null ? ex.GetType() : null);

            if (parent == null) {
                parent = _MainWindow;
            }

            if (!IsGuiThread()) {
                Gtk.Application.Invoke(delegate {
                    ShowException(parent, ex);
                });
                return;
            }

            #if LOG4NET
            _Logger.Error("ShowException(): Exception:", ex);
            #endif

            if (ex is System.Runtime.Remoting.RemotingException) {
                Gtk.MessageDialog md = new Gtk.MessageDialog(parent,
                    Gtk.DialogFlags.Modal, Gtk.MessageType.Error,
                    Gtk.ButtonsType.OkCancel, _("The frontend has lost the connection to the server.\n Do you want to reconnect now?"));
                Gtk.ResponseType res = (Gtk.ResponseType) md.Run();
                md.Destroy();

                if (res == Gtk.ResponseType.Ok) {
                    Frontend.DisconnectEngineFromGUI();
                    _MainWindow.EngineManager.Reconnect();
                    return;
                }

                Quit();
                return;
            }

            CrashDialog cd = new CrashDialog(parent, ex);
            cd.Run();
            cd.Destroy();

            Quit();
        }