Bug 12726 - iOS sample 'NonConsumables' throws System.NullReferenceException.
Summary: iOS sample 'NonConsumables' throws System.NullReferenceException.
Alias: None
Product: iOS
Classification: Xamarin
Component: Samples ()
Version: 6.3.x
Hardware: Macintosh Mac OS
: --- normal
Target Milestone: 7.2.0 (iOS 7.1)
Assignee: Oleg Demchenko
Depends on:
Reported: 2013-06-17 14:41 UTC by Saurabh
Modified: 2014-03-26 10:38 UTC (History)
3 users (show)

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

NonConsumable iOS sample (541.98 KB, application/zip)
2013-06-18 10:39 UTC, Saurabh

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:

Comment 2 Saurabh 2013-06-18 10:39:07 UTC
Created attachment 4143 [details]
NonConsumable iOS sample

I have attached NonConsumable iOS sample.
Comment 4 Saurabh 2013-07-09 11:19:46 UTC
Today, we have checked this issue with latest builds: 

Mono 3.1.1
XS 4.0.5(build 15)
Xcode 4.5

Device info: iPhone 4 (6.1.3)

App info:
monotouch-samples-master-3.0- 4638ae8895e6af6ba62ae30d0c7e28e92c6214b4

now, application launches successfully on the device/simulator and does not throw System.NullReferenceException.

Hence closing this issue with iOS sample master-3.0.
Comment 5 PJ 2013-07-09 14:35:51 UTC
Can you be sure to try to reproduce on as close an environment as possible? There's no reason we shouldn't get the result from multiple environments here, you can't assume your testing on iPhone 4 is sufficient for closing a bug reported on an iPhone 5.
Comment 6 Saurabh 2013-07-10 14:49:39 UTC
We have checked this issue with latest builds:

Mono 3.1.1((no/c07cb68)  
XS 4.0.9(Build 15)

stack trace: https://gist.github.com/saurabh360/9a1c69f451bf7fc6f2b6
iOS device log: https://gist.github.com/saurabh360/06a5b1a23b1fd03ebb9a

Device info:
iPhone4 iOS 5.1
iPhone4 iOS 6.1.3
iPhone5 iOS 6.0.2

App info:
monotouch-samples-master-3.0 - 4638ae8895e6af6ba62ae30d0c7e28e92c6214b4

Hence, reopening this issue.
Comment 7 PJ 2013-07-10 15:42:15 UTC
Reported as not a regression, probably a sample issue. Moving to 6.4.x (post async).
Comment 8 GouriKumari 2013-07-16 13:46:54 UTC
I see the null reference exception in HostedNonConsumables solution but not in Consumables

Null Reference Exception cause:

Issue is in Line 114 in HostedNonConsumables/HostedProductViewController.cs file
var info = notification.UserInfo 
notification.UserInfo is not getting any information and a null value is assigned to  "info". Hence the null reference exception.

In Consumables solution notification.UserInfo is getting the correct info and is not throwing a null reference exception. 

I am not sure why the same method is behaving differently in two different solutions. Craig can you take a look at this bug.

Supplemental Info:
StackTrace: https://gist.github.com/GouriKumari/3ec28d9224531e470fb6

Test Env: (947e6645) and (bfd851e4)
Device iPodTouch 6.0 / iPad 6.1.3
Comment 9 CraigD 2013-07-16 16:37:52 UTC
Between Comment 7 and Comment 8 the discussion moved from talking about the "NonConsumables" sample to the "HostedNonConsumables" sample???

Also, this sample (I'm assuming "NonConsumables" is what was meant) works for me locally. Are these tests always run with the same identity/provisioning profile and bundle-id? 

The only reason it should fail at that location is if the *products* aren't correctly set-up in the Apple ID store account being used to test. This is similar to Bugzilla #11356 (I think).

As with #11356 I have added a null-check to the code ("NonConsumables" project) so that the app won't crash but instead display "check iTunes connect setup" on the screen.
Comment 10 PJ 2013-11-19 16:44:44 UTC
This bug was targeted for a past milestone, moving to the next non-hotfix active milestone.
Comment 11 Oleg Demchenko 2014-01-27 13:22:10 UTC
NonConsumables works for me, if Apple ID isn't set on device/simulator app displays  "check iTunes connect setup" alert.

Environment details:
OS X 10.9.1
Xamarin Studio 4.2.3
device iPad2 7.0.4
simulator iPad 7.0/6.1/6.0, iPhone 7.0/6.1/6.0
Comment 12 Tajinder Singh 2014-03-26 10:38:45 UTC
 I have checked this issue with the latest builds:

XS 4.2.4(build32)
monotouch-samples-master bea743d25bfd85df3a5dc8594cfc9ef205eab162

Now it is working fine.Hence closing this issue.