Bug 31219 - Null reference when updating a NuGet package
Summary: Null reference when updating a NuGet package
Status: RESOLVED FIXED
Alias: None
Product: Xamarin Studio
Classification: Desktop
Component: NuGet ()
Version: 5.9
Hardware: PC Mac OS
: Normal normal
Target Milestone: master
Assignee: Matt Ward
URL:
: 38050 ()
Depends on:
Blocks:
 
Reported: 2015-06-18 08:33 UTC by Matt Ward
Modified: 2016-02-22 16:24 UTC (History)
1 user (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 FIXED

Description Matt Ward 2015-06-18 08:33:52 UTC
Tried to update Xamarin.UITest NuGet package in a new iOS project and a null reference exception occurred. I have not been able to reproduce this since.

System.NullReferenceException: Object reference not set to an instance of an object
  at MonoDevelop.PackageManagement.UpdatedPackagesMonitor.RegisterProjectEvents () [0x00029] in /Users/builder/data/lanes/1858/5a524e17/source/monodevelop/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/UpdatedPackagesMonitor.cs:54 
  at MonoDevelop.PackageManagement.UpdatedPackagesMonitor..ctor (IEnumerable`1 projects) [0x00014] in /Users/builder/data/lanes/1858/5a524e17/source/monodevelop/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/UpdatedPackagesMonitor.cs:48 
  at MonoDevelop.PackageManagement.UpdatePackagesProgressMonitorStatusMessage..ctor (IEnumerable`1 projects, System.String packagesUpToDateMessage, System.String packagesUpToDateWarningMessage, MonoDevelop.PackageManagement.ProgressMonitorStatusMessage message) [0x00033] in /Users/builder/data/lanes/1858/5a524e17/source/monodevelop/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/UpdatePackagesProgressMonitorStatusMessage.cs:61 
  at MonoDevelop.PackageManagement.UpdatePackagesProgressMonitorStatusMessage..ctor (IPackageManagementProject project, System.String packagesUpToDateMessage, System.String packagesUpToDateWarningMessage, MonoDevelop.PackageManagement.ProgressMonitorStatusMessage message) [0x00000] in /Users/builder/data/lanes/1858/5a524e17/source/monodevelop/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/UpdatePackagesProgressMonitorStatusMessage.cs:44 
  at MonoDevelop.PackageManagement.ProgressMonitorStatusMessageFactory.CreateUpdatingSinglePackageMessage (System.String packageId, IPackageManagementProject project) [0x0001f] in /Users/builder/data/lanes/1858/5a524e17/source/monodevelop/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/ProgressMonitorStatusMessageFactory.cs:129 
  at MonoDevelop.PackageManagement.Commands.PackageReferenceNodeCommandHandler.UpdatePackage () [0x00033] in /Users/builder/data/lanes/1858/5a524e17/source/monodevelop/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Commands/PackageReferenceNodeCommandHandler.cs:90 

The problem seems to be that even though I had right clicked the NuGet package the ProjectService.CurrentProject returned null.
This may be related to a problem I see when using the Mac using the laptop's touch pad where sometimes the right click context menu is shown for the wrong project. I cannot reproduce it and this is the first time I have seen this problem.

However the NuGet addin could more gracefully handle this since it knows what node in the Solution pad is selected so it could record the project with the node and use that instead of looking at the active project.
Comment 1 Ram Chandra 2015-07-01 10:34:42 UTC
I have checked this issue but I am unable to reproduce this issue. We may have to see if a developer can figure out what's going on from the stack trace. If you have a chance, it might also be helpful to include IDE logs.

Environment Info:

=== Xamarin Studio ===

Version 5.9.4 (build 5)
Installation UUID: 6ea47b0d-1852-4aaf-808d-373ff0a5002b
Runtime:
	Mono 4.0.2 ((detached/c99aa0c)
	GTK+ 2.24.23 (Raleigh theme)

	Package version: 400020005

=== Apple Developer Tools ===

Xcode 6.3 (7569)
Build 6D570

=== Xamarin.iOS ===

Version: 8.10.2.38 (Enterprise Edition)
Hash: 7fdb07e
Branch: master
Build date: 2015-06-24 11:03:18-0400

=== Xamarin.Android ===

Version: 5.1.4.16 (Enterprise Edition)
Android SDK: /Users/jatin66/Desktop/Backup/android-sdk-macosx
	Supported Android versions:
		2.3    (API level 10)
		4.0.3  (API level 15)
		4.1    (API level 16)
		4.2    (API level 17)
		4.3    (API level 18)
		4.4    (API level 19)
		4.4.87 (API level 20)
		5.0    (API level 21)
Java SDK: /usr
java version "1.7.0_65"
Java(TM) SE Runtime Environment (build 1.7.0_65-b17)
Java HotSpot(TM) 64-Bit Server VM (build 24.65-b04, mixed mode)

=== Xamarin Android Player ===

Version: Unknown version
Location: /Applications/Xamarin Android Player.app

=== Xamarin.Mac ===

Version: 2.0.1.64 (Enterprise Edition)

=== Build Information ===

Release ID: 509040005
Git revision: 8010a90f6e246b32364e3fb46ef2c9d1be9c9a2b
Build date: 2015-06-08 16:52:06-04
Xamarin addins: 7e93e9c3503f28770f23ce1b7eafd829919f18e8

=== Operating System ===

Mac OS X 10.10.3
Darwin Dalvik.local 14.3.0 Darwin Kernel Version 14.3.0
    Mon Mar 23 11:59:05 PDT 2015
    root:xnu-2782.20.48~5/RELEASE_X86_64 x86_64
Comment 2 Matt Ward 2016-02-15 11:44:33 UTC
*** Bug 38050 has been marked as a duplicate of this bug. ***
Comment 3 xamarin-release-manager 2016-02-22 16:24:08 UTC
Fixed in version 6.0.0.4590 (master)

Author: Matt Ward
Commit: 21aab7e23100c958206e4781e7f49e91ccb12c22 (mono/monodevelop)