Hi to all,
i have the following 2 queries which i'm still in the dark, even after google'ing all around the web!
1)Is there a way how i can go to a windows form control while application is running in debug mode..example:application is running and i have a datetimpicker and i go dirctly to whre its properties & vents are being set. The program forms are built with telerik and in most of the forms i don't have access direclty to the designer!
2)Is it possibile to have a method that calls another method and if the method from which is called is Method 1 all code executes and if called from Method 2 only part of the method executes??
Any help is greatly appreciated..
Thanks
6 Replies - 150 Views - Last Post: 06 February 2012 - 06:54 PM
Topic Sponsor:
#1
debug app while running+calling a method from another method
Posted 06 February 2012 - 03:41 PM
Replies To: debug app while running+calling a method from another method
#2
Re: debug app while running+calling a method from another method
Posted 06 February 2012 - 03:53 PM
For your first question. see the debugging question FAQ 2
For your second question...
.. haven only part of a method execute... Sure. Send in a parameter and use it for an 'if' condition
rookie What this shows us is that you aren't familiar with breakpoints and how to debug your own code.Learning to debug one's own code is an essential skill. Sadly, one that apparently no college course teaches. Silly if you ask me.
Placing breakpoints and walking through the code line by line allows you to actually WATCH it execute. Visualizing what your code does will let you see why it behaves the way it does.
It would be well worth your time to do the tutorials on FAQ 2. A couple hours learning this skill will save you hundreds of hours of confusion in one project alone.
TOP most asked:
What does this error message mean?
FAQ 2: How do I debug
FAQ 3: How do I make Form1 talk to Form2
FAQ (Frequently Asked Questions - Updated Jan 2012
For your second question...
.. haven only part of a method execute... Sure. Send in a parameter and use it for an 'if' condition
void method2(bool DoFirstPart)
{
if (DoFirstPart)
{
// Some stuff
}
}
rookie What this shows us is that you aren't familiar with breakpoints and how to debug your own code.Learning to debug one's own code is an essential skill. Sadly, one that apparently no college course teaches. Silly if you ask me.
Placing breakpoints and walking through the code line by line allows you to actually WATCH it execute. Visualizing what your code does will let you see why it behaves the way it does.
It would be well worth your time to do the tutorials on FAQ 2. A couple hours learning this skill will save you hundreds of hours of confusion in one project alone.
TOP most asked:
What does this error message mean?
FAQ 2: How do I debug
FAQ 3: How do I make Form1 talk to Form2
FAQ (Frequently Asked Questions - Updated Jan 2012
Spoiler
#3
Re: debug app while running+calling a method from another method
Posted 06 February 2012 - 03:55 PM
Okay, I don't know how to answer number 1, but for number 2. Try making a bool type that changes to true/false after a certain piece of Method 1 is run, so maybe at the end. And in Method 2 try making a condition for executing the second half of the code that only runs if the bool is a true or something like that.
#4
Re: debug app while running+calling a method from another method
Posted 06 February 2012 - 04:02 PM
If Telerik didn't include PDBs, you won't be able to debug into their DLLs. You could catch errors happening there, but you can't step into their code, because the code doesn't exist on your machine. It's compiled into IL.
As to the second, it's possible to use Diagnostics/Reflection to determine the name of the calling method via the Stack Trace. However, I'd avoid it if possible. Here's the way you'd do that:
Notice I'm getting Frame 1 of the stack trace. Frame 0 is the currently executing method. Frame 1 is the first caller. You can go deeper, assuming that you're that deep in the stack.
However, I'd suggest you use another parameter instead of this.
As to the second, it's possible to use Diagnostics/Reflection to determine the name of the calling method via the Stack Trace. However, I'd avoid it if possible. Here's the way you'd do that:
using System.Diagnostics
...
static void Main(string[] args) {
Method1();
Console.ReadKey();
}
static void Method1() {
Method2();
}
static void Method2() {
var trace = new StackTrace();
var frame = trace.GetFrame(1);
var method = frame.GetMethod();
var name = method.Name;
Console.WriteLine(name);
}
//prints: Method1
Notice I'm getting Frame 1 of the stack trace. Frame 0 is the currently executing method. Frame 1 is the first caller. You can go deeper, assuming that you're that deep in the stack.
However, I'd suggest you use another parameter instead of this.
#5
Re: debug app while running+calling a method from another method
Posted 06 February 2012 - 05:04 PM
Seeing as the controls are part of a commercial product, why do you think you've discovered a bug within it?
Or are you trying to reverse engineer their source code?
Or are you trying to reverse engineer their source code?
#6
Re: debug app while running+calling a method from another method
Posted 06 February 2012 - 06:51 PM
Well, to the first question, that's not unheard of. I discovered a bug in a DevExpress control, and reported it. They patched it and released an update. Nice of them.
#7
Re: debug app while running+calling a method from another method
Posted 06 February 2012 - 06:54 PM
True. They do exist. They do get found and reported and fixed by the maker. Honestly, I'm not expecting a rookie coder to find a bug in a control that has been out for some time, that hasn't yet been reported.
Page 1 of 1
|
|

New Topic/Question
Reply




MultiQuote





|