Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

Calling interactive window methods from non-UI threads may lead to deadlock

Open
#22 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
35/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
csharp
Domain
desktop, devtools

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

Bug

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

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from dotnet/interactive-window

All issues in dotnet/interactive-window

Similar issues

More C# issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.