'Dispatcher.PushFrame hang issue
Task<string> executeScript = webView.CoreWebView2.ExecuteScriptAsync("apm.module().hasUnsavedData();");
System.Timers.Timer timer = new System.Timers.Timer();
DispatcherFrame frame = new DispatcherFrame();
string hasUnsavedData = "True";
executeScript.ContinueWith(_ =>
{
if (executeScript.IsFaulted) hasUnsavedData = executeScript.Exception.Message;
else hasUnsavedData = executeScript.Result;
frame.Continue = false;
});
ComponentDispatcher.PushModal();
timer.Enabled = true;
frame.Continue = true;
Dispatcher.PushFrame(frame);
timer.Enabled = false;
return !Convert.ToBoolean(hasUnsavedData);
I have this code to get the value from Async call and the calling method is synchronous, code is working at many places but crashes somewhere on "Dispatcher.PushFrame(frame);". Can someone please help me with this issue?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
