You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
The text was updated successfully, but these errors were encountered:
I’m not sure that
A) you are using correct ComWrappers instance and
B) I have support only for Net 7. Have to finish interface implementation for Net 8 which is tiresome
can you tell me what TFM are you targeting? And how do you enable ComWrappers?
Looks like I was targeting net 8 as it has somewhat working built-in ComWrappers source generator. Probably would have to wait for you to add support of net 8.
An update for this issue. I had to write a source generator for IDispatch COM interface implementation and to get around that exception from Marshal.GetNativeVariantForObject, call ICoreWebView2 directly.
I was working with WebView2 COM wrappers and encountered an issue where calling
CoreWebView2.AddHostObjectToScript
which produces the following outputI assume COM wrappers source generator unintentionally emits a call into this method instead of using ComWrappers-specific code.
The text was updated successfully, but these errors were encountered: