© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•11mo ago•
10 replies
Budzique

EnumerateFiles Blocks UI thread even in Task.Run()

I'm writing an application that needs to validate a user-given directory by searching for specific files in said directory. I'd like to run the validation in the background so the app doesn't freeze up. I've tried a few suggestions and still ended up here asking because it seems EnumerateFiles refuses to run on another thread.

Following is a functional example as a .net8 WPF application.
C# banner
C#Join
We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.
61,871Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

✅ Run code in main thread after Task.Run completed?
C#CC# / help
3y ago
Task.Run() in .net framework
C#CC# / help
13mo ago
✅ How to run task in separate process?
C#CC# / help
3y ago