question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

AccessViolation 0xC0000005 was thrown while calling AddHostObjectToScript

See original GitHub issue

Describe the bug

Steps to reproduce the bug

Steps to reproduce the behavior:

  1. Create a WinUI 3 project (either UWP or Desktop)
  2. Follow https://docs.microsoft.com/en-us/dotnet/api/microsoft.web.webview2.core.corewebview2.addhostobjecttoscript
  3. AccessViolation was thrown while calling AddHostObjectToScript

Expected behavior

No exception was thrown.

Version Info

NuGet package version: WASDK 1.0, WinUI 3

Windows app type:

UWP Win32
Yes Yes
Windows 10 version Saw the problem?
Windows 11 (22000) Yes
Insider Build (21322) Yes
October 2020 Update (19042)
May 2020 Update (19041)
November 2019 Update (18363)
May 2019 Update (18362)
October 2018 Update (17763)
April 2018 Update (17134)
Fall Creators Update (16299)
Creators Update (15063)
Device form factor Saw the problem?
Desktop Yes
Xbox
Surface Hub
IoT

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:1
  • Comments:16 (5 by maintainers)

github_iconTop GitHub Comments

3reactions
michael-hawkercommented, May 14, 2021

Yeah, we’re still waiting on this so we can more easily port the Monaco wrapper over to WinUI 3 without a big work-around.

2reactions
codendonecommented, Mar 3, 2021

This API is not yet implemented in the core WebView2 WinRT API.

Read more comments on GitHub >

github_iconTop Results From Across the Web

.net - Webview2 AddHostObjectToScript throws Exception ...
Exception thrown at 0x7901179F (Microsoft.Web.WebView2.Core.dll) in WinUI3_1.exe: 0xC0000005: Access violation reading location 0x00000000.
Read more >
CoreWebView2.AddHostObjectToScript(String, Object) ...
By default, an exception is thrown when attempting to get the value of a proxy property that doesn't exist on the corresponding native...
Read more >
WinRT WebView2注入宿主对象供JS使用【失败记】
从这个Issue AccessViolation 0xC0000005 was thrown while calling AddHostObjectToScript #4377 看来WinRT版的WebView2目前还是有比较多的问题的。
Read more >
Call native-side code from web-side code
When developing a WebView2 app, you may encounter a native object ... The AddHostObjectToScript API enables re-use of native-side code by ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found