mirror of
https://github.com/ElectronNET/Electron.NET.git
synced 2026-02-03 21:25:13 +00:00
Exposing Electron errors and error conditions to DotNet #769
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 @danatcofo on GitHub (Feb 24, 2022).
Originally assigned to: @GregorBiswanger on GitHub.
One of the things that creates a little bit of a blocker for me as a dotnet developer using Electron.NET is that errors that occur in the electron side of Electron.NET are effectively swallowed. This lack of visibility leads to a lot of time spent diagnosing where an issue occurred (Electron or dotnet) even before figuring out why an issue occurred. To promote visibility of errors in electron I propose the following:
For the case where an error occurs and the dotnet side of code is expecting a response but will not receive one:
return a pre-formatted string with the exception information as the content that the dotnet handler can properly parse and throw a .net exception for.For the case where an error occurs and the dotnet side of code is not expecting a response:
Create a channel to except exceptions from the js into the dotnet code. This would be a generic channel to accept the messages from any location we devise.Electron Implementation
On the electron side I propose the addition of the following:
postError.ts
How this would be consumed in the electron side.
DotNet Implementation
On the dotnet side we would have a capture class
API classes that have a callback would be updated to follow this format:
Client applications would capture unhandled exceptions like this:
Final Thoughts
Doing this would mean a large change in the code. We would have to hit many places in both the dotnet and js side of things. This would also mean a large and possibly breaking change for any consumer code as Exception Handling on the .net side would become more paramount. However I believe that the final outcome would be more visibility to the primary developers, i.e. all us dotnet monkeys.
D Gidman
@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!