Bug 34786 - IGKGameModelPlayer must export "playerId"
Summary: IGKGameModelPlayer must export "playerId"
Status: RESOLVED FIXED
Alias: None
Product: iOS
Classification: Xamarin
Component: Xamarin.iOS.dll ()
Version: XI 9.0 (iOS9)
Hardware: PC Mac OS
: Normal normal
Target Milestone: Untriaged
Assignee: Sebastien Pouliot
URL:
Depends on:
Blocks:
 
Reported: 2015-10-12 17:25 UTC by Larry O'Brien
Modified: 2015-12-23 16:35 UTC (History)
2 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 FIXED

Description Larry O'Brien 2015-10-12 17:25:56 UTC
The GKMinMaxStrategist relies on "playerId" in its evaluation of the game tree as it executes GetBestMove(IGKGameModelPlayer) ). All implementors of IGKGameModelPlayer must bind playerId, e.g.,

	public abstract class TicTacToePlayer : NSObject, IGKGameModelPlayer
	{
		public char Marker { get; }

		public TicTacToePlayer (char marker)
		{
			this.Marker = marker;
		}

		public int PlayerID {
			[Export ("playerId")]
			get {
				return (int)Marker;
			}
		}
	}

	public class AIPlayer : TicTacToePlayer
	{
		public AIPlayer (char marker) : base (marker)
		{
		}
	}
Comment 1 Sebastien Pouliot 2015-10-14 10:06:32 UTC
Yes, it looks like it started as a bug in sharpie, just filed
https://github.com/xamarin/ObjectiveSharpie/issues/90

Sadly that was not spotted at binding (or at audit time) and it means that the member was not marked abstract (and it should have been since it's a required member).

It's now a bit tricky as adding abstract members is a breaking change...

It might not be alone in this situation so we'll need to make a global decision about how to fix it (or likely them).
Comment 2 Sebastien Pouliot 2015-12-23 16:35:03 UTC
Fixed in maccore/master dcbf6e6f9f97e206aec0665f204d2f637fb1109a

Note: this is a breaking change so it's under XAMCORE_4_0*, IOW it's not part of any profile we ship (until we can break the API) so the above workaround is still needed.

* the original idea was to fix this for tvOS (XAMCORE_3_0) but doing so means we cannot share code (intersected/contract assemblies)