Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / New Users / August 2005

Tip: Looking for answers? Try searching our database.

ASP.NET & Assertions

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Tyrant Mikey - 25 Aug 2005 17:57 GMT
Do assertions not work in ASP.NET because it is a "service" type
application?
Nicole Calinoiu - 25 Aug 2005 18:03 GMT
What kind of assertions?

> Do assertions not work in ASP.NET because it is a "service" type
> application?
Tyrant Mikey - 25 Aug 2005 21:29 GMT
Well, just about any kind of assertion.

Debug.Assert(False)

That should stop the code and display a messagebox detailing the
assertion. But it doesn't. The text goes to the trace window, but I
want it to STOP my program. (You know, like an assertion failure SHOULD
do.)
Nicole Calinoiu - 26 Aug 2005 12:03 GMT
> Well, just about any kind of assertion.

Actually, System.Diagnostics.Debug is far from the only class with an Assert
method...

> Debug.Assert(False)
>
> That should stop the code and display a messagebox detailing the
> assertion. But it doesn't. The text goes to the trace window, but I
> want it to STOP my program. (You know, like an assertion failure SHOULD
> do.)

See http://www.codeproject.com/aspnet/ASPNetDebugAssertion.asp for a way to
implement this.  As for your original question of why it doesn't work as
expected automatically, my best guess would be that someone at Microsoft
decided this would probably cause too much pain when applications are
incorrectly deployed with debug configurations (which happens more often
than most of us might like to admit <g>).
Tyrant Mikey - 26 Aug 2005 19:17 GMT
That worked beautifully! Thank you! Thank you! Thank you!!

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.