System.InvalidOperationException:“Document is null” #445
Labels
No labels
Area-Accessibility
Area-Build
Area-CodeCompletion
Area-Document
Area-Documentation
Area-Editing
Area-Folding
Area-Highlighting
Area-i18n
Area-Indentation
Area-NetFx
Area-Rendering
Area-Search
Area-Snippets
dependencies
duplicate
Feedback Needed
help wanted
invalid
Issue-Bug
Issue-Discussion
Issue-Enhancement
Issue-Performance
Issue-Question
on-hold
Resolution-Answered
Resolution-By Design
Resolution-Duplicate
Resolution-Fixed
Resolution-Won't Fix
Up-for-Grabs
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
gh-icsharpcode/AvalonEdit#445
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
xmlns:avalonEdit="http://icsharpcode.net/sharpdevelop/avalonedit"
<TabControl.ItemTemplate>
</TabControl.ItemTemplate>
<local:FileSearchViewSelector x:Key="selector" BasicFileMergeTemplate="{StaticResource BasicFileMergeVMTemplate}"
AdvancedFileSearchTemplate="{StaticResource AdvancedFileSearchVMTemplate}" />
AdvancedFileSearchVMTemplate is:
...skip others...
<avalonEdit:TextEditor
x:Name="TextEditor"
Grid.Row="1"
Document="{Binding Document}"
SyntaxHighlighting="{x:Null}"
ShowLineNumbers="True"
WordWrap="False"
FontFamily="Consolas"
FontSize="12"
HorizontalScrollBarVisibility="Auto"
VerticalScrollBarVisibility="Auto"
behaviors:TextEditorExtension.Register="{Binding RegisterEditorCommand}"
/>
...skip others...
a new tab item (B) is created after the search button was clicked. the backgroud task is runing and update the TextEditor with ::
editor?.BeginChange();
try
{
updateAction?.Invoke();
}
finally
{
editor.EndChange();
if (_autoScroll)
editor.ScrollToEnd();
}
updateAction:
Document.Text = value;
if we switch to tab item A, the system is crashed :
System.InvalidOperationException:“Document is null”
if we dont switch to A, say stay with B, it's ok... we can add code to check if Document is null but it's not the case.
please, any help will be appreciated.
TabControl:
SelectedItem="{Binding SelectedTab, Mode=TwoWay}"
SelectedIndex="{Binding SelectedIndex}"
ContentTemplateSelector="{StaticResource selector}">
<TabControl.ItemTemplate>
</TabControl.ItemTemplate>