访问冲突调用 WaveInEvent.StopRecording()

问题描述

我正在尝试使用 Zak's code 定期从麦克风获取几秒钟信息并将每个录音写入不同的文件。我将它放在 VS2017 中的 Windows.Form C# 应用程序中,使用 .NET 框架 4.7.2。我使用了当前的 Nuget 包 NAudio 2.0.0
经过一些明显的工作时间后,可能是几个小时后,应用程序崩溃并出现访问冲突异常。请注意,即使是 try/catch 块也无法捕获异常,这是由 Windows 事件寄存器捕获的:

Applicazione: TestAudioAcquisitionForms.exe
Versione framework: v4.0.30319
Descrizione: il processo è stato terminato a causa di un'eccezione non gestita.
Informazioni sull'eccezione: System.AccessViolationException
in NAudio.Wave.WaveInterop.waveInReset(IntPtr)
in NAudio.Wave.WaveInEvent.StopRecording()
in Recorder_ns.NAudio.Recorder.TimerElapsed(System.Object,System.Timers.ElapsedEventArgs)
in System.Timers.Timer.MyTimerCallback(System.Object)
in System.Threading.TimerQueueTimer.CallCallbackInContext(System.Object)
in System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext,System.Threading.ContextCallback,System.Object,Boolean)
in System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext,Boolean)
in System.Threading.TimerQueueTimer.CallCallback()
in System.Threading.TimerQueueTimer.Fire()
in System.Threading.TimerQueue.FireNextTimers()
in System.Threading.TimerQueue.AppDomainTimerCallback(Int32)

欢迎任何帮助。

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)

相关问答

错误1:Request method ‘DELETE‘ not supported 错误还原:...
错误1:启动docker镜像时报错:Error response from daemon:...
错误1:private field ‘xxx‘ is never assigned 按Alt...
报错如下,通过源不能下载,最后警告pip需升级版本 Requirem...