Copied and modified from another blog for future reference.
Note that in order to debug the Javascript inside a WebBrowser control, you don’t need the source code of the application (neat!).
- Open Internet Explorer, go to Settings, tab Advanced, and, in the “Navigation” section:
- Uncheck “disable script debugging” (both IE and Other)
- Uncheck “Display friendly HTTP messages”
- Check “Display a notification about every script error”
- Open an instance of Visual Studio. Open the Tools menu, Attach to Process, and on the “Attach to” line, click “Select…”, and only check “Script”.
- Run the program including the WPF BrowserControl
- Attach the Visual Studio instance to its process.
Now, open the “Solution explorer” tab/toolbox. You will see every Javascript file loaded by the WPF WebBrowser control, and you can add breakpoints where you want.
Tested with IE 11 and Visual Studio 2010.