From c483f84f23e65374e113f2635726d4374de5fddf Mon Sep 17 00:00:00 2001 From: Ashwin Shivashankar Date: Mon, 15 May 2023 13:40:43 -0400 Subject: [PATCH 1/2] If the addin cannot be properly loaded, just skip the file. --- DesignAutomationHandler.cs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/DesignAutomationHandler.cs b/DesignAutomationHandler.cs index dbbd51b..2683db8 100644 --- a/DesignAutomationHandler.cs +++ b/DesignAutomationHandler.cs @@ -19,7 +19,16 @@ public Result Execute(ExternalCommandData commandData, ref string message, Eleme string[] files = Directory.GetFiles(app.AllUsersAddinsLocation, "*.addin"); foreach (string file in files) { - XElement addin = XElement.Load(file); + XElement addin; + try + { + addin = XElement.Load(file); + } + catch + { + // if the XML is malformed or not parse-able, just continue + continue; + } IEnumerable childList = from el in addin.Elements() select el; foreach (XElement e in childList) { From 06b1d0184f384c89119124f2e5f0b8fa110065fc Mon Sep 17 00:00:00 2001 From: Ashwin Shivashankar Date: Mon, 15 May 2023 14:09:42 -0400 Subject: [PATCH 2/2] Throw error popup on invalid addin --- DesignAutomationHandler.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/DesignAutomationHandler.cs b/DesignAutomationHandler.cs index 2683db8..67321b1 100644 --- a/DesignAutomationHandler.cs +++ b/DesignAutomationHandler.cs @@ -26,6 +26,7 @@ public Result Execute(ExternalCommandData commandData, ref string message, Eleme } catch { + MessageBox.Show($"Malformed XML in addin: {file}", "DesignAutomationHandler"); // if the XML is malformed or not parse-able, just continue continue; }