Bug 60840 - WatchOS: Extension: confusing validation code for extension bundle id
Summary: WatchOS: Extension: confusing validation code for extension bundle id
Status: CONFIRMED
Alias: None
Product: iOS
Classification: Xamarin
Component: MSBuild ()
Version: XI 11.6 (xcode9.2)
Hardware: PC Windows
: --- enhancement
Target Milestone: Future Cycle (TBD)
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2017-11-23 15:04 UTC by ThumbGen
Modified: 2017-11-23 17:22 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 for Bug 60840 on Developer Community or GitHub if you have new information to add and do not yet see a matching new report.

If the latest results still closely match this report, you can use the original description:

  • Export the original title and description: Developer Community HTML or GitHub Markdown
  • Copy the title and description into the new report. Adjust them to be up-to-date if needed.
  • Add your new information.

In special cases on GitHub you might also want the comments: GitHub Markdown with public comments

Related Links:
Status:
CONFIRMED

Description ThumbGen 2017-11-23 15:04:14 UTC
There is a bug in ValidateAppBundleTaskBase.cs (line 255).

The extension bundle id should start with the bundle id of the MAIN app and not the bundle id of the WATCH app.

The documentation is correct (reflects also the Apple documentation): https://developer.xamarin.com/guides/ios/watch/getting-started/project-references/
Comment 1 Alex Soto [MSFT] 2017-11-23 17:05:28 UTC
I have tested this scenario and works as expected (same behaviour as Xcode 9) if there is a mismatch we will error out.

That being said the code is confusing because the code and the error message do not match.

https://github.com/xamarin/xamarin-macios/blob/dd4d376c4837c36d6801aa95f84b944f2d1dd518/msbuild/Xamarin.iOS.Tasks.Core/Tasks/ValidateAppBundleTaskBase.cs#L255-L256

@Jeff can you have a look? maybe renaming the variable would help a little more or adding a comment on why this is the way it is would also help.
Comment 2 Alex Soto [MSFT] 2017-11-23 17:07:58 UTC
Downgrading to enhancement because code works as expected.
Comment 3 ThumbGen 2017-11-23 17:22:52 UTC
Hm... then both Xamarin and Apple documentation are wrong.

This does not work (error from line 256):

Main App: com.company.app
Watch App: com.company.app.watchkitapp
Watch Extension: com.company.app.watchextension

This works:

Main App: com.company.app
Watch App: com.company.app.watchkitapp
Watch Extension: com.company.app.watchkitapp.watchextension

Xamarin documentation points into the "not working" direction:

Xamarin.iOS Unified project - com.xamarin.WatchKitCatalog
WatchKit Extension project - com.xamarin.WatchKitCatalog.watchkitextension
Watch App project - com.xamarin.WatchKitCatalog.watchkitapp

Apple documentation suggests the same: the extension id is related to the main app id and not the watch app.

Hence I thought that 

!bundleIdentifier.StartsWith (watchAppBundleIdentifier

should be

!bundleIdentifier.StartsWith (mainAppBundleIdentifier


It is a very minor discrepancy but could cost some minutes waiting for the build to fail.... :)