Solved

Visual Studio 2010 Code Settings

Posted on 2010-09-17
6
490 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Congratulations! You’re Certified – Now What?

Starting a new career can be overwhelming. Becoming certified in your field of expertise is a great start, but where do you go from here?  Here are some tips to help you on your career journey.

 

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

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

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

For most people, the WrapPanel seems like a magic when they switch from WinForms to WPF. Most of us will think that the code that is used to write a control like that would be difficult. However, most of the work is done by the WPF engine, and the W…
Whether you've completed a degree in computer sciences or you're a self-taught programmer, writing your first lines of code in the real world is always a challenge. Here are some of the most common pitfalls for new programmers.
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…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…

617 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