Bug Report:When I run the program as an administrator, WebView2 throws an error

cm 1 Reputation point
2023-03-24T07:21:29.9066667+00:00

IDE:Visual Studio 2022

Programming Language: VB.Net

.Net Framework:4.8

WebView2 Version:1.0.1661.34

When I run the program as an administrator, an error occurs at the code line "Await WebView21.EnsureCoreWebView2Async", and the error message is as follows:

Hope this can be fixed,thanks!

有关调用实时(JIT)调试而不是此对话框的详细信息,
请参见此消息的结尾。

************** 异常文本 **************
System.Runtime.InteropServices.COMException (0x80070490): 找不到元素。 (异常来自 HRESULT:0x80070490)
   在 System.Runtime.InteropServices.Marshal.ThrowExceptionForHRInternal(Int32 errorCode, IntPtr errorInfo)
   在 Microsoft.Web.WebView2.Core.CoreWebView2Environment.<CreateCoreWebView2ControllerAsync>d__88.MoveNext()
--- 引发异常的上一位置中堆栈跟踪的末尾 ---
   在 System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   在 System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   在 System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task)
   在 Microsoft.Web.WebView2.WinForms.WebView2.<InitCoreWebView2Async>d__25.MoveNext()
--- 引发异常的上一位置中堆栈跟踪的末尾 ---
   在 System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   在 System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   在 System.Runtime.CompilerServices.TaskAwaiter.GetResult()
   在 WindowsApp4.Form1.VB$StateMachine_1_Form1_Load.MoveNext() 位置 F:\文档\[其他文档]\[VB园地]\Test测试大全\WindowsApp4\WindowsApp4\Form1.vb:行号 4
--- 引发异常的上一位置中堆栈跟踪的末尾 ---
   在 System.Runtime.CompilerServices.AsyncMethodBuilderCore.<>c.<ThrowAsync>b__6_0(Object state)


************** 已加载的程序集 **************
mscorlib
    程序集版本:4.0.0.0
    Win32 版本:4.8.4614.0 built by: NET48REL1LAST_B
    基本代码:file:///C:/Windows/Microsoft.NET/Framework/v4.0.30319/mscorlib.dll
----------------------------------------
WindowsApp4
    程序集版本:1.0.0.0
    Win32 版本:1.0.0.0
    基本代码:file:///F:/%E6%96%87%E6%A1%A3/%5B%E5%85%B6%E4%BB%96%E6%96%87%E6%A1%A3%5D/%5BVB%E5%9B%AD%E5%9C%B0%5D/Test%E6%B5%8B%E8%AF%95%E5%A4%A7%E5%85%A8/WindowsApp4/WindowsApp4/bin/Debug/WindowsApp4.exe
----------------------------------------
Microsoft.VisualBasic
    程序集版本:10.0.0.0
    Win32 版本:14.8.4084.0 built by: NET48REL1
    基本代码:file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/Microsoft.VisualBasic/v4.0_10.0.0.0__b03f5f7f11d50a3a/Microsoft.VisualBasic.dll
----------------------------------------
System.Windows.Forms
    程序集版本:4.0.0.0
    Win32 版本:4.8.4550.0 built by: NET48REL1LAST_C
    基本代码:file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Windows.Forms/v4.0_4.0.0.0__b77a5c561934e089/System.Windows.Forms.dll
----------------------------------------
System
    程序集版本:4.0.0.0
    Win32 版本:4.8.4605.0 built by: NET48REL1LAST_C
    基本代码:file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System/v4.0_4.0.0.0__b77a5c561934e089/System.dll
----------------------------------------
System.Drawing
    程序集版本:4.0.0.0
    Win32 版本:4.8.4390.0 built by: NET48REL1LAST_C
    基本代码:file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Drawing/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll
----------------------------------------
System.Configuration
    程序集版本:4.0.0.0
    Win32 版本:4.8.4190.0 built by: NET48REL1LAST_B
    基本代码:file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Configuration/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Configuration.dll
