locked
Javascript Debugger Error: There is not source code available for current location RRS feed

  • Question

  • Hi,

    I have a button on the Ribbon, click this button will call a javascript function. I want to debug but got this error:

    "There is not source code available for  current location"

    The function was called. Just wonder why the error occurs.

     

    Thursday, December 29, 2011 10:15 AM

Answers

  • Did you try using internet explorer's F12 (works in IE8 and up without additional installation)? It is also able to set a breakpoint on specific lines of code. Another thing is that the Ribbon is constructed outside of the form i-frame so you might be attaching to the wrong process.

    What is most likely causing the error though is that you've added the script call to the Ribbon, but you've added the actual script inside your form. If you want to access the code from the Ribbon you will need to use something like window.document.frames[0].myJavascriptFunction rather than just myJavascriptFunction. Using F12 will also allow you to see which webresources (javascript) have been loaded, if your script appears twice it's likely that it's loaded in the window and the form i-frame. If it appears once it might only reside in the i-frame and it won't be in the Ribbon scope. In the case of the latter calling the function through the Ribbon will actually cause a jump that reports the error, and this code is indeed not available in Visual Studio.

    I hope this helps

    - Alex

    Wednesday, June 13, 2012 1:10 PM

All replies

  • Can you tell me the specifics of how you are trying to debug the javascript?
    Jamie Miley
    Check out my about.me profile!
    http://mileyja.blogspot.com
    Linked-In Profile
    Follow Me on Twitter!
    Thursday, December 29, 2011 3:24 PM
    Moderator
  • Hi everybody,

    I've the same issue. If the function is invoked from the ribbon command I got the error during debug. Insted if it's invoked on a form event (ie onchange of a field), it's debuggable.

    This appens in VS2010 Sp1 Ultimate. Instead on VS2010 Premium seems to doesn't occour.

    Any ideas?

    Pier

    Wednesday, June 13, 2012 12:02 PM
  • Did you try using internet explorer's F12 (works in IE8 and up without additional installation)? It is also able to set a breakpoint on specific lines of code. Another thing is that the Ribbon is constructed outside of the form i-frame so you might be attaching to the wrong process.

    What is most likely causing the error though is that you've added the script call to the Ribbon, but you've added the actual script inside your form. If you want to access the code from the Ribbon you will need to use something like window.document.frames[0].myJavascriptFunction rather than just myJavascriptFunction. Using F12 will also allow you to see which webresources (javascript) have been loaded, if your script appears twice it's likely that it's loaded in the window and the form i-frame. If it appears once it might only reside in the i-frame and it won't be in the Ribbon scope. In the case of the latter calling the function through the Ribbon will actually cause a jump that reports the error, and this code is indeed not available in Visual Studio.

    I hope this helps

    - Alex

    Wednesday, June 13, 2012 1:10 PM