3131using ICSharpCode . ILSpy . Properties ;
3232using ICSharpCode . ILSpyX . TreeView ;
3333
34+ #nullable enable
35+
3436namespace ICSharpCode . ILSpy . TreeNodes
3537{
3638 /// <summary>
@@ -40,7 +42,7 @@ class ThreadingSupport
4042 {
4143 readonly Stopwatch stopwatch = new Stopwatch ( ) ;
4244 CancellationTokenSource cancellationTokenSource = new CancellationTokenSource ( ) ;
43- Task < List < SharpTreeNode > > loadChildrenTask ;
45+ Task < List < SharpTreeNode > > ? loadChildrenTask ;
4446
4547 public bool IsRunning {
4648 get { return loadChildrenTask != null && ! loadChildrenTask . IsCompleted ; }
@@ -67,7 +69,7 @@ public void LoadChildren(SharpTreeNode node, Func<CancellationToken, IEnumerable
6769 CancellationToken ct = cancellationTokenSource . Token ;
6870
6971 var fetchChildrenEnumerable = fetchChildren ( ct ) ;
70- Task < List < SharpTreeNode > > thisTask = null ;
72+ Task < List < SharpTreeNode > > ? thisTask = null ;
7173 thisTask = new Task < List < SharpTreeNode > > (
7274 delegate {
7375 List < SharpTreeNode > result = new List < SharpTreeNode > ( ) ;
@@ -103,7 +105,7 @@ public void LoadChildren(SharpTreeNode node, Func<CancellationToken, IEnumerable
103105 {
104106 foreach ( Exception ex in continuation . Exception . InnerExceptions )
105107 {
106- node . Children . Add ( new ErrorTreeNode ( ex . ToString ( ) ) ) ;
108+ node . Children . Add ( new ErrorTreeNode ( ex ) ) ;
107109 }
108110 }
109111 }
@@ -148,29 +150,6 @@ public override void Decompile(Language language, ITextOutput output, Decompilat
148150 }
149151 }
150152
151- sealed class ErrorTreeNode : ILSpyTreeNode
152- {
153- readonly string text ;
154-
155- public override object Text {
156- get { return text ; }
157- }
158-
159- public ErrorTreeNode ( string text )
160- {
161- this . text = text ;
162- }
163-
164- public override FilterResult Filter ( LanguageSettings settings )
165- {
166- return FilterResult . Match ;
167- }
168-
169- public override void Decompile ( Language language , ITextOutput output , DecompilationOptions options )
170- {
171- }
172- }
173-
174153 [ ExportContextMenuEntry ( Header = nameof ( Resources . CopyErrorMessage ) ) ]
175154 [ Shared ]
176155 sealed class CopyErrorMessageContextMenu : IContextMenuEntry
@@ -201,4 +180,39 @@ public void Execute(TextViewContext context)
201180 }
202181 }
203182 }
183+
184+ sealed class ErrorTreeNode : ILSpyTreeNode
185+ {
186+ public Exception ? Exception { get ; }
187+
188+ public override object Text { get ; }
189+
190+ public override object Icon => Images . Load ( this , "Images/Warning" ) ;
191+
192+ public ErrorTreeNode ( Exception exception )
193+ : this ( exception . Message )
194+ {
195+ this . Exception = exception ;
196+ }
197+
198+ public ErrorTreeNode ( string text )
199+ {
200+ this . Text = text ;
201+ }
202+
203+ public override FilterResult Filter ( LanguageSettings settings )
204+ {
205+ return FilterResult . Match ;
206+ }
207+
208+ public override void Decompile ( Language language , ITextOutput output , DecompilationOptions options )
209+ {
210+ output . WriteLine ( this . Text . ToString ( ) ) ;
211+ output . WriteLine ( ) ;
212+ if ( this . Exception != null )
213+ {
214+ output . WriteLine ( this . Exception . ToString ( ) ) ;
215+ }
216+ }
217+ }
204218}
0 commit comments