3 ms·
So basically, the CLR has ugly behavior on rethrows that can only be sanely described as a bug but it's a common-law feature at this point so we're using an ugl
by Pxtl 12y ago
So basically, the CLR has ugly behavior on rethrows that can only be sanely described as a bug but it's a common-law feature at this point so we're using an ugly linguistic construct to work around it.
- kangaroo 12y agoC# != CLR. CLR has had exception filters for a very long time, if not forever. The runtime != the language.
- Pxtl 12y agoI know CLR already supports exception filters - I've used VB.Net. You miss my point - the whole point of exception filters is to work around the way that the rethrow operation (that is, the naked "throw" without any given exception within a catch clause, so it pulls the contextual exception) screws up your stack-trace. Rethrowing an exception should not screw up the stack-trace. But they do, so we need to use the irritating exception filter mechanic.
- Lx1oG-AWb6h_ZG0 12y agoI'm confused, what is the alternative here? I expect the IDE to stop when an exception is not handled. Should it stop even if it is?
- MaulingMonkey 12y agoThere's an option for that in Visual Studio. It's not enabled by default, but I've found it handy for situations like this. The other alternative is what C# 6 added: eliminating the need to rethrow in as many circumstances in the first place, so 'logically' unhandled exceptions can be actually unhandled.
- Someone 12y agoSeparate exception catching from stack unwinding as in the Lisp condition system, where low-level code decides when to call high-level code and what options to present it, and the high-level code does whatever it wants to do and then picks an option. That more or less gives you what Microsoft calls 'edit and continue' in every program, where your high-level code decides what code does the edit and decides on how to continue. Some discussion with real-world usage scenarios at http://lambda-the-ultimate.org/node/1544 http://lambda-the-ultimate.org/node/1544. Example at http://c2.com/cgi/wiki?LispRestartExample http://c2.com/cgi/wiki?LispRestartExample
- Pxtl 12y agoWhy should a rethrow be semantically any different from an uncaught exception? I would expect the rethrow keyword to be "pretend I didn't catch this".