Solution
The issue is caused by the inlining methods in 64-bit. To work around this issue it is needed to disable or reduce the inline optimization done by the 64-bit JIT compiler. Follow these steps to reduce optimization on the DLL that is causing the issue:
1. Locate the folder where the DLL throwing the exception is (NationalInstruments.Controls.Graphs.dll). You can locate the folder by using the
Fuslogvw.exe (Assembly Binding Log Viewer). You can also see the path from which the DLL is being referenced by going to the Solution Explorer >> References >> Assembly >> Properties >> Path.
2. Add an .ini file to the folder where the NationalInstruments.Controls.Graphs assembly is installed. The .ini file should be named NationalInstruments.Controls.Graphs.ini and contain:
[.NET Framework Debugging Control]
GenerateTrackingInfo=1
AllowOptimize=0
Note: There are some performance implications due to the loss of inlining that need to be taken into account if using this workaround in production code. Since this ini setting is on an assembly in the GAC (usually), all applications that use the NationalInstruments.Controls.Graphs assembly would be affected. You might be able to reduce the scope by copying assemblies and using the ini file locally.