28 December 2016

Unity 5.5/HoloLens: AudioPluginMsHRTF.dll has failed the AppContainerCheck check

All right, so I was finally past a couple of deadlines with paid HoloLens apps and was ready to take the plunge to update my app AMS HoloATC to Unity 5.5 and the newest HoloToolkit. After wrestling my way past some some interesting breaking changes (more about that later), I was finally at the point where everything worked again as it did before – and started adding new features. Today was the day I thought it was ready enough to justify a new submission to the store. I had tested everything thoroughly, so what could possibly go wrong.

image

Image result for wtf

Why, if it ain’t my dear old friend the WACK. The 'binary analyzer' has found a file AudioPluginMsHRTF.dll that does not pass the AppContainerCheck and the WACK gives me a whole bunch of suggestions that don't mean anything to me. Apparently I have to add a couple of options when I link the app, but I have not seen a linker since I wrote my last C program, which was – I think – before 2000. Now I know the WACK has some issues, so I tried submitting it anyway – but no dice. The Windows Store spitted it right back to me, with the same error. So now what?

Fortunately I have had dealt with Spatial Sound before and recognized the “Ms HRTF Spatializer” as something I just selected in Unity. After numerous (time consuming) failures trying to juggle the WACK, I took a desperate measure. I went back to a machine that had a previous installation of Unity on it – 5.4 – and checked AudioPluginMsHRTF.dll there. I found it in
C:\Program Files\Unity HoloLens 5.4.0f3-HTP\Editor\Data\VR\Unity\WindowsStoreApps. It reports being its size as 2931200 bytes
For Unity 5.5, in
C:\Program Files\Unity550f3\Editor\Data\UnityExtensions\Unity\VR\WindowsStoreApps\uap_x86, there’s a file of 13312 bytes big. Only 13kb. Yet, when you deploy and app with this only 13kb dll to a HoloLens Spatial Sound works. You can clearly hear the difference – simple stereo versus spatial sound.

So I went about and looked around where this dll is taken from when Visual Studio project is built, and found it comes from the plugins directory in the project directory of the generated solution. In my case that’s C:\Projects\AMS_HoloATC\AMS HoloATC\App\AMS HoloATC\Plugins\X86. I replaced the 13kb AudioPluginMsHRTF.dll by the one I had taken from the 5.4 installation. That fixed the WACK. Unfortunately, it also made the app crash whenever I used Spatial Sound. Nice try, no cigar. But it conformed my suspicions that the 5.5 version of this dll is indeed the thing that makes the WACK protest.

imageSo what I did, in the end, was just get rid of ‘real’ Spatial Sound. I went to Edit/Project settings in Unity and set “Spatializer Plugin” to “None”, disabling the Ms HRTF Spatializer. Re-created the Visual Studio solution from complete scratch, and the reference to AudioPluginMsHRTF.dll and AudioPluginMsHRTF.pdb were gone. And so was the WACK error.

But of course, now my app has no real spatial sound anymore – it’s reduced to ‘normal’ Unity Stereo Panning. But a running app is better than one that does not. I have filed a bug at Unity with a repro and contacted some people within Microsoft. I will keep you posted about any progress. In the mean time, this should keep you going forward.

For those who want to try out themselves, I have made this zipped up solution including all the files I built, and you can easily check the resulting app does not pass the WACK.

Update 30-dec-2016 – the issue has been confirmed as a bug by Unity and will be addressed.

Update 31-jan-2016 – the issue has been fixed – in Unity 5.5.1p2 or higher.

5 comments:

Jarno Peschier said...

Nice going, ace. :-)

Joost van Schaik said...

Thanks @Jarno :)

Albert Jan said...

With Unity 5.5.1p1 I still get the same error. The issue is also not mentioned in the fixed list https://unity3d.com/unity/qa/patch-releases/5.5.1p1

Joost van Schaik said...

@Albert Jan your are correct. I made a typo. It should be 5.5.1p2 in stead of p1. It's listed there (bug 865507). I corrected the version number in the article

Albert Jan said...

I should have checked there are already more Unity patches. Thanks!