nuke-build / nuke

🏗 The AKEless Build System for C#/.NET
https://nuke.build
MIT License
3.07k stars 367 forks source link

Enhance Solution file parsing to ignore pragma directives in GlobalSection #1392

Closed y-karnitskaya closed 4 months ago

y-karnitskaya commented 5 months ago

This pull request addresses an issue where an exception is thrown when processing solution files (.sln) that contain #pragma directives.

[ERR] Target InitializeCoverageCollector has thrown an exception
System.IndexOutOfRangeException: Index was outside the bounds of the array.

Problem When a .sln file contains #pragma directives, the existing GetGlobalSection method does not handle these lines properly, leading to an IndexOutOfRangeException. This is due to the assumption that all lines within a GlobalSection will conform to expected key-value pairs, which is not the case when #pragma lines are present.

The proposed change adds a filter to skip lines starting with # within the GlobalSection.

I confirm that the pull-request: