SoundPlayer crash on Vista

The following code is causing an intermittent crash on a Vista machine.

using (SoundPlayer myPlayer = new SoundPlayer(Properties.Resources.BEEPPURE))

I highly suspect it is this code because the prgram crashes mid-beep or just before the beep is played every time. I have top-level traps for all ThreadExceptions, UnhandledExceptions in my app domain, and a try-catch around Application.Run, none of which trap this crash.

Any ideas?


The Event Viewer has the following information: Faulting application [xyz].exe, version, time stamp 0x48ce5a74, faulting module msvcrt.dll, version 7.0.6001.18000, time stamp 0x4791a727, exception code 0xc0000005, fault offset 0x00009b30, process id 0x%9, application start time 0x%10.

Interestingly, the HRESULT 0xc0000005 has the message: "Reading or writing to an inaccessible memory location." (STATUS_ACCESS_VIOLATION)


Actually, the above code (that is, new SoundPlayer(BEEPPURE)).Play(); was crashing for me.

This article explains why, and provides an alternative to SoundPlayer that works flawlessly:

You can use WinDBG and trap all first-chance exceptions. I'm sure you'll see something interesting. If so, you can use SOS to clean up the stack and post it here to help us along.

Or you can use Visual Studio by enabling the trap of all exceptions. Go to "Debug" and then "Exceptions" and make sure you trap everything. Do this along with switching the debugger to mixed-mode (managed and unmanaged).

Once you have the stack trace, we can determine the answer.

A process doesn't exit on Windows without an exception. It's in there. Also, you might want to check the machine's Event Log to see if anything has shown up.

The event viewer shows HRESULT 0xc0000005 "Reading or writing to an inaccessible memory location." (STATUS_ACCESS_VIOLATION)

See my edit above for more details; reproing this takes a while so I can't get a fresh crash dump for WinDBG for a little while.

Need Your Help

Smooth bitmap rotation android SurfaceView

java android canvas bitmap surfaceview

I'd like to make my asteroids rotate constatly in my android game but I have completely no idea where to start.

ios custom back button (NOT in the navi bar)

ios navigation back

i'm building my own navigation between views and i have the navi bar hidden by purpose. still, i need a button inside the view (read outside the navi bar) that would behave like "back" button. is t...

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.