473,666 Members | 2,157 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

StackFrame GetFileName and GetFileLineNumb er empty - sometimes

I've seen some other posts referring to this problem, but didn't find
any solutions.

We're trying to log a call stack when we have a problem, using the
StackTrace and StackFrame classes in C#. They are created via new
StackTrace(true ) to get the debugging info and trace.GetFrame( i). Our
classes are all compiled Debug. What we find is, even though the IDE
debugger knows the line numbers of all the methods, when we walk the
stack trace in our code, some of our methods' frames have GetFileName()
returning null and GetFileLineNumb er() returning zero. Yet for other
frames it knows both values.

What would prevent these fields from being filled in for an assembly
built Debug?

How does the debugger know the line number when StackTrace doesn't?

Nov 16 '05 #1
1 6117
The frames which don't have the line number filled in belong to a type
which has some properties and methods marked [CLSCompliant(fa lse)],
although none of those are actually on the stack at this time. Would
the presence of that attribute anywhere in the type prevent
StackTrace/StackFrame from getting line number information for any
method in that type?

Nov 16 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

13
3393
by: Mikko Ohtamaa | last post by:
From XML specification: The representation of an empty element is either a start-tag immediately followed by an end-tag, or an empty-element tag. (This means that <foo></foo> is equal to <foo/>) From XHTML specification:
2
3908
by: Avinash | last post by:
Hi, I am facing problem with the use of the stackframe and stacktrace for the exception hadling with Windows service. Can any one please tell me how to use of the above objects (stackframe and stacktrace ) in Window service. Thanks and regards, Avinash.
2
2509
by: scottrm | last post by:
I am using StackFrame class to retrieve File Name and File Line number for printing out into the debug file. Everything is working under Debug build. However StackFrame doesn't capture File Name and File Line Info in release build. Is there anyway or any class which can be used as an alternative? see this link for more info
0
1466
by: Ben Fidge | last post by:
Hi When my ASP.NET application traps an exception, it's details and the call stack are written to a log, but for some reason, StackFrame.GetFileName() always returns null. This is when running in debug mode too. Any info gratefully received, Ben
3
1438
by: Joe Rattz | last post by:
Moved some asp.net code using StackFrame (built in debug mode) to a Windows Server 2003 box and get empty filename and filelinenumber back. Anyone know why? Works just fine on Win2k.
2
3345
by: HCF_15 | last post by:
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.
2
2680
by: newscorrespondent | last post by:
I have compiled in DEBUG mode but don't get the debug information from StackFrame class. Is there a specific setting I need to use so that information is included for a debug build. Thanks Tom
0
2018
by: Gerrit Beuze | last post by:
Hi all, I'd like to get at the real underlying type when using the EnvDTE.Debugger Currently I do this: EnvDTE.Thread thread = dte.Debugger.CurrentThread; foreach (StackFrame frame in thread.StackFrames) { outputPane.OutputString("\n" + frame.FunctionName + " in " + frame.Module); }
3
1802
by: Ryanivanka | last post by:
hi, is the stackframe in managed code the same as in unmanaged? or they are not related at all.... :) if I use some asm codes (get the esp register or something about stackframe) in a unmanaged c++ DLL, when I import it into a c# managed program, can it work well?
0
8454
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8878
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8785
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8560
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7389
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6200
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4372
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2776
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2012
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.