cefsharp / CefSharp

.NET (WPF and Windows Forms) bindings for the Chromium Embedded Framework
http://cefsharp.github.io/
Other
9.84k stars 2.92k forks source link

Application crash when signing out off windows #3865

Closed RachidiL closed 2 years ago

RachidiL commented 2 years ago

Bug Report

Delete this line and everything above, and then fill in the details below.

code_snippet

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...

amaitland commented 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.

amaitland commented 2 years ago

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).

no-response[bot] commented 2 years ago

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.