-1

I'm developing an app in Unity 2020.3.3f1 to be deployed in HoloLens 2. This app has to deal with medical images thus I need to use SimpleITK library. I've downloaded SimpleITK source files and compiled them in Visual Studio 2017 for ARM64 architecture in order to match HoloLens 2 ARM64 architecture, following this procedure: https://blogs.windows.com/windowsdeveloper/2018/11/15/official-support-for-windows-10-on-arm-development/. I've added the native and managed .dll in Asset folder of the Unity project and I've written a c# script in which I use SimpleITK.

Everything works correctly in the Unity Editor without errors, but when I deploy the app in HoloLens 2 nothing works. Launching the debug of the solution in Visual Studio (Debug -> Start Debugging), these lines appear in the output window as soon as the script which uses SimpleITK is called:

'SpatialAwareness.exe' (Win32): Loaded 'U:\USERS\DefaultAccount\AppData\Local\DevelopmentFiles\BaseVS.Release_ARM64.Elena\SimpleITKCSharpNative.dll'. Module was built without symbols.
'SpatialAwareness.exe' (Win32): Unloaded 'U:\USERS\DefaultAccount\AppData\Local\DevelopmentFiles\BaseVS.Release_ARM64.Elena\SimpleITKCSharpNative.dll'
Exception thrown at 0x00007FFC1AAF39EC in SpatialAwareness.exe: Microsoft C++ exception: Il2CppExceptionWrapper at memory location 0x00000094365FE590.

How can the error be resolved?

dbc
  • 104,963
  • 20
  • 228
  • 340

1 Answers1

-1

It looks like the SimpleITK DLL you built is missing the Windows runtime component.

If you created your C++ DLL as a Win32 binary, it would throw exceptions when running on the HoloLens2 because Unity will not include standard Win32 binaries when it builds a WSA project. Therefore, you need to recreate the Win32 DLL as a UWP DLL or port the native win32 DLL to the UWP DLL, see the guidance here: To port a native DLL to the UWP without creating a new project

Hernando - MSFT
  • 2,895
  • 1
  • 5
  • 11