'Error while trying to run project uncaught exception thrown by method called through reflection

I have installed Visual studio 2010 Ultimate verion but while running below simple windows form programme getting error....

    MsgBox("Hello !")

    "error while trying to run project uncaught exception thrown by method called 
     through reflection"

anything wrong with installation ??

Its Visula studio Exception not my programme exception...

I tried below but no luck..

devenv /resetsettings

enter image description here



Solution 1:[1]

  1. Go to the project right click and select properties.
  2. Select 'Debug' tab on the left.
  3. Go to ‘Enable Debuggers’ on the bottom
  4. Check ‘Enable Native code debugging’ (or 'Enable unmanaged code debugging', depends on version) check box
  5. Run the project

Solution 2:[2]

Steps to your problem

I have uploaded the steps to your problem.

As you see the image, check the native code debugging option and that's all.

Hope it helps.

I'm using Visual Studio 2017

Solution 3:[3]

This is an annoying problem.

If you Enable native code Debugging then you cannot Edit-and-Continue:

Changes are not allowed when unmanaged debugging is enabled.

I finally solved it by unticking Enable native code Debugging and unticking Enable IntelliTrace

enter image description here


Another time I got this error was when I upgraded a Solution from VS2010 to VS2017.

The problem was the Setup Project hadn't been set to the GUI (it was set to a Control Class Library):

The solution is to right click the Project > Set as StartUp Project:

enter image description here

Solution 4:[4]

I just had to restart vs. As right clicking the solution was giving the same error.

Solution 5:[5]

Restarting Visual Studio fixed this for me.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 GalDude33
Solution 2 Olaia
Solution 3
Solution 4 Sigex
Solution 5 Englund0110