none
Source Not Available when debugging

    Question

  • OS: Win 8

    Visual Studio: 2012 R1

    App:  WPF, .Net 4.5

    http://social.msdn.microsoft.com/Forums/en-US/wpf/thread/db15b8a7-5b0a-4c18-b071-1693fb7603d7/
    http://social.msdn.microsoft.com/Forums/zh/vsdebug/thread/933f62dd-80e5-4ef3-9199-9e9abfefeadf
    http://social.msdn.microsoft.com/Forums/en-US/vsdebug/thread/36b4151e-2949-4c8c-901b-78ca14aeafca


    I just want the debugger to break on the line of code when it runs into an exception instead of showing me "Source Not Available".  How do I do that?  

    The last link above suggests a VS bug, please confirm.


    I tried setting Debug -> Exceptions, check all Common Language Runtime Exceptions.  However when I do that, my code crashes on

    return new WebClient().DownloadString(uri);

    which of course is completely legit and does not crash when throw is not checked on CLR exceptions.
    Tuesday, January 29, 2013 5:56 AM

Answers

  • Jack, I enabled Debug -> Exceptions -> Common Language runtime Exceptions, REBOOTED MY MACHINE, and it appears to be working.  I'm getting other exceptions now but it turns out they are to be expected.  Thanks for your help (but don't close this thread yet because for some reason I don't think this is completely resolved.  Hopefully I'm wrong).

    Sam

     
    Friday, February 01, 2013 4:21 AM

All replies

  • Hi SWheaties,

    Thank you for posting in the MSDN forum.

    To repro this issue, if possible, would you mind sharing us a simple sample? So we could try to debug it in our Environment.

    Source Not Available

    I doubt that your project doesn’t not contain source code for the code that you are trying to view, but you could try to use the Disassembly window to check it. For detailed information, see “No Source Available”. Maybe you could try to debugging this app in other Environment. Hope it could help.

    Best Regards,


    Jack Zhai [MSFT]
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Wednesday, January 30, 2013 2:37 AM
  • Hi Jack, to reproduce the issue, create a new wpf project.  In the constructor of MainWindow add this line:

    throw new Exception("this dosent work");

    On my machine I get a tab that blocks me from viewing my work that says "Source not Available."  My expectation is that the debugger breaks on the exception (or line after).

    Thank you,

    Sam

      
    Thursday, January 31, 2013 6:43 AM
  • Hi Sam,

    Glad to receive your reply.

    Not the WPF expert, but as you said that I create the simple WPF app, and add the code “throw new Exception("this dosent work");”, and then I add the breakpoint in this line code, the breakpoint is hit well even if I select all options for the Common Language Runtime Exceptions under Debug->Exceptions, and the app doesn’t crash.

    Update:

    It seems that if I click F11, it will generate " No Source Available". I doubt that it is related to the following setting.

    If you are debugging with How to: Step Into Just My Code enabled, the behavior is slightly different. With Just My Code enabled, the debugger ignores first-chance common language runtime (CLR) exceptions that are thrown outside of My Code and do not pass through My Code. If the exception is completely unhandled, however, the debugger always breaks.

    Disable it, and then you could debug it with "Step Into(F10)", please click "OK" button when you get the "No Source Available" for few times, and then it seems that it could debug with "Step Into" again.

    Best Regards,


    Jack Zhai [MSFT]
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.




    Thursday, January 31, 2013 11:02 AM
  • Jack, I enabled Debug -> Exceptions -> Common Language runtime Exceptions, REBOOTED MY MACHINE, and it appears to be working.  I'm getting other exceptions now but it turns out they are to be expected.  Thanks for your help (but don't close this thread yet because for some reason I don't think this is completely resolved.  Hopefully I'm wrong).

    Sam

     
    Friday, February 01, 2013 4:21 AM
  • Hi Sam,

    Since it works well now, and I will mark and close this thread, if it has this issue again, please make free feel to let me know. Thanks for your understanding.

    Best Regards,


    Jack Zhai [MSFT]
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Sunday, February 03, 2013 8:43 AM