3

I'm using Resharper 8 and I'm quite happy but one thing makes me unhappy.
Resharper does not show me any exceptions a method could throw.
I would like to know without searching on MSDN if a method throws any exceptions.

I could not find anything about this on the internet except for a howto for an old version and this does not work anymore.
Is there any option I'm missing that I have to enable?

Edit: As I noticed IntelliSense only shows information about a method if I hover over it with my mouse. So no information is shown at all while typing. Really annoying.
Nothing on the internet helped yet. Neither the thread that was suggested this thread is a duplicate of nor any other suggesting turning on Tools->Text editor->C#->General->Parameter information/Auto list members or enableing Resharper->Environment->IntelliSense->Completion Appearance->Show summary/Show member signatures.
I can only see the member signature.

TorbenJ
  • 4,462
  • 11
  • 47
  • 84
  • possible duplicate of [Can you get ReSharper to display exceptions in Intellisense?](http://stackoverflow.com/questions/5837007/can-you-get-resharper-to-display-exceptions-in-intellisense) – Neil Smith Apr 04 '14 at 21:05
  • 1
    already tried this but it does not work unfortunately – TorbenJ Apr 04 '14 at 21:32
  • Why would ReSharper know all the exceptions a method could throw? And what do you want to do with that information? I sure hope you don't intend to catch all those exceptions. – John Saunders Apr 05 '14 at 00:06
  • I guess the best thing you can do with this information is to decide whether or not you should catch exception xy. So for example if I use method y of class x I would like to know if this method throws any exception so that I can handle them. It would be much easier to get this information while typing so that I don't have to go to MSDN everytime. And no I don't want to handle every exception. – TorbenJ Apr 05 '14 at 00:11
  • 1
    You should, in general, catch _no_ exceptions unless you can actually do something about them. Since you can't do anything about most exceptions, you shouldn't _catch_ most exceptions. See "[Handling exceptions, is this a good way?](http://stackoverflow.com/questions/2469822/handling-exceptions-is-this-a-good-way/2469864#2469864)" – John Saunders Apr 05 '14 at 00:14
  • 1
    Ok so I'm a bit confused. I guess it is a bit offtopic but I don't like the idea of just leave any exception or most of them just happen without handling them. For example if I try to connect to some sort of service on the internet and the connection establishment fails with an exception, I would like to catch it and react to this exception (like logging it, inform the user or take further steps to fix it if possible). And even if I don't know that a method throws exceptions but they do and I think that I should handle them all or some of them, I would like to know which can be thrown. – TorbenJ Apr 05 '14 at 00:28

1 Answers1

2

I don't think such a feature exists these days. There used to be Red Gate's Exception Hunter but it is discontinued with the following explanation:

With the release of .NET 4.0 and WPF, the number of exceptions that the CLR can throw was greatly increased, to the point of being overwhelming. The exclusions list can no longer cover all the unlikely exceptions that the CLR may throw. This means that, although Exception Hunter will provide accurate results, these results will include a long list of potential exceptions, most of which are nothing to worry about. In essence, the tool has become a lot less usable and makes your job harder than it should be. This goes against our ingeniously simple ethos, so we have decided to stop selling new licenses for the product.

From my experience, John Saunders is quite right - you should know the exact exception you want to handle, and handle it specifically. I guess it goes well with TDD.

nrodic
  • 3,026
  • 3
  • 33
  • 38