Skip to content

Generated Wrapper calls Marshal.GetNativeVariantForObject which is not supported #82

@zznty

Description

@zznty

I was working with WebView2 COM wrappers and encountered an issue where calling CoreWebView2.AddHostObjectToScript which produces the following output

System.NotSupportedException: Built-in COM has been disabled via a feature switch. See https://aka.ms/dotnet-illink/com for more information.
   at System.Runtime.InteropServices.Marshal.GetNativeVariantForObject(Object obj, IntPtr pDstNativeVariant)
   at WinFormsComInterop.WebView2.ICoreWebView2Wrapper.webview2::Microsoft.Web.WebView2.Core.Raw.ICoreWebView2.AddHostObjectToScript(String name, Object& object)
   at Microsoft.Web.WebView2.Core.CoreWebView2.AddHostObjectToScript(String name, Object rawObject)

I assume COM wrappers source generator unintentionally emits a call into this method instead of using ComWrappers-specific code.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions