Solved

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

Posted on 2004-08-09
3
1,601 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
Comment Utility
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
Comment Utility
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
Comment Utility
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

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Email Body 4 45
Duplicate a row 2 28
c# code 19 55
Windows Service to Receive TCP Packets 4 27
This article introduced a TextBox that supports transparent background.   Introduction TextBox is the most widely used control component in GUI design. Most GUI controls do not support transparent background and more or less do not have the…
We all know that functional code is the leg that any good program stands on when it comes right down to it, however, if your program lacks a good user interface your product may not have the appeal needed to keep your customers happy. This issue can…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

728 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now