Bug 27780 - Error in the log when closing IDE or solution (NullReferenceException in SolutionClosed event)
Summary: Error in the log when closing IDE or solution (NullReferenceException in Solu...
Status: RESOLVED DUPLICATE of bug 21845
Alias: None
Product: Xamarin Studio
Classification: Desktop
Component: NuGet ()
Version: Trunk
Hardware: PC All
: Normal normal
Target Milestone: master
Assignee: Matt Ward
URL:
: 29055 ()
Depends on:
Blocks:
 
Reported: 2015-03-09 12:28 UTC by Andres G. Aragoneses
Modified: 2015-07-02 11:46 UTC (History)
4 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:
RESOLVED DUPLICATE of bug 21845

Description Andres G. Aragoneses 2015-03-09 12:28:35 UTC
Getting this with latest master as of today:

ERROR [2015-03-09 17:26:13Z]: Error in SolutionClosed event.
System.NullReferenceException: Object reference not set to an instance of an object
  at MonoDevelop.PackageManagement.ProjectTargetFrameworkMonitor.SolutionUnloaded (System.Object sender, System.EventArgs e) [0x0006b] in /home/knocte/Documents/Code/OpenSource/monodevelopMASTER/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/ProjectTargetFrameworkMonitor.cs:67 
  at (wrapper delegate-invoke) <Module>:invoke_void__this___object_EventArgs (object,System.EventArgs)
  at (wrapper delegate-invoke) <Module>:invoke_void__this___object_EventArgs (object,System.EventArgs)
  at ICSharpCode.PackageManagement.PackageManagementProjectService.OnSolutionUnloaded () [0x0001d] in /home/knocte/Documents/Code/OpenSource/monodevelopMASTER/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/PackageManagementProjectService.cs:68 
  at ICSharpCode.PackageManagement.PackageManagementProjectService.<PackageManagementProjectService>m__1 (System.Object sender, MonoDevelop.Projects.SolutionEventArgs e) [0x00001] in /home/knocte/Documents/Code/OpenSource/monodevelopMASTER/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/PackageManagementProjectService.cs:43 
  at (wrapper delegate-invoke) System.EventHandler`1<MonoDevelop.Projects.SolutionEventArgs>:invoke_void__this___object_TEventArgs (object,MonoDevelop.Projects.SolutionEventArgs)
  at MonoDevelop.Ide.RootWorkspace.OnItemUnloaded (MonoDevelop.Projects.WorkspaceItem item) [0x00047] in /home/knocte/Documents/Code/OpenSource/monodevelopMASTER/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide/RootWorkspace.cs:1233 
make[1]: Leaving directory `/home/knocte/Documents/Code/OpenSource/monodevelopMASTER/main'
Comment 1 Matt Ward 2015-03-10 06:43:56 UTC
Did you have two solutions open in MonoDevelop at the same time?
Comment 2 Andres G. Aragoneses 2015-03-10 10:26:56 UTC
Possibly. I think this happened when I opened monodevelop's .mdw file, which contains more than one solution: https://github.com/mono/monodevelop/blob/master/MonoDevelop.mdw
Comment 3 Matt Ward 2015-04-14 07:49:30 UTC
Copied comment from duplicate bug #29055:

1. Create a workspace
2. Add 2 existing solutions to the workspace
3. Close the workspace (not sure if you need to do these 2 steps)
4. Open the workspace
5. Close the workspace
6. Observe that there is a crash in the log similar to the above.

It appears that MonoDevelop.PackageManagement.ProjectTargetFrameworkMonitor is
created only once and attempts to take reference on the solutions as they are
opened. When the second solution is opened, the reference to the first solution
is overwritten and not kept.

When the solutions are closed, SolutionUnloaded is called which nulls out the
solution after the first invocation. The second call to SolutionUnloaded throws
because solution has been nulled.
Comment 4 Matt Ward 2015-04-14 07:49:39 UTC
*** Bug 29055 has been marked as a duplicate of this bug. ***
Comment 5 Matt Ward 2015-07-02 11:46:11 UTC

*** This bug has been marked as a duplicate of bug 21845 ***