简体   繁体   English

在VS2008中的Windows x64上调试x86 .NET应用程序

[英]Debugging x86 .NET application on Windows x64 in VS2008

I use the x64 version of Windows 7. My application use some COM servers (usual native x86 COM Servers) that can't be loaded in x64 context. 我使用x64版本的Windows 7.我的应用程序使用一些无法在x64上下文中加载的COM服务器(通常是本机x86 COM服务器)。 So I decided run it as a x86 application using WOW so I set platform target as x86. 所以我决定使用WOW将其作为x86应用程序运行,因此我将平台目标设置为x86。

But Visual Studio 2008 debugger started to show messages like "The source file is different...." for all source files when I try debug it. 但是当我尝试调试它时,Visual Studio 2008调试器开始向所有源文件显示“源文件不同......”等消息。 What is reason for this behaviour? 这种行为的原因是什么? This question was born there "The source file is different...." message in Visual Studio 2008 is result of debugging x32 apps on x64 Windows 这个问题诞生于那里“源文件不同......”消息在Visual Studio 2008中是在x64 Windows上调试x32应用程序的结果

Update : I cleaned solution, rebuilt solution, removed obj, bin and etc. folders, restarted computer, reinstalled Visual Studio... So, what else could be the problem? 更新 :我清理解决方案,重建解决方案,删除obj,bin等文件夹,重新启动计算机,重新安装Visual Studio ...那么,还有什么可能是问题?

Update2 : If you create new Windows Application project and change target platform to x86 you will see this trouble. Update2 :如果您创建新的Windows应用程序项目并将目标平台更改为x86,您将看到此问题。 But if you delete Settings1.settings from project the trouble will be eliminated!! 但是如果从项目中删除Settings1.settings,麻烦将被消除! . Any Idea? 任何的想法?

Update3 : http://social.msdn.microsoft.com/Forums/en-US/vsdebug/thread/bc297668-65b4-46e8-969e-c7a6340d33b6 Update3http//social.msdn.microsoft.com/Forums/en-US/vsdebug/thread/bc297668-65b4-46e8-969e-c7a6340d33b6

The error message you are getting is unrelated to debugging a WOW64 bit application. 您获得的错误消息与调试WOW64位应用程序无关。 It's even less of an issue here because Visual Studio runs a 32 bit process inside of WOW64. 这不是一个问题,因为Visual Studio在WOW64内部运行32位进程。 So instead of x64 -> x86 you are actually doing an x86 -> x86 debugging session. 因此,您实际上在进行x86 - > x86调试会话,而不是x64 - > x86。

What's going on here is that Visual Studio is reading the checksum for the source files out of the PDB and it does not match the checksum of the files you are using to debug the application. 这里发生的是Visual Studio正在从PDB读取源文件的校验和,它与用于调试应用程序的文件的校验和不匹配。 The most likely causes for this are 最可能的原因是

  • Out of date PDB's 过时的PDB
  • Using the incorrect source files. 使用不正确的源文件。 This is more common than you think in branching scenarios where you could easily grab the wrong version of the file. 这比您在分支方案中更常见,您可以轻松获取错误的文件版本。

The way I typically debug through this is 我通常通过这种方式调试的方式是

  • Close VS and manually delete all of the binaries and binary directories 关闭VS并手动删除所有二进制文件和二进制目录
  • Restart VS and rebuild 重启VS并重建
  • Close VS 关闭VS.
  • Restart VS and attach to the running project without opening the solution 重新启动VS并附加到正在运行的项目而不打开解决方案
  • Then manually open the files 然后手动打开文件

Windows 7 sets Windows Xp sp 3 compatibility mode for VS 2008 by default. Windows 7默认为VS 2008设置Windows Xp sp 3兼容模式。 Changing compatibility to Windows Vista SP2 mode have solved trouble. 更改与Windows Vista SP2模式的兼容性已经解决了问题。

You might also check the x86 build type. 您还可以检查x86构建类型。 When you created it you may not of copied the settings from the default build and as such none of your code is building when you run your application. 创建它时,您可能无法从默认构建中复制设置,因此在运行应用程序时,您的代码都没有构建。

Bring up the Solution Properties and check the Configuration Properties\\Configuration page. 打开“ 解决方案属性”并检查“ 配置属性\\配置”页面。 Then make sure all of the projects are checked under Build for the Config/Platform combo you are using. 然后确保在Build for the Config / Platform组合下检查所有项目。

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

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