Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exception when analyzing source of library with global assembly attributes. #3142

Closed
SylwesterZarebski opened this issue Dec 22, 2023 · 0 comments
Labels

Comments

@SylwesterZarebski
Copy link

Steps to reproduce

  1. Open some library which have classes used in global assembly attributes like:
[assembly: My(typeof(MyClass))]

where MyAttribute is Attribute defined as:

[AttributeUsage(AttributeTargets.Assembly)]
  1. Use Analyze on MyClass class.
  2. Above usage is shown in Used By tree:
    obraz
  3. Trying to double click or right click shows exception window.

Error message shown

On double click:

---------------------------
Sorry, we crashed
---------------------------
System.NullReferenceException: Object reference not set to an instance of an object.
   at ICSharpCode.ILSpy.Analyzers.AnalyzerEntityTreeNode.ActivateItem(RoutedEventArgs e) in D:\a\ILSpy\ILSpy\ILSpy\Analyzers\AnalyzerEntityTreeNode.cs:line 39
   at ICSharpCode.TreeView.SharpTreeViewItem.OnMouseLeftButtonUp(MouseButtonEventArgs e) in D:\a\ILSpy\ILSpy\SharpTreeView\SharpTreeViewItem.cs:line 117
   at System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target)
   at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
   at System.Windows.UIElement.ReRaiseEventAs(DependencyObject sender, RoutedEventArgs args, RoutedEvent newEvent)
   at System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target)
   at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
   at System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args)
   at System.Windows.UIElement.RaiseTrustedEvent(RoutedEventArgs args)
   at System.Windows.Input.InputManager.ProcessStagingArea()
   at System.Windows.Input.InputProviderSite.ReportInput(InputReport inputReport)
   at System.Windows.Interop.HwndMouseInputProvider.ReportInput(IntPtr hwnd, InputMode mode, Int32 timestamp, RawMouseActions actions, Int32 x, Int32 y, Int32 wheel)
   at System.Windows.Interop.HwndMouseInputProvider.FilterMessage(IntPtr hwnd, WindowMessage msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
   at System.Windows.Interop.HwndSource.InputFilterMessage(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
   at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
   at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)
   at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
   at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)

On right click:

---------------------------
Sorry, we crashed
---------------------------
System.NullReferenceException: Object reference not set to an instance of an object.
   at ICSharpCode.ILSpy.ScopeSearchToNamespace.GetNamespace(TextViewContext context) in D:\a\ILSpy\ILSpy\ILSpy\Commands\ScopeSearchToNamespace.cs:line 76
   at ICSharpCode.ILSpy.ScopeSearchToNamespace.IsVisible(TextViewContext context) in D:\a\ILSpy\ILSpy\ILSpy\Commands\ScopeSearchToNamespace.cs:line 62
   at ICSharpCode.ILSpy.ContextMenuProvider.<>c__DisplayClass18_0.<ShowContextMenu>g__BuildMenu|0(Lazy`2[] menuGroup, ItemCollection parent) in D:\a\ILSpy\ILSpy\ILSpy\ContextMenuEntry.cs:line 314
   at ICSharpCode.ILSpy.ContextMenuProvider.ShowContextMenu(TextViewContext context, ContextMenu& menu) in D:\a\ILSpy\ILSpy\ILSpy\ContextMenuEntry.cs:line 0
   at ICSharpCode.ILSpy.ContextMenuProvider.treeView_ContextMenuOpening(Object sender, ContextMenuEventArgs e) in D:\a\ILSpy\ILSpy\ILSpy\ContextMenuEntry.cs:line 247
   at System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target)
   at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
   at System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args)
   at System.Windows.UIElement.RaiseTrustedEvent(RoutedEventArgs args)
   at System.Windows.Controls.PopupControlService.RaiseContextMenuOpeningEvent(IInputElement source, Double x, Double y, Boolean userInitiated)
   at System.Windows.Controls.PopupControlService.ProcessMouseUp(Object sender, MouseButtonEventArgs e)
   at System.Windows.Controls.PopupControlService.OnPostProcessInput(Object sender, ProcessInputEventArgs e)
   at System.Windows.Input.InputManager.RaiseProcessInputEventHandlers(Tuple`2 postProcessInput, ProcessInputEventArgs processInputEventArgs)
   at System.Windows.Input.InputManager.ProcessStagingArea()
   at System.Windows.Input.InputProviderSite.ReportInput(InputReport inputReport)
   at System.Windows.Interop.HwndMouseInputProvider.ReportInput(IntPtr hwnd, InputMode mode, Int32 timestamp, RawMouseActions actions, Int32 x, Int32 y, Int32 wheel)
   at System.Windows.Interop.HwndMouseInputProvider.FilterMessage(IntPtr hwnd, WindowMessage msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
   at System.Windows.Interop.HwndSource.InputFilterMessage(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
   at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
   at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)
   at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
   at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)

Details

  • Product in use: ILSpy
  • Version in use: 8.2.0.7535
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 26, 2024
mattsh247 pushed a commit to mattsh247/ILSpy that referenced this issue Jul 30, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

1 participant