|
Thanks Luc,
1.
Luc Pattyn wrote: 2. it does not map easily to the thread IDs as can be seen from other tools, such as
Task Manager, SystemInfo, etc.
Because Task Manager will use a different ID? And ManagedThreadId is just CLR internal thread ID?
2.
What do you mean this before?
--------------------
As a consequence, there is simply NO WAY to identify your threads; not by name (Windows
does not know about thread names), and not easily by thread IDs, they are confusing
at the least.
--------------------
Why no way? I think you mentioned in last post ManagedThreadId is ok to identify -- "ManagedThreadId is fine for identifying threads within .NET"?
regards,
George
|
|
|
|
|
Hi George,
I found no easy way to relate ManagedThreadID inside a .NET app to the Thread IDs listed
by kernel-level tools such as Task Manager, SystemInfo, etc. That makes it hard to
observe multi-threading behavior unless you build a lot of code into the app itself.
|
|
|
|
|
Thanks Luc,
--------------------
As a consequence, there is simply NO WAY to identify your threads; not by name (Windows
does not know about thread names), and not easily by thread IDs, they are confusing
at the least.
What you can do is catch the managed thread ID when the thread gets created,
attach a thread name to it (using a Hashtable/Dictionary), then keep track of your
threads by asking them their ID, and look up the thread name you assigned earlier.
But that is a rather clumsy workaround for a lernel shortcoming.
--------------------
So, you think the same is the same in TaskManager and in the .Net App -- even if the ID are not the same? And you use name to link the relationship between them?
regards,
George
|
|
|
|
|
Hi George,
no
1. I have no way to link managedThreadID (inside app) to kernel thread ID (tools outside app).
2. I use names to log threads, not IDs, to get a human readable log.
|
|
|
|
|
Thanks Luc!
Anyway, using ManagedThreadId is enough for my requirement, right?
(I quote my requirement again here)
--------------------
My application is pure C# application, and I want to dump thread ID to detect the behavior of each thread, so that I can find deadlock/re-entrance/how many times a thread enters a specific method, something like this.
After reading document, I am confused whether I can use ManagedThreadId property, my concern is for example, whether two threads will map to the same ManagedThreadId, so that the monitor is not accurate to serve my purpose.
--------------------
regards,
George
|
|
|
|
|
Hi George
yes
and different Threads will have different ManagedThreadId.
|
|
|
|
|
Thanks Luc,
Question answered. Always happy to learn from you.
regards,
George
|
|
|
|
|
You're welcome.
|
|
|
|
|
|
Hi Luc,
Sorry for interruption again. I am thinking your thread ID and name matching solution. My concern is if you use thread pool to execute a task a couple of times, CLR may choose different thread to execute, which have different thread ID. How do you match in this situation -- to find thread name by thread ID?
regards,
George
|
|
|
|
|
Hi George,
1.
I typically don't use ThreadPool because IMO it does not offer sufficient control.
2.
If you were to use reusable threads (as in ThreadPool) you would have to remove the
(ID,name) pair from the hashtable/dictionary as soon as the thread is done doing the
action with that name. (You would have to lock the dictionary to do this properly!).
|
|
|
|
|
You are so smart, Luc!
regards,
George
|
|
|
|
|
Guys,
I have used Visual Studio 2008 to create my Word Addin using VSTO (Visual Studio Tools for Office). Right now the Addin consists of a ribbon with a nested group containing with two text boxes and a button.
I need to access these three objects in two different ways, a word macro and using JS ActiveXObject.
After accessing them I need to assign values to the text boxes and execute the button.
Can some one please give me advise on how I can do this or point me to the right direction.
Thanks in advance,
Shrini
|
|
|
|
|
I have a checkboxlist with different items. I have a comma separated values field that I need to bind to this cbl. The cbl is in a detailsview. I know that I need to loop through the dataset rows so each record in the detailsview is bound with the correct information, however I have only figured out how to bind the first row in the dataset for every record in the detailsview. I know I need to loop through the dataset but am not sure how to do it at the same time as looping through the rows in the detailsview. This below function is called onDataBinding. Can anyone assist?
Thanks in advance!
public void FillControls()
{
int intSN = Convert.ToInt32(Request.QueryString["LookUp"].ToString());
Selections db = new Selections();
DataSet ds = db.Services(intSNo);
int iCount = ds.Tables[0].Rows.Count;
if (iCount != 0)
{
if (dvGetMoreData.CurrentMode != DetailsViewMode.Insert)
{
FillMultipleCheckboxesWithValue((CheckBoxList)dvGetMoreData.FindControl("cblSvcs"), ds.Tables[0].Rows[0]["Services"].ToString());
}
}
}
~Candi
|
|
|
|
|
You maybe have better luck in the ASP.NET forum.
|
|
|
|
|
Hello,
I'am strugling with the following. In my .net 2 c# application i'am using the errorprovider to validate my form. On my form there is a tabstrip and all of the tabcontainers have their own controls. Basicly one form has one save button, now my problem is the following when i wan't to validate my form it validates also controls on the other tabpages. I've tried the extende errorprovider from Microsoft nut that one didn't work on usercontrols with valaidationcontrols.
Is there an solution form the problem described above?
Kind regards,
Wilbert
|
|
|
|
|
Hello...
My name is Henry Javier I study Engineering systems...
I need create an application for disabled keyboard and mouse...
please help me, this application is homework...
Excuse me my english is very bad... I speak spanish
thanks
Hola a todos...
Necesito hacer una aplicacion la cual pueda deshabilitar el teclado y el mouse...
ayudenme porfavor es una tarea de mi universidad...
gracias
|
|
|
|
|
If you mean system wide you could use Keyboard/Mouse hooks (google for these and check out www.pinvoke.net) but your users will hate you! I'd seriously reconsider.
If you mean for your application, set e.handled to true for the various events that may be fired???
Dave
|
|
|
|
|
, rew w rt wt w w wtr utw wt wre wer erw trwh sa uaedfu tu t434u44 4wuhutqwu wquqwttwqeut wqututwt
|
|
|
|
|
It's really tough, which algorithm did you use to encrypt?
|
|
|
|
|
|
My ability to google and comprehend things today appears to be not what it should - I've been up since 4am so go easy on me
Anyway, suppose I have a very simple class with a single property:
public string SiteName {
get{return siteName;}
set{siteName = value;}
}
Now SiteName has some very specific format requirements (ie not longer than 12 characters, first 4 chars are alpha only for example). Within the setter I can do some validation with a regex or whatever, and for validating this single property everything is great. It also seems to make sense to me that this is where the validation should take place.
However, it occurs to me that I might want to do a similar kind of validation on another property, perhaps even within in a separate class - or even multiple classes, and could get very messy with the same (or very similar) logic appearing all over the place. This looks to me like an ideal candidate for re-factoring... and this is where my googling has come unstuck!
What I'm really after is an insight on to tried an trusted techniques for validating properties, and also whether my intent is actually going to cause bigger problems than they're worth. I had a quick read about Custom Attributes, but I was not particularly clear on how to hook these up to know when a property is being modified, or how they interact with the property in question...
As always, any help greatly appreciated.
|
|
|
|
|
Martin - take a look at using INotifyPropertyChanged and something like this[^] article.
|
|
|
|
|
From the article: "Take note – in the screens above, the code that triggers the error to be shown is in the business object, not in the GUI. I didn't have to write a single line of GUI code – it's already done by data binding and IDataErrorInfo."
Today's epiphany sorted
|
|
|
|
|
Yup - binding's so cool - and so bloody useful.
|
|
|
|