UnhandledExceptionHandler only handles Exceptions on Methods with Return type?
See original GitHub issueI’m noticing that if I register an UnhandledExceptionHandler
via:
ExcelIntegration.RegisterUnhandledExceptionHandler(ErrorHandler);
and an exception occurs within my ExcelFunction
-marked method the handler does not trigger unless the return type is not void
.
Is this intentional, or a bug?
Issue Analytics
- State:
- Created 7 years ago
- Comments:5 (4 by maintainers)
Top Results From Across the Web
Function's return type can be Exception when it throws ...
The compiler allows this because throwing an exception means something wrong happened, like the arguments are invalid, or the argument is null, ...
Read more >UnhandledExceptionFilter function (errhandlingapi.h)
An application-defined function that passes unhandled exceptions to the debugger, if the process is being debugged.
Read more >What is an Unhandled Exception, and How to Catch All C# ...
An exception is a known type of error. An unhandled exception occurs when the application code does not properly handle exceptions.
Read more >Application.SetUnhandledExceptionMode Method
It sets SetUnhandledExceptionMode so that all exceptions are handled by the application, regardless of the settings in the application's user configuration file ...
Read more >Pragmatic error handling. I'll present a simple and practical…
In the unhandled exception handler, you catch and handle the non-caught exceptions (ideally, only the runtime ones). In a data repository, you could...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
The exception handler gets woven into the IL method stub, which is not code I’m likely to fiddle with at this stage.
I think I didn’t make it an event since it needs to return the overridden result of the function. (I guess the event signature could have an
out
orref
parameter for that purpose, but maybe that didn’t occur to me at the time.)I’m not likely to make any changes to this aspect of Excel-DNA except improved documentation.
Might be better to provide documentation in intellisense (and elsewhere) that highlights this expected behavior. You can still have a void function; not everyone is familiar with Visual Basic’s version of Function vs Sub.
Is there a technical limitation on why it can’t handle exceptions from void?