[smuxi/stable: 1/2] Frontend-GNOME: detect and report Mono <-> .NET incompatibility for remote engines (refs: #589)



commit 1e172f72a127afeea33f2cffa9455b7d147cb7f6
Author: Mirco Bauer <meebey meebey net>
Date:   Tue Jul 12 17:10:42 2016 +0200

    Frontend-GNOME: detect and report Mono <-> .NET incompatibility for remote engines (refs: #589)
    
    Smuxi users running a smuxi-server on Mono and connecting from Windows using the
    Microsoft .NET framework will lead to an user-unfriendly crash dialog like this:
    
        Exception Type:
        System.InvalidCastException
    
        Exception Message:
        Object must implement IConvertible.
    
        Exception StackTrace:
    
        Server stack trace:
           at System.Convert.ChangeType(Object value, Type conversionType, IFormatProvider provider)
           at System.Runtime.Serialization.FormatterConverter.Convert(Object value, Type type)
           at System.Runtime.Serialization.SerializationInfo.GetValue(String name, Type type)
           at System.Collections.Generic.Dictionary`2.OnDeserialization(Object sender)
           at System.Runtime.Serialization.ObjectManager.RaiseDeserializationEvent()
           at System.Runtime.Serialization.Formatters.Binary.ObjectReader.Deserialize(HeaderHandler handler, 
__BinaryParser serParser, Boolean fCheck, Boolean isCrossAppDomain, IMethodCallMessage methodCallMessage)
           at System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Deserialize(Stream 
serializationStream, HeaderHandler handler, Boolean fCheck, Boolean isCrossAppDomain, IMethodCallMessage 
methodCallMessage)
           at System.Runtime.Remoting.Channels.CoreChannel.DeserializeBinaryResponseMessage(Stream 
inputStream, IMethodCallMessage reqMsg, Boolean bStrictBinding)
           at System.Runtime.Remoting.Channels.BinaryClientFormatterSink.SyncProcessMessage(IMessage msg)
    
        Exception rethrown at [0]:
           at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
           at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
           at Smuxi.Engine.GroupChatModel.get_Persons()
           at Smuxi.Frontend.Gnome.GroupChatView.Sync()
           at Smuxi.Frontend.Gnome.TwitterGroupChatView.Sync()
    
    The user has no hint how to proceed here. Since this is a known incompatibility
    since Mono 2.10 [0], we detect this condition and hint the user how to fix it.

 src/Frontend-GNOME/Frontend.cs |   26 ++++++++++++++++++++++++++
 1 files changed, 26 insertions(+), 0 deletions(-)
---
diff --git a/src/Frontend-GNOME/Frontend.cs b/src/Frontend-GNOME/Frontend.cs
index 9bd9730..aad7ec3 100644
--- a/src/Frontend-GNOME/Frontend.cs
+++ b/src/Frontend-GNOME/Frontend.cs
@@ -626,6 +626,32 @@ namespace Smuxi.Frontend.Gnome
             }
             _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();


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]