Solved

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

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Article by: Ivo
C# And Nullable Types Since 2.0 C# has Nullable(T) Generic Structure. The idea behind is to allow value type objects to have null values just like reference types have. This concerns scenarios where not all data sources have values (like a databa…
This article describes a simple method to resize a control at runtime.  It includes ready-to-use source code and a complete sample demonstration application.  We'll also talk about C# Extension Methods. Introduction In one of my applications…
Need to grow your business through quality cloud solutions? With everything required to build a cloud platform and solution, you may feel like the distance between you and the cloud is quite long. Help is here. Spend some time learning about the Con…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

948 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

23 Experts available now in Live!

Get 1:1 Help Now