MSBuild log generated by StyleCop throws ArgumentOutOfRangeException #80
Comments
Unit test to reproduce the error: |
@brianfeucht Thanks for the report and test case. Can you create a PR with the test case. Then I can implement the fix for this on top of it on your branch (or you can of course also directly provide the implementation in the PR if you want) |
@pascalberger PR created. I may get time to implement a fix today, but poking at it last night it wasn't 100% clear the best way to achieve that yet. It is throwing due to the repository URL being longer than the local file path at
I think this code would need to check that the string starts with the repository url before doing the |
@brianfeucht On which OS are you running it? In my environment test case works as expected:
The call to the
|
I am on Window 10. Running the test via This also fails running via the CAKE script on Powershell using MSBuild Doing a bit of debugging based on those details:
|
Interesting, |
On Azure Pipelines the test also fails because it doesn't return an issue and not with an |
The only case I see when |
When I put a stop point at |
I've been able to track this down further. The issue is indeed related to the working directory. This appears to prepend the CurrentWorking directory to the file name in the case of relative files. In my build environment this is set to the same as the Repository directory. If I call I've updated my PR to hopefully make this reproduce for you. |
Yeah, it's caused by the working directory since Path.GetFullPath is used. The point which I don't understand is why you're running into this issue, or is |
Yes, I've cloned my repo to |
@brianfeucht I've updated #81 to contain a fix for the issue. Can you please test it and report back if it solves your issue. If it works for you I'll merge the PR and create a release |
@pascalberger I have confirmed this change resolves the issue in my code base where I first ran into it. 🍻 thank you! |
(GH-80) MSBuild log generated by StyleCop throws ArgumentOutOfRangeException
@brianfeucht Release 0.6.3 is now building and should be available soon on nuget.org Thanks for reporting this and helping tracking it down. Really appreciated 👍 |
The following Xml MSBuild log causes an
System.ArgumentOutOfRangeException
:startIndex cannot be larger than length of string.
The text was updated successfully, but these errors were encountered: