Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Problem/Bug]: Crash on hibernate #4359

Open
ray007 opened this issue Feb 8, 2024 · 9 comments
Open

[Problem/Bug]: Crash on hibernate #4359

ray007 opened this issue Feb 8, 2024 · 9 comments
Assignees
Labels
bug Something isn't working

Comments

@ray007
Copy link

ray007 commented Feb 8, 2024

What happened?

The app crashes when the PC is set to hibernate, and Crash dialog is seen the next day in office on login.

The callstack to this System.NullReferenceException as follows:

   at System.Object.GetType()
   at Microsoft.Web.WebView2.Core.CoreWebView2PrivateHostObjectHelper.RawHelper.<>c__DisplayClass10_0.<SetAsyncMethodContinuation>b__0()
   at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
   at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)
   at System.Windows.Threading.DispatcherOperation.InvokeImpl()
   at MS.Internal.CulturePreservingExecutionContext.CallbackWrapper(Object obj)
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx) in f:\dd\ndp\clr\src\BCL\system\threading\executioncontext.cs:line 980
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx) in f:\dd\ndp\clr\src\BCL\system\threading\executioncontext.cs:line 928
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state) in f:\dd\ndp\clr\src\BCL\system\threading\executioncontext.cs:line 917
   at MS.Internal.CulturePreservingExecutionContext.Run(CulturePreservingExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Windows.Threading.DispatcherOperation.Invoke()
   at System.Windows.Threading.Dispatcher.ProcessQueue()
   at System.Windows.Threading.Dispatcher.WndProcHook(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
   at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
   at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)
   at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
   at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)
   at System.Windows.Threading.Dispatcher.LegacyInvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Int32 numArgs)
   at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam)
   at MS.Win32.UnsafeNativeMethods.DispatchMessage(MSG& msg)
   at System.Windows.Threading.Dispatcher.PushFrameImpl(DispatcherFrame frame)
   at System.Windows.Application.RunDispatcher(Object ignore)
   at System.Windows.Application.RunInternal(Window window)
   at Our.Company.App.Main()

I had some crashes in async function called from the jsBridge earlier too, but this one is hitting regularly for the last few days.

Importance

Important. My app's user experience is significantly compromised.

Runtime Channel

Stable release (WebView2 Runtime)

Runtime Version

121.0.2277.106

SDK Version

1.0.2194-prerelease

Framework

WPF

Operating System

Windows 10

OS Version

No response

Repro steps

Happening when leaving the office and choosing "Hibernate" from the power options.

Repros in Edge Browser

No

Regression

Don't know

Last working version (if regression)

No response

@ray007 ray007 added the bug Something isn't working label Feb 8, 2024
Copy link

github-actions bot commented Feb 8, 2024

Hi, @ray007!

It seems that your issue contains the word "crash". If you have not already, could you attach a crash dump as a comment?

WV2 crash dumps are located in a subfolder of the app's user data folder (UDF): <UDF>\EBWebView\Crashpad\reports\. By default, the user data folder is created in the app's folder with a name like <App Exe Name>.exe.WebView2. Refer to Crash Diagnostics for more information.

Thank you for your cooperation!

@ray007
Copy link
Author

ray007 commented Feb 8, 2024

Does this folder get cleared when the app starts again? It's currently empty.

@victorhuangwq
Copy link
Collaborator

The folder shouldn't be cleared upon restart

@lflores-ms
Copy link
Contributor

Hi @ray007,

This is a crash in the app process, not the runtime, so dumps won't be in User Data Folder. Can you provide either of the following?

  • (preferred) Dump from the application. For example, you can try to Collect Dumps on Crash
  • Event Viewer log (%SystemRoot%\System32\Winevt\Logs\Application.evtx)
  • A sample project where the issue can be reproduced

Thanks,
Luis

@ray007
Copy link
Author

ray007 commented Feb 13, 2024

No crash&debug dialog this morning, but the app still crashed and left the usual 2 lines in the event log, see attached file.
appcrash.zip

@ray007
Copy link
Author

ray007 commented Feb 28, 2024

Today a crash to debug from visual studio, saved minidump from there. Get it here.

@ray007
Copy link
Author

ray007 commented Jun 17, 2024

I now have some more users for this, some of which are reporting the same problem with sleep and/or hibernate.

Just a few minutes ago I caught it (or a very similar looking case) in the debugger, in visual studio it also look quite similar to #3402.

@ray007
Copy link
Author

ray007 commented Jun 27, 2024

For testing purposes I did a quick and dirty upgrade to .NET 8 from the currently used .NET Framework 4.7.2.
While not everything is working, the sleep/hibernate crash seems to have vanished.

Unfortunately, the main part of my app also has to work as plugin in a legacy application using .NET 4.7.x, so going with the .NET upgrade into production is currently not feasible.

@ray007
Copy link
Author

ray007 commented Jul 5, 2024

Thinking about the differences between the .NET 4 and .NET 8 application, I had a new idea:

Wrap the application.Run() call in Main() with a application.Dispatcher.Invoke(...) - and suddenly the crash on sleep/hibernate seems to be gone.
Not sure why it makes a difference, maybe there's an Invoke() missing somewhere in the WebView2 .NET lib?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants