Today I upgraded a C# program from .NET 2.0 to .NET 4.0 and started debugging it.
I got the error message when pInvoke called a C++ function in one of my DLLs:
A call to PInvoke function 'MyMethod' has unbalanced the stack.
This is likely because the managed PInvoke signature does not match the unmanaged target signature.
Check that the calling convention and parameters of the PInvoke signature match the target unmanaged signature.