Hi all,
I have a small piece of code to use StackFrame to GetMethod, I found it is
inconsistent in Debug version and Release version, is there anything I am
doing wrong?
Here is code, build in Debug and Release version, you will get different
results.
My env. is VS 2005 on XP with SP2.
Thanks in advanced.
HCF
---------------------------------------------------
using System;
using System.Diagnostics;
using System.Reflection;
class Example
{
private static string GenerateFuncName()
{
StackFrame sf = new StackFrame(2);
MethodBase mb = sf.GetMethod();
if ( mb != null )
return mb.DeclaringType.Name + "." + mb.Name;
else
return "Unknown FuncName";
}
private static string getInfo()
{
string info = GenerateFuncName();
return info;
}
static void Main()
{
Console.WriteLine(getInfo());
return;
}
}