Netduino home hardware projects downloads community

Jump to content


The Netduino forums have been replaced by new forums at community.wildernesslabs.co. This site has been preserved for archival purposes only and the ability to make new accounts or posts has been turned off.
Photo

Drilling down to the StackFrame


  • Please log in to reply
2 replies to this topic

#1 Bendage

Bendage

    Advanced Member

  • Members
  • PipPipPip
  • 153 posts
  • LocationIrvine, CA

Posted 26 January 2012 - 05:28 AM

In the .Net Framework I have made a method for logging purposes in that the called method is able to determine who (what class/method) called it... // Get Log Stage string stage = ""; try { System.Diagnostics.StackFrame stackFrame; System.Reflection.MethodBase stackFrameMethod; string typeName; stackFrame = new System.Diagnostics.StackFrame(1, true); stackFrameMethod = stackFrame.GetMethod(); typeName = stackFrameMethod.ReflectedType.FullName; if (typeName.Trim().Length == 0) typeName = "Unknown"; if (typeName.IndexOf(".") > -1) { typeName = typeName.Substring(typeName.LastIndexOf(".") + 1); } stage = typeName + ":" + stackFrameMethod.Name; } catch (Exception expTrace) { Debug.WriteLine("Could not obtain log stage from stack. " + expTrace.Message); stage = "Unknown"; } I noticed in the micro framework that System.Diagnostics does not contain the StackFrame class. Perhaps it was placed somewhere else? Perhaps there is another way a method can determine the calling method?

#2 Novice Alex

Novice Alex

    Advanced Member

  • Members
  • PipPipPip
  • 59 posts

Posted 04 August 2012 - 03:35 PM

Hi Bendage, Have you managed to find the solution to your above problem? Care to shared? Thanks in advance.

#3 Bendage

Bendage

    Advanced Member

  • Members
  • PipPipPip
  • 153 posts
  • LocationIrvine, CA

Posted 09 August 2012 - 05:46 PM

Hi Bendage,

Have you managed to find the solution to your above problem?
Care to shared?

Thanks in advance.


Hi,

Unfortunately, the Micro Framework does not provide such methods. It is not currently possible.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

home    hardware    projects    downloads    community    where to buy    contact Copyright © 2016 Wilderness Labs Inc.  |  Legal   |   CC BY-SA
This webpage is licensed under a Creative Commons Attribution-ShareAlike License.