Javascript debugging doesn’t work in razor pages

Chrome (and Canary) used to be able to show javascript source which was embedded in aspx files.

Typically, I would add a debugger; statement, save, and then load my web page in Chrome with the developer tools window open. When Chrome hit the debugger; statement, it would stop and then show the javascript source, so that I could inspect variable or step through code.

A recent change has changed this so that now, when the debugger; statement is executed, Chrome dutifully stops execution but it is unable to show the source.

I had the same problem. When I clicked on the aspx page, under the Sources tab, I got a blank page. What worked for me was refreshing the page in Chrome. After that, the aspx code showed up in Developer Tools, and I was able to see , debug and search the code. This seems to be a Chrome bug.

Chrome Developer tool: html script is blank (in source) debugging tutorial

FavoriteLoadingAdd to favorites
Spread the love

Author: Shahzad Khan

Software developer / Architect