locked
Debugging a WinRT Component DLL while running a C# Metro App RRS feed

  • Question

  • My C# Metro app references a C++ WinRT component DLL that's building in my solution. I can successfully build, deploy and run, but when I debug my C# app, I can't step into the C++ code. Is this expected? Is there any way to get it to work? If I right click on the module in the Modules view and look at the symbol load information for my DLL, it says "Symbol search wasn't done for this module. Check if debug information was generated when the module was built." I'm definitely building it debug, and I see the .pdb sitting in the same directory as the .dll and .winmd. It makes me think the debugger is only doing managed and not native, but I don't see anything in the project properties that lets me turn on both managed and native. Does anyone have any ideas? Thanks for your help.

    Steve

    Tuesday, December 13, 2011 9:28 AM

Answers

  • I ran into the same problem as you.  I was able to work around it by manually enabling it in the .csproj.user file.  Create a file called "<projectname>.csproj.user" and put it in the same folder as the "<projectname>.csproj" file.  Give it the following contents:

     

    <?xml version="1.0" encoding="utf-8"?>
    <Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
      <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|AnyCPU'">
        <EnableUnmanagedDebugging>true</EnableUnmanagedDebugging>
      </PropertyGroup>
    </Project>

     

    Change "Debug" or "AnyCPU" if you are using a different configuration.  That worked for me, but YMMV.

    • Proposed as answer by Truckhunter Thursday, December 15, 2011 9:27 PM
    • Marked as answer by Steve Otteson Saturday, December 17, 2011 7:43 AM
    Thursday, December 15, 2011 9:26 PM

All replies

  • Steve, try to check "Enable unmanaged code debugging" checkbox in Debug tab of C# project properties.
    Tuesday, December 13, 2011 1:40 PM
  • When I look at the Debug tab of the properties, the space is empty under "Enable Debuggers." Has my install of VS 11 gone bad? Is there any way to repair this?

    Tuesday, December 13, 2011 3:19 PM
  • I think my install is broken somehow. I am able to debug both native and managed if I first start my app without debugging, and then attach the debugger with both managed and native selected. It's not as good as just F5, but it works for now.
    • Proposed as answer by Anton K2 Wednesday, December 14, 2011 5:33 AM
    Tuesday, December 13, 2011 10:43 PM
  • That's strange. I have the checkbox under "Enable Debuggers." May be you need to reinstall Win8
    Wednesday, December 14, 2011 5:34 AM
  • I ran into the same problem as you.  I was able to work around it by manually enabling it in the .csproj.user file.  Create a file called "<projectname>.csproj.user" and put it in the same folder as the "<projectname>.csproj" file.  Give it the following contents:

     

    <?xml version="1.0" encoding="utf-8"?>
    <Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
      <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|AnyCPU'">
        <EnableUnmanagedDebugging>true</EnableUnmanagedDebugging>
      </PropertyGroup>
    </Project>

     

    Change "Debug" or "AnyCPU" if you are using a different configuration.  That worked for me, but YMMV.

    • Proposed as answer by Truckhunter Thursday, December 15, 2011 9:27 PM
    • Marked as answer by Steve Otteson Saturday, December 17, 2011 7:43 AM
    Thursday, December 15, 2011 9:26 PM
  • That works! Thanks!
    Saturday, December 17, 2011 7:43 AM