Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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:

View Details Exception

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

like image 203
Matias Cicero Avatar asked Jul 15 '15 11:07

Matias Cicero


People also ask

How do I fix CS0103 error?

CS0103 is caused when you are using a name for a variable or method that does not exist within the context that you are using it. In order to fix the CS0103 error you will need to correct the name of the variable or method from where it is declared or referenced.

Does not exist in the current context means?

I know this error means that the control being referenced generally doesn't exist or is not a part of the class that's referencing it, but as far as I can see, that isn't the case here.

Does not exist in the current context c# asp net?

Many a times while writing a code we get this error which says, “The name does not exists in the current context”. This is because the code behind file is not able to find the control being added to your aspx file.


1 Answers

I solved the same problem in these steps:

step 1) If you program your custom DLL in C++ using Visual studio,then at the property page of your project set the Common Language Runtime Support (/clr)parameter to Common Language Runtime Support (/clr).

step 2) To function deceleration in .h file use __declspec(dllexport) keyword like below:

__declspec(dllexport) double Sub(int a,int b);

step 3) Build and export DLL file, then use the Dependency Walker software to get your function EntryPoint.

step4) Import DLL file In the C# project and set EntryPoint and CallingConvention variable like below:

[DllImport("custom.dll", EntryPoint = "?Sub@@Y234NN@Z", CallingConvention = CallingConvention.Cdecl)]

    public static extern double Sub(int a,int b);
like image 178
Hamid Avatar answered Oct 29 '22 16:10

Hamid