Bug 23027 - NSNotFound is not included in iOS API
Summary: NSNotFound is not included in iOS API
Status: RESOLVED NOT_REPRODUCIBLE
Alias: None
Product: iOS
Classification: Xamarin
Component: Xamarin.iOS.dll ()
Version: master
Hardware: PC Mac OS
: --- normal
Target Milestone: Untriaged
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2014-09-15 18:26 UTC by Jon Douglas [MSFT]
Modified: 2016-08-26 11:03 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 NOT_REPRODUCIBLE

Description Jon Douglas [MSFT] 2014-09-15 18:26:51 UTC
Customer Description:

https://developer.apple.com/library/ios/documentation/Cocoa/Reference/Foundation/Miscellaneous/Foundation_Constants/Reference/reference.html#//apple_ref/c/econst/NSNotFound

When making a call to UITableView.ScrollToRow, I must pass in an NSIndexPath. An NSIndexPath can be constructed with a row index and a section index. Well, the iOS docs from Apple state that when scrolling to a section with 0 rows, you must use NSNotFound as your row index. If Xamarin doesn't wrap NSNotFound, I can't make the correct API call.

NSNotFound = NSIntegerMax = int.MaxValue(C#)
Comment 1 Rolf Bjarne Kvinge [MSFT] 2014-09-16 03:52:23 UTC
It's in NSRange (NSRange.NotFound).
Comment 2 Shawn Castrianni 2014-09-16 10:38:18 UTC
1. NSRange does not seem like the proper place for it.
2. NSNotFound is supposed to be equal to NSIntegerMax which means on 64-bit systems, it should be larger than on 32-bit systems.  Does NSRange.NotFound make this distinction?
Comment 3 Rolf Bjarne Kvinge [MSFT] 2014-09-16 10:50:38 UTC
1. It's used a various Foundation API, so there is no good place for it anywhere. In Objective-C it's a global constant, which C# doesn't have.
2. Yes. It's defined as a nint field whose value is nint.MaxValue (which differs between 32 and 64bit  systems).
Comment 4 Shawn Castrianni 2014-09-16 10:51:55 UTC
Great, thanks.
Comment 5 Charlie 2016-08-26 10:16:13 UTC
I'm still getting "attempt to scroll to invalid index path" when using NSRange.NotFound. Does this really work?
Comment 6 Rolf Bjarne Kvinge [MSFT] 2016-08-26 11:03:42 UTC
@Charlie, if you have an issue, please open a new bug report and attach a test project we can use to reproduce the problem.