From 0fccdb3d58c69eb2dad0c09db5ce5b59c44560c9 Mon Sep 17 00:00:00 2001 From: David Alpert Date: Mon, 17 Jul 2006 10:52:50 +0000 Subject: [PATCH] possible workaround to SD2-941. i couldn't reproduce the problem illustrated in SD2-941, but instead this addresses the crash when BooBinding tries to reference FormsDesigner if the FormsDesigner.addin file does not exist. git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@1593 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61 --- .../Project/Src/Services/MessageService/MessageService.cs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/Main/Core/Project/Src/Services/MessageService/MessageService.cs b/src/Main/Core/Project/Src/Services/MessageService/MessageService.cs index 50c78de1fa..d04069406a 100644 --- a/src/Main/Core/Project/Src/Services/MessageService/MessageService.cs +++ b/src/Main/Core/Project/Src/Services/MessageService/MessageService.cs @@ -81,6 +81,13 @@ namespace ICSharpCode.Core msg += "Exception occurred: " + ex.ToString(); } + if (MessageService.MainForm == null) { + // let's try this; don't know if it's threadsafe? I expect + // that MainForm.InvokeRequired can be assumed to be false + // if MainForm doesn't exist yet... + MessageBox.Show(StringParser.Parse(msg), StringParser.Parse("SharpDevelop: ${res:Global.ErrorText}"), MessageBoxButtons.OK, MessageBoxIcon.Error); + } else { + MethodInvoker showError = delegate { MessageBox.Show(MessageService.MainForm, StringParser.Parse(msg), StringParser.Parse("${res:Global.ErrorText}"), MessageBoxButtons.OK, MessageBoxIcon.Error); }; @@ -89,6 +96,7 @@ namespace ICSharpCode.Core } else { showError(); } + } } public static void ShowWarning(string message)