Uh oh!
There was an error while loading. Please reload this page.
Revert "Partially revert PR #125326: revert ComActivator/LicenseInter… - #126141
Conversation
…eInteropProxy changes (dotnet#125706)" This reverts commit 3e79783. This commit also does the following: - Fix test bug in LicenseTesting.h - Rewrite BSTRHolder to a simpler form - Remove layers in the managed site - Use the BSTR marshaller instead of Marshal class helpers - Remove unused signatures
Tagging subscribers to this area: @dotnet/interop-contrib |
There was a problem hiding this comment.
Pull request overview
This PR reverts a prior partial revert affecting COM licensing activation, and refactors the CoreCLR↔managed licensing glue to use the [UnmanagedCallersOnly] calling pattern and BSTR marshalling while also fixing a native test ownership bug.
Changes:
- Fix BSTR ownership in the COM native test server (
LicenseTestingnow copies the incoming license BSTR before freeing). - Switch COM licensing activation in
runtimecallablewrapper.cppfromMethodDescCallSite/manualARG_SLOTplumbing toUnmanagedCallersOnlyCaller, updating the managedLicenseInteropProxyentrypoints accordingly. - Introduce a simplified
BSTRHolderRAII type inholder.hand remove the olderutilcode.htypedef; remove some metasig entries and unused signatures.
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| src/tests/Interop/COM/NativeServer/LicenseTesting.h | Fixes BSTR ownership by copying the incoming license string before destructor frees it. |
| src/tests/Interop/COM/NETClients/Licensing/Program.cs | Renames a helper to DesignTime and updates the corresponding logging/call sites. |
| src/coreclr/vm/runtimecallablewrapper.cpp | Reworks licensing activation to call managed helpers via UnmanagedCallersOnlyCaller and uses BSTRHolder. |
| src/coreclr/vm/metasig.h | Removes several COM-related metasig definitions and one duplicate RetObj signature entry. |
| src/coreclr/vm/interoputil.cpp | Updates BSTRHolder initialization style for a temporary BSTR allocation. |
| src/coreclr/vm/corelib.h | Changes LICENSE_INTEROP_PROXY binder method signatures to NoSig for UCO usage. |
| src/coreclr/utilcode/comex.cpp | Updates to default-constructed BSTRHolder usage for IErrorInfo::GetDescription. |
| src/coreclr/inc/utilcode.h | Removes the old util::BSTRHolder typedef and its helper free function. |
| src/coreclr/inc/holder.h | Adds a new BSTRHolder RAII class under FEATURE_COMINTEROP. |
| src/coreclr/System.Private.CoreLib/src/Internal/Runtime/InteropServices/ComActivator.cs | Adds [UnmanagedCallersOnly] entrypoints for LicenseInteropProxy and switches to BStrStringMarshaller for BSTR conversion. |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
…d update method signatures
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 10 out of 10 changed files in this pull request and generated no new comments.
Comments suppressed due to low confidence (1)
src/tests/Interop/COM/NativeServer/LicenseTesting.h:35
- The constructor now allocates a new BSTR before checking
s_DenyLicense, but ifs_DenyLicenseis true the constructor throws and the destructor won’t run, leaking the newly allocated_lic. Consider performing the deny check before allocating, or using a temporary holder/RAII (allocate into a local, then assign to_liconly after the throw path is ruled out).
LicenseTesting(_In_opt_ BSTR lic)
: _lic{ TP_SysAllocString(lic) }
{
if (s_DenyLicense)
throw CLASS_E_NOTLICENSED;
}
AaronRobinsonMSFT
commented
Mar 26, 2026
/azp run runtime |
|
Azure Pipelines successfully started running 1 pipeline(s). |
…n LicenseTesting constructor
…opProxy changes (#125706)"
This reverts commit 3e79783.
This commit also does the following:
LicenseTesting.hBSTRHolderto a simpler formBSTRmarshaller instead ofMarshalclass helpersContributes to #123864