Environment.StackTrace Functionality

  • Thread starter Thread starter Rich Hanbidge MSFT
  • Start date Start date
R

Rich Hanbidge MSFT

Hello,
Is there a way in the Compact Framework to access the callstack/stacktrace
of the currently executing thread? I'd like to simulate what
Environment.StackTrace does.

Cheers!

Rich
 
The StackTrace is only accessible from a thrown exception (and only from
..NETCF 2.0 and later). Alternatively you can view the stacktrace on screen
using the Debug.Fail dialog.

Peter

--
Peter Foot
Microsoft Device Application Development MVP
peterfoot.net | appamundi.com | inthehand.com
APPA Mundi Ltd - Software Solutions for a Mobile World
In The Hand Ltd - .NET Components for Mobility
 
Hi Peter,
Thanks for the quick response!
What I'm trying to do is find the namespace of the calling method. If you
have any creative ideas, please let me know. It's no biggie though, we can
live without the functionality.

Cheers!
 
Depending on your need (basically if slowness matters) you can always throw
an exception inside a try/catch to get the stack trace in the catch block
and then just move on afterward. It works, but the perf sucks.

-Chris
 
Back
Top