locked
64-bit debug problem RRS feed

  • Question

  • hi, group,

    Right now I am doing 64-bit development with Visual Studio 2008 (C#). My Vista is 64 bits system. When I debug the problem, I cannot drag current execution back to previous location, it says 64-bit system does not support this function.  Sometimes what I need is just to do a test application, can I "configure" Visual Studio make it think it is 32-bit system, so I can drag the current execution spot back to previous version?

    Thanks.
    Tuesday, June 3, 2008 6:32 PM

Answers

  • Ahh you're talking about Edit and Continue (ENC).  Unfortunately VS2008 does not support ENC for x64 builds.  It might be added in a subsequent release but the current implementation does not support it.  Therefore if you are doing x64 development then there is nothing you can do about it.

    You mentioned that you would be glad to do x32 debugging just to get ENC support.  You can do that by modifying your project configuration.  By default .NET projects use a platform of Any CPU.  This results in you running x64 on a 64-bit OS and x86 on a 32-bit one.  To force 32-bit code you'll have to modify your project settings to use the x86 platform. 

    The easiest way to do this is to right click the solution (in Solution Explorer) and select Configuration Manager.  I recommend that you leave the default configuration alone.  It is set up to compile either way and is appropriate in almost all cases.  For your specific situation you'll have a little extra work to do but it keeps things simple. 

    In Configuration Manager click on the Active solution platform combo.  If x86 doesn't appear then click New and you'll be able to add it.  Be sure to leave the Create new project platforms as checked.  You now have a new platform associated with the solution.  For this platform you will go through each project in the project list (below the combo) and change the platform from Any CPU to x86.  You have now set up a x86-specific platform for your solution.

    A solution consists of configurations and platforms.  All configurations of a solution share the same platforms.  It is the combination of a configuration and its platform that determines what, and how, each project gets built.  Normally you only deal with one platform so it looks like the configuration controls everything but in reality it is both the configuration and the platform.  As a result, following the steps given earlier, you have created a new platform and configured the current configuration for the given platform.  You will need to select each of the other solution configurations (probably just Release) and again adjust the platform used by each project.  Remember that the platforms are shared by all configurations so you don't need to recreate the platforms, you just need to tell the build environment which platform to use for each project. 

    Here's an example:

    Solution Configuration: Debug, Solution Platform: Win32
       Project1, Debug, Any CPU
       Project2, Debug, Any CPU

    Solution Configuration: Release, Solution Platform: Win32
       Project1, Release, Any CPU
       Project2, Release, Any CPU

    Solution Configuration: Debug, Solution Platform: x86
       Project1, Debug, x86
       Project2, Debug, x86

    Solution Configuration: Release, Solution Platform: x86
       Project1, Release, x86
       Project2, Release, x86

    In the build toolbar you should already have a combo containing the solution configurations.  You should also have one for the platforms.  If you don't then you'll need to add it.  For ENC support you'll want to select the Debug configuration and the x86 platform.  This will build a debug version of your code targetting 32-bit. 

    Michael Taylor - 6/4/08
    http://p3net.mvps.org



    • Marked as answer by Tao Liu Wednesday, June 4, 2008 6:13 PM
    Wednesday, June 4, 2008 5:38 PM
    Moderator

All replies

  • I'm not following what problem you're having.  Are you talking about the Set Next Statement command?  x64 supports this functionality.  I do it all the time and I'm running x64.  It might be an issue with the current context that you're trying it in.  Can you be more specific about the language and situation you are in where the debugger won't let you do it?

    Michael Taylor - 6/4/08
    http://p3net.mvps.org
    Wednesday, June 4, 2008 1:09 PM
    Moderator
  • Sorry, it is my fault. What I mean is how to get rid of "changes to 64-bit applications are not allowed". I cannot type in some code and make debugging does not stop.

    Thanks.
    Wednesday, June 4, 2008 5:22 PM
  • Ahh you're talking about Edit and Continue (ENC).  Unfortunately VS2008 does not support ENC for x64 builds.  It might be added in a subsequent release but the current implementation does not support it.  Therefore if you are doing x64 development then there is nothing you can do about it.

    You mentioned that you would be glad to do x32 debugging just to get ENC support.  You can do that by modifying your project configuration.  By default .NET projects use a platform of Any CPU.  This results in you running x64 on a 64-bit OS and x86 on a 32-bit one.  To force 32-bit code you'll have to modify your project settings to use the x86 platform. 

    The easiest way to do this is to right click the solution (in Solution Explorer) and select Configuration Manager.  I recommend that you leave the default configuration alone.  It is set up to compile either way and is appropriate in almost all cases.  For your specific situation you'll have a little extra work to do but it keeps things simple. 

    In Configuration Manager click on the Active solution platform combo.  If x86 doesn't appear then click New and you'll be able to add it.  Be sure to leave the Create new project platforms as checked.  You now have a new platform associated with the solution.  For this platform you will go through each project in the project list (below the combo) and change the platform from Any CPU to x86.  You have now set up a x86-specific platform for your solution.

    A solution consists of configurations and platforms.  All configurations of a solution share the same platforms.  It is the combination of a configuration and its platform that determines what, and how, each project gets built.  Normally you only deal with one platform so it looks like the configuration controls everything but in reality it is both the configuration and the platform.  As a result, following the steps given earlier, you have created a new platform and configured the current configuration for the given platform.  You will need to select each of the other solution configurations (probably just Release) and again adjust the platform used by each project.  Remember that the platforms are shared by all configurations so you don't need to recreate the platforms, you just need to tell the build environment which platform to use for each project. 

    Here's an example:

    Solution Configuration: Debug, Solution Platform: Win32
       Project1, Debug, Any CPU
       Project2, Debug, Any CPU

    Solution Configuration: Release, Solution Platform: Win32
       Project1, Release, Any CPU
       Project2, Release, Any CPU

    Solution Configuration: Debug, Solution Platform: x86
       Project1, Debug, x86
       Project2, Debug, x86

    Solution Configuration: Release, Solution Platform: x86
       Project1, Release, x86
       Project2, Release, x86

    In the build toolbar you should already have a combo containing the solution configurations.  You should also have one for the platforms.  If you don't then you'll need to add it.  For ENC support you'll want to select the Debug configuration and the x86 platform.  This will build a debug version of your code targetting 32-bit. 

    Michael Taylor - 6/4/08
    http://p3net.mvps.org



    • Marked as answer by Tao Liu Wednesday, June 4, 2008 6:13 PM
    Wednesday, June 4, 2008 5:38 PM
    Moderator
  • Thank you so much Michael. It helps me a lot.. :)
    Wednesday, June 4, 2008 6:14 PM
  • great post, it solved my problem, ty
    Saturday, June 27, 2009 11:49 AM
  • Hi,

    I thought the C# compiler would be compiling bytecode for the Common Language Runtime, not x86(32|64) Native code?  Am I wrong?
    Monday, June 29, 2009 2:17 PM
  • The CLR is platform independent.  However the debugger is not.  The x64 debugger (that runs when you debug x64 code or .NET code on an x64 OS) does not support EnC in VS2008.  Only the x86 debugger does.  That is what the OP was talking about.  The .NET code you write (if verifiable) will be platform agnostic but under the hood the CLR will be x86 on Win32 and x64 on Win64.

    Michael Taylor - 6/29/09
    http://p3net.mvps.org
    Monday, June 29, 2009 2:20 PM
    Moderator
  • I'm using the express edition of visual basic but I was wondering if someone might be able to help me, I've been looking in the solution explorer box but I cant find or get to configuration manager.  Does express edition not have that or am i missing something?
    Monday, August 3, 2009 5:54 PM
  • It's there but hidden by default.  Go to Tools\Options -> Projects and Solutions -> Show advanced build configurations

    Michael Taylor - 8/3/09
    http://p3net.mvps.org
    Monday, August 3, 2009 5:58 PM
    Moderator
  • I changed the setting in Projects and Solutions, still cant find it.  I right clicked on just about anything and everything in the solutions explorer box...
    Monday, August 3, 2009 6:35 PM
  • Look under the Build menu.  It should be at the bottom.

    Michael Taylor - 8/3/09
    http://p3net.mvps.org
    Monday, August 3, 2009 6:37 PM
    Moderator
  • jeez, finally got a simple database to work in windows 7 x64... thank you so much. 
    Monday, August 3, 2009 6:47 PM
  • I have been using edit and continue x86 mode in vst 2008 std RTM with .net 3.5 , and I tried again using x64 ENC after the .net 3.5 sp1 installed. of course ENC is still not really supported

    Now that vstd 2010 will be coming sometime next year, right? what are the chances vst2009 will have the update to allow ENC on x64?

    • Edited by fs - ab Tuesday, August 18, 2009 5:49 PM
    Monday, August 17, 2009 5:30 PM
  • VS2010 does not support ENC under x64.  There is actually some mixed information coming from MS about the topic.  Some devs have said it is supported but others say it isn't.  From what I've seen, and understand, the problem lies in the x64 CLR rather than the debugger and compiler.  ENC requires that code be rewritten on the fly to update the portions of code that were recompiled.  Based upon how the CLR currently works this isn't doable.  There are some major architectural issues involved.  Given the prioritization and feature requests, MS is not ready to commit the necessary folks to resolve it. 

    Having said that I don't see any reason why ENC couldn't work for native x64 code.  I don't do much x64 native code anymore so I can't confirm.  I suspect however that ENC under x64 is disabled across the board.

    Michael Taylor - 8/17/09
    http://p3net.mvps.org

    Monday, August 17, 2009 5:48 PM
    Moderator
  • I know this is an old thread, but in case Michael Taylor is still listening, I just wanted to say thanks for his help here.  I have been fighting with this for a while and stumbled on this post.  Sure glad I found it.

    Now where was I with that code...

    Sunday, April 15, 2012 2:08 PM