This can be a very difficult one to figure out. Since the error points to the .NET framework itself and not any AdvancedHMI code, it really gives no clue as to where it is occurring.
The version of Visual Studio has no relevance since the .NET framework does the compiling
Which driver are you using and which version of AdvancedHMI?