SteveSandersonMS / WebWindow

.NET Core library to open native OS windows containing web UI on Windows, Mac, and Linux. Experimental.
Apache License 2.0
1.99k stars 215 forks source link

Can't get the blazor sample to work #54

Closed eivarin closed 4 years ago

eivarin commented 4 years ago

I can't seem to get the blazor sample to work. the other sampes (normal html and vue.js) work just fine. but when i open the blazor one the it show's the edge bug :

Hmmm… can't reach this page It looks like the webpage at https://app/ might be having issues or it may have moved permanently to a new web address. ERR_NAME_RESOLUTION_FAILED

what to do?

tteichmeister commented 4 years ago

I also got this error ... This error occurs under Windows. I tried to run the application on macOS and it works

MaverickMartyn commented 4 years ago

I'm getting the same error on Windows. I have installed the C++ desktop workload, and the latest Edge beta. I'm also using the latest version of Visual Studio 2019. It worked for a bit, but now doesn't. What gives?

tbebekis-ax commented 4 years ago

For some reason it waits for ever on ComponentsDesktop.cs, line 119 await PerformHandshakeAsync(ipc);

Inside PerformHandshakeAsync() stops forever waiting in the line 172 await tcs.Task;

where tcs.Task's Result has the value "Not yet computed".

And I think, not sure though, that's because the ipc.Once()'s callback is never called. It's that callback lambda that sets tcs.SetResult(null).

PS. I use Microsoft Edge Version 80.0.361.33 (Official build) beta (64-bit)

denmerc commented 4 years ago

Having this same issue as well - ran on two windows 10 machines and getting ERR_NAME_NOT_RESOLVED page when trying to reach https://app/ 1) windows 10 machine with edge beta 80.0.361.33 2) another machine with edge 44.18362.449.0

vavadevds commented 4 years ago

Hi, as @tbebekis-ax said, the problem is in 'await PerformHandshakeAsync(ipc)'. The ipc.Once("components:init") is never called.

techierathore commented 4 years ago

Hi All, I am also getting this same error on windows where as on Mac it's working fine. Any suggestions will help a lot.

grumson commented 4 years ago

Hi! I'm getting the same error.

eivarin commented 4 years ago

So how would we fix it?

274188A commented 4 years ago

Hi! I'm getting the same error.

vavadevds commented 4 years ago

Hi, Finally, I found a solution to the problem, the problem was coming from WebWindow.Native.dll, Please remove WebWindow.Native and WebView2Loader.dll from WebWindow project references, And replace them by this files (I corrected some errors):

https://drive.google.com/open?id=1VaZ0BcPltUxnH_yZKapO-sil9guB1pBH https://drive.google.com/open?id=17C2SgGNr_9HxIY9PkhP1gqdXfgYRUvSf

Please let me know if you want more help.

techierathore commented 4 years ago

Hi @vavadevds, Thanks for the solution, but what about for people like me who are executing the DLLs taken from Nuget and doesn't have the code setup on local. Can you please submit a pull request with your changes so that we can get it in Nuget. or share the whole Package a Nuget Package. Thanks in advance.

vavadevds commented 4 years ago

Hi @techierathore please check this dlls and tell me if it's work for you, Note : this dlls compiled for .net core 3.1

https://drive.google.com/open?id=1-vhu4TVtPbeKhVgukR_Kcg53d9r6gp6l

Please let me know if you want something else.

grumson commented 4 years ago

Hi @vavadevds thanks for helping, but I have the same problem like @techierathore and I don't know how to fix this with dlls files you give.

techierathore commented 4 years ago

Hi @vavadevds, I tried to use these DLLs by coping them in the packages folder of the application but nothing happened. I think the best way would be to you submit a pull request of your changes and @SteveSandersonMS publishes a new nuget package.

vavadevds commented 4 years ago

Hi @techierathore @grumson I have created this sample for you, Please try it and tell me if this works for you.

https://drive.google.com/open?id=1xRmxLE3UyW9FpwUdJl0OnVj9jT9cnp2O

grumson commented 4 years ago

That works for me! Thanks @vavadevds !!!

eivarin commented 4 years ago

