Skip to content

feat: Ignorable pointer members#60

Merged
IvanMurzak merged 4 commits into
mainfrom
feature/ignorable-pointer-members
Jan 19, 2026
Merged

feat: Ignorable pointer members#60
IvanMurzak merged 4 commits into
mainfrom
feature/ignorable-pointer-members

Conversation

@IvanMurzak

Copy link
Copy Markdown
Owner

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, AllowPointerFieldsAccess and AllowPointerPropertiesAccess, 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:

  • Added AllowPointerFieldsAccess and AllowPointerPropertiesAccess properties to the IReflectionConverter interface, allowing converters to specify whether pointer fields and properties should be accessed.
  • Provided default implementations for these properties in BaseReflectionConverter, defaulting to true.

Reflection Logic Updates:

  • Updated GetSerializableFields and GetSerializableProperties in BaseReflectionConverter to filter out pointer fields and properties when the corresponding AllowPointer...Access property is false. [1] [2]

Testing Enhancements:

  • Added a comprehensive test region in BaseReflectionConverterTests.cs to verify pointer field/property inclusion/exclusion based on the new properties, including both allowed and disallowed scenarios, and confirming the default values.

Project Configuration:

  • Enabled unsafe code blocks in the test project by setting <AllowUnsafeBlocks>true</AllowUnsafeBlocks> in the test project file to support pointer-related tests.

@IvanMurzak IvanMurzak self-assigned this Jan 19, 2026
@IvanMurzak IvanMurzak added the enhancement New feature or request label Jan 19, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Test Results

    2 files      2 suites   8m 40s ⏱️
1 161 tests 1 161 ✅ 0 💤 0 ❌
2 322 runs  2 322 ✅ 0 💤 0 ❌

Results for commit 98eb46e.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 AllowPointerFieldsAccess and AllowPointerPropertiesAccess properties to IReflectionConverter interface and BaseReflectionConverter with default values of true
  • 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.

Comment thread ReflectorNet/src/Converter/Reflection/Base/BaseReflectionConverter.cs Outdated
Comment thread ReflectorNet/src/Converter/IReflectionConverter.cs Outdated
Comment thread ReflectorNet/src/Converter/IReflectionConverter.cs Outdated
Comment thread ReflectorNet/src/Converter/Reflection/Base/BaseReflectionConverter.cs Outdated
@IvanMurzak IvanMurzak merged commit f10d4f0 into main Jan 19, 2026
1 check passed
@IvanMurzak IvanMurzak deleted the feature/ignorable-pointer-members branch January 19, 2026 06:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants