Calling interactive window methods from non-UI threads may lead to deadlock
Nobody has claimed this yet.
Assessment
- Difficulty
- 5/5
- Estimated time
- Over a week
- Newbie friendliness
- 35/100
Research direction
Start by tracing InteractiveEvaluator.ExecuteCodeAsync and the IInteractiveWindow.Write path, focusing on the interaction between Dispatcher.Invoke and the JoinableTaskFactory job. Reproduce the background-thread output scenario with ConfigureAwait(false) and observe the dispatcher queue under heavy output. Done means interactive-window methods can safely be called from non-UI threads without deadlocking or causing excessive dispatcher work.
Written by the indexing model from the issue text.
Description
When standard UI thread loop is replaced with JoinableTaskFactory job, Dispatcher.Invoke is blocked until job is completed. This may end up in a deadlock if calling code has switched from UI thread to background using СonfigureAwait(false) or any other custom awaiter.
Issue can be easily got around by calling all interactive window methods from UI thread, but it eliminates the advantage of calling IInteractiveWindow.Write from background thread. Maybe this method can use BeginInvoke instead.
Scenario: User inputs some command into interactive window. InteractiveEvaluator.ExecuteCodeAsync switches to background thread and waits until command is completed. Command produces some output which we have to print to user while it is coming. If command produces too much output and for each of it we have to create a task in Dispatcher, we get too many of them which is noticeable by user.
- Dominant language
- C#
- Stars
- 78
- Forks
- 44
- PR merge metrics
- No merged PRs in 30d
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from dotnet/interactive-window
-
dotnet/interactive-window#255 · 2 comments · 6 reactions · 1 assignee ·
-
Difficulty 4/5 3-5 days Newbie friendliness 35/100
dotnet/interactive-window#241 · 1 comment ·
-
Difficulty 3/5 1-2 days Newbie friendliness 38/100
dotnet/interactive-window#230 ·
-
Difficulty 3/5 1-2 days Newbie friendliness 35/100
dotnet/interactive-window#185 ·
-
Difficulty 3/5 1-2 days Newbie friendliness 35/100
dotnet/interactive-window#184 ·
All issues in dotnet/interactive-window
Similar issues
-
copilot documentation
Difficulty 1/5 Under an hour Newbie friendliness 88/100
Maintainers usually reply within 2 days
-
needs triage
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
spectreconsole/spectre.console#2221 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
godotengine/godot-docs#12428 ·
Maintainers usually reply within 1 day
-
.NET triage
Difficulty 2/5 1-3 hours Newbie friendliness 73/100
microsoft/semantic-kernel#14526 ·
Maintainers usually reply within 4 days