It also worked for me!!! If no one else has any problems and can use @vavadevds dll's then I think I'll close this issue. @vavadevds Can you submit a pull request for this fix? That would be great, as i would like to mess with the property's in componentsDesktop

ScottKane commented 4 years ago

@vavadevds please can you create a PR with the source code so we can see what was changed to fix the ERR_NAME_NOT_RESOLVED error?

grahamehorner commented 4 years ago

@vavadevds would really like to see what you changed to get this working; please can you submit a PR with the changes; so we can all review/comment and/or see the root cause is fixed without any other breaking changes.

Mike-E-angelo commented 4 years ago

Also... downloading and running random DLLs from the internet without close inspection and/or validation isn't exactly a recommended online activity you should partake in. 😆

denmerc commented 4 years ago

This works for me but only the machine with edge beta. Does anyone know if this requires the newer version of edge based on chromium? I was under the impression that this had a fallback if edge-chromium is not installed? @vavadevds thanks for the sample. @eivarin @grumson are you guys also running edge beta? want to know if this sample only works on edge-beta. thanks in advance.

eivarin commented 4 years ago

@denmerc at the moment I'm running the latest edge beta. Version 80.0.631.33

grahamehorner commented 4 years ago

@denmerc I've the latest version of edge beta, dev & canery builds installed

vavadevds commented 4 years ago

Hi all, thank you for your feedback, i w'l clone the repo, and i w'l submit a pull request of my changes,

Thank you all.

grumson commented 4 years ago

@denmerc yes it only works on edge-beta.

ScottKane commented 4 years ago

@vavadevds I'm unable to build your PR, failing with compiler errors. Can you verify that the code should be building?

vavadevds commented 4 years ago

Hi @ScottKane Please change manually in the following file : 'packages\Microsoft.Web.WebView2.0.8.355\build\native\include\WebView2.h'

Please change from this :

 MIDL_INTERFACE("E0618CDD-4947-4F58-802C-FC1F20BD4274")
    IWebView2CreateWebViewCompletedHandler : public IUnknown
    {
    public:
        virtual HRESULT STDMETHODCALLTYPE Invoke( 
            HRESULT result,
            IWebView2WebView *webView) = 0;

    };

To this :

 MIDL_INTERFACE("E0618CDD-4947-4F58-802C-FC1F20BD4274")
    IWebView2CreateWebViewCompletedHandler : public IUnknown
    {
    public:
        virtual HRESULT STDMETHODCALLTYPE Invoke( 
            HRESULT result,
            IWebView2WebView5 *webView) = 0;

    };
ScottKane commented 4 years ago

@vavadevds Not sure I agree with modifying an external closed source package, IWebView2WebView5 should extend IWebView2WebView so not sure of the benefit of modifying this Invoke method. Think this is something we need @SteveSandersonMS to take a look at.

SteveSandersonMS commented 4 years ago

I may look at it when I can but it won't be during the next week due to other commitments.

If the community here is able to figure out a truly correct and minimal fix (presumably without patching Microsoft.Web.WebView2.0.8.355), then I will be in a position to merge it sooner. If the PR given already was obviously correct then I'd merge it right now, but since it isn't it's going to be longer until this is addressed.

Nonetheless, thanks very much @vavadevds for figuring out some steps towards the solution!

grahamehorner commented 4 years ago

@vavadevds while I do appreciate your help/effort in attempting to track the root cause I would agree with @ScottKane that modification of the nuget package resources for the WebView2 > is not a good option if you think the root cause in an error with this package this needs feeding back to the owners, with details of the issue and/or a sample git repo that reproduces the error/issue.

vavadevds commented 4 years ago

Hi all, thank you for your feedback, @ScottKane @grahamehorner i completely agree with you, I update my solution, now no need for patching Microsoft.Web.WebView2.0.8.355, @SteveSandersonMS Please check it, and tell me if there is any problems,

Thank you all.

vavadevds commented 4 years ago

Hi @SteveSandersonMS , Just i want to notify you that I'm update my solution, now no need for patching (Microsoft.Web.WebView2.0.8.355)

Thank you.

ScottKane commented 4 years ago

@vavadevds I was able to build and run your latest update to master with no issues, could you create a fresh PR to merge this in? Thanks for all your effort in troubleshooting and producing a workaround. @SteveSandersonMS might want to give it a once over but the static_cast to IWebView2WebView5 seems to do the trick.

