Bug 57870 - [generator] Smart enum wrapper doesn't work on setters
Summary: [generator] Smart enum wrapper doesn't work on setters
Status: ASSIGNED
Alias: None
Product: iOS
Classification: Xamarin
Component: Tools (show other bugs)
Version: XI 10.99 (xcode9)
Hardware: PC Mac OS
: Normal enhancement
Target Milestone: Future Cycle (TBD)
Assignee: Alex Soto [MSFT]
URL:
Depends on:
Blocks:
 
Reported: 2017-06-29 20:19 UTC by Vincent Dondain [MSFT]
Modified: 2017-11-21 19:38 UTC (History)
2 users (show)

See Also:
Tags:
Is this bug a regression?: No
Last known good build:


Attachments

Description Vincent Dondain [MSFT] 2017-06-29 20:19:46 UTC
Problem:

[Wrap ("HMPresenceTypeExtensions.GetValue (_PresenceType)")]
HMPresenceType PresenceType { get; set; }

where _PresenceType is:

[Export ("presenceType")]
NSString _PresenceType { get; set; }

The generated code for the getter is fine but wrong for the setter.

[CompilerGenerated]
public HMPresenceType PresenceType {
	get {
		return (HMPresenceType) (HMPresenceTypeExtensions.GetValue (_PresenceType));
	}
	set {
		HMPresenceTypeExtensions.GetValue (_PresenceType) = value;
	}
}

Idk if we should support `[Wrap ("_PresenceType")]` or `BindAs`.
Comment 1 Sebastien Pouliot 2017-08-03 18:59:16 UTC
Changing how `[Wrap]` works will likely cause other issues and it's also confusing.
I think we should be using something like:

	HMPresenceType PresenceType {
		[Wrap ("HMPresenceTypeExtensions.GetValue (_PresenceType)")]
		get; 
		[NotImplemented]
		set; 
	}

but it still require a small fix to avoid

> error BI1018: bgen: No [Export] attribute on property HomeKit.HMPresenceEvent.PresenceType

That check should be relaxed if the getter and setters (when presents) have [Wrap], [Export], [BindAs] or [NotImplemented].

FWIW it always bugged me to do something like

	[Export ("advertisingTrackingEnabled")]
	bool IsAdvertisingTrackingEnabled { [Bind ("isAdvertisingTrackingEnabled")] get; }

since the [Export] is ignored (when no setter is present).
Comment 2 Sebastien Pouliot 2017-08-11 15:53:19 UTC
Not required to ship `xcode9` support. We want to minimize changes (and potential regression) from stable on this branch.

Note You need to log in before you can comment on or make changes to this bug.