From a68e40a244d24108164bc1ccdd317555798ff628 Mon Sep 17 00:00:00 2001 From: alcexhim Date: Thu, 16 Oct 2014 12:45:21 -0400 Subject: [PATCH] Catch the issue early on so we don't throw an unrelated exception later --- .../UniversalEditor.Bootstrapper/Program.cs | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/CSharp/Applications/UniversalEditor.Bootstrapper/Program.cs b/CSharp/Applications/UniversalEditor.Bootstrapper/Program.cs index bd4a52be..54866166 100644 --- a/CSharp/Applications/UniversalEditor.Bootstrapper/Program.cs +++ b/CSharp/Applications/UniversalEditor.Bootstrapper/Program.cs @@ -16,17 +16,24 @@ namespace UniversalEditor.Bootstrapper { try { - // why do we do this? because, if the class was static, it tries to load the 'Engine' type - // from another library immediately... if it can't be found, it crashes. this way, if it - // can't be found, we can still catch it since it's loaded on-demand rather than - // immediately. - (new BootstrapperInstance()).Main(); + string path = + System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location) + + System.IO.Path.DirectorySeparatorChar.ToString() + + "UniversalEditor.UserInterface.dll"; + + Assembly asm = System.Reflection.Assembly.LoadFile(path); } catch { MessageBox.Show("The file 'UniversalEditor.UserInterface.dll' is required for this software to run, but is either missing or corrupted. Please re-install the software and try again.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } + + // why do we do this? because, if the class was static, it tries to load the 'Engine' type + // from another library immediately... if it can't be found, it crashes. this way, if it + // can't be found, we can still catch it since it's loaded on-demand rather than + // immediately. + (new BootstrapperInstance()).Main(); } private class BootstrapperInstance