Browse Source

Fix "Unhandled exception when installing packed addin with incorrect .addin file" (http://community.sharpdevelop.net/forums/t/11807.aspx)

pull/1/head
Daniel Grunwald 15 years ago
parent
commit
748caff645
  1. 28
      src/Main/Core/Project/Src/AddInTree/AddIn/AddIn.cs

28
src/Main/Core/Project/Src/AddInTree/AddIn/AddIn.cs

@ -267,22 +267,26 @@ namespace ICSharpCode.Core @@ -267,22 +267,26 @@ namespace ICSharpCode.Core
public static AddIn Load(TextReader textReader, string hintPath)
{
AddIn addIn = new AddIn();
using (XmlTextReader reader = new XmlTextReader(textReader)) {
while (reader.Read()){
if (reader.IsStartElement()) {
switch (reader.LocalName) {
case "AddIn":
addIn.properties = Properties.ReadFromAttributes(reader);
SetupAddIn(reader, addIn, hintPath);
break;
default:
throw new AddInLoadException("Unknown add-in file.");
try {
AddIn addIn = new AddIn();
using (XmlTextReader reader = new XmlTextReader(textReader)) {
while (reader.Read()){
if (reader.IsStartElement()) {
switch (reader.LocalName) {
case "AddIn":
addIn.properties = Properties.ReadFromAttributes(reader);
SetupAddIn(reader, addIn, hintPath);
break;
default:
throw new AddInLoadException("Unknown add-in file.");
}
}
}
}
return addIn;
} catch (XmlException ex) {
throw new AddInLoadException(ex.Message, ex);
}
return addIn;
}
public static AddIn Load(string fileName)

Loading…
Cancel
Save