mirror of
https://github.com/ElectronNET/Electron.NET.git
synced 2026-02-03 21:25:13 +00:00
Electron.IpcMain.On doesn't allow for event parameter #652
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 @Zshandi on GitHub (Apr 14, 2021).
Originally assigned to: @GregorBiswanger on GitHub.
Inside my main process, I am trying to receive a signal from my renderer process using
IpcMain.On()and return a value back to the renderer process. The issue I am having is that I cannot access the event parameter inside of the callback function. I am receiving a compile time error stating that event is an "Invalid Expression term".I looked at the source code for
On()insideIpcMain.csand it doesn't seem to be calling the listener callback function with an event parameter.The comments say that the listener will be called as such:
But looking at the implementation, it doesn't seem to be calling the listener with the event parameter as it says it does:
In particular,
Action<object> listenerforces the listener to only take a single argument, andlistener(objectArray.First());orlistener(objectArray);only pass the argument object list, which doesn't include an event.Steps to Reproduce:
@GregorBiswanger commented on GitHub (Mar 28, 2023):
🎉🚀 New Electron.NET version 23.6.1 released 🚀🎉
With native Electron 23 and .NET 6 support. Your problem should be fixed here. If you continue to have the problem, please let us know. Please note the correct updating of your API & CLI. Info in the README. Have fun!