Skip to content

Commit 2e3533e

Browse files
If the addin cannot be properly loaded, just skip the file. (#11)
1 parent 52ae637 commit 2e3533e

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

DesignAutomationHandler.cs

+11-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,17 @@ public Result Execute(ExternalCommandData commandData, ref string message, Eleme
1919
string[] files = Directory.GetFiles(app.AllUsersAddinsLocation, "*.addin");
2020
foreach (string file in files)
2121
{
22-
XElement addin = XElement.Load(file);
22+
XElement addin;
23+
try
24+
{
25+
addin = XElement.Load(file);
26+
}
27+
catch
28+
{
29+
MessageBox.Show($"Malformed XML in addin: {file}", "DesignAutomationHandler");
30+
// if the XML is malformed or not parse-able, just continue
31+
continue;
32+
}
2333
IEnumerable<XElement> childList = from el in addin.Elements() select el;
2434
foreach (XElement e in childList)
2535
{

0 commit comments

Comments
 (0)