From 3d7ac9e97878e3725e2c8156ac2f9356da15de23 Mon Sep 17 00:00:00 2001 From: Andrii Kurdiumov Date: Sat, 24 Dec 2022 01:25:57 +0600 Subject: [PATCH] NativeAOT does not support TypeIdentifier apparently and until resolution for https://github.com/dotnet/runtime/issues/79941 happens, I cannot do anything except supporting only latest WebView2 --- WinFormsComInterop/WebView2/ICoreWebView2Wrapper.cs | 5 +++-- .../Raw/ICoreWebView2PrivatePartial.cs | 13 +++++++++++++ samples/BlazorHybrid/BlazorHybrid.csproj | 5 ++++- 3 files changed, 20 insertions(+), 3 deletions(-) create mode 100644 facades/Microsoft.Web.WebView2.Core/Raw/ICoreWebView2PrivatePartial.cs diff --git a/WinFormsComInterop/WebView2/ICoreWebView2Wrapper.cs b/WinFormsComInterop/WebView2/ICoreWebView2Wrapper.cs index 699fbcf..6fe06b9 100644 --- a/WinFormsComInterop/WebView2/ICoreWebView2Wrapper.cs +++ b/WinFormsComInterop/WebView2/ICoreWebView2Wrapper.cs @@ -5,8 +5,9 @@ namespace WinFormsComInterop.WebView2; [RuntimeCallableWrapper(typeof(webview2::Microsoft.Web.WebView2.Core.Raw.ICoreWebView2))] -[RuntimeCallableWrapper(typeof(Microsoft.Web.WebView2.Core.Raw.ICoreWebView2Private))] -[RuntimeCallableWrapper(typeof(Microsoft.Web.WebView2.Core.Raw.ICoreWebView2PrivatePartial))] +//[RuntimeCallableWrapper(typeof(Microsoft.Web.WebView2.Core.Raw.ICoreWebView2Private))] +//[RuntimeCallableWrapper(typeof(Microsoft.Web.WebView2.Core.Raw.ICoreWebView2PrivatePartial))] +[RuntimeCallableWrapper(typeof(webview2::Microsoft.Web.WebView2.Core.Raw.ICoreWebView2PrivatePartial))] internal partial class ICoreWebView2Wrapper { public readonly IntPtr instance; diff --git a/facades/Microsoft.Web.WebView2.Core/Raw/ICoreWebView2PrivatePartial.cs b/facades/Microsoft.Web.WebView2.Core/Raw/ICoreWebView2PrivatePartial.cs new file mode 100644 index 0000000..5cdfa51 --- /dev/null +++ b/facades/Microsoft.Web.WebView2.Core/Raw/ICoreWebView2PrivatePartial.cs @@ -0,0 +1,13 @@ +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +namespace Microsoft.Web.WebView2.Core.Raw; + +[ComImport] +[InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] +[Guid("2C94DD56-E252-40A1-BA7E-B19417B26A60")] +public interface ICoreWebView2PrivatePartial +{ + [MethodImpl(MethodImplOptions.InternalCall)] + void AddHostObjectHelper([In][MarshalAs(UnmanagedType.Interface)] ICoreWebView2PrivateHostObjectHelper helper); +} diff --git a/samples/BlazorHybrid/BlazorHybrid.csproj b/samples/BlazorHybrid/BlazorHybrid.csproj index e70ea67..c958228 100644 --- a/samples/BlazorHybrid/BlazorHybrid.csproj +++ b/samples/BlazorHybrid/BlazorHybrid.csproj @@ -8,8 +8,10 @@ enable true + <_SuppressWinFormsTrimError>true - true false @@ -20,6 +22,7 @@ +