Need help loading Cortana VCD file on using C++ DirectX/XAML

1

I am adding Cortana to a DirectX/XAML Windwos 10 game. Every example I can find is given in C#, not C++. Normally this wouldn't be a problem, but apparently I'm not implementing it correctly in C++ and need some help with this one.

The purpose of this chunk of code is to load a VCD file which Cortana uses for my app-related voice commands. I have already created the VCD file using standard examples.

This is the specific C# code I'm having trouble implementing in C++:

var storageFile = 
  await Windows.Storage.StorageFile.GetFileFromApplicationUriAsync(
    new Uri("ms-appx:///myvcdfile.xml"));
await 
  Windows.ApplicationModel.VoiceCommands.VoiceCommandDefinitionManager.
    InstallCommandDefinitionFromStorageFileAsync(storageFile);

My attempted C++ implementation of this is:

Uri^ uri = ref new Uri("ms-appx:///myvcdfile.xml");
    create_task(StorageFile::GetFileFromApplicationUriAsync(uri)).then([](task<StorageFile^> t) {
        StorageFile^ sfile = t.get();
        Windows::ApplicationModel::VoiceCommands::VoiceCommandDefinitionManager::InstallCommandDefinitionsFromStorageFileAsync(sfile);
    });

When I run this, no visible error is thrown (no immediate crash) but in the output window the following exceptions are thrown:

Exception thrown at 0x76473E28 (KernelBase.dll) in darksong.exe: 0x40080201: WinRT originate error (parameters: 0x8000000B, 0x00000040, 0x018BE280).
Exception thrown at 0x76473E28 (KernelBase.dll) in darksong.exe: 0x00000005: Access is denied.
Exception thrown at 0x76473E28 (KernelBase.dll) in darksong.exe: 0x000006D9: There are no more endpoints available from the endpoint mapper.
Exception thrown at 0x76473E28 (KernelBase.dll) in darksong.exe: 0x000006D9: There are no more endpoints available from the endpoint mapper.
Exception thrown at 0x76473E28 (KernelBase.dll) in darksong.exe: 0x40080201: WinRT originate error (parameters: 0x80004005, 0x00000013, 0x0EEAF160).

The "access is denied" error makes me think there is some issue opening the file itself, although if I purposely enter an invalid filename it's a completely different error which crashes, so I know it's finding the file but perhaps is having some issue actually accessing it?

Also, even if I exclude the "InstallCommandDefinitionsFromStorageFileAsync()" line The exceptions are all still thrown.

Any help is appreciated, thanks in advance!

c++
windows-10
cortana
asked on Stack Overflow Jul 31, 2015 by NateMonster

1 Answer

0

You have certainly an error in your xml file (if you have set for exemple in command an item using PhraseList but you have forgot the PhraseList node in your xml)

answered on Stack Overflow Oct 25, 2015 by Mehdi Lahlou

User contributions licensed under CC BY-SA 3.0