Simple Injector with Async Form Factories
<p><strong>Background</strong></p>

<p>I'm creating a Winforms application that has an "AccountManagementView" form. Every time the form is created, immediately after a long task takes place. My goal is that I create the form first, and make it so that the user can interact with the form while it is performing the long task.</p>

<p><strong>Solution (so far)</strong></p>

<p>My strategy so far is to make the form's constructor private, and instead use a async factory method to create the form. After the form is created, the factory method then starts the long task.</p>

<pre><code>public partial class AccountManagementView : Form, IAccountManagementView
{
    private AccountManagementView()
    {
        InitializeComponent();
    }

    public static async Task&lt;AccountManagementView&gt; CreateAsync()
    {
        AccountManagementView view = new AccountManagementView();
        await view.LongTask();
        return view;
    }

    private async Task LongTask()
    {
        await Task.Delay(5000);
        this.lblTitle.Text = "Account Management - Loaded";
    }
}
</code></pre>

<p><strong>Question</strong></p>

<p>How do I register this factory with the IoC container Simple Injector? I've tried to register the form via:</p>

<pre><code>container.RegisterSingleton&lt;AccountManagementView&gt;(AccountManagementView.CreateAsync());
</code></pre>

<p>With that attempt, I'm getting the following error message: "cannot convert from 'System.Threading.Tasks.Task' to 'Dispatch.UI.Windows.Views.Account.AccountManagementView'"</p>