Skip to content

Conversation

@MiroBrodlovaUnityGit
Copy link

Overview

This PR replaces all instances of BinaryFormatter with System.Runtime.Serialization.DataContractSerializer in this repo, and is part of Epic SCP-1555.

Previous Behavior

The package used deprecated BinaryFormatter which is deprecated in future .NET versions and may prevent assemblies from unloading or return incorrect results.

New & Expected Behavior

The package now uses DataContractSerializer for serialization/deserialization with [DataContract] and [DataMember] attributes added to all serialized classes.

Changes

  • KdTree.cs: Replaced BinaryFormatter with DataContractSerializer in SaveToFile and LoadFromFile methods
  • KdTreeNode.cs: Added [DataContract] and [DataMember] attributes to enable serialization
  • Added [DataContract] and [DataMember] attributes to all serialized classes to ensure proper serialization

Further Context

  • BinaryFormatter is deprecated in future .NET versions
  • Epic SCP-1555 tracks this migration work
  • DataContractSerializer was chosen as it does not require referencing additional assemblies

JIRA-ticket

Testing

Running the default job-suite. Please share if there are additional steps needed!

BinaryFormatter is deprecated in future .NET versions and may prevent
assemblies from unloading or return incorrect results.

Replaced with System.Runtime.Serialization.DataContractSerializer as
recommended for compatibility.

Changes:
- KdTree.cs: Replaced BinaryFormatter with DataContractSerializer in
  SaveToFile and LoadFromFile methods
- KdTreeNode.cs: Added DataContract and DataMember attributes
- Added [DataContract] and [DataMember] attributes to all serialized classes

Related to SCP-1555
@unity-cla-assistant
Copy link

unity-cla-assistant commented Nov 27, 2025

CLA assistant check
All committers have signed the CLA.

@codecov-github-com
Copy link

codecov-github-com bot commented Nov 27, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

@@           Coverage Diff           @@
##           master     #641   +/-   ##
=======================================
  Coverage   35.57%   35.57%           
=======================================
  Files         277      277           
  Lines       34892    34892           
=======================================
  Hits        12413    12413           
  Misses      22479    22479           
Flag Coverage Δ
mac_trunk 35.34% <ø> (ø)
probuilder_Ubuntu_6000.0 35.20% <ø> (ø)
probuilder_Ubuntu_6000.2 35.20% <ø> (ø)
probuilder_Ubuntu_6000.3 35.21% <ø> (ø)
probuilder_Ubuntu_6000.4 35.21% <ø> (ø)
probuilder_Ubuntu_6000.5 35.21% <ø> (ø)
win_trunk 35.23% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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.

3 participants