Bug 34474 - Font file set to BundleResource gets erased on build.
Summary: Font file set to BundleResource gets erased on build.
Alias: None
Product: Visual Studio Extensions
Classification: Xamarin
Component: iOS ()
Version: 4.0.0 (C6)
Hardware: PC Windows
: Highest critical
Target Milestone: 4.0.0 (C6)
Assignee: Jon Goldberger [MSFT]
Depends on:
Reported: 2015-09-30 22:42 UTC by Jon Goldberger [MSFT]
Modified: 2015-10-05 12:42 UTC (History)
8 users (show)

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

Test Project (60.67 KB, application/zip)
2015-09-30 22:42 UTC, Jon Goldberger [MSFT]

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:

Description Jon Goldberger [MSFT] 2015-09-30 22:42:25 UTC
Created attachment 13152 [details]
Test Project

## Description

Adding a font file to a new template iOS project and setting the Build Action to BundleResource causes the font file to be overwritten and zeroed out (size 0 KB) after the build. This causes, obviously, the font to not be loaded and a exception at runtime when trying to use the font. The same occurs in VS 2013 or 2015. But works as expected in Xamarin Studio (Mac) using the Cycle 6 builds. 

## Regression status

BAD: Xamarin (Cycle 6 Alpha builds on XS Mac)
GOOD: Xamarin   3.11.1443.0 (Cycle 5 SR 4 builds on XS Mac)

## Steps to reproduce

1. Open the attached test project. 

2. In File Explorer, navigate to the Resources\Fonts directory

3. Verify the file size of the Font file.

4. Build the app in Visual Studio.

4a. (Due to UPDATE below) Allow app to launch and you should see the customer font.

5. Go back to File Explorer and check the file size of the Font file.

Expected result: Font file will still have some bytes in it. 

Actual result: Font file has a size of 0KB

(UPDATE: Double checking that my test project (from template) reproduces the issue as the customer's test project did, on the first build, the app deployed and displayed the font on the simulator on the Mac, so it worked as expected, but then the font file was empty and the next deploy failed because the font file could not be loaded due to being 0KB).

## Notes

Other Build Actions were tested, like Compile, None, and EmbeddedResource and the overwrite only occurs when the font file is set to BundleResource. As far as I know BundleResource is the required build action for Font files. 

This does not occur with image files set with Build Action BundleResource. I have not tested other types of resource files. 

## Environment

Microsoft Visual Studio Professional 2015
Version 14.0.23107.0 D14REL
Microsoft .NET Framework
Version 4.6.00079

Installed Version: Professional

Visual Basic 2015   00322-40000-00000-AA850
Microsoft Visual Basic 2015

Visual C# 2015   00322-40000-00000-AA850
Microsoft Visual C# 2015

Visual C++ 2015   00322-40000-00000-AA850
Microsoft Visual C++ 2015

Visual F# 2015 RC   00322-40000-00000-AA850
Microsoft Visual F# 2015 RC

Windows Phone SDK 8.0 - ENU   00322-40000-00000-AA850
Windows Phone SDK 8.0 - ENU

Application Insights Tools for Visual Studio Package   1.0
Application Insights Tools for Visual Studio

ASP.NET and Web Tools   14.0.20626.0
ASP.NET and Web Tools

ASP.NET Web Frameworks and Tools 2013   5.2.30624.0
For additional information, visit http://www.asp.net/

Common Azure Tools   1.5
Provides common services for use by Azure Mobile Services and Microsoft Azure Tools.

GenerateUnitTest   1.0
Generates unit test code for methods in classes under test.

GitHub.VisualStudio   1.0
A Visual Studio Extension that brings the GitHub Flow into Visual Studio.

Microsoft Azure Mobile Services Tools   1.4
Microsoft Azure Mobile Services Tools

NuGet Package Manager   3.0.0
NuGet Package Manager in Visual Studio. For more information about NuGet, visit http://docs.nuget.org/.

PreEmptive Analytics Visualizer   1.2
Microsoft Visual Studio extension to visualize aggregated summaries from the PreEmptive Analytics product.

SQL Server Data Tools   14.0.50616.0
Microsoft SQL Server Data Tools

Visual Studio Tools for Universal Windows Apps   14.0.23121.00 D14OOB
The Visual Studio Tools for Universal Windows apps allow you to build a single universal app experience that can reach every device running Windows 10: phone, tablet, PC, and more. It includes the Microsoft Windows 10 Software Development Kit.

Xamarin (9ac5fb8)
Visual Studio extension to enable development for Xamarin.iOS and Xamarin.Android.

Xamarin.Android (faa77fc)
Visual Studio plugin to enable development for Xamarin.Android.

Xamarin.iOS (bdbf45b)
Visual Studio extension to enable development for Xamarin.iOS.
Comment 2 Jon Goldberger [MSFT] 2015-09-30 22:53:08 UTC
Additional note: The same behavior was observed with .otf or .ttf font files.
Comment 4 PJ 2015-10-01 15:13:47 UTC
Deleting user data is one of the criteria for a bug to be marked as 'Highest' priority. Updating.

I am not sure if this would block the C6 RC. I think it should. I am not the sole arbiter, but I would never want to knowingly market and ship a release that could delete a user's file.
Comment 5 Adrian Alonso 2015-10-01 16:07:08 UTC
Should be already fixed in the latest mater/cycle6 build
Comment 6 Jose Gallardo 2015-10-01 16:10:11 UTC
This actually sound pretty much a side effect of the issue we fixed on iOS9SR1 with embedded resources (https://bugzilla.xamarin.com/show_bug.cgi?id=34144).

That patch is currently on master and cycle6. We couldn't repro this issue with those builds.
Comment 9 Mohit Kheterpal 2015-10-05 12:42:59 UTC
I am able to reproduce this issue with the help of steps given in comment 0, and also observed that this issue is working fine with Xamarin.VisualStudio_4.0.0.1566_5abb0de8afa3ff99a49b89ad8933c6a068e09210.msi