切换到VS2010后,托管调试助手在从C#应用程序调用非托管C++函数时显示有关不平衡堆栈的错误.
通常的嫌疑人似乎没有引起这个问题.还有别的我应该检查一下吗?VS2008构建的C++ DLL和C#应用程序从来没有出现问题,没有奇怪或神秘的错误 - 是的,我知道这并不意味着什么.
以下是检查的内容:
C#:
[DllImport("Correct.dll", EntryPoint = "SuperSpecialOpenFileFunc", CallingConvention = CallingConvention.StdCall, CharSet = CharSet.Ansi, ExactSpelling = true)]
public static extern short SuperSpecialOpenFileFunc(ref SuperSpecialStruct stuff);
[StructLayout(LayoutKind.Sequential, Pack = 1, CharSet = CharSet.Ansi)]
public struct SuperSpecialStruct
{
public int field1;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 256)]
public string field2;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 20)]
public string field3;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 10)]
public string field4;
public ushort field5;
public ushort field6;
public ushort field7;
public …Run Code Online (Sandbox Code Playgroud) 我的解决方案中有两个项目:C/C++ Win32 DLL和一些C#应用程序.
我需要做些什么才能在调试时进入DLL?
我打开了C++项目设置中的所有调试选项,并将其复制到C#应用程序根目录下:MyLib.dll,MyLib.pdb,vc90.pdb,vc90.idb,但它没有帮助.
我还要采取哪些其他行动?
.net step-into visual-studio visual-c++ visual-studio-debugging