eivarin commented 4 years ago

@vavadevs can u do the fresh PR please.

ScottKane commented 4 years ago

@SteveSandersonMS build on PR has succeeded now. All credit to @vavadevds for the fix. I updated the pipeline to target the latest sdk.

vavadevds commented 4 years ago

Hi, all, thank you for your cooperation, @SteveSandersonMS I'm absolutely sure that this project is the future of desktop applications, And I'm so glad I helped a little bit in this project.

eivarin commented 4 years ago

@SteveSandersonMS please review one of the pull requests from @vavadevds or @ScottKane and merge it so that I can close this issue

eivarin commented 4 years ago

@vavadevds or @ScottKane can you compile the fixed repo dll's for download. i'm not being able to build them.

ScottKane commented 4 years ago

@eivarin You should be able to build them by running in x64. There will need to be an update to WebWindow.Blazor too as IComponentsApplicationBuilder is no longer available (see #69). @SteveSandersonMS - Appreciate you're busy with NDC at the minute, but could you please take a look at my PR and also advise what you would recommend to fix the above mentioned issue so we can get something that will at least run and connect

vavadevds commented 4 years ago

Hi all,

@eivarin Please check my PR i think your problem is solved now, @ScottKane Can you please remove your PR, I think there is no need to have the same PR duplicate twice, Especially since I added new changes.

Thank you all.

eivarin commented 4 years ago

@vavadevds @ScottKane So, I builded @vavadevds PR and all went fine. I then started to include the dll's on my blazor wasm project. I started by adding the normal WebWindow.dll and rebuilded the project. it builds fine, no errors. Then i proceeded to add the WebWindow.Blazor.dll but when i rebuilded the project... two errors came out: -ILLink failed with exited code -532462766. -Unhandled exception. Mono.Cecil.AssemblyResolutionException: Failed to resolve assembly: 'Microsoft.Extensions.Logging, Version=3.1.1.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'

Along with these two errors, there also came many other warnings, all about conflicts

I dont know if i'm doing anything wrong when adding these dll's. Are they supposed to vbe added to the Blazor wasm project or another totally different project that refferences the main blazor wasm one.

My template of blazor wasm is : 3.1.0-preview4.19579.2

vavadevds commented 4 years ago

Hi @eivarin, I think you also need to add these packages to your project

Microsoft.Extensions.Configuration Microsoft.Extensions.Configuration.Jso Microsoft.Extensions.Logging.Console

And please update all your packages to latest, Thank you.

vavadevds commented 4 years ago

@eivarin also you need to add these dlls to your project as content (build action = content)

WebView2Loader.dll WebWindow.Native.dll

As i say as content note as dll reference. Thank you.

eivarin commented 4 years ago

Getting these 2 build errors at the moment: -ILLink failed with exited code -532462766 -Unhandled exception. Mono.Cecil.ResolutionException: Failed to resolve System.IO.BinaryWriter @ScottKane @vavadevds

eivarin commented 4 years ago

As a workaround, I turned off the Linker with:

false

On the project properties.

Now i can't startup the program... it opens the console and not the window.

I think this due to the startup.cs being completely deprecated on the blazor 3.2.0 template and now the full startup process of using a builder and adding an app to it is done in the program.cs https://devblogs.microsoft.com/aspnet/blazor-webassembly-3-2-0-preview-1-release-now-available/ Should i downgrade for now while the adaptation isn't done for the new tart-up process? @vavadevds @ScottKane

3GDXC commented 4 years ago

@eivarin I personally can't get this to work; however the PR created by @ScottKane has worked for me; IMHO any other changes you have now added should be as a separate PR and have information with regards what these are and what issue they address.

3GDXC commented 4 years ago

@eivarin BTW updating nuget packages references that break functionality shouldn't be done unless your working on updating the complete solution and move forward the MAJOR verison as part of the PR and not simply addressing an issue; thanks for you work thus far; but IMHO @ScottKane PR fixed the issue outline without breaking support/upgrading to nuget packages

eivarin commented 4 years ago

As @3GDXC said the main problem has been solved by the commit f2ec757976f01ca1ba01c635469ba03bf5b13fb0. I'll close this issue and open a new one with my bug