Skip to content
This repository was archived by the owner on Oct 16, 2020. It is now read-only.

Commit 8e6e3a4

Browse files
committed
Fix crash in MSBuildBasedProject.LoadProjectExtensions when the extension element exists, but the requested element name does not.
1 parent 8de363f commit 8e6e3a4

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

src/Main/Base/Project/Src/Project/MSBuildBasedProject.cs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1467,7 +1467,15 @@ public override XElement LoadProjectExtensions(string name)
14671467
existing = projectFile.CreateProjectExtensionsElement();
14681468
return new XElement(name);
14691469
}
1470-
return XElement.Parse(existing[name]);
1470+
string content = existing[name];
1471+
if (string.IsNullOrEmpty(content))
1472+
return new XElement(name);
1473+
try {
1474+
return XElement.Parse(content);
1475+
} catch (XmlException ex) {
1476+
LoggingService.Warn(ex);
1477+
return new XElement(name);
1478+
}
14711479
}
14721480
}
14731481

0 commit comments

Comments
 (0)