Skip to content

Commit 0c5866c

Browse files
committed
additional unparseable file message
1 parent 003dad9 commit 0c5866c

2 files changed

Lines changed: 13 additions & 0 deletions

File tree

nuget/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Utilities/MSBuildHelperTests.cs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -634,5 +634,17 @@ Using Msbuild from '/usr/local/dotnet/current/sdk/9.0.311'.
634634
// expectedError
635635
new UnknownError(new Exception("Multiple project files found for single packages.config"), "TEST-JOB-ID"),
636636
];
637+
638+
yield return
639+
[
640+
// output
641+
"""
642+
Error parsing packages.config file at /path/to/packages.config: Unexpected XML declaration. The XML declaration must be the first node in the document, and no whitespace characters are allowed to appear before it. Line 1, position 5.
643+
644+
^^^ this blank line is necessary to force a newline at the end of the output
645+
""",
646+
// expectedError
647+
new DependencyFileNotParseable("/path/to/packages.config", "Unexpected XML declaration. The XML declaration must be the first node in the document, and no whitespace characters are allowed to appear before it. Line 1, position 5.")
648+
];
637649
}
638650
}

nuget/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Utilities/MSBuildHelper.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -728,6 +728,7 @@ private static void ThrowOnUnparseableFile(string output)
728728
{
729729
new Regex(@"\nAn error occurred while reading file '(?<FilePath>[^']+)': (?<Message>[^\n]*)\n"),
730730
new Regex(@"NuGet\.Config is not valid XML\. Path: '(?<FilePath>[^']+)'\.\n\s*(?<Message>[^\n]*)(\n|$)"),
731+
new Regex(@"Error parsing packages\.config file at (?<FilePath>[^:]+): (?<Message>[^\n]*)\n"),
731732
};
732733
var match = patterns.Select(p => p.Match(output)).Where(m => m.Success).FirstOrDefault();
733734
if (match is not null)

0 commit comments

Comments
 (0)