简体   繁体   中英

cannot find or open PDB file, debugging native code

I have a code running that successfully register Excel AddIn using C# Automation and talks to C++ though C# layer

// Tools -> Create GUID -> Register Format
namespace MyExcelAddins
{
    [ClassInterface(ClassInterfaceType.AutoDual), ComVisible(true)]
    [Guid("6F89542F-3DAC-471F-86DD-145F5E456968")]

    public class MyExcelFunctions : AddInRegistrator
    {
        [DllImport(@"C:\Users\Ilya\Documents\Visual Studio 2012\Projects\UnmanegedTester\x64\Debug\")]
        public static extern double AddNumbers(double a, double b);

        public double SampleAdd(double a, double b)
        {
            double res = AddNumbers(a, b);
            return res;
        }
    }
}

Here is the view of my solution where C++ project I added from another directory.

解决方案资源管理器视图

I was able to debug C# code and now I want to try to debug the C++ part. I set the debug property of C# project to

C#项目调试属性

and when click run, the error I got is

运行时错误

If I uncheck "Enable Native Code Debugging", I do not have the error but of course cannot debug C++. My guess I'm missing something in the settings. Please let me know if anyone has an idea how to fix that.

If I continue debugging I can hit breakpoint in C# but not in C++

在此处输入图片说明

That error message is telling you that you don't have debug symbols for excel.exe , which is not surprising since it is a Microsoft program. You can continue debugging, and your code (which should have debugging information) will still be debuggable. For example, you can set a breakpoint in some of your code that will be called by Excel and the debugger will stop on it when it is reached.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM