Remove unnecessary unsafe modifiers from classes and methods#2158
Merged
Sergio0694 merged 1 commit intostaging/3.0from Jan 19, 2026
Merged
Remove unnecessary unsafe modifiers from classes and methods#2158Sergio0694 merged 1 commit intostaging/3.0from
unsafe modifiers from classes and methods#2158Sergio0694 merged 1 commit intostaging/3.0from
Conversation
There was a problem hiding this comment.
Pull request overview
This PR removes unnecessary unsafe modifiers from class and method declarations throughout the codebase. The changes are purely modifier removals with no functional code changes - the methods and classes still work with unsafe code (pointers), but the unsafe keyword on the declaration itself was redundant since the containing contexts are already marked as unsafe.
Key changes:
- Removed
unsafemodifier from static class declarations - Removed
unsafemodifier from method declarations that are already in unsafe contexts - No changes to method signatures, logic, or functionality
Reviewed changes
Copilot reviewed 12 out of 12 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| IAgileObjectImpl.cs | Removed unsafe from static class declaration |
| WindowsRuntimeImports.cs | Removed unsafe from partial method declaration |
| FreeThreadedObjectReference.cs | Removed unsafe from override method declaration |
| WindowsRuntimeActivationHelper.cs | Removed unsafe from five static method declarations |
| WindowsRuntimeEnumerator{T}.cs | Removed unsafe from abstract class declaration |
| WindowsRuntimeIterator.cs | Removed unsafe from sealed class declaration |
| IAsyncAction.cs | Removed unsafe from static method in abstract class |
| INotifyPropertyChanged.cs | Removed unsafe from static class declaration |
| INotifyCollectionChanged.cs | Removed unsafe from static class declaration |
| IList.cs | Removed unsafe from static class declaration |
| IEnumerator.cs | Removed unsafe from static class declaration |
| IEnumerable.cs | Removed unsafe from static class declaration |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
manodasanW
approved these changes
Dec 18, 2025
Removed redundant 'unsafe' modifiers from various classes and methods across ABI, Bindables, Collections, and InteropServices namespaces. This change improves code clarity and safety by limiting the use of 'unsafe' to where it is strictly required.
320b704 to
9d1e3ec
Compare
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.
Title. No actual code changes.