The .NET default TaskScheduler doesn't guarantee that two tasks of the same Request will get executed on the same Thread.
To know more read Internal Mechanisms of Tasks in .NET
This behaviour of .NET can create issues in some situations. Sometimes we want some of our tasks executed on the Same Thread.
For example, Say we are using some library that doesn't support getting called from multiple Threads.
To solve this problem, we are creating a Custom TaskScheduler that will execute tasks on the same thread.
The project is not finished yet.
- Maybe we need to make it IDisposable.
- We need to maintain a threadpool.
- Test and brainstorm if there is any other issues.