Open protegesolutions opened 4 years ago
Let me take a quick look, thanks for reporting!
I was unable to repro on my machine with the latest samples. Do you have a version of Edge Canary/Dev/Beta or the WebView2 Runtime installed on your machine?
I have latest-release Edge (86.0.622.48). I don't have a Canary/Dev/Beta version of Edge and neither do my customers(??)
The WebView2Samples solution updated packages to the latest 1.0.674. I saw a post somewhere that the bolded version component of Edge must be the same as or later than the WebView2 version, so I then tried to use 1.0.622 but this version doesn't have a lib folder of the reference assemblies. (In fact, none of the non-pre-release versions have this folder - why not?)
So I tried using earlier pre-releases (0.9.579/538-prerelease) and found that none of the assemblies are not strong-named, so I couldn't use these in my own app either. So I tried them in the demo app and found that it wouldn't compile due to breaking changes in later versions (eg CoreWebView2.WebResourceResponseReceived and CoreWebView2.CookieManager don't exist). Man, this is quite a curve considering how easy the WebBrowser control is to use (when it works).
I've read through the doco on this and found it very lacking. Eg, just adding the NuGet package doesn't add WebView2 to the UI Toolbox, there's nothing about version numbers or why you would need to have an unreleased Edge version to test with (that seems crazy on its own).
As background, I'm trying to get WebView2 going to replace a simple embedded oAuth2 authorization form in a .NET class library that is currently using the old (IE) WebBrowser control. But we've found that this doesn't seem to work properly with Google 2-step-verification (nothing happens after the user confirms on their mobile device, the browser just sits there). But so far, 5 hours down the track, I can't even get the demo solution to work - which isn't looking promising - and I don't know if this will be robust enough to roll out.
Thanks for the additional info!
WebView2 only works with Canary, Dev, Beta Edge (mostly for development) and the WebView2 Runtime for production. You can learn more here: https://docs.microsoft.com/en-us/microsoft-edge/webview2/concepts/distribution We making changes soon to make the distribution simpler, closer to how .NET frameworks are installed as prerequisites.
.NET is only available in the pre-release packages currently, so that's why 1.0.622.22 doesn't work and the .NET assemblies aren't in those packages.
Strong naming was fixed in 0.9.628-prerelease and later: https://docs.microsoft.com/en-us/microsoft-edge/webview2/releasenotes#09628-prerelease
Part of the complexity is that you are trying out a preview version of the .NET control. We plan to GA the .NET controls later this year, which will make a lot of this simpler. The sample apps are meant to demonstrate our latest APIs, which is why they have a dependency on the latest SDK packages. If you create your own app you should be able to use the older SDKs.
Clearly our docs have failed here, and we'd love to get feedback to help improve them. Where did you start with the docs? Were there points where clarification would have been helpful? Was there specific info missing? (I saw the issue you already added to the docs about toolbox, I've responded separately there)
Thanks for the update. I really think someone needs to take a huge step back from this work and look at it from the POV of someone who's trying to actually use it. The very term "pre-release" implies "Don't use this, use a stable release/production version". And why can't I simply target the installed Edge version, as anyone would expect to be able to do (WebBrowser does this).
I could find zero info on how to deploy a production app using WebView2. I have no idea where this WebView2 Runtime is or how to employ it, what the difference is between the .NET assemblies are and using the installed Edge browser.
Also, there doesn't appear to even be an 0.9.628 release or pre-release available from NuGet:
And where would it come in the release order? After 0.9.622.11 or after 1.0.622.22?
So I think this is all a bit fresh to be trying to incorporate into a production piece of kit. When do you think it'll be fully cooked?
I'll post separately regarding doco but trust me when I say you need a very clear, concise overview of how all of this goes together, including all of the secret sauce such as how the Edge/WebView2 versions fit together, what "pre-release" means in context, what "initialize CoreWebView2" means and why I need to do it, why I need to include Microsoft.Web.WebView2.Core instead of Microsoft.Web.WebView2.WinForms for a WinForms project, etc, etc.
Oh, and what is "Evergreen WebView2 Runtime"? I read the page you linked but still have zero idea what they're talking about; HOW do I use it/deploy it/choose it or Edge to use for dev/prod? (Sorry, but it's like someone spent more time coming up a with a name for it than anything else.)
Sorry for the added wrench - 0.9.628-prerelease was recently deprecated (yesterday I believe) which is why it doesn't show up in the list anymore. Poor choice of example.
You're right - the .NET controls are not ready for production/fully cooked, hence their existence only in the prerelease packages as you've noted.
Most of the runtime and deployment questions are answered here: https://docs.microsoft.com/en-us/microsoft-edge/webview2/concepts/distribution
For example, "Evergreen" refers to the fact that it updates on it's own: https://docs.microsoft.com/en-us/microsoft-edge/webview2/concepts/distribution#evergreen-distribution-mode As opposed to the "Fixed Version": https://docs.microsoft.com/en-us/microsoft-edge/webview2/concepts/distribution#fixed-version-distribution-mode
The "How" of deployment is here (in a general sense): https://docs.microsoft.com/en-us/microsoft-edge/webview2/concepts/distribution#fixed-version-distribution-mode With more specific steps and samples coming soon (like how to use ClickOnce if deploying a .NET app to install the runtime as a prerequisite)
Again, I appreciate the feedback and look forward to more on the docs. I'll be opening a bug to track the items you've noted here on our backlog. Thanks!
Downloaded opened in VS2019, got some Wiix errors, ignored as not deploying.
Opened WebView2Samples solution. Ran WebView2WindowsFormsBrowser.
Clicked Go. Nothing. Blank grey form.
Clicked Refresh. System.InvalidOperationException: 'The instance of CoreWebView2 is uninitialized and unable to complete this ...
Clicked Events. System.NullReferenceException: 'Object reference not set to an instance of an object.'
????