plotly / plotly/Plotly.NET

[ImageExport] Synchronous invokation deadlock still occures

Đang mở
#323 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Area: ImageExport Type: Bug
Ngôn ngữ chính
F#
Star
860
Fork
99
Merge trung bình
22 phút
Pull request đã merge (30 ngày)
1

Mô tả

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.

Hướng dẫn đóng góp

Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Hướng nghiên cứu

Bắt đầu với đường dẫn đồng bộ của ImageExport, đặc biệt là page.CloseAsync() và AsyncHelper.taskSyncUnit, rồi so sánh với đường dẫn ToBase64PNGStringAsync() đang hoạt động. Tái hiện sự cố bằng trình xử lý nút Avalonia được hiển thị trong báo cáo; hoàn tất khi chart.ToBase64PNGString() kết thúc và gặp ngoại lệ sau.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
fsharp
Lĩnh vực
data-visualization, desktop
Loại issue
Lỗi
Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức độ hoạt động
Đình trệ
Độ rõ ràng
Khá rõ ràng
Mức phù hợp với người mới
35/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.