----------------------------------------
System.Core
    程序集版本:4.0.0.0
    Win32 版本:4.8.4605.0 built by: NET48REL1LAST_C
    基本代码:file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Core/v4.0_4.0.0.0__b77a5c561934e089/System.Core.dll
----------------------------------------
System.Xml
    程序集版本:4.0.0.0
    Win32 版本:4.8.4084.0 built by: NET48REL1
    基本代码:file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Xml/v4.0_4.0.0.0__b77a5c561934e089/System.Xml.dll
----------------------------------------
Accessibility
    程序集版本:4.0.0.0
    Win32 版本:4.8.4084.0 built by: NET48REL1
    基本代码:file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/Accessibility/v4.0_4.0.0.0__b03f5f7f11d50a3a/Accessibility.dll
----------------------------------------
System.Runtime.Remoting
    程序集版本:4.0.0.0
    Win32 版本:4.8.4084.0 built by: NET48REL1
    基本代码:file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Runtime.Remoting/v4.0_4.0.0.0__b77a5c561934e089/System.Runtime.Remoting.dll
----------------------------------------
Microsoft.Web.WebView2.WinForms
    程序集版本:1.0.1661.34
    Win32 版本:1.0.1661.34
    基本代码:file:///F:/%E6%96%87%E6%A1%A3/%5B%E5%85%B6%E4%BB%96%E6%96%87%E6%A1%A3%5D/%5BVB%E5%9B%AD%E5%9C%B0%5D/Test%E6%B5%8B%E8%AF%95%E5%A4%A7%E5%85%A8/WindowsApp4/WindowsApp4/bin/Debug/Microsoft.Web.WebView2.WinForms.DLL
----------------------------------------
Microsoft.Web.WebView2.Core
    程序集版本:1.0.1661.34
    Win32 版本:1.0.1661.34
    基本代码:file:///F:/%E6%96%87%E6%A1%A3/%5B%E5%85%B6%E4%BB%96%E6%96%87%E6%A1%A3%5D/%5BVB%E5%9B%AD%E5%9C%B0%5D/Test%E6%B5%8B%E8%AF%95%E5%A4%A7%E5%85%A8/WindowsApp4/WindowsApp4/bin/Debug/Microsoft.Web.WebView2.Core.DLL
----------------------------------------
mscorlib.resources
    程序集版本:4.0.0.0
    Win32 版本:4.8.4084.0 built by: NET48REL1
    基本代码:file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/mscorlib.resources/v4.0_4.0.0.0_zh-Hans_b77a5c561934e089/mscorlib.resources.dll
----------------------------------------
System.Windows.Forms.resources
    程序集版本:4.0.0.0
    Win32 版本:4.8.4084.0 built by: NET48REL1
    基本代码:file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Windows.Forms.resources/v4.0_4.0.0.0_zh-Hans_b77a5c561934e089/System.Windows.Forms.resources.dll
----------------------------------------

************** JIT 调试 **************
要启用实时(JIT)调试,
该应用程序或计算机的 .config 文件(machine.config)的 system.windows.forms 节中必须设置
jitDebugging 值。
编译应用程序时还必须启用
调试。

例如:

<configuration>
    <system.windows.forms jitDebugging="true" />
</configuration>

启用 JIT 调试后,任何未经处理的异常
都将被发送到在此计算机上注册的 JIT 调试程序,
而不是由此对话框处理。


Microsoft Edge
Microsoft Edge
A Microsoft cross-platform web browser that provides privacy, learning, and accessibility tools.
2,358 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. ShiJieLi-MSFT 10,271 Reputation points Microsoft Vendor
    2023-03-24T08:45:46.1466667+00:00

    Hi @cm,

    Thanks for sharing this issue. As to this issue, the Dev Team has said that

    There is no specific timeline for when to solve all the issues for apps running as admin. We are trying to improve experience for apps running as admin and made a change recently in Edge 112 though.

    It means that the Dev Team is working on this issue actively. You can test again on Edge 112 once it is released. If you have additional information to share, you can add comments on that GitHub post to help the Dev Team learn more about it.


    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    Best Regards,

    Shijie Li

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.