Skip to content

ROU-12538: Improving .NET extension#488

Merged
rugoncalves merged 30 commits intodevfrom
ROU-12538
Feb 26, 2026
Merged

ROU-12538: Improving .NET extension#488
rugoncalves merged 30 commits intodevfrom
ROU-12538

Conversation

@rugoncalves
Copy link
Contributor

This pull request makes several improvements and refactors to the OutSystems DataGridUtils .NET extension. The changes include refactoring the JSON serialization of the objects, enhancing thread safety for cached reflection data, updating the target .NET Framework, and improving documentation for maintainers.

What was happening

  • Thread not safe access to static field;
  • Performance issues when dealing with large data sets;

What was done

  • Core refactoring and serialization improvements
    • Refactored the JSON serialization flow by introducing a private ConvertDataToJSON method in CssDataGridUtils, and updated MssConvertData2JSON to directly write combined data and metadata JSON using new helper methods. This results in clearer separation of concerns and improved maintainability.
    • Added writeData and writeMetadata methods to temp_ardoJSON and ObtainMetadata respectively, allowing direct streaming of JSON data and metadata, reducing intermediate string allocations and improving performance.
  • Thread safety and performance
    • Replaced the static Dictionary used for reflection field caching in temp_ardoJSON with a ConcurrentDictionary, ensuring thread safety in multi-threaded environments. Updated field/property caching logic to use GetOrAdd for atomic operations.
  • Metadata and serialization consistency
    • Modified metadata extraction to always pass null as the value for simple fields in metadata, ensuring no accidental data leakage and clarifying the intent of metadata-only output.
    • Adjusted date handling in JSON serialization to always convert dates to UTC before formatting, ensuring consistent date output.
    • Improved iteration safety for OutSystems lists by ensuring EndIteration is always called.
  • Project configuration and documentation
    • Updated the target .NET Framework version from 4.6.1 to 4.7.2 for improved compatibility and support.
    • Added and updated project context documentation in .cursor/rules/project-context.mdc to clarify directory layout, conventions, and dependencies for maintainers.

Test Steps

  1. Open sample page that uses ArrangeData
  2. See if the data is loaded into the grid correctly

Checklist

  • tested locally
  • documented the code
  • clean all warnings and errors of eslint
  • requires changes in OutSystems (if so, provide a module with changes)
  • requires new sample page in OutSystems (if so, provide a module with changes)

Copilot AI review requested due to automatic review settings February 19, 2026 14:51
@rugoncalves rugoncalves requested a review from a team as a code owner February 19, 2026 14:51
Copy link
Contributor

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 pull request refactors the OutSystems DataGridUtils .NET extension to improve thread safety, performance, and maintainability. The changes upgrade the target .NET Framework from 4.6.1 to 4.7.2 and update OutSystems platform dependencies to version 11.40.1.46624.

Changes:

  • Replaced static Dictionary with ConcurrentDictionary for thread-safe reflection caching using atomic GetOrAdd operations
  • Refactored JSON serialization to use direct streaming instead of intermediate string concatenation, reducing memory allocations
  • Improved date handling consistency by ensuring all dates are converted to UTC before formatting
  • Enhanced resource safety by adding finally blocks for list iteration cleanup and proper using statements for disposable resources

Reviewed changes

Copilot reviewed 8 out of 20 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
temp_ardoJSON.cs Replaced Dictionary with ConcurrentDictionary for thread-safe field caching; improved list iteration safety with try-finally; simplified field name detection logic; added writeData method for streaming
ObtainMetadata.cs Modified to pass null for simple field values in metadata to prevent data leakage; added writeMetadata method for streaming; improved resource management
DataGridUtils.cs Refactored MssConvertData2JSON to use direct JSON streaming instead of string concatenation; added private ConvertDataToJSON helper method
DataGridUtils.csproj Updated target framework from .NET 4.6.1 to 4.7.2
AssemblyInfo.cs Updated version from 11.14.0.33133 to 11.40.1.46624
.gitignore Added patterns to ignore build artifacts and Visual Studio files
.cursor/rules/project-context.mdc Added project documentation for maintainers
Bin/.dll, Bin/.xml Updated OutSystems platform dependency DLLs and documentation to version 11.40.1.46624

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

rugoncalves and others added 2 commits February 19, 2026 16:07
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Copy link
Contributor

@JoaoFerreira-FrontEnd JoaoFerreira-FrontEnd left a comment

Choose a reason for hiding this comment

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

LGTM

@OS-pedrolourenco OS-pedrolourenco self-requested a review February 25, 2026 10:29
gnbm
gnbm previously approved these changes Feb 25, 2026
Copy link
Collaborator

@gnbm gnbm left a comment

Choose a reason for hiding this comment

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

LGTM

@sonarqubecloud
Copy link

@rugoncalves rugoncalves merged commit a170234 into dev Feb 26, 2026
12 checks passed
@rugoncalves rugoncalves deleted the ROU-12538 branch February 26, 2026 11:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants