I wrote a little winforms application that search for files on the disk (what file is not that important for the sake of the question). the problem is the that it can be eve
The fact of marking SearchPnrFilesAsync
with async
keyword itself doesn't magically starts execution ot this method asynchronously in separate task.
In fact, all of the code in SearchPnrFilesAsync
except sw.WriteAsync
executes in UI thread thus blocking it.
If you need to execute your whole method in separate task, you can do it by wrapping like:
public async static Task SearchPnrFilesAsync(string mainDir)
{
await Task.Run(() => your_code_here);
}