Bug 11126 - iOS for VS doesn't create a generated App ID when the App ID is empty
Summary: iOS for VS doesn't create a generated App ID when the App ID is empty
Status: RESOLVED FIXED
Alias: None
Product: Visual Studio Extensions
Classification: Xamarin
Component: iOS ()
Version: 1.0.x
Hardware: PC Windows
: Normal normal
Target Milestone: ---
Assignee: Dominique Louis
URL:
Depends on:
Blocks:
 
Reported: 2013-03-13 13:46 UTC by Chris Hardy [MSFT]
Modified: 2013-03-19 11:38 UTC (History)
6 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 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 Chris Hardy [MSFT] 2013-03-13 13:46:05 UTC
It seems that if you don't set a AppId for your application, this is left as empty and causes lots of issues, in Xamarin Studio, this is workaround by generating one from the project name for an empty app id, iOS for VS should do the same.
Comment 4 Lennie De Villiers 2013-03-18 09:08:10 UTC
Am having a similar issue:

Am running Xamarin Studio on a Mac Machine where my colleague is using Visual Studio.Net 2012 connecting to a Mac VM from a Windows 7 machine.

We share the same solution/project.

He setup the provisioning profiles, certificates etc in Visual Studio.Net. On my side in Xamarin Studio the app id was empty, Xamarin Studio didn't gave me a warning.

When I try to deploy the application to a iPhone 4S device (running latest iOS 6.x), I get a "MT1107: Application failed to launch" error and the device crash which require a device restore.

After I manually set the app ID in Xamarin Studio it all works fine.

I tested with a new project that use the same certificate etc and it all works fine, Xamarin Studio give me the warning that the app ID haven't been set.

Look like issue is related to Xamarin Studio vs Visual Studio.
Comment 5 Dominique Louis 2013-03-18 17:57:21 UTC
I need more detail steps to repro this, as my Visual Studio tests show that it works here. Please walk me through what you are doing to get this outcome.
Comment 6 Lennie De Villiers 2013-03-19 02:42:54 UTC
- Solution + project originally created in old MonoDevelop with MonoTouch toolset (before Xamarin Studio)
- Ran application for awhile in the emulator waiting on certs, provisioning profiles etc.
- Upgraded to Xamarin Studio
- Ran abit in Xamarin Studio
- Colleague installed Visual Studio.Net 2012 and start running that from his MS Windows machine into Mac VM.
- Colleague setup the deployment certs, provisioning profiles etc within Visual Studio.Net 2012.
- I grabbed the details from Xcode Organiser and deploy to device
- Running fine on 5.x emulator + devices but crash on 6.x emulator and device.
- On deployment I got the "MT1107: Application failed to launch" 
- I looked for 2 days for a solution until I set the App ID manually within  Xamarin Studio, all was working fine for my colleague from inside Visual Studio.Net 2012.
Comment 7 Dominique Louis 2013-03-19 08:23:53 UTC
This looks to be a Xamarin Studio issue, unless I've misunderstood your steps.

PJ, Marek, Chris?
Comment 8 Lennie De Villiers 2013-03-19 08:27:18 UTC
Yes, Xamarin Studio didn't properly pickup the app id and when it was blank it cause a bad device crash, there was no warning.
Comment 9 Jeffrey Stedfast 2013-03-19 09:01:57 UTC
Is the provisioning profile a wildcard profile?

When you build in Xamarin Studio with an empty CFBundleIdentifier key in the Info.plist, Xamarin Studio will use the bundle identifier in the Provisioning Profile that has been configured to sign the app with.

However, it can't really do that if the Provisioning Profile has a wildcard in it.

I have no idea how the VS plugin works, but it sounds like the VS plugin populates the CFBundleIdentifier key/value in the Info.plist at build time based on some sort of "App Identity" field if the Info.plist does not already have one.

The problem is that Xamarin Studio has no way of knowing what the "App Identity" value is because it's in VS, not in the Info.plist.

Xamarin Studio's "App Identifier" field stores the value in the Info.plist as the CFBundleIdentifier, so it sounds to me like the VS plugin needs to do the same.
Comment 10 Lennie De Villiers 2013-03-19 09:11:20 UTC
Yes a wildcard profile. 

Yes experience must be the same on both an display a warning if it can't set the app ID so that one can do it manually within the toolset.
Comment 11 Jeffrey Stedfast 2013-03-19 10:04:01 UTC
I'll make sure that Xamarin Studio emits a build error if the CFBundleIdentifier string would be blank
Comment 12 Jeffrey Stedfast 2013-03-19 10:22:46 UTC
Did some more digging and Xamarin Studio's build process will always try to set a CFBundleIdentifier string even if the Provisioning Profile is a wildcard profile.

In the wildcard profile scenario, Xamarin Studio will use "com.yourcompany.${SanitizedProjectName}"

*However*, there was a bug in the logic that set the key in the Info.plist if it didn't exist. It would only set that value if the key didn't exist at all in the Info.plist, but if the key existed but the value was empty, it wouldn't set the value.

I suspect that this may be the issue... VS's Info.plist editor logic might be saving the Info.plist file with an empty CFBundleIdntifier value.

This won't be an issue in a future release of Xamarin Studio (4.0.4?) but VS should really fix its plist code to not save keys with empty values (they have been known to cause other problems as well)
Comment 13 Marek Habersack 2013-03-19 10:54:39 UTC
(In reply to comment #12)
> Did some more digging and Xamarin Studio's build process will always try to set
> a CFBundleIdentifier string even if the Provisioning Profile is a wildcard
> profile.
> 
> In the wildcard profile scenario, Xamarin Studio will use
> "com.yourcompany.${SanitizedProjectName}"
> 
> *However*, there was a bug in the logic that set the key in the Info.plist if
> it didn't exist. It would only set that value if the key didn't exist at all in
> the Info.plist, but if the key existed but the value was empty, it wouldn't set
> the value.
> 
> I suspect that this may be the issue... VS's Info.plist editor logic might be
> saving the Info.plist file with an empty CFBundleIdntifier value.
Yeah, we had it too - I fixed it in the current branch.

> 
> This won't be an issue in a future release of Xamarin Studio (4.0.4?) but VS
> should really fix its plist code to not save keys with empty values (they have
> been known to cause other problems as well)
Comment 14 Marek Habersack 2013-03-19 11:38:59 UTC
I believe this issue is fixed in the current development code. It will be part of the next release.