none
Debuging x86 application on Windows 7 x64

    Question

  • I use x64 version of Windows 7 and Visual Studio 2008. My application use some COM servers (usual native x86 COM Servers) that can't be loaded in x64 context. So I decided run it as a x86 application using WOW so I set project platform target as x86. But Visual Studio debugger have started to show messages like "The source file is different...." for all source files when I try debug it. What is reason for this behaviour?

    If you create new Windows Application project and change target platform to x86 you will see this trouble. But if you delete Settings1.settings from project the trouble will be eliminated!! . Any Idea?
    Tuesday, January 12, 2010 9:03 AM

Answers

  • Windows 7 sets Windows Xp sp 3 compatibility mode for VS 2008 by default. Changing compatibility to Windows Vista SP2 mode have solved trouble.
    Monday, January 18, 2010 9:13 AM

All replies

  • Hello Dmitry,

    Did we rebuild the project after changing the platform? Because the error message seems indicated that the source file is different from the original one. Would you please describe the error message as it is or provide us a code snippet here?

    Unfortunately, I could not reproduce the issue with my VS on a Windows 7 64bit machine following your "create new Windows Application project and change target platform to x86". Here are the steps I did:
     1. Open Visual Studio on my 64bit Windows 7
     2. Click File -> New -> Project
     3. Expand Visual C# and click Windows
     4. Select Windows Forms Application in the Templates box
     5. Build the project and press Ctrl + F5 to run it, it works fine (The default target platform is Any CPU).
     6. Change the target platform to X86 in the Configuration Manager
     7. Rebuild the project and run it normally
    If I missed something, please tell me.

    Best regards
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    If you have any feedback, please tell us.
    Welcome to the All-In-One Code Framework!
    Wednesday, January 13, 2010 6:59 AM
  • Hello Roahn Luo, Thanks for answer.
    Try debug this application (by press F11 or set breakpoint and press F5).
    Wednesday, January 13, 2010 7:58 AM
  • Hi Dmitry,

    I'm sorry that I don't mentioned it worked fine when debugging. I uploaded a few screen shot here:
    http://cid-98eeb33e17ffe27d.skydrive.live.com/browse.aspx/winformdebugging

    One more thing I noticed is I debugged it with Visual Studio SP1, could I ask did we install SP1 of VS2008?

    Best regards
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    If you have any feedback, please tell us.
    Welcome to the All-In-One Code Framework!
    Wednesday, January 13, 2010 9:08 AM
  • Can you try change platform on Build page of Properties of Project to x86, not in configuration manager?
    I think sequence of actions to reproduce is:
    1. Create Windows Forms Application
    2. Change platform to x86 on Build Page of Project's properties.
    3. Save all changes
    4. Rebuild solution
    5. Try debug application by pressing F11 or etc.

    Thank you for help.
    Wednesday, January 13, 2010 9:59 AM
  • Works fine, too.
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    If you have any feedback, please tell us.
    Welcome to the All-In-One Code Framework!
    Wednesday, January 13, 2010 10:40 AM
  • Is option "Require source file to exactly match the original version" enabled or disabled in your general debugger options (Tools -> Options->Debugging -> General)?
    Wednesday, January 13, 2010 10:48 AM
  • I try to find byte sequences of SHA1 and MD5 hashes of one of my source file in PDB, but I haven't found it. How do you think Is it possible to compiler compute hash incorrectly? How can I see hash of my source file in PDB?
    Wednesday, January 13, 2010 11:20 AM
  • Hello Dmitry,

    We could not find byte sequences in PDB files. PDB file is for debugging, it does not store the byte sequences of SHA1/MD5, it stores the following information:
     1. Public, private, and static function addresses
     2. Global variable names and addresses
     3. Parameter and local variable names and offsets where to find them on the stack
     4. Type data consisting of class, structure, and data definitions
     5. Frame Pointer Omission (FPO) data, which is the key to native stack walking on x86
     6. Source file names and their lines
    For more information about pdb files, please refer to John's Blog here:
    http://www.wintellect.com/CS/blogs/jrobbins/archive/2009/05/11/pdb-files-what-every-developer-must-know.aspx

    Best regards
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    If you have any feedback, please tell us.
    Welcome to the All-In-One Code Framework!
    Thursday, January 14, 2010 6:24 AM
  • Hello,
    No, PDB's store byte sequences of hash. I've just found 2 articles: http://msdn.microsoft.com/en-us/library/y4t61xzd.aspx and http://msdn.microsoft.com/en-us/library/44y24e8y.aspx. How otherwise can debugger check that source file was changed? By using checksum, of course.
    Thursday, January 14, 2010 6:52 AM
  • Hi,

    The two articles are about Debug Interface Access (DIA) APIs. We could use those APIs to dump the information in pdb files, for example, the source files, types, fpos etc.

    I assumed you want to get those information in pdb file. The answer is DIA APIs. Did you install DIA SDK when installing Visual Studio, all the APIs are contained in dia2.h file. I suggest you get the SDK, it also contains a sample named dia2dump, it may be helpful to you.

    By the way, has your original been solved? We would be really appreciated if you could share the resolution with our community members having the same issue. Please start a new thread if you are interested in DIA APIs.

    Thanks a lot!
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    If you have any feedback, please tell us.
    Welcome to the All-In-One Code Framework!
    Friday, January 15, 2010 1:42 AM
  • Windows 7 sets Windows Xp sp 3 compatibility mode for VS 2008 by default. Changing compatibility to Windows Vista SP2 mode have solved trouble.
    Monday, January 18, 2010 9:13 AM