System.InvalidOperationException:“Document is null”
还没有人认领这个 Issue。
评估
调研方向
在所示的 TabControl、AdvancedFileSearchVMTemplate 和 AvalonEdit TextEditor binding 下重现崩溃,同时后台 updateAction 更改 Document.Text。跟踪标签页切换和编辑器更新的顺序;完成标准是从标签页 B 切换到标签页 A 不再抛出 InvalidOperationException,同时更新仍能安全地继续进行。
由索引模型根据 Issue 内容生成。
描述
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.
- 主要语言
- C#
- 星标
- 2.1k
- 派生
- 496
- PR 合并指标
- 30 天内没有已合并 PR
环境准备
这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
icsharpcode/AvalonEdit 的其他 Issue
-
难度 3/5 1-2 天 新手友好度 76/100
icsharpcode/AvalonEdit#454 ·
-
难度 4/5 3-5 天 新手友好度 48/100
icsharpcode/AvalonEdit#449 ·
-
难度 2/5 1-3 小时 新手友好度 48/100
icsharpcode/AvalonEdit#446 ·
-
Context menu ApplicationCommands.Cut still enabled when IsReadOnly = true可能已有人在做 @JyslaFancy 于 162 天前认领。 未关闭
难度 3/5 1-2 天 新手友好度 35/100
icsharpcode/AvalonEdit#444 ·
-
难度 3/5 1-2 天 新手友好度 45/100
icsharpcode/AvalonEdit#442 ·
查看 icsharpcode/AvalonEdit 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 72/100
umbraco/Umbraco.Automate#612 ·
维护者通常 1 天内回复
-
崩溃日志只按 CRLF 分行未关闭
难度 2/5 1-3 小时 新手友好度 72/100
PCL-Community/PCL-CE#3872 ·
维护者通常 1 天内回复
-
type:task ux
难度 2/5 1-3 小时 新手友好度 72/100
elsa-workflows/elsa-foundation#5253 ·
维护者通常 1 天内回复