Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Combining a C# and C++ project works for x86 and x64 but not for ARM

I have two projects in my solution. One is a C# Universal Application and the other is a C++ project (obtained from here) and re-targetted to Windows 8.1 (this was performed by Visual Studio 15 when I imported the project). I have referenced the C++ project from my C# project and set Copy Local to true.

The code builds perfectly fine for all three platforms (x86, x64 and ARM). However, when deployed to an ARM device there is an exception thrown on the line where I try to access the C++ code. On the x86 and x64 versions this is not an issue and the code works perfectly fine. The exception is a System.IO.FileNotFoundException and here is a pastebin of the exception in detail.

My understanding of this exception is that the generated .dll is for some reason not being copied over onto the device? I have had a look at the configuration settings and everything seems set up correctly as far as I can tell (screenshot incuded below). The other possibility is that the C++ project has an internal dependency on another class that I somehow need to identify and reference from somewhere. There is a line from the stacktrace (included in the above pastebin link) that suggests it occurs on the line System.StubHelpers.StubHelpers.GetWinRTFactoryObject(IntPtr pCPCMD).

The C++ code uses Media Foundation WinRT components and should work perfectly fine on ARM devices.

It seems that other questions on SO (such as here) have also looked at this but only for one particular platform such as x86.

Is there any particular reason why this currently works on x86 and x64 but not on ARM?

Screenshots:

enter image description here

enter image description here

like image 548
Gordonium Avatar asked Jul 03 '15 11:07

Gordonium


People also ask

Can you combine AC units?

You Can Combine a Heating and Cooling System By combining heating and cooling, you can save space and money with one unit. However, if you have existing systems, you will have to replace them with a whole new setup. Forced-air systems are the most common choice for combining heating and cooling.

Can you have 2 zones with one AC unit?

Dual-zone systems allow you to split the house into a number of zones, where each zone can have its own autonomous temperature setting. And the best part? It can all be done with a single HVAC system. No need to install multiple air conditioning units!

Can I add AC to my existing heating system?

The short answer to this is, “yes.” Yes, you can add an air conditioner to a forced-air heating system.

How do you combine central air and heat?

The best way to combine heating and cooling systems is with a heat pump. They're perfect for milder winter climates like Oklahoma's, and they can save you energy. Whereas gas furnaces burn fuel to heat the air, heat pumps are electric and operate on the same principle as air conditioners.


1 Answers

and re-targetted to Windows 8.1

That's your problem right there. If you target a Windows 10 device, you need to create a new Windows Runtime Component (Universal Windows):

Universal Windows (10) C++ Windows Runtime Component

My guess is that the Windows 8.1 Winmd is not compatible with the device you selected.

I have downloaded the VideoRecorder tool, and reproduced your problem. Then if I create a new Winmd Universal Windows, add the C++ files in it, it runs without issues on a Raspberry Pi 2 with Windows 10 IoT.

EDIT: If you are targeting a Windows 8.1 device and not a Windows 10 device then you need the Universal Windows 8.1 project:

Universal Windows 8.1 C++ Windows Runtime Component

I've made a sample and deployed it on a Nokia Lumia 925 without issues.

like image 81
Julien Lebot Avatar answered Oct 24 '22 09:10

Julien Lebot