windows . media . speechsynthesizer . speechsynthesizer构造函数抛



我的UWP应用程序的许多用户都在Windows.Media.SpeechSynthesis.SpeechSynthesizer..ctor()中点击System.IO.FileNotFoundException

代码正在调用Windows.Media.SpeechSynthesis.SpeechSynthesizer的默认构造函数

private SpeechSynthesizer _speechSynthesizer = new SpeechSynthesizer();

我得到了一个用户的以下堆栈跟踪,其他用户也报告了类似的堆栈跟踪。我没有在我的本地机器上遇到这个异常,所以无法进一步调试。

任何想法我怎么能进一步调试或修复它?

System.IO.FileNotFoundException
The system cannot find the file specified.
at System.Runtime.InteropServices.McgMarshal.ActivateInstance(String) + 0x17b
   at Windows.Media.SpeechSynthesis.SpeechSynthesizer..ctor() + 0x1c
   at SampleReader.TtsHelper.TtsHelper..ctor(TtsData, MediaElement) + 0x6f
   at SampleReader.UIPages.Reader.<InitializeReader>d__45.MoveNext() + 0xfb
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() + 0x21
   at System.Runtime.CompilerServices.AsyncMethodBuilderCore.<>c.<ThrowAsync>b__7_0(Object) + 0x1e
   at System.Action`1.Invoke(T) + 0x28
   at System.Threading.WinRTSynchronizationContext.Invoker.InvokeCore() + 0x33
   at System.Runtime.InteropServices.McgMarshal.ThrowOnExternalCallFailed(Int32, RuntimeTypeHandle) + 0x21
   at __Interop.ComCallHelpers.Call(__ComObject, RuntimeTypeHandle, Int32) + 0xb8
   at __Interop.ForwardComStubs.Stub_19[TThis](__ComObject, Int32) + 0x24
   at Microsoft.AppCenter.Utils.ApplicationLifecycleHelper.<.ctor>b__17_1(Object, UnhandledErrorDetectedEventArgs) + 0x3d
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() + 0x21
   at Microsoft.AppCenter.Utils.ApplicationLifecycleHelper.<.ctor>b__17_1(Object, UnhandledErrorDetectedEventArgs) + 0x75
   at System.EventHandler`1.Invoke(Object, TEventArgs) + 0x2e
   at __Interop.Intrinsics.HasThisCall__24[TArg0](Object, IntPtr, Object, TArg0) + 0x36
   at Sample Reader!<BaseAddress>+0x110b4f0

我测试了上面的代码,并遇到了相同的异常(未找到文件)。

你可以让你的用户检查语音识别在本机启用功能(类型语音识别)在 盒)。并检查使用的语言是否(如English(United States)))启用Speech(打开设置>时间,语言比;语言比;首选语言,点击英文(美国)>选择(.如果语音识别功能不支持,需要启用

有两种方法可以尝试启用该功能:

  1. language 中查找您的语言(设置在时间,语言),点击选项,点击下载下的按钮语音启用语音特性
  2. 打开
  3. 演讲(设置在时间,语言),点击添加声音管理声音,选择所需语言到添加

相关内容

  • 没有找到相关文章

最新更新