Unmanaged/Managed project mix in VS2015

Hi,
my app needs some layer written in cpp/unmanaged code, the rest is managed code.
I have problems to get this mix working.

1.) I can’t set a reference from the (managed) main project to the unmanaged project. So deployment is a problem. I think, I have fixed this by adding the unmanaged .dll to the managed project and changed the properties of this file to ‘Copy always’. Deployment works, but if the unmanaged project is recompiled after some changes, the old version is deployed. Bad news.

2.) Is there a chance to set breakpoints in the unmanaged code? For now I get the message ‘No symbols loaded’.

Maybe issue 1 and 2 were related somehow.

Is there any chance to get this running.

Thanks a lot.

With best regards

Gerhard

Dear @Gerhard
I used to work mostly with VS2008 (WEC7), where these features worked fine.
I recently faced similar issues when I tried to debug a mixed application with VS2015.

  1. I don’t know your solution setup, so I’m afraid I cannot give you a clear answer how to solve this. However, I would expect that recompiling the native part would overwrite your old version.
    As you mentioned, VS is deploying the old version, so I recommend to investigate why there is even an old version around anywhere. Did you maybe build the release version only, but deploy the debug version?
    Also try to right-click onto the native project in the solution explorer and select deploy. I don’t see a reason why this shouldn’t deploy the latest version.

  2. It seems debugging native code in a mixed application is not possible with VS2015. We have a pending request at Microsoft to clarify whether there is a way to make it work.
    In the meantime I’m afraid you will either have to debug the native part either by writing a native test application, or by printf-debugging (inserting NKDbgPrintfW() or similar statements to output useful information onto the debug serial port.

Regards, Andy

Dear @Gerhard
We got a reply from Microsoft. They outlined a solution how to debug mixed code (C# / Native) using Platform Builder:
I’m afraid, without Platform Builder it seems you are restricted to the approaches I listed in my initial answer above.
Regards, Andy


Microsoft’s Approach based on Platform Builder

If you want to just debug the native Dll and you know where to put the breakpoints in the corresponding source code, then I don’t think you need to specify the remote executable anywhere.

Please try the below steps

  1. In one instance of Visual studio (say A), launch the Windows CE OS design project and boot the image on the target device.
  2. Open the corresponding source files of the native dll which you want to debug and put the breakpoints
  3. Then open an another instance of Visual studio (say B)
  4. In this instance, open the .NET CF application project and just deploy it (using F5) on the target device (using the IP address). Please note that you need to launch the corecon applications (conmanclient3.exe and cmaccept3.exe) on the device for successful deployment.
  5. As soon as the application starts on the device and hits the native dll, the breakpoints should hit on the first instance (A).
  6. In fact, you can simply copy the managed exe to the flat release directory of the OS design and launch the .NET CF application directly on device using Target control window. In this case, you don’t need to launch the 2nd instance of Visual studio.

… ok, thanks.
I have Platformbuilder, used it with my former SoM, but didn’t try with Colibri iMX7D for now.

With best regards

Gerhard

… ok, thanks.
I have Platformbuilder, used it with my former SoM, but didn’t try with Colibri iMX7D for now.

With best regards

Gerhard