Skip to content

Remove nullable annotation from NuspecReader PackageTypes - #272

Merged
jeffkl merged 1 commit into
jeffkl:mainfrom
MattKotsenas:bugfix/nuspec-package-types
Mar 7, 2024
Merged

jeffkl merged 1 commit into
jeffkl:mainfrom
MattKotsenas:bugfix/nuspec-package-types

Conversation

@MattKotsenas

Copy link
Copy Markdown
Contributor

Previously, PackageTypes on the NuspecReader allowed returning null strings from the enumerable.

This type causes an issue when passing the result of the NuspecReader (which is IEnumerable<string?>) as the input of the Package (which is IEnumerable<string>?). Since a valid .nuspec's <packageType> will always have a name (according to https://github.com/NuGet/Home/wiki/Package-Type-%5BPacking%5D), update the enumerable to only return non-null values.

@MattKotsenas

Copy link
Copy Markdown
Contributor Author

I don't have any unit tests here, as I'm not sure how best to test. Given that the point of the NuspecReader is to be a simple XML parser and avoid dependencies on the NuGet packages, and failures here would be invalid nuspecs.

Let me know if this makes sense / if you have any questions, thanks!

@jeffkl
jeffkl merged commit b63ff14 into jeffkl:main Mar 7, 2024
@MattKotsenas
MattKotsenas deleted the bugfix/nuspec-package-types branch March 7, 2024 22:08
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

Successfully merging this pull request may close these issues.

2 participants