phmonte / Buildalyzer

A utility to perform design-time builds of .NET projects without having to think too hard about it.
MIT License
593 stars 94 forks source link

ProjectAnalyzer throws when solution is not in a project parent directory #175

Closed psfinaki closed 3 years ago

psfinaki commented 3 years ago

I have a big database so I don't have a common solution and instead use SlnGen for those purposes. So I basically have temp solution files in test projects rather than one solution file in the root.

Turns out, in this case ProjectAnalyzer throws an error in the ctor when doing some string manipulation.

System.ArgumentOutOfRangeException: startIndex cannot be larger than length of string. (Parameter 'startIndex')
   at System.String.Substring(Int32 startIndex, Int32 length)
   at System.String.Substring(Int32 startIndex)
   at Buildalyzer.ProjectAnalyzer..ctor(AnalyzerManager manager, String projectFilePath, ProjectInSolution projectInSolution)
   at Buildalyzer.AnalyzerManager.GetProject(String projectFilePath, ProjectInSolution projectInSolution)
   at Buildalyzer.AnalyzerManager.GetProject(String projectFilePath)