A: 

In regards to the first question, if there was a public statement, then it was more than likely put on the web somewhere, in which case, Google should turn up something (if it exists).

If it is a direct email with the C# team, then it is more than likely that it is under NDA, so it wouldn't be able to be published anyways.

With the second question, there is a search capability on Microsoft Connect which they prompt you to use before entering a new suggestion. If you can't find it, then there probably isn't one.

My recommendation would be to put a suggestion in, and then promote it to get others to weigh in on it.

casperOne
Please see the update at the bottom of my question.
Daniel Earwicker
A: 

As I understand them, at the moment of rethrow, the finally handlers in the inner functions are executed and that's what creates problems for you.

But let's say you have an exception filter that passes the exception through without actually rethrowing it. You'll still have to handle it somehow somewhere, and you will run in the same kinds of problems (finally effects) there.

So unless I am misunderstanding something, there is not great gain from having language-supported exception filters.

Andrey Shchekin
If the exception is unhandled by the time it leaves Main, the UnhandledException event fires - without running finally blocks. You can either trigger your own version of WER (Watson) at that point and exit, or allow WER to kick in. Either way this allows you to diagnose the problem...
Daniel Earwicker
... the point being that there is immense value in crashing properly! There are good and bad ways to crash. Running arbitrary code- perhaps trashing external customer data - and also trashing the evidence you need, or throwing further exceptions, is not the right way to crash.
Daniel Earwicker
In the simplest case, consider NulLReferenceException - do you really want to catch and try to recover from that?
Daniel Earwicker
NB. To be absolutely clear, the finally handlers do not run at the moment of rethrow unless there is an enclosing try/catch statement that can handle the throw exception.
Daniel Earwicker
I see, I have not considered WER level.
Andrey Shchekin
+2  A: 

Using Exception Filter Inject may be simpler than using the delegate workaround.

For a real answer to your question you will need a response from Anders Hejlsberg, or someone who was in the original design meetings. You might try seeing if you can get it asked by the Channel 9 interviewer next time the C# design team is interviewed.

I'd guess that when the original decision was made, exception filters were seen as an unnecessary complication that might do more harm than good. You can certainly see a desire to remain 'silent' about unproven features in this interview about the decision not to support checked exceptions: The Trouble with Checked Exceptions .

I think the postmoterm diagnostic scenarios argue strongly for providing access to exception filters in the language. However those scenarios may not have been articulated at the time. Also those scenarios really need proper tooling support, which certainly wasn't available in V1. Finally there may be big negatives about adding this feature that we are not considering.

If there isn't a connect bug on this you should enter one and encourage others to vote it up. [I'd recommend asking for access to the CLR feature rather than attempting to design how it fits in the language.]

Steve Steiner
That injection idea is similar to something I suggested to the CLR team: to have a global policy delegate. But it's not as powerful as the filters feature because it's global rather than per-catch.
Daniel Earwicker
+1  A: 

I don't believe that Java has a filter option either. Guessing that if it did, we would also see one in C#. VB.net likely has one by chance given that the VB team started with a clean slate.

One thing that might work in your favor as far as gaining this option in a future version of C# is Microsoft's stated goal to maintain parity between laguage features in future versions of C# and VB.net. I would put forward my arguement based on that.

http://www.chriseargle.com/post/2009/01/Parity-Between-Languages.aspx

Andrew Robinson
The situation in Java is dreadful - finally blocks always run, even for uncaught exceptions. I tested it in the current runtime, and it's in the language spec. So I wrote it up here: http://en.wikipedia.org/wiki/Comparison_of_C_Sharp_and_Java#Finally_Blocks_and_Uncaught_Exceptions
Daniel Earwicker
+2  A: 

As to any existing connect bugs. The following issue deals with exception fliters. The user did not explicitly state they wanted them be an actual filter in the sense of when they execute but IMHO it's implied by the logic.

https://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=401668

Besides that issue though, there are no issues I can find or know of that are related to what you are looking for. I think it would do good to have a separate issue which explicitly calls out the want for VB.Net style exception filters.

I wouldn't worry too much about introducing a duplicate question if you've done a bit of due diligence looking for an existing one. If there is a dupe, Mads will dupe it accordingly and link you to the main request.

As for the part of getting an official response from the C# team, you will likely get that when you either 1) file a connect bug or 2) get duped against the main bug. I really doubt there is an official reason / justification out there right now.

Here's my speculation on the issue: My guess is that this feature simply wasn't on the original C# 1.0 feature set and since that time there hasn't been enough demand to make it into the language. The C# and VB team spend an unbelievable amount of time ranking language features at the start of every ship cycle. We have to make some very difficult cuts at times. Without sufficient demand there is very little chance a feature will make it into the language.

Up until recently I bet you would be hard pressed to find 1 out of 10 people who understood the difference between VB.Net's Try/When and just using a plain old if statement in a C# catch block. It seems to be a bit more on peoples minds lately so maybe it will make it into a future version of the langauge.

JaredPar
I hope (in fact I'm sure this is true) that the language design is driven in places by what is necessary, even if it isn't widely known to many users yet. I only understood this issue last week after Andrew Pardoe explained it twice!
Daniel Earwicker
@Earwicker language design is a bit of both (want vs. necessary for language evolution). IMHO this kind of feature is the type that is driven by want.
JaredPar