none
breakpoints are ignored when debugging 3.5 xbaps RRS feed

  • Question

  • I got a new machine recently and have had trouble with debugging xbaps from the visual studio environment since installing vs2008 and vs2010 on the machine. When debugging from within visual studio, all breakpoints are ignored as though they are not there.

    It appears only to affects xbaps, not other solutions; standard wpf apps work fine.

    It also only appears to happen on 3.5 framework; that is, the problem occurs in both vs2008 and vs2010 if the framework is set to 3.5, but xbaps under vs2010/4.0 are debugging normally. The problem is occurring with both old/existing apps and new apps I have been creating to test the problem.

    I am using the following versions of visual studio and framework:

    Microsoft Visual Studio 2008
    Version 9.0.30729.4462 QFE
    Microsoft .NET Framework
    Version 3.5 SP1

    Microsoft Visual Studio 2010
    Version 10.0.30319.1 RTMRel
    Microsoft .NET Framework
    Version 4.0.30319 RTMRel

     

    Thank you.

     

    • Moved by Jie BaoModerator Thursday, April 21, 2011 10:25 AM (From:Windows Presentation Foundation (WPF))
    Tuesday, April 19, 2011 8:29 PM

Answers

  • Hi poolboi,

     

    You could try modifying the app.exe.config file by adding the <supportedRuntime> tag with the correct version of the .NET runtime in the <startup> section as shown in the example below. This will let Visual Studio know which version of the .NET runtime you will be running.

    e.g.

    <!-- sample foo.exe.config -->
    <?xml version ="1.0"?>
    <configuration>
    <startup>
    <supportedRuntime version="v2.0.[version on your machine]" />
    </startup>
    </configuration>

     

    To determine the correct [version on your machine] look in the “C:\Windows\Microsoft.NET\Framework” directory for the most recent “v2.0.xxxxx” folder.                                                                               

     

    There is no option as Managed(v3.5) code type available in Visual Studio as v3.5 is actually an extension of v2.0. With the release of .NET 4.0 came a new 4.0 debug engine in Visual Studio 2010 (so there are now two managed debug engines, 2.0/3.0/3.5 and 4.0) so Managed(v2.0/1.1/1.0) is used for 3.5 code type and Managed v4.0 is used for 4.0 code type.

     

    I used the same configuration that you mentioned earlier to try reproduce the problem. I researched and found no known issues with debugging xbaps targeting .net framework 3.5. If after trying the above solution the problem still persist I would recommend you to open up an incident case with us as we were not able to reproduce the issue at our end and would require to debug the problem at the machine where the problem exists.


    --Trevor H.
    Send files to Hotmail.com: "MS_TREVORH"
    Monday, May 23, 2011 2:52 PM
    Moderator

