I have problem while trying to read XML data from string asynchronous in Blazor. It's just freeze browser for couple seconds while reading. I wonder how to do it asynchronous to get nice progress for validation.Here is my implementation.
<RadzenButton Visible="true" ButtonStyle="ButtonStyle.Light" Click="@(async () => await ValidateAsync())">Waliduj Async</RadzenButton> private async Task ValidateAsync() { await using var timer = new Timer(_ => InvokeAsync(() => StateHasChanged())); timer.Change(TimeSpan.FromMilliseconds(500), TimeSpan.FromMilliseconds(500)); progress = 0; try { XmlReaderSettings settings = new XmlReaderSettings(); StringReader stringReader = new StringReader(xmlData); settings.Async = true; using (XmlReader reader = XmlReader.Create(stringReader, settings)) { while (await reader.ReadAsync()) { progress++; } } } finally { StateHasChanged(); } }P.S. This is my first stackoverflow question so feel free to correct me if construction of question is incorrect