Skip to content

Commit

Permalink
Use empty string as key for project properties if TargetFrameworkMoni…
Browse files Browse the repository at this point in the history
…ker isn't found (as it is no longer generated for C++ projects with Visual Studio 2022)
  • Loading branch information
echalone authored and daveaglick committed Jan 19, 2022
1 parent d1e530d commit a71b5ba
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Buildalyzer/Logging/EventProcessor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,8 @@ private void ProjectStarted(object sender, ProjectStartedEventArgs e)
?.ToDictionaryEntries()
.FirstOrDefault(x => string.Equals(x.Key.ToString(), "TargetFrameworkMoniker", StringComparison.OrdinalIgnoreCase))
.Value
?.ToString();
if (!string.IsNullOrWhiteSpace(tfm))
?.ToString() ?? string.Empty; // use an empty string if no target framework was found, for example in case of C++ projects with VS >= 2022
if (propertiesAndItems != null && propertiesAndItems.Properties != null && propertiesAndItems.Items != null)
{
if (!_results.TryGetValue(tfm, out AnalyzerResult result))
{
Expand Down

0 comments on commit a71b5ba

Please sign in to comment.