Bug 45088 - Image Assets are explicitly excluded from the IVsHierarchy
Summary: Image Assets are explicitly excluded from the IVsHierarchy
Status: REOPENED
Alias: None
Product: Visual Studio Extensions
Classification: Xamarin
Component: iOS ()
Version: 4.2.0 (C8)
Hardware: PC Windows
: Normal major
Target Milestone: 15.6
Assignee: Adrian Alonso
URL:
Depends on:
Blocks:
 
Reported: 2016-10-05 22:38 UTC by Jon Goldberger [MSFT]
Modified: 2017-12-07 21:54 UTC (History)
11 users (show)

Tags: ac vs Akvelon
Is this bug a regression?: No
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 45088 on Developer Community 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
  • Copy the title and description into the new report. Adjust them to be up-to-date if needed.
  • Add your new information.
Related Links:
Status:
REOPENED

Description Jon Goldberger [MSFT] 2016-10-05 22:38:29 UTC
## Description

This issue only occurs in Visual Studio, not in Xamarin Studio.

When you open a storyboard or xib in iOS Designer, any Image Sets in the asset catalog will be picked up and will be selectable when clicking on the drop down for the Image property of a UIImage view. If you add a new Image Set to the Asset Catalog, the new image set will not be available in the drop down list for the Image property until you close and re-open the storyboard/xib. IN Xamarin Studio I do not need to close and re-open the storyboard/xib for the new image set to be available in the drop down. 

## Steps to reproduce

1. Create a new iOS Single View app project in Visual Studio.

2. Create an asset catalog and add a new Image set and populate it with images. 

3. Save the asset catalog. 

4. Open the LaunchScreen.xib (created by default with the template... I would have though we would create a LaunchScreen.storyboard instead of an xib, but that is an issue for another bug report)

5. Drag an Image View to the View Controller and select it and view the properties.

6. Click on the Image property for the UIImageView in the properties pane. You should see the Image Set you created in step 2 in the drop down list. 

7. Go back to the asset catalog and add a new Image Set and populate it with images. 

8. Save the asset catalog.

9. Go back to the iOS Designer and select the image and click the Image property in the Properties pane.

Expected result: Will see the new image set created in step 7 in the drop down. 

Actual result: I only see the image set created in step 2. 

## Notes

So it would appear that iOS designer is oblivious to changes in the asset catalog while a xib or storyboard is open, and only picks up the Image Sets that existed when the xib/storyboard was opened. I do note exactly the same behavior with a storyboard. Again this is Visual Studio only. All works as expected in Xamarin Studio. 

## Environment

Microsoft Visual Studio Enterprise 2015
Version 14.0.25431.01 Update 3
Microsoft .NET Framework
Version 4.6.01586

Installed Version: Enterprise

Architecture and Modeling Tools   00322-80000-00000-AA208
Microsoft Architecture and Modeling Tools
    
UML® and Unified Modeling Language™ are trademarks or registered trademarks of the Object Management Group, Inc. in the United States and other countries.

Visual Basic 2015   00322-80000-00000-AA208
Microsoft Visual Basic 2015

Visual C# 2015   00322-80000-00000-AA208
Microsoft Visual C# 2015

Visual C++ 2015   00322-80000-00000-AA208
Microsoft Visual C++ 2015

Visual F# 2015   00322-80000-00000-AA208
Microsoft Visual F# 2015

Windows Phone SDK 8.0 - ENU   00322-80000-00000-AA208
Windows Phone SDK 8.0 - ENU

Application Insights Tools for Visual Studio Package   7.8.00927.1
Application Insights Tools for Visual Studio

ASP.NET and Web Tools 2015.1   14.1.20907.0
ASP.NET and Web Tools 2015.1

ASP.NET Web Frameworks and Tools 2012.2   4.1.41102.0
For additional information, visit http://go.microsoft.com/fwlink/?LinkID=309563

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

Azure App Service Tools v2.9   14.0.20316.0
Azure App Service Tools v2.9

Azure Data Lake Node   1.0
This package contains the Data Lake integration nodes for Server Explorer.

