From 748caff645ad4bd6d4ce11e47af9ed3df4c9d8e1 Mon Sep 17 00:00:00 2001 From: Daniel Grunwald Date: Tue, 28 Sep 2010 16:23:35 +0200 Subject: [PATCH] Fix "Unhandled exception when installing packed addin with incorrect .addin file" (http://community.sharpdevelop.net/forums/t/11807.aspx) --- .../Core/Project/Src/AddInTree/AddIn/AddIn.cs | 28 +++++++++++-------- 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/src/Main/Core/Project/Src/AddInTree/AddIn/AddIn.cs b/src/Main/Core/Project/Src/AddInTree/AddIn/AddIn.cs index d7e553d90c..03d23b8e0e 100644 --- a/src/Main/Core/Project/Src/AddInTree/AddIn/AddIn.cs +++ b/src/Main/Core/Project/Src/AddInTree/AddIn/AddIn.cs @@ -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)