Browse Source

Fixed unhandled exception thrown when opening a file that is not a .NET assembly or COM component in the Component Inspector.

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/branches/3.0@3707 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts
Matt Ward 17 years ago
parent
commit
5d0452ed41
  1. 14
      src/AddIns/Misc/ComponentInspector/ComponentInspector.Core/Src/ObjectBrowser/ObjectBrowser.cs
  2. 13
      src/AddIns/Misc/ComponentInspector/ComponentInspector.Core/Src/ObjectBrowser/ObjectBrowserForm.cs

14
src/AddIns/Misc/ComponentInspector/ComponentInspector.Core/Src/ObjectBrowser/ObjectBrowser.cs

@ -12,6 +12,7 @@ using System.IO;
using System.Windows.Forms; using System.Windows.Forms;
using ICSharpCode.Core; using ICSharpCode.Core;
using NoGoop.Controls;
using NoGoop.Obj; using NoGoop.Obj;
using NoGoop.ObjBrowser.GuiDesigner; using NoGoop.ObjBrowser.GuiDesigner;
using NoGoop.ObjBrowser.Panels; using NoGoop.ObjBrowser.Panels;
@ -185,27 +186,32 @@ namespace NoGoop.ObjBrowser
/// <summary> /// <summary>
/// Tries to open the specified file into the object browser. /// Tries to open the specified file into the object browser.
/// </summary> /// </summary>
public void OpenFile(string fileName) public bool OpenFile(string fileName)
{ {
Exception savedException = null; Exception savedException = null;
try { try {
AssemblySupport.OpenFile(fileName); AssemblySupport.OpenFile(fileName);
return; return true;
} catch (Exception ex) { } catch (Exception ex) {
savedException = ex; savedException = ex;
} }
try { try {
ComSupport.OpenFile(fileName); ComSupport.OpenFile(fileName);
return; return true;
} catch (Exception ex) { } catch (Exception ex) {
if (savedException == null) if (savedException == null)
savedException = ex; savedException = ex;
} }
TraceUtil.WriteLineWarning(null, String.Concat("Error opening file ", fileName, ": " + savedException)); TraceUtil.WriteLineWarning(null, String.Concat("Error opening file ", fileName, ": " + savedException));
throw savedException; ErrorDialog.Show(savedException,
"Error opening file " + fileName + "\n\n" +
"The Inspector can only open .NET assemblies, ActiveX controls or ActiveX type libraries.",
"Error opening file " + fileName,
MessageBoxIcon.Error);
return false;
} }
public void CloseSelectedFile() public void CloseSelectedFile()

13
src/AddIns/Misc/ComponentInspector/ComponentInspector.Core/Src/ObjectBrowser/ObjectBrowserForm.cs

@ -197,18 +197,7 @@ namespace NoGoop.ObjBrowser
/// </summary> /// </summary>
public bool OpenFile(string fileName) public bool OpenFile(string fileName)
{ {
try { return _objectBrowser.OpenFile(fileName);
_objectBrowser.OpenFile(fileName);
return true;
} catch (Exception ex) {
ErrorDialog.Show(ex,
"Error opening file " + fileName
+ "\n\nThe Inspector can only open .NET "
+ "assemblies, ActiveX controls or ActiveX type libraries.",
"Error opening file " + fileName,
MessageBoxIcon.Error);
return false;
}
} }
void FindClick(object sender, EventArgs e) void FindClick(object sender, EventArgs e)

Loading…
Cancel
Save