Bug 38244 - Resources in library projects are not included into the app bundle on unclean build if the initial build failed due to a C# syntax error
Summary: Resources in library projects are not included into the app bundle on unclean...
Status: VERIFIED FIXED
Alias: None
Product: iOS
Classification: Xamarin
Component: MSBuild ()
Version: XI 9.4 (iOS 9.2)
Hardware: PC Mac OS
: --- major
Target Milestone: (C7)
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2016-02-01 10:45 UTC by Brendan Zagaeski (Xamarin Team, assistant)
Modified: 2016-04-28 13:59 UTC (History)
2 users (show)

Tags:
Is this bug a regression?: ---
Last known good build:


Attachments
Test case (13.27 KB, application/zip)
2016-02-01 10:45 UTC, Brendan Zagaeski (Xamarin Team, assistant)
Details
Detailed version info (1.57 KB, text/plain)
2016-02-01 10:47 UTC, Brendan Zagaeski (Xamarin Team, assistant)
Details
Test case (updated) (12.99 KB, application/zip)
2016-02-01 11:01 UTC, Brendan Zagaeski (Xamarin Team, assistant)
Details


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:
VERIFIED FIXED

Description Brendan Zagaeski (Xamarin Team, assistant) 2016-02-01 10:45:43 UTC
Created attachment 14827 [details]
Test case

Storyboards in library projects are not included into the app bundle on unclean build if the initial build failed due to a C# syntax error




## Regression status: not a regression

BAD: Xamarin.iOS 9.4.1.25 (962a050) + Xcode 7.1
BAD: Xamarin.iOS 9.4.0.0  (7322991) + Xcode 7.1
BAD: Xamarin.iOS 9.1.0.27 (1f068b4) + Xcode 7.1
BAD: Xamarin.iOS 8.9.1.3  (f7736a4) + Xcode 6.4




## Steps followed to replicate

1. Open the attached test case.

2. Navigate to the `AppDelegate.cs` file and delete a semicolon from one of the lines to introduce a C# syntax error.

3. Attempt to build and run the app in the "Debug|iPhoneSimulator" configuration. (This step should fail due to the C# syntax error.)

4. Add back the missing semicolon in the `AppDelegate.cs` file.

5. Without cleaning the project, attempt to build and run the app again.




## Results

Unhandled managed exception: Objective-C exception thrown.  Name: NSInvalidArgumentException Reason: Could not find a storyboard named 'Main' in bundle NSBundle </Users/macuser/Library/Developer/CoreSimulator/Devices/4B06FB47-506F-4AC3-A990-EBEF6A28F651/data/Containers/Bundle/Application/2B2C4638-4111-419B-A38B-8D054ADE024E/UnifiedSingleViewIphone1.app>
Comment 1 Brendan Zagaeski (Xamarin Team, assistant) 2016-02-01 10:47:55 UTC
Created attachment 14828 [details]
Detailed version info
Comment 2 Brendan Zagaeski (Xamarin Team, assistant) 2016-02-01 11:01:19 UTC
Created attachment 14829 [details]
Test case (updated)

## Slightly simplified test case

The original test case had the storyboard in a subfolder. But that is _not_ required to hit this particular behavior, so I have attached a new test case where the storyboard is in the root folder of the library project.

And I have confirmed that the regressions status is unchanged:

BAD: Xamarin.iOS 9.4.1.25 (962a050)
BAD: Xamarin.iOS 9.4.0.0  (7322991)
BAD: Xamarin.iOS 8.9.1.3  (f7736a4)
Comment 3 Brendan Zagaeski (Xamarin Team, assistant) 2016-02-12 01:26:10 UTC
I am updating the summary slightly to be more general. I did some additional tests today while investigating another bug, and I found that the problem affects _all_ resources in library projects, not just storyboards.

The fact that the issue is more general means that it can more easily lead to published builds that are silently missing assets. Moreover, Apple's submission process might check explicitly for missing storyboards, but I don't think they have any way to check for missing ".html" bundle resource files (for example). And I think images and other bundle resources are also probably more common than storyboards in library projects.

In short, the generality of this problem makes it worse, so I am increasing the severity and setting the target milestone to the next upcoming milestone for initial assessment.




## Steps to replicate

1. Replace the `.storyboard` file in the test case from Comment 2 with a `.png` or `.xml` file with a build action of "BundleResource".
2. Follow the steps to replicate from Comment 0.




## Regression status: not a regression

BAD: Xamarin.iOS 9.4.1.25 (962a050) + Xcode 7.2
BAD: Xamarin.iOS 9.4.0.0  (7322991) + Xcode 7.2
BAD: Xamarin.iOS 8.9.1.3  (f7736a4) + Xcode 6.4
Comment 4 Jeffrey Stedfast 2016-02-16 22:58:00 UTC

*** This bug has been marked as a duplicate of bug 37837 ***
Comment 5 Brendan Zagaeski (Xamarin Team, assistant) 2016-02-16 23:08:45 UTC
Unfortunately, this does not seem to be a duplicate of Bug 37837. Bug 37837 was a regression in Cycle 6 – Service Release 1. This bug is (as far as I can tell) not a regression at all.

Also, Xamarin.iOS 9.4.1.25 (962a050) fixes Bug 37837 in my tests, but unfortunately it does not fix this bug (Bug 38244).
Comment 6 Jeffrey Stedfast 2016-02-22 20:35:15 UTC
Fixed in git master: fc887e28844c7a3a1734e505e1e70a3af90cd052
Comment 7 Rajneesh Kumar 2016-04-28 13:59:37 UTC
I have checked this issue with the builds from cycle 7 and observed that after adding back the missing semicolon in the 'AppDelegate.cs' file, and without cleaning the project,its build and run successfully without any exception.

Screencast: http://www.screencast.com/t/LIxZeLHGyq

It seems that this issue has been fixed and working as expected. If someone face this issue again so feel free to reopen it or file a seperate bug.

So as of now I am closing this issue.

Thanks..!

Env Info:  https://gist.github.com/Rajneesh360Logica/2c99ffc3f4c951be2e14e6e0671b5a7d