plotly / plotly/Plotly.NET

[ImageExport] Synchronous invokation deadlock still occures

Abierto
#323 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

Area: ImageExport Type: Bug
Lenguaje dominante
F#
Estrellas
860
Forks
99
Merge medio
22 min
PR fusionados (30 d)
1

Descripción

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.

Guía de contribución

No hay ninguna guía de contribución indexada para este repositorio

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Línea de trabajo

Comienza con la ruta síncrona de ImageExport, especialmente page.CloseAsync() y AsyncHelper.taskSyncUnit, y compárala con la ruta funcional ToBase64PNGStringAsync(). Reproduce el problema usando el controlador del botón de Avalonia mostrado en el informe; está hecho cuando chart.ToBase64PNGString() termina y se alcanza la siguiente excepción.

Escrito por el modelo de indexación a partir del texto del issue.

Evaluación

Stack tecnológico
fsharp
Área
data-visualization, desktop
Tipo de issue
Error
Dificultad
4/5
Tiempo estimado
3-5 días
Estado de actividad
Estancado
Claridad
Bastante claro
Aptitud para principiantes
35/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.