Skip to content

Conversation

@bjornharrtell
Copy link

@bjornharrtell bjornharrtell commented Dec 18, 2025

This is a proposed fix for #6381.

@bjornharrtell bjornharrtell requested a review from roji as a code owner December 18, 2025 18:10
Copilot AI review requested due to automatic review settings December 18, 2025 18:10
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR extends the handleOrdinates configuration option to control which ordinates (coordinate dimensions) are written when serializing geometry objects, not just when reading them. Previously, this option only affected deserialization, which could lead to unexpected ordinates being written when NTS geometry processing introduces additional dimensions.

Key changes:

  • Instantiate and configure a PostGisWriter with the handleOrdinates setting
  • Pass the configured writer to the mappings setup

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.


TypeInfoMappingCollection? _mappings;
protected TypeInfoMappingCollection Mappings => _mappings ??= AddMappings(new(), _gisReader, new(), _geographyAsDefault);
protected TypeInfoMappingCollection Mappings => _mappings ??= AddMappings(new(), _gisReader, _gisWriter, _geographyAsDefault);
Copy link

Copilot AI Dec 18, 2025

Choose a reason for hiding this comment

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

The _gisWriter field is used in the lazy initialization of Mappings, but _gisWriter is only initialized in the constructor. If Mappings is accessed before the constructor completes (e.g., in a derived class), this could result in using an uninitialized field. Consider ensuring the initialization order is safe or moving the writer initialization inline with the reader.

Copilot uses AI. Check for mistakes.
Copy link
Author

Choose a reason for hiding this comment

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

I think it is the same for existing fields.

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.

1 participant