mirror of
https://github.com/ElectronNET/Electron.NET.git
synced 2026-02-04 05:34:51 +00:00
Get properties that use Task.Run().Result seem to block execution #514
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @freosc on GitHub (Jun 12, 2020).
.net core 3.1 node 12.16.3
Steps to Reproduce:
Inside the property getter code I see that the code is executed correctly, but the socket.on "autoUpdater-allowDowngrade-get-reply" event is never fired.
This bug occurs for all property getters in the electron.net code that use the Task.Run().Result pattern
(Sidenote: a few seconds after the code execution is blocked, the socket also disconnects)
@freosc commented on GitHub (Jun 14, 2020):
I discovered that it does work in sync methods, and doesn't work in async methods.
If you put the example lines of code inside the Program.CreateWebHostBuilder, like this:
This will work. But it'll fail when ran from an async method such as the
async ElectronBootstrap()in your demo webapp, or in case somewhere upstream in the stacktrace an async method is used.
I guess we're looking at the infamous async deadlock issue, described here:
https://blog.stephencleary.com/2012/07/dont-block-on-async-code.html
@theolivenbaum commented on GitHub (May 25, 2021):
Is there anyone working on the remaining .Result uses? Happy to jump with a PR if not...