Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
I'm submitting a...
Bug report (I searched for similar issues and did not find one)
If you try to your app as adminstrator (elevated), the app will not show, no errors or messages, it just doesn't show.
The reason this became an issue, was that I primarily develop websites, and to debug the local IIS, Visual Studio must run as admin, so I have changed the VS shortcut to require that. Unfornately this Means, that any app launched will also run as admin.
The proplem is that it's impossible to debug, when nothing is shown.
The app should run (Edge can run as admin). If that isn't possible, I suggest, you check at startup, whether it runs as admin and then throw an exception: "WebView can't run as administrator".
That will save hours of frustrating debugging for many people,
Minimal reproduction of the problem with instructions
Run Visual Studio as admin, now launch an app with WebView.
I'm have the same issue with latest Win 10 updates, with VS2017 (latest).
VS running in normal mode, starts debugging of the app without the problem, VS running in elevated mode ("Run as Administrator") give that error, and unfortunately I need elevated mode since have self hosted WebApi app (which will not run in normal mode) and win forms App using WebView (not working in normal mode?!?!).
So is there any news about this and how to overcome and resolve this? and what is the real cause of exception when VS/app is being run in elevated mode?
Exception being raised in InitializeComponent method is:
Can someone get insight how to overcome this? and what is the real reason.. here is stack trace:
2 similar comments
I can also confirm that when I use the "Run as administrator" command to run a test WPF app that uses WebView, the WebView doesn't work. I don't see an error/exception, rather the WebView just remains blank.
I'm just making a wild guess here, but is it possible that this admin bug is related to issue #165 (WPF WebView crashes when "explorer.exe" is not running) ? Maybe
If that's what it does, then I think
Or maybe they are totally separate issues. I don't know.
I investigated further and noticed that the WWAHost.exe instance isn't running at all, whenever the WPF app (with WebView) is running as admin. I suggest that the solution might be to make
HOWEVER, the above idea may be rejected because of the security implications. Perhaps it's a bad idea to allow the web engine to process webpages while running as elevated admin. So, to work around this, I can't really say because the full source code is unavailable, but I guess maybe consider using Impersonation Tokens after launching WWAHost using the elevated token, but do this while keeping in mind that impersonation doesn't really work in the manner that people expect it to. Anyway, if possible, when creating the WebView's HWND, use the elevated/admin access, but when processing webpages, use a lower level of access.