JustAssembly icon indicating copy to clipboard operation
JustAssembly copied to clipboard

NullReferenceException in TypeNode.CleanExceptionSource when trying to compare assemblies

Open markusschaber opened this issue 7 years ago • 6 comments

Hi,

I just wanted to test it on a "real world case" by comparing two assemblies, and get the following exception just before the end of the "Loading assembly 2 of 2" phase:

Der Objektverweis wurde nicht auf eine Objektinstanz festgelegt.
   bei JustAssembly.Nodes.TypeNode.CleanExceptionSource(IDecompilationResults decompilationResult, String sourceCode) in c:\Jenkins\ReleaseFullWithUploadBuild\workspace\UI\JustAssembly\Nodes\TypeNode.cs:Zeile 99.
   bei JustAssembly.Nodes.TypeNode.GetDifferenceDecoration() in c:\Jenkins\ReleaseFullWithUploadBuild\workspace\UI\JustAssembly\Nodes\TypeNode.cs:Zeile 168.
   bei JustAssembly.Nodes.TypeNode..ctor(IOldToNewTupleMap`1 typesMap, ItemNodeBase parent, APIDiffInfo apiDiffInfo, FilterSettings filterSettings) in c:\Jenkins\ReleaseFullWithUploadBuild\workspace\UI\JustAssembly\Nodes\TypeNode.cs:Zeile 39.
   bei JustAssembly.Nodes.NamespaceNode.GenerateTypeNode(IOldToNewTupleMap`1 metadataTuple, LoadAPIItemsContext context) in c:\Jenkins\ReleaseFullWithUploadBuild\workspace\UI\JustAssembly\Nodes\NamespaceNode.cs:Zeile 65.
   bei System.Linq.Enumerable.WhereSelectListIterator`2.MoveNext()
   bei System.Collections.ObjectModel.ObservableCollection`1.CopyFrom(IEnumerable`1 collection)
   bei JustAssembly.Nodes.NamespaceNode.LoadChildren() in c:\Jenkins\ReleaseFullWithUploadBuild\workspace\UI\JustAssembly\Nodes\NamespaceNode.cs:Zeile 47.
   bei ICSharpCode.TreeView.SharpTreeNode.EnsureLazyChildren()
   bei ICSharpCode.TreeView.SharpTreeNode.set_IsExpanded(Boolean value)
   bei JustAssembly.Nodes.ModuleNode.<>c__DisplayClass4.<LoadChildren>b__1(IGrouping`2 g) in c:\Jenkins\ReleaseFullWithUploadBuild\workspace\UI\JustAssembly\Nodes\ModuleNode.cs:Zeile 53.
   bei System.Linq.Enumerable.WhereSelectEnumerableIterator`2.MoveNext()
   bei System.Collections.ObjectModel.ObservableCollection`1.CopyFrom(IEnumerable`1 collection)
   bei JustAssembly.Nodes.ModuleNode.LoadChildren() in c:\Jenkins\ReleaseFullWithUploadBuild\workspace\UI\JustAssembly\Nodes\ModuleNode.cs:Zeile 50.
   bei ICSharpCode.TreeView.SharpTreeNode.EnsureLazyChildren()
   bei ICSharpCode.TreeView.SharpTreeNode.set_IsExpanded(Boolean value)
   bei JustAssembly.Nodes.AssemblyNode.GenerateModuleNode(IOldToNewTupleMap`1 metadataTuple, LoadAPIItemsContext context, Boolean shouldBeExpanded) in c:\Jenkins\ReleaseFullWithUploadBuild\workspace\UI\JustAssembly\Nodes\AssemblyNode.cs:Zeile 272.
   bei System.Linq.Enumerable.WhereSelectEnumerableIterator`2.MoveNext()
   bei System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
   bei System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
   bei JustAssembly.Nodes.AssemblyNode.GetMergedModules(Boolean shouldBeExpanded) in c:\Jenkins\ReleaseFullWithUploadBuild\workspace\UI\JustAssembly\Nodes\AssemblyNode.cs:Zeile 260.
   bei JustAssembly.Nodes.AssemblyNode.<>c__DisplayClass6.<LoadItemsAsync>b__3() in c:\Jenkins\ReleaseFullWithUploadBuild\workspace\UI\JustAssembly\Nodes\AssemblyNode.cs:Zeile 181.

I attached a Zip archive containing the files in question. LibCompare.zip

Thanks for your patience...

markusschaber avatar Apr 27 '17 11:04 markusschaber

I pulled the latest code compiled and ran with your zip IronPython.dll files and everything is working correctly.

cjohn93 avatar Jul 07 '17 20:07 cjohn93

The issue is still reproducible, for example when comparing v2.7.2 and v2.9.1 of DocumentFormat.OpenXML assemblies (net46 flavors).

It seems the error is in the UI when comparing members which have exceptions during decompilation.

bsivanov avatar Nov 19 '19 14:11 bsivanov

And the call stack in English:

Object reference not set to an instance of an object.
   at JustAssembly.Nodes.TypeNode.CleanExceptionSource(IDecompilationResults decompilationResult, String sourceCode) in C:\Jenkins\ReleaseFullWithUploadBuild\workspace\UI\JustAssembly\Nodes\TypeNode.cs:line 99
   at JustAssembly.Nodes.TypeNode.GetDifferenceDecoration() in C:\Jenkins\ReleaseFullWithUploadBuild\workspace\UI\JustAssembly\Nodes\TypeNode.cs:line 166
   at JustAssembly.Nodes.TypeNode..ctor(IOldToNewTupleMap`1 typesMap, ItemNodeBase parent, APIDiffInfo apiDiffInfo, FilterSettings filterSettings) in C:\Jenkins\ReleaseFullWithUploadBuild\workspace\UI\JustAssembly\Nodes\TypeNode.cs:line 39
   at JustAssembly.Nodes.NamespaceNode.GenerateTypeNode(IOldToNewTupleMap`1 metadataTuple, LoadAPIItemsContext context) in C:\Jenkins\ReleaseFullWithUploadBuild\workspace\UI\JustAssembly\Nodes\NamespaceNode.cs:line 65
   at System.Linq.Enumerable.WhereSelectListIterator`2.MoveNext()
   at System.Collections.ObjectModel.ObservableCollection`1.CopyFrom(IEnumerable`1 collection)
   at JustAssembly.Nodes.NamespaceNode.LoadChildren() in C:\Jenkins\ReleaseFullWithUploadBuild\workspace\UI\JustAssembly\Nodes\NamespaceNode.cs:line 47
   at ICSharpCode.TreeView.SharpTreeNode.EnsureLazyChildren()
   at ICSharpCode.TreeView.SharpTreeNode.set_IsExpanded(Boolean value)
   at JustAssembly.Nodes.ModuleNode.<>c__DisplayClass8_0.<LoadChildren>b__1(IGrouping`2 g) in C:\Jenkins\ReleaseFullWithUploadBuild\workspace\UI\JustAssembly\Nodes\ModuleNode.cs:line 53
   at System.Linq.Enumerable.WhereSelectEnumerableIterator`2.MoveNext()
   at System.Collections.ObjectModel.ObservableCollection`1.CopyFrom(IEnumerable`1 collection)
   at JustAssembly.Nodes.ModuleNode.LoadChildren() in C:\Jenkins\ReleaseFullWithUploadBuild\workspace\UI\JustAssembly\Nodes\ModuleNode.cs:line 50
   at ICSharpCode.TreeView.SharpTreeNode.EnsureLazyChildren()
   at ICSharpCode.TreeView.SharpTreeNode.set_IsExpanded(Boolean value)
   at JustAssembly.Nodes.AssemblyNode.GenerateModuleNode(IOldToNewTupleMap`1 metadataTuple, LoadAPIItemsContext context, Boolean shouldBeExpanded) in C:\Jenkins\ReleaseFullWithUploadBuild\workspace\UI\JustAssembly\Nodes\AssemblyNode.cs:line 315
   at System.Linq.Enumerable.WhereSelectEnumerableIterator`2.MoveNext()
   at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
   at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
   at JustAssembly.Nodes.AssemblyNode.GetMergedModules(Boolean shouldBeExpanded) in C:\Jenkins\ReleaseFullWithUploadBuild\workspace\UI\JustAssembly\Nodes\AssemblyNode.cs:line 303
   at JustAssembly.Nodes.AssemblyNode.<>c__DisplayClass29_0.<LoadItemsAsync>b__1() in C:\Jenkins\ReleaseFullWithUploadBuild\workspace\UI\JustAssembly\Nodes\AssemblyNode.cs:line 194

bsivanov avatar Nov 19 '19 14:11 bsivanov

Thank you @bsivanov I'm gonna watch this

AKrasheninnikov avatar Nov 19 '19 14:11 AKrasheninnikov

Probably #57 is duplicate of this one.

bsivanov avatar Apr 13 '20 05:04 bsivanov

Just ran across this too. I suppose there hasn't been any fix or workaround yet?

Alloc86 avatar Mar 27 '21 12:03 Alloc86