没有使用VS2010加载混合C#C(win32)项目中的符号 [英] No Symbols loaded in mixed C# C(win32) project using VS2010

查看:167
本文介绍了没有使用VS2010加载混合C#C(win32)项目中的符号的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的项目有几个新的C#模块和一个使用win32系统调用编译的C模块(而不是C ++)。我正在使用PInvoke互操作层从C#调用C代码。 C函数被调用。



所有模块正在写入单个bin目录,并且都会写入pdb文件。



在运行时,然后在断开点前停止在C.dll的调用之前,我看到C模块中的断点被禁用。看看Debug | Windows | Modules列表,即使在执行调用后,我也看不到C.dll模块加载。



另外一个factoid:in Solution |属性|配置属性|配置显示了使用Platform =Any CPU的C#模块和使用Win32的C模块



为什么不加载模块?不是它的符号加载吗?



谢谢,
最大

解决方案

综合答案来自多个来源。您是否正在运行调试配置?

在解决方案检查中:SolnExplorer |解决方案|属性| ConfigurationProperties |配置=调试

和:SolnExplorer |解决方案|属性| ConfigurationProperties |配置| ProjectConfig [] = Debug
- >注意:虽然断点将与发布配置一起使用,但有时可能优化或重新排列。


  • <您是否生成调试信息?
    在C#项目中:SolnExplorer |项目|属性| ConfigurationProperties |链接器|调试|生成调试信息= YES

    在C ++项目中:SolnExplorer |项目|属性| ConfigurationProperties | C / C ++ |调试信息格式=程序数据库(/ Zi)

    - >注意:它支付检查命令行参数。


  • 正在重建?如果PDB不同步,调试器可能无法加载符号:

    在解决方案中:SolnExplorer |解决方案|属性|配置属性| Build = TRUE(检查)所有项目。
    在C#项目中:SolnExplorer | Project | Properties | Debug |启用非托管代码debugging = TRUE(已检查)< br>
    在C / C ++项目中:SolnExplorer |属性|配置属性|调试|调试器类型=混合


  • 他们是?我使用一个bin \debug目录来收集所有项目的DLL和PDB。

    在C#项目中:SolnExplorer | Project | Properties | Build | Output Path = ..\bin\debug

    在C / C ++项目中:SolnExplorer | Project | Properties | ConfigProp | Linker | OutputFile = ..\bin\debug\ $(TargetName)$(TargetExt)


  • 是否存在旧文件?
    检查bin目录中所有输出文件的时间戳。确保他们是最后一次重建。

    有些人建议吹走所有的bin和obj目录。这可能是值得的,只是为了看到旧的文件没有铺设。检查时间和日期邮票应该也是如此。


  • 是否已加载DLL?如果断点被禁用,可能是因为尚未加载DLL。
    检查菜单|调试| Windows |模块。

    查找模块名称中的dll。

    在同一个模块窗口中,确保从正确路径加载文件。

    如果程序集在多个程序之间共享,可以从GAC加载。

    - >注意:在需要之前,可以预加载C / C ++ DLL。使用:IntPtr lpDLL = LoadLibrary(myLibraryName);



  • My project has several new C# modules and one C module (not C++) compiled using win32 system calls. I'm using the PInvoke interop layer to call the C code from the C#. The C function is getting called.

    All modules are writing to a single bin directory and all write pdb files.

    On running, and then stopping at a breakpoint right before a call into the C.dll, I see the breakpoints in the C module are disabled. Looking at the Debug|Windows|Modules list I don't see the C.dll module loaded even after the call has been executed.

    One more factoid: in Solution|Properties|Configuration Properties|Configuration is shows the C# modules using Platform = "Any CPU" and the C module using "Win32"

    Why isn't the module loaded and why aren't its symbols loading?

    Thanks, Max

    解决方案

    I've consolidated answers from several sources.

    • Are you running the debug configuration?
      In the Solution check: SolnExplorer|Solution|Properties|ConfigurationProperties| Configuration = Debug
      and: SolnExplorer|Solution|Properties|ConfigurationProperties| Configuration|ProjectConfig[]=Debug -->Note:Although breakpoints will work with release configuration, sometimes the lines may be optimized out or rearranged.

    • Are you generating debug information? In C# projects: SolnExplorer|Project|Properties|ConfigurationProperties|Linker|Debugging|Generate Debug Info=YES
      In C++ projects: SolnExplorer|Project|Properties|ConfigurationProperties|C/C++|Debug Information Format = Program Database(/Zi)
      -->Note: It pays to check the command line arguments.

    • Is everything is being rebuilt? If the PDB is out of sync, the debugger may not be able to load symbols:
      In Solution: SolnExplorer|Solution|Properties|Configuration Properties|Build=TRUE(Checked) for all projects.

    • Can you debug unmanaged code?
      In C# projects: SolnExplorer|Project|Properties|Debug|Enable unmanaged code debugging = TRUE(Checked)
      In C/C++ projects: SolnExplorer|Properties|Configuration Properties|Debugging|Debugger Type = Mixed

    • Are files being put where you think they are? I use a single bin\debug directory for collecting all project DLL's and PDB's.
      In the C# projects: SolnExplorer|Project|Properties|Build|Output Path = ..\bin\debug
      In C/C++ projects: SolnExplorer|Project|Properties|ConfigProp|Linker|OutputFile = ..\bin\debug\$(TargetName)$(TargetExt)

    • Are old files getting in the way? Check the timestamps on all the output files in the bin directory. Make sure they are as of the last rebuild.
      Some people advise blowing away all the bin and obj directories. This may be worthwhile just to see that old files aren't laying about. Checking the time and date stamps should do just as well.

    • Has the DLL been loaded? If the Breakpoints are disabled, it may be because the DLL has not been loaded yet. Check Menu|Debug|Windows|Modules.
      Look for the dlls in the module name.
      In the same Modules window make sure files are loading from the correct path.
      If an assembly is shared among several programs, it can be loaded from the GAC.
      -->Note: You can preload the C/C++ DLL before it is required. Use: IntPtr lpDLL = LoadLibrary(myLibraryName);

    这篇关于没有使用VS2010加载混合C#C(win32)项目中的符号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

    查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