It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 12 years ago.
I have a multithreaded code which is hang in some case. I want to know what's the recommended way to debug?
When it hangs, you can attach the debugger and inspect thread state, including callstacks, to your heart's content. Often there will be one (or more) thread(s) that is (are) in a wait state, and you might be able to work out why that is.
If the state is not self-explanatory at the time of the hang, you can resort to techniques suggested to provide context information for the preceding program flow.
Because it is multi-threaded, you can't debug such as setting breakpoints, trace the statements and pause to see the values of the variables. The only way in my opinion is to print to the console and see the status from there.
Related
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 9 years ago.
Question:
Is it possible to start a web project application in my current solution without debugger (keycombo: Ctrl+F5) through a codeline?
thanks in advance
You can add
System.Diagnostics.Debugger.Launch();
In your code to debug.
The method KuldipMCA given is great, it can start debugger every time this code is executed.
And there are another way, add an Assert into your code, this can enable you to attach debugger with some condition control. Such as:
//This will trigger an assert when the condition is false
System.Diagnostics.Debug.Assert(obj != null);
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 9 years ago.
After learning about state machines, I want to place it in every class of my code. That's a great pleasure for me to declaratively (or "fluently") construct a machine, handle events and be sure that any logic violation will throw an exception.
Can you please critisize me on this practice? Or, may be, you install Stateless package habitually for each project (like I do)?
Any examples of state machines overusing?
Whilst design-patterns are very good practice, you should be cutting code to solve a particular problem that potentially will use a design-pattern to solve that problem in a tried-and-tested manner.
We do not write code from a "let's use this design-pattern" perspective because a single design-pattern is not a one-size fits all solution!
Do not write all your code around the state machine idiom. It will make many simple tasks over-complicated and difficult to maintain.
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 10 years ago.
I need to read the contents of a browser window from a console application in C#.
What is the best way to do it.
I'm trying to use Automation UI (by capturing process of the browser and creating a AutomationElement of that process) but since I'm very new to this concept. I don't know where to begin from.
I understand what you are trying to accomplish but please be also noting that AutomationElement works only with some browsers, not all, among which Opera is to be shot down first.
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 11 years ago.
I'm particularly interested in some Visual Studio plugins (or maybe built-in functionality I don't know of) that can help me with that...
You can do this with perfmon - can I suggest you read this article on MSDN magazine that describes auditing memory in detail:
http://msdn.microsoft.com/en-us/magazine/dd882521.aspx
Good luck!
System.Process has a lot of properties you can use to analyse memory usage.
You can get a handle on the current process like this Process.GetCurrentProcess() or another process using one the Process.GetProcessXXX(..) methods
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 11 years ago.
I get that mistake.. I use a loop to run through a bunch of images to be drawn..I also use multithreading..
What could cause that problem and how could it be prevented?
I use winforms
Additional information:
it tells me if i use graphics after GetHDv method, call the ReleaseHDC method..
What does it mean?
section of the code:
A thread created like this:
Before I did this:
BackgroundWorker1.RunWorkerAsync();
Now I am testing with this:
Backgroundworker back=new backgroundworker();
back.runworkerAsync();
is that the root of the exception?
According to this page
What's really happening with "Object is currently in use elsewhere" is
that GDI+ is complaining that the device context (DC) that it is
trying to use is already "in use". With WinForms, this generally
means there is a recursive Graphics.GetHdc occurring. GetHdc must
match a ReleaseHdc before any other GetHdc.
And
You can encounter this exception if you're drawing to a form from
multiple threads. You'll likely also be encountering a
cross-threading exception as well. The solution in this case is to
not use multiple threads when accessing a form, including drawing.