Bug 42031 - Deleted ImageAsset sprite does not show up in Visual Studio
Summary: Deleted ImageAsset sprite does not show up in Visual Studio
Alias: None
Product: Visual Studio Extensions
Classification: Xamarin
Component: General ()
Version: unspecified
Hardware: PC Windows
: --- normal
Target Milestone: 4.3.0 (C9)
Assignee: Bugzilla
Depends on:
Reported: 2016-06-21 13:43 UTC by Akash Kava
Modified: 2016-12-22 19:36 UTC (History)
7 users (show)

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:

Description Akash Kava 2016-06-21 13:43:05 UTC
I added Sprite ImageAsset in Visual Studio, I decided to get rid of Sprite ImageAsset, so I deleted it from Visual Studio. This did not delete actual <ImageAsset> tag inside csproj file, when I tried to build it, It kept on giving me error that could not find content.json inside ImageAsset for respective sprite. So I went to Mac, I opened same project in Xamarin Studio, I could see my deleted sprite still inside Xamarin Studio. I deleted sprite in Xamarin Studio, this actually did delete <ImageAsset> tag inside csproj file.

So in summary,
Deleting ImageAsset in Visual Studio does not remove ImageAsset tag from csproj, it does delete the files in the disk.
Comment 1 Ben Beckley 2016-06-22 00:23:23 UTC
Hello Akash,

Thank you for taking the time to report this bug. I've gone ahead and tried to reproduce the issue that you are experiencing, but couldn't manage to replicate the behavior.

Could you please describe how you are deleting the asset from Visual Studio? Below is a link to a screencast where I unset the ImageAsset from the Asset Catalog and it is removed from the csproj file.

Could you please also provide what XVS build you were using? Mine is below.

Thank you.
Comment 2 Akash Kava 2016-06-22 08:41:54 UTC
I don't know how did it happen, it could be due to git's conflict that may have resulted in deleting resources and overriding csproj file and leaving <ImageAsset> in csproj file.

But in that case, error message should indicate before giving compilation error from mac agent.

So to summarise, delete resource manually and leave <ImageAsset> in csproj, it does not indicate Yellow warning or anything indicating that resource does not exist. VS does not show ImageAsset at all, so there is no way to know that csproj contains something that does not exist in the disk.

However, if you open project in XS then you will see that ImageAsset even if there is no Imageasset on the disk.
Comment 3 Ben Beckley 2016-06-22 19:21:50 UTC
Hi Akash,

I went and deleted an AppIcon element manually from the Resources/Images.xcassets/AppIcons.appiconset folder. The csproj still had a reference to the <ImageAsset> element. There was also a reference in the corresponding Contents.json folder. Prior to building, I did not have any errors or warnings. Post-build, I did have a warning that there was no asset for the one that I had deleted - which makes sense.

I tried the same process with a SpriteAtlas element, and did not receive a warning.

In an attempt to reproduce your error with the missing content.json file, I deleted the one which references the sprites. I still did not receive an error, which I find to be odd.

If possible, could you please provide a project that exhibits this behavior? Also, what version of XVS are you using?

My environment info: https://gist.github.com/BenBeckley/2a2a435d2bf3e1d8764d2f36bce875a8
Comment 5 Adrian Alonso 2016-12-22 19:36:59 UTC
Please let us know if you still need help with this issue. Thanks, Adrian