Bug 19870 - Intellisence not working as expected in razor files (*.cshtml)
Summary: Intellisence not working as expected in razor files (*.cshtml)
Alias: None
Product: Xamarin Studio
Classification: Desktop
Component: ASP.Net ()
Version: 4.2.x
Hardware: PC Windows
: Normal normal
Target Milestone: Future Cycle (TBD)
Assignee: Bugzilla
Depends on:
Reported: 2014-05-17 17:42 UTC by timlogan475
Modified: 2017-05-18 16:00 UTC (History)
3 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 for Bug 19870 on Developer Community or GitHub 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 or GitHub Markdown
  • Copy the title and description into the new report. Adjust them to be up-to-date if needed.
  • Add your new information.

In special cases on GitHub you might also want the comments: GitHub Markdown with public comments

Related Links:

Description timlogan475 2014-05-17 17:42:30 UTC
So I'm playing around with an asp.net MVC5 project in Xamarin and stuff is working as it should, except for intellisense in razor files. Or rather in the C# part of those files.
There's no problem with the html part, the intellisense pops up and is really helpful etc. but when I try to write C# code, like so

@model UserProfile

No help what so ever, I can't even force intellisense out by clicking ctrl+spacebar.

If you need any more info please let me know =)
Comment 1 Mikayla Hutchinson [MSFT] 2014-05-19 14:26:33 UTC
I can repro the issue with no completion for the type after the @model, but C# completion elsewhere works fine for me. Do you have other cases where it's not working?
Comment 2 timlogan475 2014-05-19 17:18:35 UTC
It works in all normal .cs files, but I can't get it to work for C# anywhere in a .cshtml files =)
Comment 3 Mikayla Hutchinson [MSFT] 2014-05-20 16:48:29 UTC
Weird, do you have a repro case?
Comment 4 timlogan475 2014-05-20 16:56:12 UTC
I'm sorry, but I don't know what that means =)

What I did to get where I am now is follow this guide to get ASP.NET MVC5 working in XS (since it's broken right out of the box..)


And from there .cshtml only show intellisense in the html part, not the cs part.

Is that what you're looking for? =)
Comment 5 Mikayla Hutchinson [MSFT] 2014-05-20 17:22:30 UTC
I mean step by step instructions to reproduce the problem.

For example if I create an ASP.NET MVC3 Razor project in XS 5.0, it works: http://screencast.com/t/1Bn4SXo5BD3z

And if I change the target framework to 4.5 and add a ASP.NET MVC5 NuGet Package reference, it still works.
Comment 6 timlogan475 2014-05-22 20:02:30 UTC

System: windows 7
XS version 4.2.5

Open XS
Create new project
MVC3 with Razor
*the project is created and loaded*
I click F5

and I'm greeted by my new website

Well, that won't do. So I follow the link from earlier
In the project options I go Build->General and then set target framework to be 4.5
Then I right click the reference folder and select Manage NuGet Packages. Then I search for and add "Microsoft ASP.NET MVC".
Yet again I try to run and this time I'm greeted with this page


Ok, I now open the root Web.config file 
And I change this line (on mine, line 92)
<add key="webpages:Version" value="" />
<add key="webpages:Version" value="" />

This time the site looks like so

Now in the views folder I open the Web.config 
I find all instances of
System.Web.WebPages.Razor, Version=
And replace them with
System.Web.WebPages.Razor, Version=

And all instances of
System.Web.Mvc, Version=
And replace them with
System.Web.Mvc, Version=

And this time when I run I'm finally greeted by


Now if I open a .cshtml file at random, and I write "@" to start writing c# code, the intellisense or autocomplete or whatever it's name is, window doesn't pop up, if I start writing, and I click ctrl+space it doesn't show up either.
that said, I have just discovered that if I were to hit ctrl+space in the middle of html code, it does indeed come up with this short list of suggestions for C# code.

I hope that answers that. If not, then let me know what you need =)
Comment 7 Lluis Sanchez 2017-05-18 16:00:23 UTC