diff --git a/src/Main/Base/Project/Src/Dom/ReflectionLayer/ReflectionLoader.cs b/src/Main/Base/Project/Src/Dom/ReflectionLayer/ReflectionLoader.cs index 2d1af33506..09896f72df 100644 --- a/src/Main/Base/Project/Src/Dom/ReflectionLayer/ReflectionLoader.cs +++ b/src/Main/Base/Project/Src/Dom/ReflectionLayer/ReflectionLoader.cs @@ -27,7 +27,11 @@ namespace ICSharpCode.SharpDevelop.Dom return null; return DomPersistence.SaveProjectContent(content); } catch (Exception ex) { - LoggingService.Error(ex); + if (ex is FileLoadException) { + LoggingService.Info(ex); + } else { + LoggingService.Error(ex); + } throw; } } @@ -48,10 +52,10 @@ namespace ICSharpCode.SharpDevelop.Dom if (assembly != null) return new ReflectionProjectContent(assembly); else - return null; - } catch (BadImageFormatException) { + throw new FileLoadException("Assembly not found."); + } catch (BadImageFormatException ex) { LoggingService.Warn("BadImageFormat: " + include); - return null; + throw new FileLoadException(ex.Message, ex); } finally { AppDomain.CurrentDomain.ReflectionOnlyAssemblyResolve -= AssemblyResolve; lookupDirectory = null; diff --git a/src/Main/Base/Project/Src/Services/ParserService/ProjectContentRegistry.cs b/src/Main/Base/Project/Src/Services/ParserService/ProjectContentRegistry.cs index 94587d508b..11dc3fa775 100644 --- a/src/Main/Base/Project/Src/Services/ParserService/ProjectContentRegistry.cs +++ b/src/Main/Base/Project/Src/Services/ParserService/ProjectContentRegistry.cs @@ -172,9 +172,13 @@ namespace ICSharpCode.Core object o = domain.CreateInstanceAndUnwrap(typeof(ReflectionLoader).Assembly.FullName, typeof(ReflectionLoader).FullName); ReflectionLoader loader = (ReflectionLoader)o; database = loader.LoadAndCreateDatabase(filename, include); + } catch (FileLoadException e) { + database = null; + WorkbenchSingleton.SafeThreadAsyncCall((Action3)ShowErrorMessage, + new object[] { filename, include, e.Message }); } catch (Exception e) { database = null; - MessageService.ShowError(e, "Error loading " + include + " from " + filename); + MessageService.ShowError(e, "Error loading code-completion information for " + include + " from " + filename); } finally { AppDomain.Unload(domain); } @@ -187,6 +191,16 @@ namespace ICSharpCode.Core } } + delegate void Action3(A a, B b, C c); + + static void ShowErrorMessage(string filename, string include, string message) + { + WorkbenchSingleton.Workbench.GetPad(typeof(CompilerMessageView)).BringPadToFront(); + TaskService.BuildMessageViewCategory.AppendText("Error loading code-completion information for " + + include + " from " + filename + + ":\r\n" + message + "\r\n"); + } + public static Assembly MscorlibAssembly { get { return typeof(object).Assembly;