[release/8.0] Use strategy in StrategyBasedComWrappers.ComputeVtables (#92250)
authorgithub-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Tue, 19 Sep 2023 04:38:55 +0000 (21:38 -0700)
committerGitHub <noreply@github.com>
Tue, 19 Sep 2023 04:38:55 +0000 (21:38 -0700)
* Use strategy in StrategyBasedComWrappers.ComputeVtables

We didn't actually use the strategy object here, so users like WinForms can't actually use it.

* Update src/libraries/System.Runtime.InteropServices/src/System/Runtime/InteropServices/Marshalling/StrategyBasedComWrappers.cs

Co-authored-by: Jackson Schuster <36744439+jtschuster@users.noreply.github.com>
---------

Co-authored-by: Jeremy Koritzinsky <jekoritz@microsoft.com>
Co-authored-by: Jackson Schuster <36744439+jtschuster@users.noreply.github.com>
src/libraries/System.Runtime.InteropServices/src/System/Runtime/InteropServices/Marshalling/StrategyBasedComWrappers.cs

index 14ced03d3a7fd0e2291ef1e46f6220997664dd17..9741b482633c241d1bd7e5be43815cdd2d84a5ff 100644 (file)
@@ -76,7 +76,7 @@ namespace System.Runtime.InteropServices.Marshalling
         /// <inheritdoc cref="ComWrappers.ComputeVtables" />
         protected sealed override unsafe ComInterfaceEntry* ComputeVtables(object obj, CreateComInterfaceFlags flags, out int count)
         {
-            if (obj.GetType().GetCustomAttribute(typeof(ComExposedClassAttribute<>)) is IComExposedDetails details)
+            if (GetOrCreateInterfaceDetailsStrategy().GetComExposedTypeDetails(obj.GetType().TypeHandle) is { } details)
             {
                 return details.GetComInterfaceEntries(out count);
             }