473,944 Members | 1,830 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Stacktrace constructor hangs

Hello,

I have a line code : StackTrace stackTrace = new StackTrace(fals e);
When I run the project in debug, the application keeps hanging on this line.

My Environment:
Windows 2003 Server Standard SP1
Visual Studio 2003 SP1

Any help is welcome

Kurt Biesemans
Nov 17 '05 #1
3 1967
Kurt Biesemans <Ku************ @KubiSoft.biz> wrote:
I have a line code : StackTrace stackTrace = new StackTrace(fals e);
When I run the project in debug, the application keeps hanging on this line.

My Environment:
Windows 2003 Server Standard SP1
Visual Studio 2003 SP1

Any help is welcome


Could you post a short but complete program which demonstrates the
problem?

See http://www.pobox.com/~skeet/csharp/complete.html for details of
what I mean by that.

--
Jon Skeet - <sk***@pobox.co m>
http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too
Nov 17 '05 #2
Hi John,

I made a simple application that executes the specific line that hangs.

My application exists of 2 classes.

FIRST CLASS: Name = MAIN.CS

using System;

namespace StackTraceTest

{

public class MainClass

{

[STAThread]

static void Main()

{

Processing processingClass = new Processing();

Console.WriteLi ne("BEFORE CALL TO PROCESSING");

processingClass .CreateStackTra ce();

Console.WriteLi ne("AFTER CALL TO PROCESSING");

}

}

}

SECOND CLASS: Name = Processing.cs

using System;

using System.Reflecti on;

using System.Diagnost ics;

namespace StackTraceTest

{

public class Processing

{

public Processing()

{

}

public void CreateStackTrac e()

{

Console.WriteLi ne("BEFORE CREATION OF STACKTRACE");

StackTrace stackTrace = new StackTrace(fals e);

Console.WriteLi ne("AFTER CREATION OF STACKTRACE");

int stackOffset = GetCallerStackO ffset(stackTrac e);

StackFrame stackFrame = stackTrace.GetF rame(stackOffse t);

int callerOffset = stackTrace.Fram eCount - stackOffset;

}

private int GetCallerStackO ffset(StackTrac e pStackTrace)

{

int stackOffset = 0;

// Lookup for the method of the object speaker caller.

while (stackOffset < pStackTrace.Fra meCount)

{

// Collect information from the call stack.

Type speakerObject = this.GetType(). BaseType;

StackFrame stackFrame = pStackTrace.Get Frame(stackOffs et);

MethodBase stackMethod = stackFrame.GetM ethod();

// Evaluate if the method belongq to the abstract object speaker.

if (stackMethod.De claringType == speakerObject)

{

stackOffset++;

continue;

}

// Evaluate if the method belongq to a specific object speaker.

if (stackMethod.De claringType.Bas eType == speakerObject)

{

stackOffset++;

continue;

}

// The method does not belong to an object speaker.

break;

}

// Provide the stack offset of the caller method.

return(stackOff set);

}

}

}

Please let me know if you need more info.

Kurt

"Jon Skeet [C# MVP]" <sk***@pobox.co m> wrote in message
news:MP******** *************** *@msnews.micros oft.com...
Kurt Biesemans <Ku************ @KubiSoft.biz> wrote:
I have a line code : StackTrace stackTrace = new StackTrace(fals e);
When I run the project in debug, the application keeps hanging on this
line.

My Environment:
Windows 2003 Server Standard SP1
Visual Studio 2003 SP1

Any help is welcome


Could you post a short but complete program which demonstrates the
problem?

See http://www.pobox.com/~skeet/csharp/complete.html for details of
what I mean by that.

--
Jon Skeet - <sk***@pobox.co m>
http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too

Nov 17 '05 #3
Kurt Biesemans <Ku************ @KubiSoft.biz> wrote:
I made a simple application that executes the specific line that hangs.


<snip>

Hmm... and it hangs on your box? It works fine on mine, I'm afraid...

--
Jon Skeet - <sk***@pobox.co m>
http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too
Nov 17 '05 #4

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

Similar topics

0
279
by: Robert Phillips | last post by:
I can successfully place a StackTrace object a MSMQ queue, but when trying to retrieve it, the call to Message.Body hangs and doesn't return. Strings and my custom objects work fine. I assumed StackTrace would work since it is Serializable. Any insight appreciated.
0
2543
by: MTK | last post by:
My application hangs at times when creating an instance of the Systems.Diagnostics.Stacktrace. StackTrace st = new StackTrace(true); This doesnt happen all the time, just once in many days. Has anyone come across this? Cheers, MTK.
4
4416
by: Barry Mossman | last post by:
Hi, I am throwing an exception derived from ApplicationException as follows catch (Exception ex) { throw new MyException("message", ex); } My exception's constructor is: public ExceptionBase(string aMessage, Exception aInnerException): base(aMessage, aInnerException)
2
374
by: norvinl | last post by:
Hi, I have a textbox on a form. When I assign a string to the .Text property while in my form's constructor, the program just hangs indefinitely. Alternatively, if I assign the string to the form's .Text property, it works fine. this code hangs (never returns from 3rd line):
4
1281
by: Tom Shelton | last post by:
Problem: XmlTextReader Constructor hangs until underlying socket closes when passed a NetworkStream. Example: Dim reader As New XmlTextReader (New NetworkStream(s, False)) I can positively confirm by the way that this only happens AFTER installation of SP1 for framework 1.1. So, has anyone else have this
2
1772
by: Adam Clauss | last post by:
There is a StackTrace constructor that can take a target thread. This requires that the target thread be Suspended. However, the Suspend() method of Thread is now deprecated. Is there an alternative? -- Adam Clauss
7
2162
by: Morgan Cheng | last post by:
In the book *Programming C#* 4th editionby Jesse Liberty, it reads "Actually, the CLR guarantees to start running the static constructor before anything else is done with your class. However, it only guarantees to *start* running the static constructor; it doesn't actually guarantee to *finish* running it." Page 82, Chap 4 Classes and Objects. If it is true, then it is possible that some static fields are not initialized (by static...
3
1710
by: rani.yaroshinski | last post by:
Hi all, The Stacktrace class (system.diagnostic) in CLR 2.0 (Framework 2.0), still offers a constructor to allow showing the stack-trace of another thread. However, the usage involves suspending the diagnosted thread. Now, CLR 2.0 turns the Suspend method into obsolete, which leaves the above quite impossible/useless (it is still possible in theory, cause you can use obsolete methods).
1
4828
by: lesani | last post by:
hi, i want to find out stacktrace of a thread that is only have its thread id (which have created in vc++ project), i can find processthread by searching in ids of System.Diagnostics.Process.GetCurrentProcess().Threads but how can find stacktrace while stacktrace constructor only accept system.threading.thread but not system.diagnostics.processthread? tanx
0
10145
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
11545
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
10673
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9868
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
8236
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
7397
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
6090
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4920
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
4516
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.