-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
.Net 5.0 Application using NAudio libraries crashes after applying cumulative update 21H1 to Windows 10 #789
Comments
Can confirm this Error. Excerpt from my eventlogs:
EDIT: Attached a small sample to reproduce error. |
This started happening with mine as well. |
It also crashes in Windows 7.. Maybe it's in .NET 5.0.7 Update ? |
The application was migrated into .NET 5.0 some time ago and it used to work fine. Since then I have applied the regular Visual Studio and Windows 10 updates. I suspect that it was CU 21H1 or one of the follow-up updates. Unfortunately I do not have another computer where I can test the application with - and without - the latest updates. I also noticed that "msvcrt.dll" has not been updated lately because in my computer it is dated: 2020-10-14. |
Similar issue here. I get weird sounds played back and then it quits with an access violation. I think they've changes something and the memory pointer for the WaveOut buffer for example is not set right, playing back program code instead of audio data, then going outside of the program's memory. |
Ok, it's the .NET framework 5.0. I have an older compiled version of my app still and it's on 3.x and that one works. So, there's a bug in the current "hotfix" of .NET 5.x. The NAudio team should contact Microsoft ASAP. It has nothing to do with any other updates (Cumulative, etc.). Unfortunately .NET updates cannot be uninstalled. |
Does any of you use a specific audio output API via NAudio? Like WaveOut, DirectSound, WASAPI, etc.? |
Same here. Started with CU 21HI. |
Same here. It is the NET 5.0.7 runtime causing the issue. Rolling back to 5.0.6 is the fix. BUT Microsoft is forcing the 5.0.7 update and I have to keep removing 5.0.7 and reinstalling 5.0.6 |
I've installed 5.0.0 and the issue was still there. |
The issue causes memory to be read that does not belong to the process, so the Windows kernel kills the application with the error "Access Violation". It is NOT the Cumulative update! It's a "hotifx" in the current .NET 5.x runtime. |
I don't see that here. 100% reproducible in all my tests across multiple machines. NET 5.0.6 works without issue, but with 5.0.7 it fails consistently. |
Have you switched the runtime and recompiled? I've definitely installed 5.0.0 and it did not work. Maybe it didn't really uninstall, I don't know. But there is definitely an issue in the runtime and I hope Microsoft will fix this ASAP. |
Can confirm the same issue in the past 2 days. Sound now plays random samples in memory. .NET 5.0 application. |
Wow, thanks everyone for reporting this. I'm afraid I've been extremely busy on other projects recently, but I will try to chase up with Microsoft to understand what is going on here |
I can concur I am getting the same problem with WaveOut and Wasapi on .NET 5.0.7 |
Can anyone suggest a way to rollback my .NET Sdk version? I've tried uninstalling from the Control Panel and installing 5.0.5 from the website but 5.0.7 persists. To be completely honest I don't remember installing 5.0.7 so this must have happened with a VS update, in which case is it impossible to uninstall 5.0.7? |
The only thing that worked for me was changing the runtime back to 3.x and recompiling my application. |
That is a solution I suppose, but I REALLY don't wanna move back to .Net Core 😬 (older C# version too which isn't convenient) Luckily my apps aren't very popular so it's not a critical issue at this stage 🤗😁. I'm very intrigued to hear what Mark's prognosis is, I don't understand low level stuff but it does excite me! |
I was going crazy ! I thought I had to do something with it ! The only thing that works is a WPF app with Edit: Odd thing is, it works if you go on your bridge project app and right click on it then And it's because of |
Our WPF did not work with Publish. It doesn't crash, but audio still wouldn't play. Had to switch audio library, but transition was easy enough as we already had a wrapper. Hopefully NAudio gets it fixed soon so we can revert it back in the future. |
Have you tried building self-contained (with 5.0.6 runtime included) application for a temporary fix? |
Tried with any .NET 5 version. Can reproduce it on any version. |
Try it with the latest .NET 6 Preview 4 SDK and Runtime. Would like to hear if it works then too? If not then file issue at https://github.com/dotnet/runtime/ and link this one as well and tell them it started in .NET 5's version of the runtime. Chances are this could possibly be a regression they failed to catch. |
Yea me to, ill also note if I keep trying to get it to play it plays a weird screeching sound if successful |
To me it really looks like a memory pointer issue. |
A PR was created in .NET to fix this issue. Also mentioned that making the NAudio interop classes sealed would also resolve the issue. |
No, it can randomly work in newer dotnet runtimes:
Originally posted by @jkotas in dotnet/runtime#54132 (comment) |
another fact: not random. But in general you are right, yes! |
It looks like this is going to be fixed in dotnet/runtime#54235 (comment) once merged. This still exposes technically incorrect code in the |
Not sure yet if this is relevant, on OS build 2004 WASAPI output I get: Exception thrown at 0x00007FF8547A4B89 (KernelBase.dll) in CrewChiefV4.exe: WinRT originate error - 0x80004001 : 'Not implemented'. CrewChiefV4 is .NET 4 app though optionally using WASAPI ouput. No issue with WaveOut. I will investigate deeper when I've time. edit: it happens every time we do this:
here, sample provider is NAudio.Wave.SampleProviders.SampleChannel |
dotnet/runtime#54132 (comment) |
Which classes need to be marked as sealed? |
For this particular case, the WaveHeader type would need to be sealed. Generally, any |
I left this comment on: dotnet/runtime#54132 The sad thing here is that NAudio is widely used. It has 2.34 Million downloads on github and there is currently nothing that comes close to it's functionality that is maintained. And got this reply from jkoritzinsky: I'm hoping this will be looked at. |
I noticed the comment about sealing the classes used for interop. It sounds like something that would be worth trying. Haven't had the chance to dig deep into this myself yet. Would be happy to accept a PR if anyone wants to give this a try with WaveHeader (which seems to be the main culprit) |
I created a PR at #798 and a small repro project at https://github.com/jackpoz/NetCore507Crash , testing before and after the PR and the "sealed" change fixed the crash. |
@markheath do you have any plan on when next NAudio release will be so we can just update to latest nuget package ? Thanks |
I've just pushed a new version of the NuGet package. Please let me know if it resolves your issue |
YES! 2.0.1 works for me. Thanks very much. |
Awesome, many thanks to @jackpoz |
For me, it no longer crashes, but MP3 playback only runs for about a second before going silent. The Waveout says the mp3 is playing in its current state. Volume is maxed. The upside is, it no longer crashes. But Mp3 playback is not working for myself. Just to clarify, this isn't under https://github.com/jackpoz/NetCore507Crash/blob/master/Program.cs sample. This is using the AudioFileReader to load the MP3 and passing the AudioFileReader Object to the WaveOut.Init function and then calling Play. This path may not function correctly, I will review the above link and implement that method. |
2.0.1 fixed it for me though I have only tested with wav files. |
I can confirm that |
How do I fix this if I'm using NAudio.Extras NuGet package? It doesn't seem to have received an update. |
Make sure that you're also referencing NAudio 2.0.1 |
Workaround by using WASAPI output. Relevant issue on GitHub: naudio/NAudio#789
My application started crashing after applying the Windows 10 "21H1" cumulative update.
As soon as I click the play button to play any WAV file the application freezes for 10 seconds and then abruptly ends - no error messages on the screen. Only the Event Log reveals the problem message:
MyApp.exe
2.1.0.0
607f5cf5
msvcrt.dll
7.0.19041.546
564f9f39
c0000005
00000000000744ce
3134
01d75d5bc38d4623
D:\Development\MyApp\MyApp.exe
C:\WINDOWS\System32\msvcrt.dll <====================== OFFENDING LIBRARY
cb662446-488f-4cb5-80f2-a815faeb3852
Has any of you experienced the same behavior after updating Windows 10 with the 21H1 cumulative update?
Thank you.
The text was updated successfully, but these errors were encountered: