Windows Home Server and the Task Parallel Library
-
2011年10月27日 11:55
Firstly apologies as this is a cross post question from stack overflow - http://stackoverflow.com/questions/7915423/windows-home-server-and-the-task-parallel-library. Sorry if this is against the rules!
I have some very simple class library with code as follows:-
public Task<string> ConnectAsync() { Task<string> result = Task.Factory.StartNew(()=> Connect()); return result; } public string Connect() { System.Threading.Thread.Sleep(10000); return "Test"; }In my front end I have the following:
Task<string> myTask = connection.ConnectAsync(); myTask.ContinueWith(ant => { label1.Invoke((MethodInvoker)(() => label1.Text = ant.Result)); }In a normal windows form this works as expected, no UI lock up's. However when I push exact code out as a windows home server 2011 plugin its a different storey. The UI locks up and eventually the dashboard is killed automatically.
Any help would be really appreciated!
Thanks
Ross
- 已編輯 RossDargan 2011年10月27日 11:56
所有回覆
-
2011年10月27日 12:09
daft mistake - the third party library wasn't been copied over with the addin which is why it errors- 已標示為解答 Ken WarrenMVP, Moderator 2011年10月27日 13:17