|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
turn off assertions in VB 2005Say I would like to use assertions to make sure correct inputs are
given to a procedure. But, I want to do this in testing only, not in production. I saw Debug.Assert, which is nice, but does VB.NET have a feature where you can turn off assertions on production code? Douglass,
Debug methods are not included in the Release build. Kerry Moorman Show quoteHide quote "douglass_da***@earthlink.net" wrote: > > Say I would like to use assertions to make sure correct inputs are > given to a procedure. But, I want to do this in testing only, not in > production. > > I saw Debug.Assert, which is nice, but does VB.NET have a feature where > you can turn off assertions on production code? > > -- > http://www.douglass.com > > ok... thanks. would be a nice feature.
Show quoteHide quote > Douglass, > > Debug methods are not included in the Release build. > > Kerry Moorman > > > "douglass_da***@earthlink.net" wrote: > > > > > Say I would like to use assertions to make sure correct inputs are > > given to a procedure. But, I want to do this in testing only, not in > > production. > > > > I saw Debug.Assert, which is nice, but does VB.NET have a feature where > > you can turn off assertions on production code? > > > > -- > > http://www.douglass.com > > > > As Kerry stated,
>> Debug methods are not included in the Release build. When you compile your app you can compile it for Debug or for Release.The default is a Debug build, so Debug.Assert will be included. You can use "Build - Configuration Manager - Active solution configuration" to switch between Debug & Release builds of your application. Alternatively there should be a "Solution configurations" combo box on the standard toolbar. NOTE: You may need to use "Tools - Options - Projects and Solutions - Show advanced build configurations" to enable the solution configurations above. As Theo suggests you can also use Build - Configuration Manager to define new configurations, however for Debug.Assert this is not specifically necessary. -- Show quoteHide quoteHope this helps Jay B. Harlow ..NET Application Architect, Enthusiast, & Evangelist T.S. Bradley - http://www.tsbradley.net <douglass_da***@earthlink.net> wrote in message news:1162066150.296366.312000@k70g2000cwa.googlegroups.com... > ok... thanks. would be a nice feature. > > -- > http://www.douglassdavis.com > > Kerry Moorman wrote: >> Douglass, >> >> Debug methods are not included in the Release build. >> >> Kerry Moorman >> >> >> "douglass_da***@earthlink.net" wrote: >> >> > >> > Say I would like to use assertions to make sure correct inputs are >> > given to a procedure. But, I want to do this in testing only, not in >> > production. >> > >> > I saw Debug.Assert, which is nice, but does VB.NET have a feature where >> > you can turn off assertions on production code? >> > >> > -- >> > http://www.douglass.com >> > >> > > You can also use your own build types:
Goto the menu Build - Configuration Manager, and select <new> under Active Configuration. Type you config name (ie MyTest), and copy the settings from Release. Now you can use the following in your code: #IF CONFIG = "MyTest" THEN your asserting code #END IF The above code is only compiled in your application when you are using the MyTest configuration; as soon as you switch to Release, the code is removed from your assembly. douglass_da***@earthlink.net wrote: Show quoteHide quote > Say I would like to use assertions to make sure correct inputs are > given to a procedure. But, I want to do this in testing only, not in > production. > > I saw Debug.Assert, which is nice, but does VB.NET have a feature where > you can turn off assertions on production code? > > -- > http://www.douglass.com >
Constants can't be defined in a namespace. WTH?
Math class for Visual Basic.NET (matrix operations) Graph control webreq.getresponse exceptions Simple thread implementation not working. Adding a Web Reference into a Windows Project Errors in Page directive Determine if xml is malformed when to use an Interface (the template like thing) in my project? Date from Double |
|||||||||||||||||||||||