Enhance enum parsing and nullable context handling#23
Conversation
…xt handling in MethodUtils
…h .NET 8 and earlier versions
There was a problem hiding this comment.
Pull Request Overview
This PR improves cross-platform compatibility by adjusting conditional compilation directives and adding defensive null checks for enum parsing operations.
- Wraps
JsonSchemaExporterContextmethod with conditional compilation and uses fully-qualified type name - Adjusts conditional compilation for
NullableContextAttributeusage across .NET versions - Adds defensive null checks before
Enum.IsDefinedcalls in enum conversion logic
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| ReflectorNet/src/Utils/TypeUtils.cs | Removes System.Text.Json.Schema using directive, wraps GetPropertyDescription method with conditional compilation, and uses fully-qualified type name for JsonSchemaExporterContext |
| ReflectorNet/src/Utils/MethodUtils.cs | Updates conditional compilation directives for NullableContextAttribute to support .NET Standard 2.1 and distinguish between .NET 8.0+ and .NET 5.0+ |
| ReflectorNet/src/Reflector/MethodWrapper.cs | Adds null check before Enum.IsDefined call in ConvertStringToEnum method |
| ReflectorNet/src/Convertor/Json/EnumJsonConverter.cs | Adds null check before Enum.IsDefined call in enum string parsing logic |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…te values in MethodUtils
There was a problem hiding this comment.
Pull Request Overview
Copilot reviewed 4 out of 4 changed files in this pull request and generated no new comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…Utils for better understanding of environment support
There was a problem hiding this comment.
Pull Request Overview
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull Request Overview
Copilot reviewed 4 out of 4 changed files in this pull request and generated no new comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Improvements include better handling of null values in enum parsing and adjustments to nullable context handling in MethodUtils for compatibility with different .NET versions.