UI Freeze when loading large (~20MB) file into RadSyntaxEditor

0 Answers 126 Views
SyntaxEditor
Margret
Top achievements
Rank 1
Margret asked on 23 Aug 2022, 06:33 AM | edited on 23 Aug 2022, 06:49 AM

Hi,

in my application we have an ui which displays transaction data in it's raw form (XML Data), it's optional exception and a further content control with some parsed datails.

The structure of the RadWindow the following:

<UserControl x:Class="TransactionXmlDataView"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation">

    <telerik:RadBusyIndicator x:Name="BusyIndicator">
        <Grid HorizontalAlignment="Stretch"
              Height="Auto"
              Width="Auto">

            <Grid.RowDefinitions>
                <RowDefinition Height="Auto" />
                <RowDefinition Height="Auto" />
                <RowDefinition Height="1*" />
            </Grid.RowDefinitions>

            <ContentControl x:Name="ParsedTransactionDataViewer"
                            Visibility="{Binding HasParsedTransactionData, Converter={StaticResource BoolToVisibilityConverter}}" />

            <TextBlock Text="{Binding DisplayName}"
                       HorizontalAlignment="Left"
                       Grid.Row="1"/>


            <telerik:RadLayoutControl Grid.Row="2">
                <ContentControl x:Name="XmlDocumentFileViewer" Width="{Binding XmlViewerWidth}"/>
                <telerik:LayoutControlSplitter Visibility="{Binding ExceptionViewerVisible, Converter={StaticResource BooleanToVisibleCollapsedConverter}}"/>
                <TextBox x:Name="ExceptionText"
                         TextWrapping="Wrap"
                         IsReadOnly="True"
                         VerticalContentAlignment="Top"
                         Visibility="{Binding ExceptionViewerVisible, Converter={StaticResource BooleanToVisibleCollapsedConverter}}"/>
            </telerik:RadLayoutControl>
        </Grid>
    </telerik:RadBusyIndicator>
</UserControl>

Not all parts of the UI are always shown:

  • The ParsedTransactionDataViewer is optionally shown in the first row of the grid. The whole row is collapsed if there is nothing to show
  • The LayoutControlSplitter and the Textbox "ExceptionText" within the third row are optionally shown. When there is no Excpetion to show the Splitter and Textbox shall be collapsed

Only the ContentControl XmlDocumentFileViewer is always displayed. This ContentControl is a UserControl with another ContenControl inside which Content is Binding to an RadSyntaxEditor in the Code.

<UserControl x:Class="XmlDocumentFileViewerView"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
    <ContentControl Width="Auto"
                    Height="{Binding ContentHeight}"
                    Content="{Binding XmlRadSyntaxEditor}" />
</UserControl>
The UI works perfectly well with smaller XMLs but with bigger ones (tested with ~24MB) the entire window and application freezes.

In regard to this I have found the follwoing article: SyntaxEditor inside a LayoutControl which points out that my SyntaxEditor looses the ability to virtualize... Followingly I tried the approach with a surrounding Canvas but still the UI freezes.

Addtionally I tried to simplify the application even more and making the width and height of the Syntax Editor fixed and defining it directly within xaml.

<UserControl x:Class="TransactionXmlDataView"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation">

    <telerik:RadBusyIndicator x:Name="BusyIndicator"
                              Style="{DynamicResource InputRadBusyIndicatorStyle}">
        <Grid HorizontalAlignment="Stretch"
              Margin="10"
              Height="Auto"
              Width="Auto">

            <Grid.RowDefinitions>
                <RowDefinition Height="Auto" />
                <RowDefinition Height="Auto" />
                <RowDefinition Height="1*" />
            </Grid.RowDefinitions>

            <ContentControl x:Name="XmlDocumentFileViewer" Width="1000" Height="1000"/>

        </Grid>
    </telerik:RadBusyIndicator>
</UserControl>

<UserControl x:Class="XmlDocumentFileViewerView"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation">

    <telerik:RadSyntaxEditor
        x:Name="XmlEditor"
        IsReadOnly="True"
        AllowScaling="False"
        VerticalScrollBarVisibility="Visible"
        HorizontalScrollBarVisibility="Visible"
        Height="1000"
        Width="1000"/>
</UserControl>

Even with this very simplified UI the whole UI freezes when trying to load a ~20MB xml file.

Is there any solution to this problem? Or are these files simply to big to display?

Thanks a lot in advance for your help! I'm looking forward to your suggestions!



Dilyan Traykov
Telerik team
commented on 25 Aug 2022, 02:20 PM

Hi Margret,

Thank you for the provided code snippets.

Based on them, I tried to replicate the issue you described in a small sample project, however, I do not observe a UI freeze at my end when loading a large XML file.

I'm attaching the sample project I set up to my reply for your reference. Can you please have a look and let me know if I'm missing something of importance?

Margret
Top achievements
Rank 1
commented on 30 Aug 2022, 12:40 PM

Hi Dilyan,
unfortunately the sample project you added istn't executed correctly at my local machine, it just shows a blank window see the picture attached. Maybe you can execute my sample project. It's very close, almost identical to the code where the issue occured in the first place. I tested it with a smaller and a larger xml file. With the small one the behaviour is as wished, in all cases (exception data available  or not/ parsed transaction data available or not).

With the large file LargeFile.xml the freeze happens again. I hope you can reproduce this!

Thanks a lot for your help! I'm looking forward hearing from you!
Dilyan Traykov
Telerik team
commented on 02 Sep 2022, 09:54 AM

Hi Margret,

Thank you very much for the provided project.

Indeed, I was able to replicate the UI freeze at my end. I will further investigate its cause and update you with my findings as soon as possible.

Dilyan Traykov
Telerik team
commented on 06 Sep 2022, 04:29 PM

Hi Margret,

Thank you for your patience.

It appears that this issue is caused by the registered XmlFoldingTagger. I have thus logged a new bug report regarding this in our feedback portal on your behalf. I've also awarded you with some Telerik points for bringing this to our attention.

We will try to address this for our upcoming service pack in the middle of October. In the meantime, I can suggest removing the XmlFoldingTagger if you find this possible.

No answers yet. Maybe you can help?

Tags
SyntaxEditor
Asked by
Margret
Top achievements
Rank 1
Share this question
or