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 / Languages / Managed C++ / October 2007

Tip: Looking for answers? Try searching our database.

Assertions in release builds?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Duncan Smith - 03 Oct 2007 14:17 GMT
Last week, I got reports back of errors in a patch I let someone try
out (release dll, but not from the build machine).  Turns out it was
some Debug::Assert statements firing.

In umanaged code, I'd always understood that assertions were only
fired in debug builds and would compile down to NOPs in release builds
(for good reasons)

Now it looks as though I have to be careful to code assertions
conditionally?

#ifdef _DEBUG
   Debug::Assert( false );
#endif

as opposed to

ASSERT( FALSE );

What's the thinking behind the change?

Regards,

Duncan
David Lowndes - 04 Oct 2007 16:23 GMT
>Last week, I got reports back of errors in a patch I let someone try
>out (release dll, but not from the build machine).  Turns out it was
[quoted text clipped - 16 lines]
>
>What's the thinking behind the change?

Duncan,

This quirk would appear to be specific to C++/CLI usage. Using
Debug.Assert from C# (I presume VB is the same) doesn't generate any
code in release builds.

The documentation does say "C++ does not support the Debug class
methods." - which in itself seems rather odd because it clearly works
but has the quirk that its not removed in release builds.

This offers some explanation of why the situation is as it is:
http://blog.kalmbachnet.de/?postid=78

There's also a bug report on this here (you might want to add a vote
to it) - note it's still the same with Orcas B2:
http://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=98820

Dave

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.