Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ArgumentNullException on multiple tfms #43

Open
rgroenewoudt opened this issue Dec 14, 2023 · 0 comments
Open

ArgumentNullException on multiple tfms #43

rgroenewoudt opened this issue Dec 14, 2023 · 0 comments

Comments

@rgroenewoudt
Copy link

rgroenewoudt commented Dec 14, 2023

ArgumentNullException happens when parsing a project containing < TargetFrameworks >

Stacktrace:

>	NuGet.Frameworks.dll!NuGet.Frameworks.NuGetFramework.Parse(string folderName, NuGet.Frameworks.IFrameworkNameProvider mappings) Line 377	C#
 	Snitch.dll!Snitch.Analysis.AnalyzerResultExtensions.GetNearestFrameworkMoniker.AnonymousMethod__0(string x) Line 28	C#
 	System.Linq.dll!System.Linq.Enumerable.ToDictionary<string, NuGet.Frameworks.NuGetFramework, string>(System.Collections.Generic.IEnumerable<string> source, System.Func<string, NuGet.Frameworks.NuGetFramework> keySelector, System.Func<string, string> elementSelector, System.Collections.Generic.IEqualityComparer<NuGet.Frameworks.NuGetFramework> comparer) Line 8144	C#
 	Snitch.dll!Snitch.Analysis.AnalyzerResultExtensions.GetNearestFrameworkMoniker(NuGet.Frameworks.NuGetFramework framework, System.Collections.Generic.IEnumerable<string> candidates) Line 26	C#
 	Snitch.dll!Snitch.Analysis.AnalyzerResultExtensions.GetNearestFrameworkMoniker(System.Collections.Generic.IEnumerable<Buildalyzer.IAnalyzerResult> source, string framework) Line 18	C#
 	Snitch.dll!Snitch.Analysis.ProjectBuilder.Build(Buildalyzer.AnalyzerManager manager, Snitch.Analysis.Project project, string tfm, int indentation) Line 166	C#

Project.TargetFramework and IAnalyzerResult.TargetFramework are null, which causes issues.

Example csproj:

<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
	<TargetFrameworks>net48;net8.0</TargetFrameworks>
  </PropertyGroup>

</Project>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant