PC Review


Reply
Thread Tools Rate Thread

ASP.NET & Assertions

 
 
Tyrant Mikey
Guest
Posts: n/a
 
      25th Aug 2005
Do assertions not work in ASP.NET because it is a "service" type
application?

 
Reply With Quote
 
 
 
 
Nicole Calinoiu
Guest
Posts: n/a
 
      25th Aug 2005
What kind of assertions?


"Tyrant Mikey" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Do assertions not work in ASP.NET because it is a "service" type
> application?
>



 
Reply With Quote
 
Tyrant Mikey
Guest
Posts: n/a
 
      25th Aug 2005
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.)

 
Reply With Quote
 
Nicole Calinoiu
Guest
Posts: n/a
 
      26th Aug 2005
"Tyrant Mikey" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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/AS...gAssertion.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>).


 
Reply With Quote
 
Tyrant Mikey
Guest
Posts: n/a
 
      26th Aug 2005
That worked beautifully! Thank you! Thank you! Thank you!!

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Analysing mfc/atl assertions Daniel Lidström Microsoft VC .NET 1 7th Oct 2008 10:31 AM
Writing Assertions to a log file? Brett Romero Microsoft C# .NET 8 29th Sep 2006 07:13 AM
assertions errors =?Utf-8?B?cm9nZXI=?= Windows XP General 3 25th May 2006 06:57 PM
Too Many Assertions? Jefffff Microsoft C# .NET 8 29th Mar 2006 05:17 PM
DIG assertions Krista Windows XP MovieMaker 0 14th Jul 2003 10:22 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 11:25 AM.