I have seen this problem multiple times so I created a simple app to demonstrate. Here it is:
using System;
using Foundation;
using UIKit;
namespace nsindexpathbug.iOS
{
public partial class ViewController : UIViewController
{
public ViewController(IntPtr handle) : base(handle)
{
}
public override void ViewWillAppear(bool animated)
{
base.ViewWillAppear(animated);
var indexPath1 = NSIndexPath.FromRowSection(1, 1);
var indexPath = NSIndexPath.FromRowSection(1, 1);
BeforeLabel.Text = $"section = {indexPath.Section} row = {indexPath.Row}";
indexPath1.Dispose();
AfterLabel.Text = $"section = {indexPath.Section} row = {indexPath.Row}";
}
public override void DidReceiveMemoryWarning()
{
base.DidReceiveMemoryWarning();
// Release any cached data, images, etc that aren't in use.
}
}
}
and here is the results: