Thank you for your responses.
Steve, I'm using debug build. I think that the problem relates to your first notion, but I don't know how to handle it. Here is sample code, maybe it will help. The sample contains Task class with Load method, and Dispatcher class which starts a new thread from which the Load method is called:
public class Task{
public long Id{get; set;}
public string Name{get; set;}
public void Load(DataRow row){
try{
Id = (long)row["id"];
Name = row["name"].ToString();
}
catch(..){}
}
}
public class Dispatcher{
Thread dispatchingThread = new Thread(getTasks);
private getTasks(){
DataTable dt = DAL.GetPendingTasks();
foreach(DataRow row in dt.Rows){
Task task = new Task
task.Load(row);
//process task...
}
}
}
The "Unable to evaluate..." exeception occures in the Load() method each time in other place. This method works fine when calling it from the main thread. (I omitted from the code error handling...)
Sorry for the long post.
Thanks again,
Maya