none
Windows Home Server and the Task Parallel Library

    Question

  • 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

     


    • Edited by RossDargan Thursday, October 27, 2011 11:56 AM
    Thursday, October 27, 2011 11:55 AM

Answers