Solved

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

Posted on 2004-08-09
3
1,662 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

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…
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.
Come and listen to Percona CEO Peter Zaitsev discuss what’s new in Percona open source software, including Percona Server for MySQL (https://www.percona.com/software/mysql-database/percona-server) and MongoDB (https://www.percona.com/software/mongo-…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

734 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