[release/5.0] Fix using .NET COM server with dynamic
keyword (port of #48037)
#48481
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.
Issue: #47329
Fix in master: #48037
Minimal version of the fix from master. Only:
IDispatch::GetTypeInfoCount
returning a count of 0 as not supporting type info (even when the returned HRESULT is failure)Customer Impact
Customers are unable to use .NET COM servers from a .NET client application with
dynamic
. The only workaround (aside from not usingdynamic
) is to have the .NET COM server explicitly implementITypeInfo
- build a type library, manually register it, load the type library when the COM object is created, make the class explicitly implementITypeInfo
, forward calls to the type info from the loaded type library, and mark the assembly as imported from a type library. If the client doesn't also own the server being activated, there is no workaround.Testing
This PR adds automated tests (most of the changes in this PR).
Risk
Low. The change is targeted to only usage of
dynamic
with COM objects and the fix is simply to relax an unnecessarily strict return code.Regression
No. Support for
dynamic
with COM objects was new in 5.0 (but this is a regression from Framework support)