Avoid `QueryInterface' + 'Release' when wrapping managed CCWs#1938
Merged
Sergio0694 merged 1 commit intostaging/2.3from Feb 28, 2025
Merged
Avoid `QueryInterface' + 'Release' when wrapping managed CCWs#1938Sergio0694 merged 1 commit intostaging/2.3from
Sergio0694 merged 1 commit intostaging/2.3from
Conversation
manodasanW
approved these changes
Feb 28, 2025
Sergio0694
added a commit
that referenced
this pull request
Mar 12, 2025
Squashed commit of the following: commit 8003cbd Author: Sergio Pedri <sergio0694@live.com> Date: Wed Mar 12 09:13:10 2025 -0700 Add .NET 9 target for WinRT.Runtime.dll (#1843) * Build CsWinRT with .NET 9 locally * Suppress all 'IL2081' warnings * Update 'MarshalNonBlittable' for AOT support * Update build steps for .NET 9 * Update .nuspec file for .NET 9 * Fix duplicate 'global.json' creation * Remove new framework references * Update CsWinRT-PublishToNuget-Stage.yml * Build .NET 9 in CI as well * Fix new IL analyzer warnings * Add missing nullable annotation * Remove double lookup in 'FindRcwTypeByNameCached' * Delete leftover API compat files * Fix build * Bump .NET SDK to 9.0.201 Co-authored-by: Manodasan Wignarajah <mawign@microsoft.com> * Update src/build.cmd --------- Co-authored-by: Manodasan Wignarajah <mawign@microsoft.com> commit ede00cc Author: Sergio Pedri <sergio0694@live.com> Date: Tue Mar 11 09:11:39 2025 -0700 Remove unused internal 'IPropertyValue' and IDIC support (#1937) * Remove 'IPropertyValue' IDIC interface * Add tests --------- Co-authored-by: Manodasan Wignarajah <mawign@microsoft.com> commit 2abc88e Author: Sergio Pedri <sergio0694@live.com> Date: Fri Mar 7 11:19:00 2025 -0800 Remove unnecessary overload use (#1945) commit 7cf8b53 Author: Sergio Pedri <sergio0694@live.com> Date: Fri Feb 28 13:33:42 2025 -0800 Add and use 'AttachFreeThreadedUnsafe' (#1938)
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.
This PR does a small optimization when creating
IObjectReference-s wrapping CCWs produced by ComWrappers over managed objects. All CCWs produced by ComWrappers implementIAgileObject, meaning they're all always free-threaded. The original code didn't rely on this fact, and instead tested for the presence of that interface every single time. This PR removes that unnecessary work by adding a new 'AttachFreeThreadedUnsafe' method that can be used specifically when wrapping CCWs produced by ComWrappers, which skips the checks and always just wraps the objects as agile objects.