Winforms - cursor doesn't stay as "WaitCursor" in long running async method
I have an async button click that awaits some long running file i/o stuff. I noticed that for REALLY long i/o stuff (like reading massive files), the wait cursor and controls don't change before hitting that await like in the first two lines of the function below. For smaller files they change without issue. I don't understand why that would matter but that's what is happening.
If I wrap
Importer.ImportFile(item)
in a Task.Run, then it seems to work. Not sure why or if that is the right solution.3 Replies
yo bro
?
try using a
Refresh()
to force the form to refresh things right after setting the cursor.
if i had to guess, its setting the cursor then going to the file without giving the form a chance to change.