Skip to content

Remove unnecessary unsafe modifiers from classes and methods#2158

Merged
Sergio0694 merged 1 commit intostaging/3.0from
user/sergiopedri/remove-unsafe
Jan 19, 2026
Merged

Remove unnecessary unsafe modifiers from classes and methods#2158
Sergio0694 merged 1 commit intostaging/3.0from
user/sergiopedri/remove-unsafe

Conversation

@Sergio0694
Copy link
Copy Markdown
Member

Title. No actual code changes.

Copy link
Copy Markdown

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 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 unsafe modifier from static class declarations
  • Removed unsafe modifier 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.

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.
@Sergio0694 Sergio0694 force-pushed the user/sergiopedri/remove-unsafe branch from 320b704 to 9d1e3ec Compare January 19, 2026 01:52
@Sergio0694 Sergio0694 enabled auto-merge (squash) January 19, 2026 01:52
@Sergio0694 Sergio0694 merged commit f9b8a15 into staging/3.0 Jan 19, 2026
10 checks passed
@Sergio0694 Sergio0694 deleted the user/sergiopedri/remove-unsafe branch February 1, 2026 23:21
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