Hi!
We are developing an application for Windows 10 where we are using Chakra engine. In this application the end-user can write JavaScript code which we run inside our app.
We like to deliver the users some kind of possibility to debug their code. But I couldn't find any way yet as to how can I debug the code which I run on Chakra.
Now, we have a sample app about this, where I simply create a Js Runtime and Context, then I set up CurrentContext, then I simply have the JS Code in a string which I running on Chakra with JSRunScript.
I tried to call JsStartDebugging which should enable us to debug the code with Visual studio, but it didn't helped altough the call returns with NoError.
Could you give me some info about this? Is this even possible somehow?
// FYI @agarwal-sandeep
Hi @monutam91 and thanks for reaching out to us! First just to make sure, I'm assuming that we are talking about Chakra - the system component on Windows 10, not ChakraCore as there is a difference when it comes to debugging. In the sample case you mentioned, once you call JsStartDebugging, Chakra should be in debug mode and VS will break at any unhandled exception or debugger statement or breakpoint in scripts. Can you check whether you selected the "script" debugging option in VS? This is really easy to forget.
@monutam91 and if you're comfortable with sharing the sample or a small repo with me, that'd also be fantastic and help me understand your scenario and setting better.
@monutam91 when you do JsStartDebugging it will put the script code in the debug mode. That means you still need to attach the VS to the app to further debug the script. However as @liminzhu mentioned while attach you need to select the 'script' debugging option.
Hi,
Yes, I'm talking about the Chakra and not the ChakraCore. I'm familiar with the Script option and I set it up, in debug time I can see the Script Documents part in the Solution Explorer, but there aren't any Script files in it, only the root of the Application exe can be seen, which I can't open.
@monutam91 we have a UWP sample where debugging is all set up and working. The hosting part in the sample is fairly minimal and commented, and as in the sample, enabling debugging should be as simple as calling JsStartDebugging once before running any scripts with JsRunScript. Can you try and see if the sample works for you and it can help you? To do that with VS2015 (similarly in VS2013),
Updated the issue title to make it easier for others to find this information in the future.
Closing question as answered, but feel free to comment if you'd like to discuss further.
So how to debug ChakraCore embedded in my own C++ project? I have tried choosing different debug mode and using code like:
however Visual Studio does not hit the breakpoint.
ChakraCore provides just the debugging APIs and doesn't implement a debugger. We have implement debugging support in Node-ChakraCore which can be used to debug using VSCode as frontend.
Will VS support be scheduled in the future?
Most helpful comment
Will VS support be scheduled in the future?