Closed RachidiL closed 2 years ago
With the changes in v92, the method schedules the task on the thread pool, this has the effect that the task is run on the main thread.
How exactly does queuing a Task on the threadpool cause it to run on the main thread?
In prior versions the tasks were also scheduled on the threadpool, as per the Taskscheduler.Default.
I don't believe your analysis is correct.
What is the exception you are seeing? Please include a stack trace, no images.
Queues the specified work to run on the ThreadPool and returns a task or Task
handle for that work.
As per Task.Run the task will be queued on the ThreadPool
.
Looking at the .Net Reference Source and TaskScheduler.Default
is also used for Task.Run
So the changes made in commit https://github.com/cefsharp/CefSharp/commit/4ab6d2ad25cb0dc19ced4dc0dad040a863c1a616#diff-df112b02559a8f6e4974da2943e081757cde96d23e5e7ec39ffcf3ab70a10de3 should also queue the Task
for execution in the ThreadPool
.
I need a stack trace and or an example that clearly reproduces the problem (preferably both).
This issue has been automatically closed because there has been no response to our request for more information from the original author. With only the information that is currently in the issue, we don't have enough information to take action. Please reach out if you have or find the answers we need so that we can investigate further.
Bug Report
Delete this line and everything above, and then fill in the details below.
What version of the product are you using?
What architecture x86 or x64? x64
What version of .Net? .Net 4.x
On what operating system? Win10
Are you using
WinForms
,WPF
orOffScreen
? WPFWhat steps will reproduce the problem? We have an MFC-application and use CefSharp.WPF to display the Chromium Webbrowser to enable users to use the Webbrowser in our application. As of v92 there was a change in the class ConcurrentMethodRunnerQueue. Previously, in the method ConcurrentMethodRunnerQueue::Enqueue, tasks were started using the method Task.Start which scheduled the task on the current TaskScheduler, which means the task was run on a different thread than the main thread.See left side of the screenshot.
With the changes in v92, the method schedules the task on the thread pool, this has the effect that the task is run on the main thread.
Now to my problem: With the above mentioned changes in v92, when a user has our application running and clicks on sign out from the current Windows session, there is an exception thrown on the main thread(and not anymore on a different thread) due to the above mentioned facts and this crashes our application. This means that the application is not closed properly. After signing in and starting the application, we get error messages that says that the application was not shut down properly, which can cause database-related problems.
In v91 and downwards, this did not happen...