System.Diagnostics.Debug.Assert has stack trace; how do I get to it?

  • Thread starter Thread starter Eli Tucker
  • Start date Start date
E

Eli Tucker

Hello.

I've noticed that if I call System.Diagnostics.Debug.Assert( false ), I'll
see a stack trace. I'm acutely aware that exceptions in the compact
framework do not contain stack trace information, but I'm wondering how the
Assert method gets this information. Would it be possible to go into
unmanaged code to get the same information that the built-in assert method
has? Or is there any other way, without calling the built-in assert method,
to get a stack trace?

Thanks,
Eli
 
Hello Eli,

This is a very frequently requested feature. Unfortunately there isn't a
workaround that I know of for current releases, but I can give you a bit
more info as to what is going on.
Exceptions are different from Debug.Assert because the CLR needs to unwind
the stack in order to search for a try/catch combo. Where this gets tricky
is when there is a native/managed code boundary - such as a call to
Application.Run for example. Exceptions actually get re-thrown over this
boundary, so you lose the earlier part of the stack trace.

I'll forward your post on to a PM on the EE team, so he hears the request
once again ;-).

-Katie

This posting is provided "AS IS" with no warranties, and confers no rights.

***.Net Compact Framework Info***
Faq:
http://msdn.microsoft.com/mobility/prodtechinfo/devtools/netcf/FAQ/default.a
spx
QuickStarts: http://samples.gotdotnet.com/quickstart/CompactFramework/
Samples:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnnetcomp/h
tml/CompactfxTechArt.asp

--------------------
| From: "Eli Tucker" <[email protected]>
| Subject: System.Diagnostics.Debug.Assert has stack trace; how do I get to
it?
| Date: Fri, 12 Mar 2004 10:46:31 -0800
| Lines: 14
| X-Priority: 3
| X-MSMail-Priority: Normal
| X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
| Message-ID: <[email protected]>
| Newsgroups: microsoft.public.dotnet.framework.compactframework
| NNTP-Posting-Host: 63.229.139.19
| Path:
cpmsftngxa06.phx.gbl!cpmsftngxa10.phx.gbl!TK2MSFTNGXA05.phx.gbl!TK2MSFTNGP08
.phx.gbl!tk2msftngp13.phx.gbl
| Xref: cpmsftngxa06.phx.gbl
microsoft.public.dotnet.framework.compactframework:48430
| X-Tomcat-NG: microsoft.public.dotnet.framework.compactframework
|
| Hello.
|
| I've noticed that if I call System.Diagnostics.Debug.Assert( false ), I'll
| see a stack trace. I'm acutely aware that exceptions in the compact
| framework do not contain stack trace information, but I'm wondering how
the
| Assert method gets this information. Would it be possible to go into
| unmanaged code to get the same information that the built-in assert method
| has? Or is there any other way, without calling the built-in assert
method,
| to get a stack trace?
|
| Thanks,
| Eli
|
|
|
 
Back
Top