Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
I had some trouble with my visual studio 2013 professional edition last week which meant I had to reinstall the software. I have set everything back up and I have noticed that the IntelliSense is not working in my razor files for dynamic objects. I may be wrong but I could of swore this used to work prior to the reinstallation of VS.
Consider the following code
//gets the home page using doc type alias (root node)
var siteRoot = Model.Content.AncestorOrSelf("homePage");
//gets the about us page using doc type alias
var portfolioPage = siteRoot.Descendant("portfolioPage");
//gets the gallery page using doc type alias
var galleryPage = siteRoot.Descendant("galleryPage");
var imagesToDisplay = portfolioPage.HasValue("imageAmount") ? portfolioPage.GetPropertyValue<int>("imageAmount") : 2;
<!-- .container -->
<h2>@(portfolioPage.HasValue("heading") ? portfolioPage.GetPropertyValue("heading") : portfolioPage.Name)</h2>
<!--get gallery albums-->
@foreach (var type in galleryPage.Children)
var galleryAlbum = Umbraco.Media(type.GetPropertyValue<int>("image"));
if (galleryAlbum.ChildrenAsList.Count() != 0)
<a href="#" data-filter=".class-@type.Id">@type.Name</a>
when using visual studio IntelliSense i get no options and a message informing me that its a dynamic expression and it will be resolved at runtime
I have resharpher ultimate installed and when i go to resharper > options and switch to the resharper IntelliSense i get the members from object and what looks like members that i have used elsewhere but resharper is not quite sure.
I know that the ChildrenAsList member (which is what i need) is available to the dynamic galleryAlbum object but why doesnt my IntelliSense tell me this.
The other thing that i have noticed is that my IntelliSense constantly stops working regardless if its in vs or resharper mode which also makes me believe something is screwed with this install. To fix i either have to close the code file or teh project itself. So with the above in mind i have the following questions
If anyone has any info on the above then i would be really greatful. I have attempted to reset all user settings via the import and export wizzard but had no luck
I have never had intellisense for dynamic objects. Think about it this way, how is VS or Resharper supposed to infer the properties of an object that is essentially a ghost until it receives values? This is why I usually strongly type anything coming into the page, even CurrentPage to var currentPage = (IPublishedContent)CurrentPage. Just makes debugging a lot easier.
VS Intellisense, while a great tool, is hard to compare to a product that has focused on that functionality as one of it's major attributes that it can charge for.
3.Personally, I have ran into this issue a couple of times. Usually restarting VS or refreshing the Resharper cache fixes it for me.
All that information is really useful. I'll mark as the solution 😄
is working on a reply...
Write your reply to:
Image will be uploaded when post is submitted