Recently I had to develop a WinForm application doing some checks. During development, with test data, everything was fast and the UI was acceptable. But once running the application with real data, as it was much more, I understood I was facing a long running task, as the UI was not responsive for 2+ hours.
This was fine in the "old" versions of .NET, and even if still supported, I did some researches to see if a more modern approach was available, for example using the Task class introduced in .NET 4.
In fact the solution is pretty easy: you can run your background task with:
Task t = Task.Factory.StartNew(() =>
// do your long-time processing here
// callback when task is complete
// callback when task throws an exception
And in how run now operations in the Task synced with the main thread, necessary to update the UI?