plotly / plotly/Plotly.NET

[ImageExport] Synchronous invokation deadlock still occures

オープン
#323 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

Area: ImageExport Type: Bug
主要言語
F#
スター
860
フォーク
99
平均マージ
22分
マージ済み PR(30日)
1

説明

Problem

This is the problem that we intended to fix with PR #321. It is fixed partially.

After we migrated to tasks instead of F#'s async, plus we changed

- page.CloseAsync() |> Async.AwaitTask |> Async.RunSynchronously
+ page.CloseAsync() |> AsyncHelper.taskSyncUnit

The async version works, as in, completes. However, the synchronous version still does not terminate

Reproduction

I'm going to present the repro with AvaloniaUI, but it should be as well reproduced in WinForms or WPF if you're on Windows.

1. Install templates & create project:
dotnet new --install Avalonia.Templates
dotnet new avalonia.mvvm -o TestAsync -n TestAsync
cd TestAsync/
2. Install the package

Add source & install the latest

dotnet new nugetconfig
dotnet nuget add source https://www.myget.org/F/plotly-net-nightly/api/v3/index.json
dotnet add package Plotly.NET.ImageExport --prerelease
3. Adding a component

Go to MainWindow.axaml and replace some default thingy with a button

- <TextBlock Text="{Binding Greeting}" HorizontalAlignment="Center" VerticalAlignment="Center"/>
+ <Button Click="Button_OnClick" />
4. Adding event

Go to MainWindow.axaml.cs and add this method:

        private async void Button_OnClick(object? sender, RoutedEventArgs e)
        {
            var layout = new Layout();
            var trace = new Trace("bar");
            var fig = GenericChart.Figure.create(ListModule.OfSeq(new[] { trace }), layout);
           
            var chart = GenericChart.fromFigure(fig);


            // This works now
            await chart.ToBase64PNGStringAsync();

            // This never terminates
            chart.ToBase64PNGString();
            
            // If we get to this line, it terminated
            throw new Exception();
        }
5. Run
dotnet run

Now, once it started, click the button. Successful completion is when the exception occurs.

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

まず ImageExport の同期パス、特に page.CloseAsync() と AsyncHelper.taskSyncUnit から始め、動作している ToBase64PNGStringAsync() パスと比較します。レポートに示されている Avalonia のボタンハンドラーを使って問題を再現します。chart.ToBase64PNGString() が終了し、次の例外に到達すれば完了です。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
fsharp
領域
data-visualization, desktop
issue の種類
バグ
難易度
4/5
見積もり時間
3〜5日
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
35/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。