Fazer uma PerguntaFazer uma Pergunta
 

Respondido64-bit debug problem

  • terça-feira, 3 de junho de 2008 18:32Tao Liu Medalhas de usuárioMedalhas de usuárioMedalhas de usuárioMedalhas de usuárioMedalhas de usuário
     
    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.

Respostas

  • quarta-feira, 4 de junho de 2008 17:38TaylorMichaelLMVP, ModeradorMedalhas de usuárioMedalhas de usuárioMedalhas de usuárioMedalhas de usuárioMedalhas de usuário
     Respondido
    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



    • Marcado como RespostaTao Liu quarta-feira, 4 de junho de 2008 18:13
    •  

Todas as Respostas

  • quarta-feira, 4 de junho de 2008 13:09TaylorMichaelLMVP, ModeradorMedalhas de usuárioMedalhas de usuárioMedalhas de usuárioMedalhas de usuárioMedalhas de usuário
     
    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
  • quarta-feira, 4 de junho de 2008 17:22Tao Liu Medalhas de usuárioMedalhas de usuárioMedalhas de usuárioMedalhas de usuárioMedalhas de usuário
     
    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.
  • quarta-feira, 4 de junho de 2008 17:38TaylorMichaelLMVP, ModeradorMedalhas de usuárioMedalhas de usuárioMedalhas de usuárioMedalhas de usuárioMedalhas de usuário
     Respondido
    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



    • Marcado como RespostaTao Liu quarta-feira, 4 de junho de 2008 18:13
    •  
  • quarta-feira, 4 de junho de 2008 18:14Tao Liu Medalhas de usuárioMedalhas de usuárioMedalhas de usuárioMedalhas de usuárioMedalhas de usuário
     
    Thank you so much Michael. It helps me a lot.. :)
  • sábado, 27 de junho de 2009 11:49Valnuke Medalhas de usuárioMedalhas de usuárioMedalhas de usuárioMedalhas de usuárioMedalhas de usuário
     
    great post, it solved my problem, ty
  • segunda-feira, 29 de junho de 2009 14:17Kenny Gillen Medalhas de usuárioMedalhas de usuárioMedalhas de usuárioMedalhas de usuárioMedalhas de usuário
     
    Hi,

    I thought the C# compiler would be compiling bytecode for the Common Language Runtime, not x86(32|64) Native code?  Am I wrong?
  • segunda-feira, 29 de junho de 2009 14:20TaylorMichaelLMVP, ModeradorMedalhas de usuárioMedalhas de usuárioMedalhas de usuárioMedalhas de usuárioMedalhas de usuário
     
    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
  • segunda-feira, 3 de agosto de 2009 17:54thedumbdinga Medalhas de usuárioMedalhas de usuárioMedalhas de usuárioMedalhas de usuárioMedalhas de usuário
     
    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?
  • segunda-feira, 3 de agosto de 2009 17:58TaylorMichaelLMVP, ModeradorMedalhas de usuárioMedalhas de usuárioMedalhas de usuárioMedalhas de usuárioMedalhas de usuário
     
    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
  • segunda-feira, 3 de agosto de 2009 18:35thedumbdinga Medalhas de usuárioMedalhas de usuárioMedalhas de usuárioMedalhas de usuárioMedalhas de usuário
     
    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...
  • segunda-feira, 3 de agosto de 2009 18:37TaylorMichaelLMVP, ModeradorMedalhas de usuárioMedalhas de usuárioMedalhas de usuárioMedalhas de usuárioMedalhas de usuário
     
    Look under the Build menu.  It should be at the bottom.

    Michael Taylor - 8/3/09
    http://p3net.mvps.org
  • segunda-feira, 3 de agosto de 2009 18:47thedumbdinga Medalhas de usuárioMedalhas de usuárioMedalhas de usuárioMedalhas de usuárioMedalhas de usuário
     
    jeez, finally got a simple database to work in windows 7 x64... thank you so much. 
  • segunda-feira, 17 de agosto de 2009 17:30fs - ab Medalhas de usuárioMedalhas de usuárioMedalhas de usuárioMedalhas de usuárioMedalhas de usuário
     

    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?

    • Editadofs - ab terça-feira, 18 de agosto de 2009 17:49
    •  
  • segunda-feira, 17 de agosto de 2009 17:48TaylorMichaelLMVP, ModeradorMedalhas de usuárioMedalhas de usuárioMedalhas de usuárioMedalhas de usuárioMedalhas de usuário
     

    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