Solved

Visual Studio 2010 Code Settings

Posted on 2010-09-17
6
471 Views
Last Modified: 2013-11-27
Is it possible to set visual studio to give a compile error or warning when you are not catching exceptions.  For example, If I try to open a connection to a SQL database and do not catch the SqlException that is possible when you invoke the open method, is it possible for Visual Studio to give me a warning or error?
0
Comment
Question by:shanemay
  • 3
  • 2
6 Comments
 
LVL 41

Expert Comment

by:guru_sami
ID: 33703252
Don't think so...because that is a runtime issue and not the compile-time.
0
 
LVL 16

Expert Comment

by:13598
ID: 33703739
If you are not catching (trapping) the error it should error out.
0
 
LVL 16

Expert Comment

by:13598
ID: 33703797
Oh! Are you asking if you can easily set your compile warning configuration to warn you whenever a sql object/step that could error out does not have a try/catch statement to account for the possibility of an error? Then no, I don't believe so.
0
Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

 

Author Comment

by:shanemay
ID: 33703862
That is correct, I use IntelliJ for Java development and it will warn you if you invoke a method that throws an error.  It might be because C# does not support checked exceptions. In Java, these are declared using the throws keyword, to specify that a method can throw a particular type of exception that must be handled by the calling code.  
0
 
LVL 16

Accepted Solution

by:
13598 earned 500 total points
ID: 33703896
The closest in visual studio would be the Code Analysis tab. You can go through all the settings there and then run a code analysis.
0
 

Author Closing Comment

by:shanemay
ID: 33715950
Thank you for your help.  
0

Featured Post

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
This article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question