.NET Community Toolkit is a collection of helpers and APIs that work for all .NET developers and are agnostic of any specific UI platform. The toolkit is maintained and published by Microsoft, and part of the .NET Foundation.
Fix TypeExtensions.ToTypeString method throws if invoked on a generic class without specifying the generic type.
Closes #609
Added a check on type.IsGenericParameter inside FormatDisplayString to avoid calling the method recursively given that, in this case, type.DeclaringType returns the parent class that defined the generic type parameter and this parent class was already taken into account by FormatDisplayString.
I've also added 2 tests for testing this case.
PR Checklist
[x] Created a feature/dev branch in your fork (vs. submitting directly from a commit on main)
[x] Based off latest main branch of toolkit
[x] PR doesn't include merge commits (always rebase on top of our main, if needed)
[ ] Pull Request has been submitted to the documentation repository instructions. Link:
[ ] Added description of major feature to project description for NuGet package (4000 total character limit, so don't push entire description over that)
[x] Tests for the changes have been added (for bug fixes / features) (if applicable)
[ ] Header has been added to all new source files (run build/UpdateHeaders.bat)
[x] Contains NO breaking changes
[ ] Every new API (including internal ones) has full XML docs
Fix TypeExtensions.ToTypeString method throws if invoked on a generic class without specifying the generic type.
Closes #609
Added a check on type.IsGenericParameter inside FormatDisplayString to avoid calling the method recursively given that, in this case, type.DeclaringType returns the parent class that defined the generic type parameter and this parent class was already taken into account by FormatDisplayString.
I've also added 2 tests for testing this case.
PR Checklist