refactor: Nullable and Modernization for Core Presentation projects#2654
Merged
Eideren merged 6 commits intoMar 1, 2025
Merged
Conversation
It will not throw a cast exception for a type mismatch, but instead filter out bad items.
b7417be to
e2303c5
Compare
Collaborator
|
Thanks ! |
8 tasks
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.
PR Details
Similar to #2639 and #2643.
Description
Modernize the code, use nullable annotations, try to fix null reference warnings when possible.
Affected projects:
Stride.Core.PresentationStride.Core.QuantumStride.Core.Quantum.TestsStride.Core.Presentation.QuantumStride.Core.Presentation.Quantum.TestsI purposely left out
Stride.Core.Presentation.Wpfas well asStride.Core.Presentation.Testsas I consider those legacy since we are moving towards using Avalonia in the near future.Dispose pattern
I also fix the
Disposepattern in some places. It was previously implemented as follow:The main issue is that if any derived class does have a finalizer (because it has to release unmanaged resources), it will be broken : finalizer are not supposed to call managed code (included from ancestor classes), as it can lead to unpredictable/undefined behavior. More details https://learn.microsoft.com/en-us/dotnet/standard/garbage-collection/implementing-dispose and https://learn.microsoft.com/en-us/dotnet/standard/design-guidelines/dispose-pattern.
The correct implementation (according to the guidelines linked above) is:
Related issues
#2155
#2156
Types of changes
Checklist