feat: Ignorable pointer members#60
Merged
Merged
Conversation
Contributor
Test Results 2 files 2 suites 8m 40s ⏱️ Results for commit 98eb46e. |
Contributor
There was a problem hiding this comment.
Pull request overview
This pull request adds support for controlling whether pointer-type fields and properties are included during reflection-based serialization. The feature introduces two new configuration properties to the reflection converter interface, allowing converters to exclude pointer members when needed.
Changes:
- Added
AllowPointerFieldsAccessandAllowPointerPropertiesAccessproperties toIReflectionConverterinterface andBaseReflectionConverterwith default values oftrue - Updated reflection logic to filter out pointer-type fields and properties when the corresponding allow properties are set to
false - Added comprehensive test coverage for pointer access control scenarios
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| ReflectorNet/src/Converter/IReflectionConverter.cs | Added interface properties for controlling pointer field and property access |
| ReflectorNet/src/Converter/Reflection/Base/BaseReflectionConverter.cs | Implemented pointer access control properties with filtering logic in GetSerializableFieldsInternal and GetSerializablePropertiesInternal |
| ReflectorNet.Tests/src/Converter/Reflection/Base/BaseReflectionConverterTests.cs | Added test entity with pointer members and comprehensive tests verifying pointer inclusion/exclusion behavior |
| ReflectorNet.Tests/ReflectorNet.Tests.csproj | Enabled unsafe code blocks to support pointer-related tests |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request adds support for controlling access to pointer fields and properties in reflection-based converters, along with comprehensive tests for these behaviors. The changes introduce two new properties,
AllowPointerFieldsAccessandAllowPointerPropertiesAccess, to the reflection converter interface and its base implementation, allowing fine-grained control over whether pointer types are included during serialization. Tests are added to verify both enabled and disabled scenarios.Pointer Access Control Improvements:
AllowPointerFieldsAccessandAllowPointerPropertiesAccessproperties to theIReflectionConverterinterface, allowing converters to specify whether pointer fields and properties should be accessed.BaseReflectionConverter, defaulting totrue.Reflection Logic Updates:
GetSerializableFieldsandGetSerializablePropertiesinBaseReflectionConverterto filter out pointer fields and properties when the correspondingAllowPointer...Accessproperty isfalse. [1] [2]Testing Enhancements:
BaseReflectionConverterTests.csto verify pointer field/property inclusion/exclusion based on the new properties, including both allowed and disallowed scenarios, and confirming the default values.Project Configuration:
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>in the test project file to support pointer-related tests.