.NET source debugging on Windows 7

We are trying to debug through a SQL Server Compact issue on a Windows 7 Enterprise RTM (64-bit) desktop running the .NET Framework 3.5, SP1. The application is crashing consistently, and we are trying to set up .NET Framework debugging for Visual Studio 2008, SP1. Using the scattered resources around the Internet, we set the options:

  • Symbol Server = http://referencesource.microsoft.com/symbols
  • Menu Tools -> Options -> Debugging -> Just My code = Disabled
  • Menu Tools -> Options -> Debugging -> Enable .NET Framework Debugging = Enabled
  • Tools -> Options -> Debugging -> Enabled Source Server Support = Enabled
  • When we run the application, we are unable to step into the source and we still get the error

    There is no source code at this location.

    We do get the stack trace indicating that the SQL Server Compact symbols have loaded and when we click the details on the error dialog, we get a message indicating that the SQL Server Compact PDB file was loaded correctly.

    I did find a blog post indicating that this is an issue with the symbols not being updated for Windows 7, yet, Visual Studio 2008 SP1 .NET Framework Source Debugging.

    However, I cannot find anything official about this issue. Is there anything I'm missing? Is it true that Windows 7 symbols are being incorrect. If so, when will they be updated?

    My Windows 7 build is 64-bit. We also just tested this same scenario on Windows Vista 64-bit and received the same problem and error. It says that it loaded the PDB, but it claims there is no source code at the location.


    My guess is that your DLL files are release build, and so the JIT compiler is optimising away some of the function calls (it often inlines small functions). That means that when the runtime tries to translate from the jitted code back to the PDB, it gets confused.

    Try adding an .ini file to your application root; so if your app is prog.exe , add prog.ini with the following content;

    [.NET Framework Debugging Control] 
    GenerateTrackingInfo=1
    AllowOptimize=0
    

    This will stop the JIT compiler from optimising away the calls, and let your PDB files refer to the correct calls in your code. You'll need to restart the application, and because it's running without optimisations, it'll slow it down to DEBUG build levels, but you should be able to attach the debugger correctly.


    In the project build properties, there is an option to choose which architecture to run on - x86 or x64. You might try switching to x86 for debugging purposes; it may allow you to debug and find your problem.

    链接地址: http://www.djcxy.com/p/74542.html

    上一篇: 尽管设置了选项,.NET框架源代码步进不起作用

    下一篇: Windows 7上的.NET源代码调试