I'm trying to get the line number and file name of an exception when it is thrown for my app built on the .net Compact Framework. I know that StackTrace
objects were left out of .netCF, but I wonder if there is an alternative. Searching google only brought up issues from back in 2005 or earlier, so I wonder if there has been any advanc开发者_JS百科ements made in the past 6 years.
Thanks!
The line number and file name are not available in the Compact Framework's stack trace in version 1.0, 2.0, or 3.5. Not sure about 3.7 (the underpinnings of Phone), but I doubt it's there either.
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.
I believe if you find nothing else, just assume nothing new was done afterwards.
Anyway if you need to access the stack trace from a catch block you do have the exception object so it should be ok...
精彩评论