All replies

  • Hi poolboi,

    Could you please clean the solution first and build to test again? As we know, for XBAP, Visual Studio attaches the PresentationHost.exe process to enable debug, so you could try to start your XBAp program and attach the VS to the PresentationHost.exe to check if it can pause on the breakponits.

    Another suggestion, you could try to delete all breakpoints and add them again. If it still cannot help you, I think you could start a thread on the Visual Studio Debuger forum on the MSDN forums. Or you could submit a feedback about this issue on the Microsoft Connect site.

    Sincerely,


    Bob Bao [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Wednesday, April 20, 2011 5:24 AM
    Moderator
  • Thanks for the response.

    I think I have attempted the things you are recommending. I have tried the following:

    • cleaning the solution
    • starting several new projects to test the behavior
    • deleting the 2.0 folder in %USERPROFILE%\Local Settings\Apps\
    • removing the breakpoints and re-adding them
    • rebooting the machine
    • running mage -cc

    But the behavior is consistent: if it is 3.5 and an xbap, breakpoints are ignored.

    Most interestingly, I created a test xbap in vs2010. There, I switch the project's framework back and forth from 3.5 to 4.0. When running under 4.0, it stops at all the breakpoints; under 3.5, it blows right through them.

    Wednesday, April 20, 2011 1:43 PM
  • I re-looked at your response and realized I missed one. So I ran a test xbap from visual studio (which is my preferred practice) and then select "Attach to process...". This showed that vs was already attached to presentationHost.

    So then I tried running the xbap file itself from the debug folder and using vs to attach to presentationHost as you recommended. The breakpoints were hit.

    I don't know why one way works and the other does not, since they *seem* to be the same thing.

    Is there any way to get debugging to work when starting the app from visual studio?
    Wednesday, April 20, 2011 1:57 PM
  • After launching debugging session, you may open the Processes window (Debug -> Windows -> Processes), how many processes listed there? Does PresentationHost.exe included?

     

    Anyway, I cannot reproduce this issue, it will be appreciated if you could provide some reproduce steps.


    Eric Yang [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Friday, April 22, 2011 8:12 AM
  • While debugging, the processes window shows one process: presentationhostHost.exe.

    I did not expect that anyone would be able to reproduce the behavior. I apologize if the statements I made above were unclear.

    Here is a summary of the above:

    • On my machine I have recently installed both vs2008 and vs2010.
    • While debugging 3.5 framework xbaps under either version of visual studio, breakpoints are ignored.
    • This is true for *all* xbaps on my machine, old or ones that I have very recently created for testing this behavior.
    • However, if I execute an xbap from the debug folder and then use visual studio to attach to presentationHost, then breakpoints are hit.

     

    If you need additional clarification, please do not hesitate to let me know.

    Thank you.

    Sunday, April 24, 2011 10:12 PM
  • OK. I think I can see what is happening here, but I am not sure what to do about it.

    The 3.5 xbaps appear to automatically be debugged under "Managed (v2.0, v1.1, v1.0)" when starting them from visual studio. However, when I attach to one that is already running from vs2010, it defaults to "Managed (v4.0)"--this is when breakpoints are recognized. I think the v4.0 can understand the debug symbols; the v2.0 and earlier cannot, hence the breakpoints are ignored.

     

    For some reason, there is not a "Managed (v3.5)" available to me.

    To clarify, in vs2010 if I select "Attach to Process...", the popup that opens has an "Attach To:" area. If I choose "Select...", the debug types available do *not* include a "Managed (v3.5)" code type. It seems reasonable to believe that this absence is the source of my problem.

    What is wrong with my system to where that choice does not appear in that list?

     

    Sunday, April 24, 2011 10:56 PM
  • Hi poolboi,

     

    You could try modifying the app.exe.config file by adding the <supportedRuntime> tag with the correct version of the .NET runtime in the <startup> section as shown in the example below. This will let Visual Studio know which version of the .NET runtime you will be running.

    e.g.

    <!-- sample foo.exe.config -->
    <?xml version ="1.0"?>
    <configuration>
    <startup>
    <supportedRuntime version="v2.0.[version on your machine]" />
    </startup>
    </configuration>

     

    To determine the correct [version on your machine] look in the “C:\Windows\Microsoft.NET\Framework” directory for the most recent “v2.0.xxxxx” folder.                                                                               

     

    There is no option as Managed(v3.5) code type available in Visual Studio as v3.5 is actually an extension of v2.0. With the release of .NET 4.0 came a new 4.0 debug engine in Visual Studio 2010 (so there are now two managed debug engines, 2.0/3.0/3.5 and 4.0) so Managed(v2.0/1.1/1.0) is used for 3.5 code type and Managed v4.0 is used for 4.0 code type.

     

    I used the same configuration that you mentioned earlier to try reproduce the problem. I researched and found no known issues with debugging xbaps targeting .net framework 3.5. If after trying the above solution the problem still persist I would recommend you to open up an incident case with us as we were not able to reproduce the issue at our end and would require to debug the problem at the machine where the problem exists.


    --Trevor H.
    Send files to Hotmail.com: "MS_TREVORH"
    Monday, May 23, 2011 2:52 PM
    Moderator