[PATCH] More detailed error message of the browser when failing to initialize the renderer
Valentin Sawadski <[email protected]> Sun, 25 Nov 2007 13:22:33 +0100
| Newsgroups | gmane.comp.gnome.mono.documentation |
|---|---|
| Message-ID | <[email protected]> |
Hello everybody, my Monodoc-Browser was again not working because of some missing unmanaged dependencies. Monodoc was looking for libgtkhtml-3.8.so.15 while 3.14.so.19.1 was present in my system. While this is relatively easy to fix for it has been hard to diagnose since the browser does not show a detailed error message. A "The Renderer could not be initialized" is all you get by now. Therefore I attached a small path to show more error output when the renderer could not be started. This is however more a hack than a real solution. But unfortunately I do not know how to fix the real issue, the unmanaged dependency which could not be found. Kind Regards, Valentin S. _______________________________________________ Mono-docs-list maillist - [email protected] http://lists.ximian.com/mailman/listinfo/mono-docs-list
browser.cs.diff
(text/x-patch, 3.2 KB)
Index: docbrowser/browser.cs
===================================================================
--- docbrowser/browser.cs (revision 90253)
+++ docbrowser/browser.cs (working copy)
@@ -2266,17 +2266,12 @@
static IHtmlRender GetRenderer (string file, string type, Browser browser)
{
- try {
-
- string exeAssembly = Assembly.GetExecutingAssembly ().Location;
- string myPath = System.IO.Path.GetDirectoryName (exeAssembly);
- Assembly dll = Assembly.LoadFrom (System.IO.Path.Combine (myPath, file));
- Type t = dll.GetType (type, true);
+ string exeAssembly = Assembly.GetExecutingAssembly ().Location;
+ string myPath = System.IO.Path.GetDirectoryName (exeAssembly);
+ Assembly dll = Assembly.LoadFrom (System.IO.Path.Combine (myPath, file));
+ Type t = dll.GetType (type, true);
- return (IHtmlRender) Activator.CreateInstance (t, new object [1] { browser.help_tree });
- } catch {
- return null;
- }
+ return (IHtmlRender) Activator.CreateInstance (t, new object [1] { browser.help_tree });
}
@@ -2301,20 +2296,30 @@
// Setup the HTML rendering and preview area
//
if (browser.UseGecko) {
- html = GetRenderer ("GeckoHtmlRender.dll", "Monodoc.GeckoHtmlRender", browser);
- html_preview = GetRenderer ("GeckoHtmlRender.dll", "Monodoc.GeckoHtmlRender", browser);
- HelpSource.use_css = true;
+ try {
+ html = GetRenderer ("GeckoHtmlRender.dll", "Monodoc.GeckoHtmlRender", browser);
+ html_preview = GetRenderer ("GeckoHtmlRender.dll", "Monodoc.GeckoHtmlRender", browser);
+ HelpSource.use_css = true;
+ } catch(Exception e) {
+ // Show some error message to indicate why Gecko could not be initialized.
+ Console.WriteLine(string.Format(@"NOTE: Could not load GeckoHtmlRenderer. Here's the stacktrace: ""{0}""", e.ToString()));
+ }
}
-
+
+ Exception gtkhtmlEx = null;
if (html == null || html_preview == null) {
- html = GetRenderer ("GtkHtmlHtmlRender.dll", "Monodoc.GtkHtmlHtmlRender", browser);
- html_preview = GetRenderer ("GtkHtmlHtmlRender.dll", "Monodoc.GtkHtmlHtmlRender", browser);
- browser.UseGecko = false;
- HelpSource.use_css = false;
+ try {
+ html = GetRenderer ("GtkHtmlHtmlRender.dll", "Monodoc.GtkHtmlHtmlRender", browser);
+ html_preview = GetRenderer ("GtkHtmlHtmlRender.dll", "Monodoc.GtkHtmlHtmlRender", browser);
+ browser.UseGecko = false;
+ HelpSource.use_css = false;
+ } catch(Exception e)
+ gtkhtmlEx = e;
}
- if (html == null || html_preview == null)
- throw new Exception ("Couldn't find html renderer!");
+ if (html == null || html_preview == null) {
+ throw new Exception ("Couldn't find html renderer!", gtkhtmlEx);
+ }
//Prepare Font for css (TODO: use GConf?)
if (browser.UseGecko && SettingsHandler.Settings.preferred_font_size == 0) {
Index: docbrowser/ChangeLog
===================================================================
--- docbrowser/ChangeLog (revision 90253)
+++ docbrowser/ChangeLog (working copy)
@@ -1,3 +1,7 @@
+2007-11-25 Valentin Sawadski <[email protected]>
+ * browser.cs: Show a more detailed error-message when the renderer could
+ not be initialized.
+
2007-11-23 Mario Sopena <[email protected]>
* browser.cs: