简体   繁体   English

VS2015无法调试引用的DLL vs2015

[英]VS2015 unable to debug referenced dll vs2015

I am working on a C# project. 我正在从事C#项目。 That uses a dll library that i also am developing at the same time. 那使用了我同时也在开发的dll库。

At some point I wrote a different unit test app (new project) To test some new functions in the library, before using them in my main app. 在某个时候,我编写了另一个单元测试应用程序(新项目),以便在库中测试一些新功能,然后再在主应用程序中使用它们。 The unit test app, never wrote in the library dll, it was only to test new functions. 单元测试应用程序从未在库dll中编写过,仅用于测试新功能。

Some problems occurred with new functions, and so i edited the .dll from my original main app prj (as that prj includes the .dll as additional project). 新功能发生了一些问题,因此我从最初的主应用程序prj中编辑了.dll(因为prj包括了.dll作为附加项目)。

Then i got some warning from file has been modified outside my mijn prj. 然后,我从文件mijn prj外部修改了文件,得到了一些警告。 But since I never edited the dll from outside the main app. 但是,因为我从未从主应用程序外部编辑过dll。 I didnt reload the code from behind the mainapp; 我没有从mainapp的后面重新加载代码; as i was believing that main app contained the current code. 因为我认为主应用程序包含当前代码。 From my main app i can still compile the llibrary with no problems. 从我的主应用程序中,我仍然可以毫无问题地编译库。

As i didnt like those file-locking alike errors i decided to remove the test-unit app and to include similar test functionality but now from my main app development prj. 由于我不喜欢这些文件锁定相似的错误,因此决定删除测试单元应用程序,并包括类似的测试功能,但现在从我的主要应用程序开发项目中删除。 Now a push button opens a test form to test stuff. 现在,一个按钮将打开一个测试表单以测试内容。

The problem I now can no longer set a breakpoint in my dll source code And when something goes wrong, the code execution doesnt halt on where it went wrong in my dll, but hangs in my mainapp at the point where it calls the dll was used. 这个问题我现在不能再设置一个断点在我的DLL的源代码,并在出现错误时,该代码执行犯规停止在哪里出了问题,我的DLL,但在它调用的dll使用了点,我的mainapp挂起。

Just my code has been disabled, but that doesnt seams enough. 只是我的代码已被禁用,但这还不够。

Well i solved it, but it's still strange. 好吧,我解决了,但还是很奇怪。 Just in case others might get into similar problems i post my solution. 万一别人可能遇到类似的问题,我会发布我的解决方案。

Here's what i did. 这就是我所做的。

I removed the libray dll from the project using the solution explorer. 我使用解决方案资源管理器从项目中删除了libray dll。 It only removes that part it doesnt delete it from disk or so. 它只会删除该部分,而不会从磁盘上删除它。

Then i went to menu Tool\\options\\ In there go to Debugging > symbols There is the location of the pdp files as used by vs2015 for symbol debug. 然后我去了菜单Tool \\ options \\,在那儿去了Debugging> symbol。vs2015使用了pdp文件的位置来进行符号调试。 Then there i removed the path pointing to the pdb of my dll. 然后在那里,我删除了指向我dll的pdb的路径。

Saved my project. 保存了我的项目。 restarted Vs2015 Added again my dll file, File menu add existing prj Then under options debuging symbols i added again the pdb file location of my release version of the dll. 重新启动Vs2015再次添加了我的dll文件,“文件”菜单添加了现有的prj,然后在选项调试符号下,我再次添加了我发布版本的dll的pdb文件位置。

=== then you can set breakpoint but its not enough === those breakpoint will error out on codesource isnt equal. ===然后可以设置断点,但是断点不够===这些断点将在代码源不相等时出错。

To solve that go to the build menu and perform a Clean of the prj Or if using batch build overthere use Clean And then start fresh over with Build 要解决该问题,请转到“构建”菜单并执行“清除prj”,或者如果使用批处理构建,请使用“清洁”,然后从Build重新开始

Now you can set breakpoint and actually break on them ...pretty amazin huh ? 现在您可以设置断点并对其进行折断...漂亮的亚马逊吧?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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