Solved

.NET Compact Framework -- how to get method name?

Posted on 2004-08-09
3
1,622 Views
Last Modified: 2008-03-17
Situation: When catching errors in a C# .NET Compact Framework, I log the name of the method and what error occured into a SQLCE table for review.  As of now I have to manually enter the name of the method into a string to be saved into the table for later analysis.

So the question is: Using C# and the .NET Compact Framework -- how does one programatically retrieve the current method name?  I know this is possible in regular windows form development within .NET -- but is it even possible in the Compact Framework?
0
Comment
Question by:LanceWLarsen
3 Comments
 
LVL 9

Accepted Solution

by:
s_sansanwal earned 250 total points
ID: 11757926
The current method name during execution could be found by

StackTrace stk = new StackTrace();
StackFrame stf = stk.GetFrame(0);    
string methodName = stf.GetMethod().Name;


Unfortunately, the Compact Framework doesn't expose the StackTrace class so it looks like this won't be possible for WINCE.NET

Cheers,
S Sansanwal

0
 
LVL 7

Expert Comment

by:psdavis
ID: 11762287
One of the best resources for .Net compact framework is at www.opennetcf.org

I just searched their website and found nothing for StackTrace

http://www.opennetcf.org/forums/topic.asp?TOPIC_ID=2648&SearchTerms=StackTrace
0
 

Author Comment

by:LanceWLarsen
ID: 11925404
Well -- was hoping the someone from MS or elsewhere would intercede and let us know a back way into the StackTrace -- but alas it is not to be.  Thanks tons for the knowledge that it isn't possible in the current framework -- keeps me from searching endlessly...

Regards...

...Lance W. Larsen
www.lancelarsen.com
0

Featured Post

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In order to hide the "ugly" records selectors (triangles) in the rowheaders, here are some suggestions. Microsoft doesn't have a direct method/property to do it. You can only hide the rowheader column. First solution, the easy way The first sol…
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

775 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question