[Checked exceptions] Any tools out there?

  • Thread starter Thread starter F. GEIGER
  • Start date Start date
F

F. GEIGER

Hi everybody,

I like checked exceptions as provided by Java. No, I don't want to start a
thread on that, but ask, if anyone knows of a tool for that. It may be
stand-alone, but being plugable into MSVS would ease its use, I guess.

Many thanks in advance and best regards
Franz GEIGER
 
for me, who has never written a line of Java, I'd like it if you could
explain this concept. One of us may be able to translate it into .NET for
you.
--- Nick
 
Nick Malik said:
for me, who has never written a line of Java, I'd like it if you could
explain this concept. One of us may be able to translate it into .NET for
you.

The checked exception scheme is one where most exceptions count as
checked, and any method which may throw those exception (including by
calling other methods which may throw them) has to declare which
checked exceptions it might throw.

There's no equivalent in .NET - I ping-pong back and forth as to
whether or not it's a good idea. It (.NET) feels like driving without a
seatbelt - it feels more free, but more dangerous too.
 
If you really want checked exceptions, you should take a look at J#. You
will get all the Java features + direct access to the .NET framework. This
is probably the easiest way to get checked exceptions in the .NET world.

Otherwise, in C#, you could fake them by introducing a special "Throws"
attribute that lists the exceptions that a method may throw. The hard part
will be to write a tool that analyses the bodies of methods and tells you if
you violate the checked exception constraints.

To me, this is not worth the trouble at all. I have done lots of programming
in Java, and I ended up dropping checked exceptions completely and
subclassing all my exceptions from RuntimeException. But if you really want
this feature...

Bruno.
 
Hi F. GEIGER,

Thank you for posting in the community!

Bruno has provided 2 ways for you. Does that make sense to you?

Yes, C# does not implement the "Checked Exception", there is a conversation
between C# designer Anders and Bruce Eckel, talked about this:
http://www.artima.com/intv/handcuffs.html

If you are interested in the future directions for C#, please refer to:
http://msdn.microsoft.com/chats/vstudio/vstudio_032103.asp

There is some "Checked Exception" quesiton in the link.

I hope the information I provide you makes sense to you.

If you have any further concern, please feel free to feedback, we will help
you to resove it.

Anyway, I will monitor this thread, thanks

Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
 
Thanks to all who contributed!

<Nick>
for me, who has never written a line of Java, I'd like it if you could
explain this concept. One of us may be able to translate it into .NET for
you.
</Nick>

Nick, I think from the responses to my post it has become clear, what I'm
speaking of. Nevertheless, sorry for assuming that everyone knows about
checked exceptions.

<Jon>
There's no equivalent in .NET - I ping-pong back and forth as to
whether or not it's a good idea. It (.NET) feels like driving without a
seatbelt - it feels more free, but more dangerous too.
</Jon>

Yes, that's exactly how I see it too. I still have very little experience in
programming Java (started a few weeks ago, in my spare time, like C# too),
but immediately found, that checked exceptions are what I always missed in
C++ (I come from the C, MSVC++, Python corner). Yes, MSVC++ has exception
specs, but they aren't checked. And I always found that a pity.

<Bruno>
Otherwise, in C#, you could fake them by introducing a special "Throws"
attribute that lists the exceptions that a method may throw. The hard part
will be to write a tool that analyses the bodies of methods and tells you if
you violate the checked exception constraints.
</Bruno>

Yes, a fake like that would be the seed to build a tool around. My hope was,
that somebody already has bitten the bullet...

<Jeffrey>
Yes, C# does not implement the "Checked Exception", there is a conversation
between C# designer Anders and Bruce Eckel, talked about this:
http://www.artima.com/intv/handcuffs.html
</Jeffrey>

I've read it. In that article Anders says, that tools will take over in this
matter. Seems reasonable to me. For now it doesn't matter to me if such a
tool is the compiler itself or, well, a tool. However, I like to have the
choice: Seatbelts yes or no :-). But as I said: My experiences wrt checked
exceptions are little yet.


Many thanks again and best regards
Franz GEIGER
 
Hi F. GEIGER,

Thanks very much for your feedback.

I am glad the community's reply makes sense to you.

After some searching in internet, I found there was a tool named "CLRxLint"
may meet your need.

CLRxLint is a checked exception verifier for Microsoft .NET platform. With
support for any MS CLR -based languages including C#, VB.NET and Managed
C++, CLRxLint is the only solution that introduces concept of checked
exception for .NET platform.

For more detailed information, please refer to the link:
http://www.software4net.com/products/clrxlint.html

There is also simple example in C# using checked exception in that link.

Hope it can help you.

Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
 
Hi GEIGER,

Thanks for your feedback.

That can help you.

My original response contains a reference to a third-party World Wide Web
site. Microsoft is providing this information as a convenience to you.
Microsoft does not control these sites and has not tested any software or
information found on these sites; therefore, Microsoft cannot make any
representations regarding the quality, safety, or suitability of any
software or information found there. There are inherent dangers in the use
of any software found on the Internet, and Microsoft cautions you to make
sure that you completely understand the risk before retrieving any software
from the Internet.

Anyway, if you have further, please feel free to post, we will help you.

Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
 
Hi GEIGER,

Thanks for your feedback.

Hope that can help you.

I want to inform you that: my original response contains a reference to a
third-party World Wide Web site. Microsoft is providing this information as
a convenience to you.
Microsoft does not control these sites and has not tested any software or
information found on these sites; therefore, Microsoft cannot make any
representations regarding the quality, safety, or suitability of any
software or information found there. There are inherent dangers in the use
of any software found on the Internet, and Microsoft autions you to make
sure that you completely understand the risk before retrieving any software
from the Internet.

Anyway, if you have further, please feel free to post, we will help you.

Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
 
Back
Top