The name '$exception' does not exist in the current context

.net, c#, debugging, exception, visual-studio-2012

Solution

Try explicitly to tell the compiler how to import the dll. Ex:

using System;
using System.Runtime.InteropServices;

namespace BitmapProcessingCs
{
    public static class NativeMethods
    {
        [DllImport("BitmapProcessingCpp.dll", CallingConvention = CallingConvention.Cdecl)]
        public static extern void GenerateBitmap(IntPtr src, int dimension);
    }
}

Problem

Today I was debugging an application in my work. I proceeded to set a breakpoint in one of my catch blocks in order to inspect an exception with more detail. The `View Detail` modal window opens normally, but instead of showing me the details of the exception, it is throwing a strange error, one I never got, nor I know what it means: The error says: The name '$exception' does not exist in the current context This is frustating because I am within the catch block scope, so I should be able to see my exception. After restarting my application, I managed to debug it just fine. This was the only time (so far) I got this error. Does anyone know what it means and how can I fix it (without having to restart application)? NOTE: I am using Visual Studio 2012 Premium. Version 11.0.61030.00 Update 4

Original source