Element-Blazor / Element-Blazor

A Web UI Library based on Element and Blazor WebAssembly.

Home Page:https://element-blazor.github.io/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

DialogService.ShowDialogAsync<Component, int>("title", new Dictionary<string, object>()) 叉号关闭窗口报错

WileyChia opened this issue · comments

Index.razor

@page "/Search"
@inject DialogService DialogService
<BButton OnClick="showdialog">open</BButton>
<h1>Hello, world!</h1>
Welcome to your new app.
@code{
    async void showdialog()
    {
        await DialogService.ShowDialogAsync<Component, int>("title", new Dictionary<string, object>());
    }
}

Component.razor

<h3>Component</h3>

报错内容

fail: Microsoft.AspNetCore.Components.Server.Circuits.CircuitHost[111]
      Unhandled exception in circuit 'Pb37cme57SCa5nzkzs7oH0nCXLzOzKcuv42M6CsuBO4'.
System.NullReferenceException: Object reference not set to an instance of an object.
   at Blazui.Component.DialogService.ShowDialogAsync[TResult](Object typeOrRender, String title, Single width, IDictionary`2 parameters)
   at Blazui.Component.DialogService.ShowDialogAsync[TComponent,TResult](String title, Single width, IDictionary`2 parameters)
   at Blazui.Component.DialogService.ShowDialogAsync[TComponent,TResult](String title, IDictionary`2 parameters)
   at Wistd.StockControl.WebSite.Pages.Search.Index.showdialog() in D:\WiStd\StockControl\Wistd.StockControl.WebSite\Pages\Search\Index.razor:line 9
   at System.Threading.Tasks.Task.<>c.<ThrowAsync>b__139_0(Object state)
   at Microsoft.AspNetCore.Components.Rendering.RendererSynchronizationContext.ExecuteSynchronously(TaskCompletionSource`1 completion, SendOrPostCallback d, Object state)
   at Microsoft.AspNetCore.Components.Rendering.RendererSynchronizationContext.<>c.<.cctor>b__23_0(Object state)
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
--- End of stack trace from previous location where exception was thrown ---
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
   at Microsoft.AspNetCore.Components.Rendering.RendererSynchronizationContext.ExecuteBackground(WorkItem item)

感谢反馈