Azure Data Lake Tools for Visual Studio   2.0.6000.0
Microsoft Azure Data Lake Tools for Visual Studio

Command Bus, Event Stream and Async Manager   Merq
Provides ICommandBus, IEventStream and IAsyncManager MEF services for loosely coupled Visual Studio extension components communication and integration.

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

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

JavaScript Language Service   2.0
JavaScript Language Service

JavaScript Project System   2.0
JavaScript Project System

Microsoft .NET Core Tools (Preview 2)   14.1.20907.0
Microsoft .NET Core Tools (Preview 2)

Microsoft Azure HDInsight HQL Service   2.0.6000.0
Language service for Hive query

Microsoft Azure HDInsight Tools for Visual Studio   2.0.6000.0
An integrated development environment for HDInsight application development.

Microsoft Azure Mobile Services Tools   1.4
Microsoft Azure Mobile Services Tools

Microsoft Azure Tools   2.9
Microsoft Azure Tools for Microsoft Visual Studio 2015 - v2.9.40323.3

NuGet Package Manager   3.5.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.60519.0
Microsoft SQL Server Data Tools

ToolWindowHostedEditor   1.0
Hosting json editor into a tool window

TypeScript   1.8.36.0
TypeScript tools for Visual Studio

Visual Studio Tools for Universal Windows Apps   14.0.25527.01
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   4.2.0.703 (3b7df6f)
Visual Studio extension to enable development for Xamarin.iOS and Xamarin.Android.

Xamarin.Android   7.0.1.3 (96c7ba6)
Visual Studio extension to enable development for Xamarin.Android.

Xamarin.iOS   10.0.1.10 (ad1cd42)
Visual Studio extension to enable development for Xamarin.iOS.
Comment 1 Alan McGovern 2017-09-14 13:18:44 UTC
Actually let's ignore this for now - i'm waiting on some additional information from our VS team before we can address this properly.
Comment 2 Alan McGovern 2017-09-25 12:37:43 UTC
> <ImageAsset Include="Resources\Media.xcassets\AppIcons.appiconset\40x40.png">
>     <InProject>false</InProject>
> </ImageAsset>```

XVS adds ImageAssets with the `InProject` metadata attribute. VSM does not.

This causes two issues:
1) Projects created in VSM are not the same as projects created in VS.
2) Items with `InProject` set to false will not be accessible via the normal IVsHierarchy APIs and so will not trigger the ItemAdded/ItemRemoved events from `Dte.Events`.

Option 1:
* Use <Hidden>true</Hidden> instead of <InProject>false</InProject.
* Migrate old projects to the new system.

Option 2:
* Provide a custom API point which mimics the standard events, but only triggers for these explicitly excluded items

Option 3:
I'm open to anything ;)

Finally, we should make sure VSM follows the same conventions.
Comment 3 Alan McGovern 2017-09-25 12:38:58 UTC
Sorry, the correct flag is `<Visible>False</Visible>`, not `<Hidden>true</Hidden>`. I always get that wrong ;)
Comment 8 Alan McGovern 2017-12-07 21:51:04 UTC
Yes, i suspect the fact that ImageAsset items don't show up with the normal IVs events is the same reason why they don't show up in the normal IVSHierachy, which is why we still need the MSBuild hack to retrieve them.

https://screencast.com/t/V59WfVdDgpT

https://github.com/xamarin/designer/tree/vs-image-assets

I'm hoping we can remove the msbuild hack once the events work, as my hope is they will show up like normal items then!
Comment 9 Alan McGovern 2017-12-07 21:54:24 UTC
I found another doc somewhere, but all I can find now is this: https://blogs.msdn.microsoft.com/jomo_fisher/2005/01/25/hack-the-build-hide-items-from-visual-studio-solution-explorer/#comment-2383

<InProject>false</InProject> might prevent something being included in the hierarchy, so we will need to remove that attribute. However just removing it might not be sufficient to make something be *in* the hierarchy. As it stands these items are still not showing up in the places they should be.