Todd, I tried to replicate your problem since I had a strong suspicion it had something to do with the uri-scheme. I didn't have your complete code but was able to replicate it by just putting the grammar and lexicon files in the root folder of the app's local storage.
When I used type="application/pls+xml" in C#, I didn't get the 80045003 error. Rather, I kept getting this:
WinRT information: Grammar error found: C:\Data\Users\DefApps\AppData{A7C75BFD-F873-4DA9-834C-C4CA3D97AA6B}\Local\SRGSGrammar.xml, line 4: Cannot compile lexicon file "ms-appdata:///local/SRGSLexicon.xml": 0x80004003
which I think is a file pointer not found error. And when I paid closer attention to the error message, I noticed the file paths that the parser thinks it has for the grammar file and the lexicon file is different, even tho I was using "ms-appdata:///" to reference both files.
It turns out that the grammar parser probably cannot accept ANY of the special uri-schemes. I used the full path of the file path from the error message for the PLS file uri attribute and that worked. You'll notice I'm still using type="application/pls+xml"
So I'm not sure that this work around is an acceptable solution... but I believe this gets to the root of the problem.
This is the code (in C#) that makes this work
SRGSLexicon.pls (unchanged)
SRGSGrammar.xml (using a file path rather than the uri-scheme)
<?xml version="1.0" encoding="utf-8" ?>
<grammar version="1.0" xml:lang="en-US" tag-format="semantics/1.0" root="thecolor"
xmlns="http://www.w3.org/2001/06/grammar" >
<lexicon uri="C:\Data\Users\DefApps\AppData\{A7C75BFD-F873-4DA9-834C-C4CA3D97AA6B}\Local\SRGSLexicon.pls" type="application/pls+xml" />
<rule id="thecolor">
<item>blue</item>
</rule>
</grammar>
My app code (C#)
public MainPage()
{
InitializeComponent();
var srgsGrammar = new Uri("ms-appx:////SRGSGrammar.xml", UriKind.Absolute);
_recognizerUi.Recognizer.Grammars.AddGrammarFromUri("SRGSGrammar", srgsGrammar);
}
readonly SpeechRecognizerUI _recognizerUi = new SpeechRecognizerUI();
private async void Test_OnClick(object sender, RoutedEventArgs e)
{
//I used these next 2 lines to show the FilePath of the SRGSGrammar.xml file, and I used the same folder
//structure for the lexicon pls file uri (just changed the file name)
//var fileName = (await StorageFile.GetFileFromApplicationUriAsync(new Uri("ms-appdata:///local/SRGSGrammar.xml"))).Path;
//MessageBox.Show(fileName);
var recoResult = await _recognizerUi.RecognizeWithUIAsync();
var x = recoResult.RecognitionResult.TextConfidence;
MessageBox.Show(((int)x).ToString()); //show confidence
}
I hope this helps at all. I think the grammar parser just doesn't know what to do with the uri-scheme.