Skip to content

Commit 819f116

Browse files
authored
Merge pull request #3179 from chhh/feature/report-project-file-location
Add local project file location to exception when parsing fails
2 parents 8cd3a1b + cac4eb1 commit 819f116

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/GitVersion.Core/VersionConverters/AssemblyInfo/ProjectFileUpdater.cs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,15 @@ public void Execute(VersionVariables variables, AssemblyInfoContext context)
4747
var localProjectFile = projectFile.FullName;
4848

4949
var originalFileContents = this.fileSystem.ReadAllText(localProjectFile);
50-
var fileXml = XElement.Parse(originalFileContents);
50+
XElement fileXml;
51+
try
52+
{
53+
fileXml = XElement.Parse(originalFileContents);
54+
}
55+
catch (XmlException e)
56+
{
57+
throw new XmlException($"Unable to parse file as xml: {localProjectFile}", e);
58+
}
5159

5260
if (!CanUpdateProjectFile(fileXml))
5361
{

0 commit comments

Comments
 (0)