Fix contract violations for OLE scenario.#114609
Merged
AaronRobinsonMSFT merged 6 commits intodotnet:mainfrom Apr 16, 2025
Merged
Fix contract violations for OLE scenario.#114609AaronRobinsonMSFT merged 6 commits intodotnet:mainfrom
AaronRobinsonMSFT merged 6 commits intodotnet:mainfrom
Conversation
Rework the logic so the FCall doesn't do any allocations and defers any non-fast scenario to the slow path.
Contributor
|
Tagging subscribers to this area: @dotnet/interop-contrib |
Contributor
There was a problem hiding this comment.
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
Comments suppressed due to low confidence (1)
src/coreclr/vm/stubhelpers.cpp:194
- [nitpick] Consider adding a clarifying comment that explains TryGetOleTlsData only retrieves existing TLS data without creating it, to differentiate it clearly from GetOrCreateOleTlsData.
FORCEINLINE static SOleTlsData* TryGetOleTlsData()
Contributor
There was a problem hiding this comment.
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
Comments suppressed due to low confidence (2)
src/coreclr/vm/stubhelpers.cpp:232
- The removal of the FP state clearing call in the slow path diverges from the previous behavior where FP state was cleared for VB6 compatibility. Verify that this change is intentional and that it does not introduce issues in scenarios requiring FP state clearing.
GetCOMIPFromRCW_ClearFP();
src/coreclr/vm/olecontexthelpers.cpp:37
- Switching the contract mode from MODE_ANY (with ENTRY_POINT) to MODE_COOPERATIVE may affect call sites that previously relied on a more flexible mode. Confirm that this change is appropriate for all scenarios where SetupOleContext is used.
MODE_COOPERATIVE;
Member
Author
|
/cc @jkoritzinsky |
jkoritzinsky
approved these changes
Apr 15, 2025
Member
Author
|
/backport to release/10.0 |
Contributor
|
Started backporting to |
AaronRobinsonMSFT
added a commit
that referenced
this pull request
Apr 10, 2026
Fixes #126619. This was a regression introduced in #114609 When `System.StubHelpers.GetCOMIPFromRCW()` misses the fast path on a native-created thread, the slow path can create OLE TLS and still resolve the COM interface pointer from the RCW cache. Those cache hits are borrowed and should not be released by the stub cleanup path. This change moves the `pfNeedsRelease` decision to the slow helper so it can distinguish between: - RCW cache hits after OLE TLS initialization - freshly acquired interface pointers from `ComObject::GetComIPFromRCWThrowing` Testing: - verified against the local repro from #126619 --------- Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
|
@AaronRobinsonMSFT backporting to git am output$ git am --3way --empty=keep --ignore-whitespace --keep-non-patch changes.patch
Applying: Fix contract violations for OLE scenario.
Using index info to reconstruct a base tree...
M src/coreclr/vm/olecontexthelpers.cpp
M src/coreclr/vm/stubhelpers.cpp
Falling back to patching base and 3-way merge...
Auto-merging src/coreclr/vm/stubhelpers.cpp
CONFLICT (content): Merge conflict in src/coreclr/vm/stubhelpers.cpp
error: Failed to merge in the changes.
hint: Use 'git am --show-current-patch=diff' to see the failed patch
hint: When you have resolved this problem, run "git am --continue".
hint: If you prefer to skip this patch, run "git am --skip" instead.
hint: To restore the original branch and stop patching, run "git am --abort".
hint: Disable this message with "git config set advice.mergeConflict false"
Patch failed at 0001 Fix contract violations for OLE scenario.
Error: The process '/usr/bin/git' failed with exit code 128 |
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Rework the logic so the FCall doesn't do any
allocations and defers any non-fast scenario
to the slow path.
Fixes #114372