Learn to use Visual Studio, Visual Studio Online, Application Insights and Team Foundation Server to decrease rework, increase transparency into your application and increase the rate at which you can ship high quality software throughout the application lifecycle
Hello, I am Patrick Nelson, a developer on the Visual Studio Debugger Team.
Authoring apps that are using more than one language is not uncommon these days. For example, some developers prefer one language for the UI layer but use another language (or reuse components in another language) for their business logic. When debugging such apps, most of the time you are either debugging one language or the other (and you select which debugger type you want to use through the project properties), but sometimes you need to have the debugger attached to both. In other words, you want to be using both debugger engines at the same time. It is for this reason that in VS2012 Update 1 we enabled and blogged about interop debugging between Managed and Native code in the same app.
Before delving into the VS2013 experience, it is worth pointing out that even with Visual Studio 2012, it is possible to debug both code types of the same app simultaneously by starting debugging in one instance of Visual Studio, and then opening another instance of Visual Studio to attach to the same process but with a different debug engine selected (in the project properties)
There are some disadvantages to using this workaround including:
To select this new debugger type, go to project properties –> debugging and for “Debugger Type” select “Native with Script”
Now when you start debugging, you’ll notice the active script documents load in the solution view as they do when Script debugging:
Say we are debugging an app that crashes on startup. If we debug it with Script Only, all we see is an unhandled exception in WWAHost and the Visual Studio Just-In-Time debugger:
If we debug with Native only, we get a bit more information. We see a divide by zero first chance exception in FolderInfo.h by looking at the Output window. To see why we are getting the divide by zero error, we can temporarily enable break on divide by zero exception via Debug -> Exceptions:
Running it again with break on first chance exceptions thrown, we see the divide by zero error is being caused because m_ImageList->Size is zero. Unfortunately, the deep call stack provides no clue as to how we got here except that we came from jscript9.dll:
Here we see that the folder we are looking at is “Pictures” and there are no images in that folder. This is the cause of the divide be zero error. If we add a picture to the pictures folder the divide by zero exception goes away. We found and verified a possible fix.
By the way, now is a good time to turn off break on divide by zero exceptions so we don’t get extra noise during future debugging sessions.
If you want to try this yourself, you can download the sample program I used to create this post.
We are actively looking for feedback on both this and other diagnostics features so please stop by our MSDN support forum and let us know what you think.
Thank you for your feedback!
This feature sounded so cool. Much nicer than Firebug & similar browser based tools. So I spent the last few days searching for ways to get the Debug Menuitem to appear in the Project (or Solution) properties page. I installed & reinstalled VS2013, Tried heaps of projects to no avail.
Patrick: Can you confirm this feature only works with Windows Store projects?
Thank you for the feedback!
The specific issue is that "The breakpoint will not currently be hit. No executable code of the debugger's target code type is associated with this line. Possible causes include: conditional compiliation, compilier optimizations, or the target architecture of this line is not supported by the current debugger code type."
Thanks in advance.
Can you contact us at email@example.com? This may be easier to troubleshoot over email. It would be most helpful if you could provide detailed repro steps about what you are trying to do and the results you are seeing (what type of project, does it happen for all the projects you tried or a particular one, what do you do - set a BP, F5, etc.) and a simple repro project.
Is this supported only for "Windows Store Apps"?
I am trying to debug an application that hosts MSHTML/WebBrowser and having no success. When I attach (remotely) I still have to choose Native or Script but not both. No matter which one I choose, there's no project and thus no project properties window in which I can choose "Native with Script".
Is is because this JS/Native interop is supported only with WWAHost.exe and not the general MDM/PDM case of Active Scripting?
Do you have any suggestions for me?
Using VS2013, but the Configuration Properties under project property, does not have "General" and "Debugging"
This is only supported for Windows Store Apps unfortunately. If you would like it supported for other app types, would you mind logging a suggestion on visualstudio.uservoice.com
Visual Studio Debugger
The Project properties pages are different depending on what project type you have. Can you give me more details about what you are trying to do, what's your project type, etc.
Well, I am working on a mobile app using MVC 5.0 and Bootstrap. I right mouse click on the solution in the Solution Explorer.
I'm having the exact same problem, I don't get the "General" or "Debugger" items, just "Configuration" item in that tree. I really really want to take advantage of the script debugging, but this mystery has prevented me from using it. My project is a Windows Phone + PhoneGap template I found online, it says "(Windows Phone 8 Silverlight 8)" in the project name, but it's wrapping an HTML5 app. I'm using VS2013 Ultimate.
These kinds of efforts on the part of the MSFT team are much-appreciated. They really do help - more so, I think, than the terribly dry formula-driven documentation. Before you post them, however, it might be a good idea to run them past the "terribly dry formula-driven" folks to avoid some of the more common errors. As the comments are making clear, a few lines at the top of this article defining its scope would be helpful.