Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

749
Views
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

over 4 years ago · Santiago Trujillo
3 answers
Answer question

0

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);
    }
}
over 4 years ago · Santiago Trujillo Report

0

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);
over 4 years ago · Santiago Trujillo Report

0

Have a look at MSDN's library : https://msdn.microsoft.com/en-us/library/ms164891.aspx

According to them, you'll get an exception if you try to evaluate an exception object if no exception has occurred. But, since you're in the catch block, an excption has occurred... Without seeing your code it's hard to guess, but is it maybe possible that you have multiple threads running, and the exception was consumed by one thread before being handled by another? Doesn't really make sense but it's worth looking at. A safe(r) option would be to ensure you check if the exception is null in your logger, before trying to get detail from it. Also worth looking at: The HttpRequestException contains an inner exception, which might be the source of your null reference? Just speculating.

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!