Padawan
Padawan

Reputation: 390

Windows 10 Development : How do I debug the Windows Runtime Component (written in C#) which is consumed by Javascript code

I'm trying to develop a Windows 10 app as follows:

  1. The app is written using HTML5/WinJS
  2. The app consumes a Windows Runtime Component which I wrote in C#

I'm able to hit the break point in the javascript which invokes the method call to the WRC. But I'm not able to step into the code and see what's happening inside it. The reason for that is because the debugger is set to Script mode. If I set it to Native, then it will never hit the javascript code in the first place.

My problem, is that Visual Studio doesn't let me (to the best of my knowledge) to attach the source code of an external reference, so that I can put a breakpoint in it and run the debugger in native mode. Resharper has this feature, but I need a solution in Visual Studio.

Visual Studio DOES let me attach source code when I try to step into a reference from native code. I confirmed this by writing a dummy Windows 10 app using C#, and then tried to step into the invocation of the same Windows Runtime Component. When the source was not available, it asked me for the same and I was able to attach it and step through the code.

Does anyone have any ideas?

Upvotes: 7

Views: 1072

Answers (1)

vine'th
vine'th

Reputation: 5030

I had a similar problem. I have a C# Windows Runtime App which was referring the C++/CX Runtime component, and I couldn't get the break point to hit in the C++ code. The fix that worked was:

  • In the C# Project : Goto Properties
  • Select Debug Tab
  • Debugger type : For Application Process / Background process, select "Mixed (Managed and Native)"

Upvotes: 2

Related Questions