Bug 13571 - "Reopen Closed Tab" causes exception on Assembly Browser tabs
Summary: "Reopen Closed Tab" causes exception on Assembly Browser tabs
Status: VERIFIED FIXED
Alias: None
Product: Xamarin Studio
Classification: Desktop
Component: General ()
Version: Trunk
Hardware: Macintosh Mac OS
: --- normal
Target Milestone: master
Assignee: Marius Ungureanu
URL:
Depends on:
Blocks:
 
Reported: 2013-07-29 14:06 UTC by Adam Patridge
Modified: 2014-01-22 07:30 UTC (History)
2 users (show)

Tags:
Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
VERIFIED FIXED

Description Adam Patridge 2013-07-29 14:06:33 UTC
May affect other types of tabs with non-path-based data, but definitely affects Assembly Browser window.

Steps to reproduce:
1. Double-click a non-project reference (e.g., System) to open an Assembly Browser window.
2. Close Assembly Browser window.
3. Trigger "Reopen Closed Tab" to cause exception (example trace attached at the end).

Expected behavior:
I was hoping the Assembly Browser window would re-open with the same assembly loaded as before.

The problem may stem from `NavigationHistoryService` when closing a document rather than the re-open process itself. When the service hooks into `IdeApp.Workbench.DocumentClosed` (currently line 64), the handler doesn't check if the closed document has a useful `FileName` which is used to create the new `NavigationHistoryItem` added to the `HistoryList`. To get my expected behavior, Assembly Browser windows would need a navigable location. An argument could be made for not putting non-navigable items in the history at all, which could be an easier fix from the small amount of time I spent looking at the source.

Example exception (on trunk July 29, 2013, labeled 4.1.7 in About):
Error while executing command: Reopen Closed Tab
System.NullReferenceException: Object reference not set to an instance of an object
  at MonoDevelop.Ide.Gui.DockNotebook.ReorderTab (MonoDevelop.Ide.Gui.DockNotebookTab tab, MonoDevelop.Ide.Gui.DockNotebookTab targetTab) [0x00015] in /Users/patridge/Projects/monodevelop/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/DockNotebook.cs:242 
  at MonoDevelop.Ide.Gui.DefaultWorkbench.ReorderTab (Int32 oldPlacement, Int32 newPlacement) [0x0002d] in /Users/patridge/Projects/monodevelop/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/DefaultWorkbench.cs:1198 
  at MonoDevelop.Ide.Gui.Workbench.ReorderTab (Int32 oldPlacement, Int32 newPlacement) [0x00009] in /Users/patridge/Projects/monodevelop/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/Workbench.cs:977 
  at MonoDevelop.Ide.Navigation.ClosedDocumentNavigationPoint.DoShow () [0x0002e] in /Users/patridge/Projects/monodevelop/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Navigation/ClosedDocumentNavigationPoint.cs:64 
  at MonoDevelop.Ide.Navigation.ClosedDocumentNavigationPoint.Show () [0x00002] in /Users/patridge/Projects/monodevelop/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Navigation/ClosedDocumentNavigationPoint.cs:57 
  at MonoDevelop.Ide.Navigation.NavigationHistoryItem.Show () [0x0002a] in /Users/patridge/Projects/monodevelop/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Navigation/NavigationHistoryItem.cs:62 
  at MonoDevelop.Ide.Navigation.NavigationHistoryService.OpenLastClosedDocument () [0x0001b] in /Users/patridge/Projects/monodevelop/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Navigation/NavigationHistoryService.cs:224 
  at MonoDevelop.Ide.Commands.ReopenClosedTabHandler.Run () [0x00001] in /Users/patridge/Projects/monodevelop/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Commands/FileTabCommands.cs:83 
  at MonoDevelop.Components.Commands.CommandHandler.Run (System.Object dataItem) [0x00002] in /Users/patridge/Projects/monodevelop/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Commands/CommandHandler.cs:61 
  at MonoDevelop.Components.Commands.CommandHandler.InternalRun (System.Object dataItem) [0x00003] in /Users/patridge/Projects/monodevelop/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Commands/CommandHandler.cs:42 
  at MonoDevelop.Components.Commands.CommandManager.DefaultDispatchCommand (MonoDevelop.Components.Commands.ActionCommand cmd, MonoDevelop.Components.Commands.CommandInfo info, System.Object dataItem, System.Object target, CommandSource source) [0x0008c] in /Users/patridge/Projects/monodevelop/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Commands/CommandManager.cs:1109 
  at MonoDevelop.Components.Commands.CommandManager.DispatchCommand (System.Object commandId, System.Object dataItem, System.Object initialTarget, CommandSource source) [0x002fc] in /Users/patridge/Projects/monodevelop/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Commands/CommandManager.cs:1076
Comment 1 Mikayla Hutchinson [MSFT] 2013-07-29 14:58:09 UTC
The navigation service shouldn't be inventing new ClosedDocumentNavigationPoint items based on the filename only. It should check whether it can get an actual navigation point from the document using the same logic as GetNavPointForDoc(), and use that - *if* it's non-null.
Comment 2 Marius Ungureanu 2013-07-30 12:04:26 UTC
Fixed. :D
Comment 3 Atin 2014-01-22 07:30:31 UTC
Today, we have checked this issue with:

XS 4.2.3(build 154)- http://www.screencast.com/t/lkWntUrET32Y
MT 7.0.7.64

Now this issue is not exist, reopening the close tab doesn't cause Exception on Assembly Browser tab and Assembly Browser window is re-open with the same assembly loaded as before.

Screencast: http://www.screencast.com/t/lkWntUrET32Y

Hence marking this as Verified