|
Hi Judah, thanks but no what I'm after is a data breakpoint, one that isn't set on any line of code. Like I enjoyed with c++ for many years. I.E. I have a business object with an "IsDirty" property, somewhere in a mountain of code something is setting one of it's properties which in turn is flagging it as dirty and I want to find out where that is happening. In the c++ days I could set a data breakpoint on the condition that IsDirty=true. The code would break when that condition happened irrespective of any particular line of code.
|
|
|
|
|
I didn't know you could do that in c++, but it makes sense, as a memory location for a variable would not change. This is not so in C#. What you could do, is hide your data behind a property and set a breakpoint in the setter.
Christian Graus - C++ MVP
'Why don't we jump on a fad that hasn't already been widely discredited ?' - Dilbert
|
|
|
|
|
Unfortunately there is no single property to set it on, it's a complex business object with sub objects and dozens of properties. All I have to go on is an isdirty flag that is set by any of those properties being set different than how they were when it was loaded / created, but that property is buried several levels below in the business object framework itself of which I don't have the code in my main project. I figured out the source of the problem anyway since then, but I was surprised that such a useful feature doesn't exist in c#.
Maybe there's an article in there somewhere down the road.
|
|
|
|
|
No, no, no.... Wrap the IsDirty in a Property, then set a breakpoint in the setter of that prop. WHen the code stops, you can look at the call stack to see the line of execution that got you there.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
I see what you mean, it's a good idea in most cases, but it would be too disruptive to my project (besides which I already found the culprit some time ago) because isdirty is already a property that is based on, in turn, the isdirty properties of all the sub objects which are many layers deep and in turn have their base isdirty variable buried in the lowest level of the business object framework which is in another solution entirely because it's all just too big to be practical in one solution (This particular object I was debugging is a complex object with children and grandchildren, part of an asp.net UI layer based on a business object layer in turn based on a generic business framework layer plus). I could do it with some re-arrangement but it would sure be nice if I could set a data breakpoint on the root level isdirty change to true then track back down from there.
It's a massive released application, I'm not touching a thing below the UI level at this point as it's all tested and production code with a *lot* of code sitting on top of it.
Good suggestion though, thank you.
|
|
|
|
|
John Cardinal wrote: it would sure be nice if I could set a data breakpoint on the root level isdirty change to true then track back down from there.
How about changing the top level object's IsDirty property to a method and setting a code breakpoint there?
/ravi
|
|
|
|
|
This is a truly annoying feature in visual studio. Even VB6 gave you the opportunity to break on value changed or on an expression. It has saved me many times in the past, especially if it's someone else's object that is changing and you want to know when that change happens.
|
|
|
|
|
Hi all,
Is there a way to save HTML from, say a WebBrowser (express) COM object automatically--that is, without using the ShowSaveAs function?
Is there another object capable of accessing online information that would have this ability if it's not available with WebBrowser?
Thanks!
|
|
|
|
|
You can cast the DomDocument property of the WebBrowser to the mshtml.IHTMLDocument2 COM interface. From there, you can access the HTML body using the .body property.
|
|
|
|
|
hello
i need to know how i can i write a code to take a pic with a webcam writting a code for it in C++ then save it as bitmap then read it in a code to compare it to as same pic about with nothing in there??????
please if someone know can u e-mail me at Bagleyst@aol.com
thanks alot
|
|
|
|
|
Dude this is the C# board, not the C++ board, you've posted in the wrong forum.
Secondly, asking people here to email you directly is a pretty good way to piss off a lot of people who might otherwise answer. Why you ask? Because people here take the time to answer questions not only to help the person who asks but the thousands of others that may come across it in future and have the same question. If you want private support pull out your credit card and phone Microsoft.
|
|
|
|
|
im sorry im just use to put my email that all it cuz i have a project the require me to do that and i can not find how to do that why
so where should i put it??
and once again im sorry if i piss anyone off
|
|
|
|
|
If you scroll up to the top of this page you will see a list of all the programming forums try in the c++ one. You don't need to put an email address, you will be notified when someone answers your question in the forum.
I apologize for being harsh, I've never understood why people ask questions here and then at the bottom tell people to reply to them directly by email and I get a lot of emails directly from people about my articles instead of asking in the article message board which annoys me completely. It's probably only pissed me off, just re-ask your question in the correct message board and someone will answer it if they can there.
|
|
|
|
|
thanks alot it ok i understand
|
|
|
|
|
Hi all,
I would like to do a database testing, like testing the Stored procedures. Could anyone guide me?
|
|
|
|
|
Roy Osherove's got a great free project, XTUnit[^] that provides a way to unit test database access (stored procedures, views, etc.) and still rollback any changes made during the unit test.
|
|
|
|
|
|
Hi,
I have not done StackTrace stuff like that, but here are some facts and ideas:
1)
the documentation says "If a StackTrace is created with a target thread that is not the
current thread, the target thread must first be suspended"
Well, suspending the UI thread is not a good idea (if it is all possible); and I would
not be surprised if you would fail to suspend it when your app is "Not Responding".
Anyway it sounds like a bad idea if you already have UI problems...
2)
AFAIK the "Not Responding" mechanism is as follows: Windows kernel periodically sends a special
WM_xxx command to each application, and expects a return message within a short delay
(similar to the ping protocol over a network). Normally that message gets handled by the
message pump (normally the UI thread), unless the app is too busy (long calculation
on UI thread), is waiting on something, or hangs in any other way.
3)
This also means I cannot predict the ThreadState of your UI thread.
4)
Thread priorities:
if your app uses multiple threads, carefully choose their priority; at or below normal
should not pose problems; above normal should be used carefully, and real-time is to
be avoided (except for short and very specific loop- and wait-free code).
Rationale: when two threads are ready to run, Windows would allot most CPU cycles to
the highest priority one, and some CPU cycles to the lower priority one too, but if that
is the UI thread you would call it unacceptable responsiveness. (And I expect this to
be even worse on a Windows Server OS).
A real-time thread would consume all CPU cycles.
5)
sometimes a small UI problem can be solved by including some
Application.DoEvents(); statements inside a busy loop. I am not sure this is a clean
solution, but it occassionally improves the UI behavior.
6)
My advise: try one or more of the following:
- watch the Task Manager's "Performance" tab while your app is, if possible, the only one
really running. If CPU load is high, it looks like either real calculation, or a polling
loop that lacks a delay; if they are in the UI thread, they should be moved in another thread;
if they occur in a higher priority thread, they would severely reduce UI responsiveness.
- use some other observation tool (e.g. "task info", not part of Windows) that can give you
an indication of CPU load per thread; although identifying threads within a process is
not easy, I expect the UI thread to be the first (or one of the first).
- run your app inside Visual Studio, pref. in debug mode, and pause the app while the
non-responsiveness begins; if this brings up a source file (or a useful call stack)
that is the suspect code.
- if you can find the code that causes the problem:
if it is real calculations, they must move to another thread, with a priority at or
below normal; if it is a wait (anything that blocks or could block), it does not belong
in the UI thread. The UI thread should never block ! (I know this is not easy, it also
means it should not lock).
Hope this helps
Luc Pattyn
|
|
|
|
|
Hi
I've got a problem...
I developed a program taht downloads the sourcecode of a website and checks it for a special string (a picture-name in my case).
I'm using this to download the website:
WebClient client1 = new WebClient(); <br />
client1.DownloadFile("http://" + lVsm.CheckedItems[i].ToString() + ".xxxxxx.xxxxxxx.de", Application.ExecutablePath + "/temp.txt");
In the second line the framework tells me "URI formats are not supported".
I already tried a stream but it didn't help.
|
|
|
|
|
What is lVsm.CheckedItems[i] ? What data type is it? What value does it contain? Does converting it to a string result in a meningful value?
---
single minded; short sighted; long gone;
|
|
|
|
|
When a single but complex line fails, the first attempt to understand it is
to split the line and look at the intermediate values, like so:
string s1="http://" + lVsm.CheckedItems[i].ToString() + ".xxxxxx.xxxxxxx.de";
string s2=Application.ExecutablePath + "/temp.txt";
Console.WriteLine("s1="+s1);
Console.WriteLine("s2="+s2);
client1.DownloadFile(s1, s2);
Chances are you will immediately see what is wrong.
If not, include the output in your post.
Luc Pattyn
|
|
|
|
|
hi,
i was using to conver a string into HttpUtility.UrlEncodeUnicode("string value"), its working fine web application, but when i tried to run in windows forms application , it says httputility does nt exist in current context, i m using this format in crawling.
please need quick help.
many thanks, adnan
|
|
|
|
|
The .NET classes reside in many namespaces; most namespaces need to be added
(add reference) and declared (using ... at the top of your files).
Visual Studio will add some references and some using statements, depending on
the type of project you create. But you can always add to them, so find out what
it is you need, either by reading the documentation on the classes you are
interested in, or by looking at another project that uses them and does compile.
Luc Pattyn
|
|
|
|
|
bundle of thanks, Adnan
|
|
|
|
|
Please do remember to use the HttpUtility class, you need IIS running, ie. you need a webserver. your windows application may not have this as prerequisite as happens in most cases.
So this is not a good class to use in Windows application.
Pradipta Basu
|
|
|
|