WebView2Feedback icon indicating copy to clipboard operation
WebView2Feedback copied to clipboard

[Problem/Bug]: WebView2CompositionControl).

Open merco opened this issue 8 months ago • 8 comments

What happened?

https://github.com/MicrosoftEdge/WebView2Feedback/issues/286

After webview2 upgrade (WPF version, net8.0-windows) to 1.0.3124.44

I Get this error using WebView2CompositionControl instead of WebView2

Could not load file or assembly 'Microsoft.Windows.SDK.NET, Version=10.0.17763.24, Culture=neutral, PublicKeyToken=31bf3856ad364e35'. Impossibile trovare il file specificato.'

and I can't install it in my project NU1213: Il pacchetto Microsoft.Windows.SDK.NET.Ref 10.0.26100.57 contiene un tipo di pacchetto DotnetPlatform che non è compatibile con questo progetto. Il pacchetto 'Microsoft.Windows.SDK.NET.Ref 10.0.26100.57' contiene un tipo di pacchetto 'DotnetPlatform' che non è supportato dal progetto 'WpfControlS3D'.

Importance

Blocking. My app's basic functions are not working due to this issue.

Runtime Channel

Stable release (WebView2 Runtime)

Runtime Version

133.0.3065.92

SDK Version

1.0.3124.44

Framework

WPF

Operating System

Windows 10

OS Version

22H2 19045.5608

Repro steps

WPF version, net8.0-windows

Repros in Edge Browser

No, issue does not reproduce in the corresponding Edge version

Regression

No, this never worked

Last working version (if regression)

No response

merco avatar Mar 13 '25 15:03 merco

Exactly the same problem. Stacktrace:

   at Microsoft.Web.WebView2.Wpf.WebView2CompositionControl.WebView2CompositionControl_Loaded(Object sender, RoutedEventArgs e)
   at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
   at System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args)
   at System.Windows.BroadcastEventHelper.BroadcastEvent(DependencyObject root, RoutedEvent routedEvent)
   at System.Windows.BroadcastEventHelper.BroadcastLoadedEvent(Object root)
   at System.Windows.Media.MediaContext.FireInvokeOnRenderCallbacks()
   at System.Windows.Media.MediaContext.RenderMessageHandlerCore(Object resizedCompositionTarget)
   at System.Windows.Media.MediaContext.RenderMessageHandler(Object resizedCompositionTarget)
   at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
   at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)

Old HWND WebView2 works fine.

SoulsideJourney avatar Mar 14 '25 10:03 SoulsideJourney

Setting SupportedOSPlatformVersion to 10.0.17763.0 in the project file solved the problem

SoulsideJourney avatar Mar 14 '25 11:03 SoulsideJourney

You can also find nuget package microsoft.windows.sdk.net.ref and copy both WinRT.Runtime.dll and Microsoft.Windows.SDK.NET.dll to your build folder.

CarnationRED avatar Mar 29 '25 10:03 CarnationRED

Hi @merco and @SoulsideJourney, are you still experiencing the same issue, or has it been resolved?

sivMSFT avatar Mar 31 '25 08:03 sivMSFT

@merco Acccording to learn.microsoft.com, WebView2 doesn't support Windows 7 after version 109. So I guess SupportedOSPlatformVersion = 10.0.17763.0 as a minimum version is a requiered setting.

SoulsideJourney avatar Mar 31 '25 11:03 SoulsideJourney

I had the same problem and was able to resolve it when putting this in the csproj file <TargetFramework>net8.0-windows10.0.19041.0</TargetFramework>

"net8.0-windows" by itself is not sufficient

nhoefer2 avatar Apr 09 '25 17:04 nhoefer2

I have the same problem, and in the release notes there is no mention of it.

I don't know if this dependency has been introduced that now requires a minimum version of Windows 10.0.17763.24 when previously there was none and used the one from TFM (7.0 in the case of .NET9).

In this case there is no official documentation that this control has this dependency and how to fix it. In this page there is not a single reference to any of this and promises that it is simply switching from one control to another and everything works the same because they share the IWebView2 interface.

Or if on the contrary it is a bug and that dependency is not expected.

cc @sivMSFT

bdovaz avatar Apr 11 '25 12:04 bdovaz

Same. In my case I had to use the following: <TargetFramework>net8.0-windows10.0.17763.0</TargetFramework>

Using WebView2 nuget version: 1.0.3179.45

mtinnes avatar Apr 14 '25 15:04 mtinnes

Also, I'm not getting NavigationCompleted events anymore. Wonder if this has anything todo with the forced TargetFramework.

mtinnes avatar Apr 22 '25 19:04 mtinnes