How to fix Visual Studio Could not evaluate Expression

October 11, 2016 at 1:16 PMMadestro

Sometimes you will come across a situation where you debug in Visual Studio and you are unable to look at the variables. You simply get a message that reads:

"Could not evaluate Expression"

Long story short, one of the reasons this happens is corrupt breakpoints.

Pull up your Breakpoint window and erase every single breakpoint you have. Compile and set your breakpoints again.

Problem solved. :-)

Posted in: ASP.NET MVC | General Development | Visual Studio

Tags:

Running Windows Authentication with IIS Express

August 6, 2015 at 10:18 AMMadestro

You may run into a situation where you have configured your site to run Windows authentication but you get an authentication error when you try to browse it during a debug session.

To fix this issue, you need to edit the Application Host file for IIS and enable Windows authentication. You can find the file here:

\My Documents\IISExpress\config\applicationhost.config

Find the <security> section inside the <system.webServer> node and enable Windows authentication as follows:

<system.webServer>
...
  <security>
...
    <authentication>
      <windowsAuthentication enabled="true" />
    </authentication>
...
  </security>
...
</system.webServer>

And that's all there is to it. :-)

Posted in: ASP.NET MVC | Visual Studio | Web Development

Tags:

Package did not load correctly on Visual Studio 2012 Startup

August 18, 2014 at 10:21 AMMadestro

My network admin apparently has Windows updates setup to auto-install and reboot if needed so the computer had done that last night and Visual Studio 2012 was reloading upon startup when I came in this morning. 

To my surprise. I was greeted by a series of errors popping up as Visual Studio 2012 fired up, concerning the loading of packages.

In my case it was a number of different packages, one of them being PasteJson.JsonPackage. Restarting VS 2012 didn't help.

The issue turned out to be that VS 2012 maintains some sort of cache (meta data most likely) about the packages and it was either outdated or corrupt for some reason.

You can fix this situation easily by going to C:\Users\[INSERT USER NAME HERE]\AppData\Local\Microsoft\VisualStudio\12.0\ComponentModelCache and deleting all files you find in that folder.

No more errors after that. :-)

Someone mentioned to me that this might be a recurring issue so until it's fixed, just delete the files again.

Posted in: Visual Studio

Tags:

ASP.NET site that runs in Visual Studio 2012 will not run in Visual Studio 2013: mimeMap entry error

July 25, 2014 at 11:38 AMMadestro

I ran into the following error while trying to open a Visual Studio 2012 solution in the new version, Visual Studio 2013:

HTTP Error 500.19 - Internal Server Error

The requested page cannot be accessed because the related configuration data for the page is invalid.

The detailed information section listed the follwing config error:

"Cannot add duplicate collection entry of type 'mimeMap' with unique key attribute 'fileExtension' set to '.woff'"

The important thing here is not the mime type. It's the action of adding it that is causing the problem.

Apparently, the IISExpress version used by Visual Studio 2013 is based on newer IIS engines (7.0 and up) which throw this error when you add the same mime type at multiple levels in the config files.

You can obviously just add it at one level and solve the problem. However, more times than not this is not ideal and you still need to have the entry there.

Fortunately, there is a simple solution. Add a Remove directive right before you add the mime type:

<staticContent>
      <remove fileExtension=".woff" />
      <mimeMap fileExtension=".woff" mimeType="application/x-font-woff" />
</staticContent>
 
And that's all there is to it. By removing the entry right before you re-add it, you avoid this error.

Posted in: Visual Studio | Web Development

Tags:

How to keep IISExpress running after you stop debugging in Visual Studio 2013

June 24, 2014 at 5:01 AMMadestro

It's very annoying to have the IISExpress web server close down every time you hit the STOP button in the Visual Studio Debugger.

Fortunately, it's simple enough to keep it open:

  1. Go to the web application in the Solution Explorer.
  2. Right click on it and hit "Properties" (or hit ALT + ENTER).
  3. Click on the "Web" tab on the left.
  4. Uncheck the box for "Enable Edit and Continue".

And that's all there is to it.

Posted in: Visual Studio | Web Development

Tags:

Intellisense not working on views after migrating MVC application to Visual Studio 2013

January 8, 2014 at 11:28 AMMadestro

 

I recently migrated one of our MVC applications to Visual Studio 2013.

After the migration, Intellisense broke. It would not work for any view I opened. It wouldn't even recognize the @model directive.

Since part of the plan was to upgrade to the latest version of MVC (5 at the time of this writing), I decided to add the NuGet package and its dependencies. This didn't solve the problem either.

Eventually, I ended up creating a new test MVC project with Visual Studio 2013. I then took the pertinent sections from the web.config file under the Views folder and copied them over to my migrated project. I then closed and relaunched VS2012 and the solution.

That got Intellisense working again.

Keep in mind that if you do this, you will introduce some new dependencies, since the latest template uses the System.Web.Optimization namespace. I didn't try removing this namespace from the web.config but if you don't want the dependencies, you might be able to get away with removing it from the web.config.

Posted in: ASP.NET MVC | Visual Studio

Tags:

Removing SVN from a Visual Studio 2012/2013 Solution

January 7, 2014 at 3:59 PMMadestro

 

I recently ran into a situation while trying to migrate a project from SVN to TFS.

I used the Export command of Tortoise SVN to produce the output I would migrate. This effectively produces a "clean" copy of the code (no SVN folders).

When I tried to add the code to TFS via Visual Studio, I noticed the solution kept loading with SVN bindings (I use the ANKHSVN plugin). If I tried to switch the plugin, it would ask me to close the solution.

I went poking around in the Solution (.sln) file and found the following entry:

 

GlobalSection(SubversionScc) = preSolution

Svn-Managed = True

Manager = AnkhSVN - Subversion Support for Visual Studio

EndGlobalSection

 

Removing this "GlobalSection" did the trick for me. After launching the solution again, I was able to add it to TFS.

I hope this helps anyone with the same issue out there.

Posted in: Visual Studio

Tags: