I used the following code to get the name of the source code's file
StackTrace trace = new StackTrace(true);
string fileName = string.Empty;
foreach (var frame in trace.GetFrames())
{
string fileToCheck = frame.GetFileName();
if (someLogicToCheckTheSuitableFile())
{
fileName = fileToCheck;
break;
}
}
When I ran it at my local server, it worked well. But when I tried it at my linux server, the function "GetFileName" always returns null. Can somebody give me an advice?