Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Visual Studio 2010 Code Settings

Posted on 2010-09-17
6
Medium Priority
?
492 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
NFR key for Veeam Backup for Microsoft Office 365

Veeam is happy to provide a free NFR license (for 1 year, up to 10 users). This license allows for the non‑production use of Veeam Backup for Microsoft Office 365 in your home lab without any feature limitations.

 

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 2000 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

Ask an Anonymous Question!

Don't feel intimidated by what you don't know. Ask your question anonymously. It's easy! Learn more and upgrade.

Question has a verified solution.

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

After several hours of googling I could not gather any information on this topic. There are several ways of controlling the USB port connected to any storage device. The best example of that is by changing the registry value of "HKEY_LOCAL_MACHINE\S…
Entering time in Microsoft Access can be difficult. An input mask often bothers users more than helping them and won't catch all typing errors. This article shows how to create a textbox for 24-hour time input with full validation politely catching …
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…
Screencast - Getting to Know the Pipeline

963 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