I open a Radzen Blazor Dialog like this:
<div>
<a href="@file2" @onclick="@(async () => { var d = await
dialogService.OpenAsync<DrawerComponents.ShowFile>("Show File",
new Dictionary<string, object>() { { "Path", file2} },
new DialogOptions() { Width = "800px", Height = "600px" }); })"
@onclick:preventDefault="true">
@(file2.Substring(file2.LastIndexOf("/") + 1))
</a>
<RadzenButton ButtonStyle="ButtonStyle.Danger" Icon="close" Size="ButtonSize.Small" Click="@(args => DeleteFile(item.Id, file.Substring(file.LastIndexOf("\\") + 1)))">
</RadzenButton>
</div>
When I open this dialog and view the file, then close dialog and then press delete button next to it, I recieve this error:
'The process cannot access the file 'C:\Users\...\drawerUpload\1\1\1\1\page3.jpeg' because it is being used by another process.'
When I delete the file without first viewing it, the delete is successful. So the Opened .razor file 'DrawerComponents.ShowFile' (that is opened by DialogService), is not disposed after viewing it.
Since I recieve a variable from dialogservice I tried to do these: d.Dispose(); d = null; and d.Close(); after opening that didn't work.
How to dispose this?