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; @@ -12,6 +12,7 @@ using System.IO;
using System.Windows.Forms;
using ICSharpCode.Core;
using NoGoop.Controls;
using NoGoop.Obj;
using NoGoop.ObjBrowser.GuiDesigner;
using NoGoop.ObjBrowser.Panels;
@ -185,27 +186,32 @@ namespace NoGoop.ObjBrowser @@ -185,27 +186,32 @@ namespace NoGoop.ObjBrowser
/// <summary>
/// Tries to open the specified file into the object browser.
/// </summary>
public void OpenFile(string fileName)
public bool OpenFile(string fileName)
{
Exception savedException = null;
try {
AssemblySupport.OpenFile(fileName);
return;
return true;
} catch (Exception ex) {
savedException = ex;
}
try {
ComSupport.OpenFile(fileName);
return;
return true;
} catch (Exception ex) {
if (savedException == null)
savedException = ex;
}
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()

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

@ -197,18 +197,7 @@ namespace NoGoop.ObjBrowser @@ -197,18 +197,7 @@ namespace NoGoop.ObjBrowser
/// </summary>
public bool OpenFile(string fileName)
{
try {
_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;
}
return _objectBrowser.OpenFile(fileName);
}
void FindClick(object sender, EventArgs e)

Loading…
Cancel
Save