Skip to content

Commit 70adc60

Browse files
authored
fix: Make sure to select valid IAnalyzerResult from Buildalyzer (#2811)
Make sure to select valid IAnalyzerResult from Buildalyzer Just like #1900 but for the InputFileResolver. This was not an issue until Buildalyzer/Buildalyzer#198 was reverted in Buildalyzer/Buildalyzer@8e85a15 for the Buildalyzer 6.0.1 release. Before this change in Buildalyzer, the empty target framework was sorted last but since v6.0.1 it's sorted first instead. Also, improve the NotSupportedException message when the language is undefined because `System.NotSupportedException: Specified method is not supported` is a terrible message.
1 parent bd0ba9c commit 70adc60

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

src/Stryker.Core/Stryker.Core/Initialisation/InputFileResolver.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ private List<IAnalyzerResult> AnalyzeSolution(StrykerOptions options)
152152
var projectLogName = Path.GetRelativePath(options.WorkingDirectory, project.ProjectFile.Path);
153153
_logger.LogDebug("Analyzing {projectFilePath}", projectLogName);
154154
var buildResult = project.Build();
155-
var projectAnalyzerResult = buildResult.Results.FirstOrDefault();
155+
var projectAnalyzerResult = buildResult.Results.FirstOrDefault(a => a.TargetFramework is not null);
156156
if (projectAnalyzerResult is not null)
157157
{
158158
projectsAnalyzerResults.Add(projectAnalyzerResult);
@@ -386,7 +386,7 @@ private ProjectComponentsBuilder GetProjectComponentBuilder(
386386
_foldersToExclude,
387387
_logger,
388388
FileSystem),
389-
_ => throw new NotSupportedException()
389+
_ => throw new NotSupportedException($"Language not supported: {language}")
390390
};
391391
}
392392
}

0 commit comments

Comments
 (0)