Answered VS2010 Cannot find or open the PDB file - .NET 4.0 with C++ COM

  • Saturday, March 10, 2012 9:39 PM
     
     

    Hello,

    I am having troubles attaching to a C#.NET 4.0 app from a native/unmanaged COM project using VS2010 SP1 @ Win7 x64 (code type: managed 4.0 and native) after conversion from VS2005 to VS2010 (basically, I start the managed app and then attach from the C++ project to it). When I used VS2005, this worked with no problems. I looked over in the Modules window and I am able to see that the location of the symbol file is correct but at Symbol status I get a "Cannot find or open the PDB file". I tried to load the symbols manually and VS says "A matching symbol file was not found in this folder" even if MyProject.pdb is there.

    I tried a clean and build, re-register the COM component - nothing worked. I don't want to get back to VS 2005... :)

    Any ideas?


    Eusebiu

All Replies

  • Monday, March 12, 2012 5:38 AM
    Moderator
     
     

    Hi Eusebiu,

    Thank you for posting in the MSDN forum.

    “Cannot find or open the PDB file”

    The message indicates that Visual Studio is looking for symbol files of some dlls, they are system dlls, we can ignore “Cannot find or open the PDB file” messages, since they will not prevent you from debugging.

    To load it, we could open the Modules window (Debug -> Windows -> Modules), right click a module, and select Load Symbols From -> Microsoft Symbol Servers. Do you mean that you check it?

    Reference:

    http://social.msdn.microsoft.com/Forums/en-US/vsdebug/thread/6d601ffd-5276-46fd-aec0-ba38e5271e53

    http://connect.microsoft.com/VisualStudio/feedback/details/567082/-debug-cannot-find-or-open-the-pdb-file

    http://social.msdn.microsoft.com/Forums/en-US/vsdebug/thread/8b7d34ee-a91a-4e99-9057-065ffce6b11b. Hope it helps.

    Best Regards,


    Jack Zhai [MSFT]
    MSDN Community Support | Feedback to us

  • Monday, March 12, 2012 7:08 AM
     
     

    Hey Jack,

    Thanks for answer! :)

    I am not trying to debug some system dll. I am just trying to debug my COM component dll by attaching VS2010 to a .NET 4.0 process which loads it. The message "Cannot find or open PDB file" is for my COM dll. Basically, everything works fine (the component is called and it is doing it's stuff) but the debugging is not working and at a moment in time, I will have to debug the component. :)

    The second message appears when I try to point VS2010 to the correct symbol file (which already knows).

    The only things that are changed are the .NET runtime (4.0) and VS (the migration of the projects - both C# and C++ - was done with VS wizard and it returned no errors).

    Regards,

    Eusebiu



    • Edited by Eusebiu Monday, March 12, 2012 7:09 AM
    • Edited by Eusebiu Monday, March 12, 2012 7:12 AM
    • Edited by Eusebiu Monday, March 12, 2012 7:13 AM
    •  
  • Monday, March 12, 2012 9:18 AM
     
     

    What happens, when you add a __debugbreak() to your c++ dll and you start your managed app normally without VS? Then the jit-debugger should pop-up. Will there be a "Cannot find or open the PDB file"?
    Also, when right-clicking module in Modules window "Symbol Load Information..." will show the paths, where Visual Studio tried to load symbol-file from. Is there something unexpected?
    Certainly, it is always recommendable to verify if "Enable unmanaged code debugging" is set in project properties of managed app and when attaching, if there is "Automatic" or mixed-mode debug-engine chosen.

    With kind regards

  • Monday, March 12, 2012 10:12 AM
     
     

    Hello,

    I've put the __debugbreak() and the jit debugger window appears and when I select the VS which already has the solution loaded, nothing happens (the attaching is failing or something). I cannot see any modules in order to tell that the message is still there. :)

    VS2010 can figure out the location of the PDB file. when I right click and try to point the PDB file, the second message appears "A matching symbol file was not found in this folder" (the same folder where the dll is located and near it is the PDB).

    "Enable unmanaged code debugging" is set on the managed project (even it I do not want to step in C++ component from .NET code - I just want to attach to a running .NET process). 

    I've also choose only Native when the Code type dialog appears with no success. Also for Automatic: Native code.

    Just as a note (maybe important): Win 7, x64, VS 2010 Ultimate with SP1 full installation. I also have to say that before I had installed VC# Express 2010 and VS WebDeveloper 2010 but I uninstalled them once we had VS2010 full licence. 

    Later edit:

    I reinstalled VS2011 and one time in the output window I got "warning LNK4020: a type record in '..../file.pdb'  is corrupted; some symbols and types may not be accessible from the debugger"... after rebuild, the warning disappeared but VS is still unable to attach.

    • Edited by Eusebiu Monday, March 12, 2012 10:14 AM
    • Edited by Eusebiu Monday, March 12, 2012 10:17 AM
    • Edited by Eusebiu Monday, March 12, 2012 4:14 PM
    •  
  • Tuesday, March 13, 2012 6:58 AM
    Moderator
     
     

    Thanks for MaybeCompletelyW’s help.

    Hi Eusebiu,

    1. Delete the Bin folder, then rebuild it and check it.
    2. I suggest you can create a new similar project with VS2010, and debug it, so we can know whether it is related to the conversion from VS2005 to VS2010, since you can debug it with VS2005.
    3. Can you try to run it with another PC?  Check it.

    Reference:http://www.codeproject.com/Questions/168914/Error-a-matching-symbol-file-was-not-found-in-this

    If possible, please attach your Visual Studio project, you can upload it to the sky driver, and then share the download link in your post. We try to debug it with our computer.

    If there's any concern, please feel free to let me know.

    Best Regards,


    Jack Zhai [MSFT]
    MSDN Community Support | Feedback to us

  • Tuesday, March 13, 2012 9:02 AM
     
     

    Hi Jack,

    1. Delete all debug and rebuild -> no success.

    2. I will try. :)

    3. I run on another PC and now VS, at Modules for my dll it says: Binary was not build with debug information (all settings in Project properties are the same as here: http://msdn.microsoft.com/en-us/library/ms164712.aspx)

    During revisiting the project configuration properties, I saw that the target machine was x86 and I set the Solution platform to Win32. Of course, the result was the same - i.e. attaching did not work.


    Eusebiu

  • Tuesday, March 13, 2012 2:19 PM
     
     

    I created a new ATL project with one ATL control and used it in a C# app. It looks like the attaching works in this case.

    So, this indicates a conversion problem (configuration problem).

    Edit: It looks like VS mislead me. The actual message is: PDB does not match image. All messages are:

    C:\Projects\MainProjects\build\MyProject\Debug\MyProject.pdb: PDB does not match image.
    C:\Projects\MainProjects\build\MyProject\Debug\MyProject.pdb: PDB does not match image.
    C:\Windows\symbols\dll\MyProject.pdb: Cannot find or open the PDB file.
    C:\Windows\dll\MyProject.pdb: Cannot find or open the PDB file.
    C:\Windows\MyProject.pdb: Cannot find or open the PDB file.


    • Edited by Eusebiu Tuesday, March 13, 2012 5:14 PM
    •  
  • Tuesday, March 13, 2012 5:32 PM
     
     Answered

    At last, VS attached.

    It looks like the configuration @ C/C++->Output files->Program Database file was $(IntDir)$(ProjectName).pdb and @ Linker->Debugging->Generate Program database file was empty. In VS2005 this has no impact on loading the PDB. I think VS2010 does not handle correctly loading the PDB when the $(OutDir) is not the same as .\Debug (my OutDir is near the solution\Debug and the solution was outside the project).


    Eusebiu

    • Marked As Answer by Eusebiu Tuesday, March 13, 2012 5:32 PM
    •