Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crash without exception on .net framework 4.8 #887

Open
martenf opened this issue Mar 8, 2022 · 2 comments
Open

Crash without exception on .net framework 4.8 #887

martenf opened this issue Mar 8, 2022 · 2 comments

Comments

@martenf
Copy link

martenf commented Mar 8, 2022

Im running into the exact same problem as #789, but while using .net framework 4.8 and NAudio 2.0.1.

The crashing code:

private static readonly WaveOutEvent SoundPlayer = new WaveOutEvent();
private static readonly SortedList<string, WaveFileReader> SoundsList = new SortedList<string, WaveFileReader>();

...

SoundPlayer.Stop();

var nextSound = SoundsList[soundName];
nextSound.Position = 0;

SoundPlayer.Init(nextSound);
SoundPlayer.Play();

The nuget references:

<package id="Microsoft.Win32.Registry" version="4.7.0" targetFramework="net48" />
<package id="NAudio.Core" version="2.0.0" targetFramework="net48" />
<package id="NAudio.WinMM" version="2.0.1" targetFramework="net48" />
<package id="System.Security.AccessControl" version="4.7.0" targetFramework="net48" />
<package id="System.Security.Principal.Windows" version="4.7.0" targetFramework="net48" />

Windows event:

Faulting application name: MyApp.exe, version: 1.12.2022.223, time stamp: 0x62274627
Faulting module name: msvcrt.dll, version: 7.0.17763.475, time stamp: 0xf362c2f9
Exception code: 0xc0000005
Fault offset: 0x0000000000074b9a
Faulting process id: 0x414
Faulting application start time: 0x01d832e4e5e161b0
Faulting application path: D:\SoundCrashTest\MyApp.exe
Faulting module path: C:\Windows\System32\msvcrt.dll
Report Id: 6f201770-d678-40cd-8faf-29b2f7fcc01f
Faulting package full name: 
Faulting package-relative application ID: 

Environment:

OS: Microsoft Windows 10 Enterprise LTSC
Architecture: 64bit
.Net runtime: 4.8
@markheath
Copy link
Contributor

Maybe worth trying with WasapiOut instead in NAudio 2.1.0
Also, WaveOutEvent was never originally designed to be used with multiple calls to Init (although is more resilient to that now). It might be worth trying creating a new instance instead of re-using the old one.

@EzeKees
Copy link

EzeKees commented Aug 22, 2022

Try to update Visual C++ Runtime

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants