Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can a mistake in simple WPF programming trigger a blue screen?

Tags:

wpf

crash

I was doing some .NET programming in WPF which involved reading .png and .txt files, placing images on a canvas, moving them around and then removing them and all of a sudden I get a bluescreen. I didn't think my little tinkering could cause a driver issue until I restarted and did the exact same thing with my program and I got another driver error. It seems that an intel graphics driver had failed and my resolution went way down. No bluescreen the second time, though. I was playing pretty fast and loose adding and removing elements from the children of the canvas. My question is, how could such simple programming cause such a serious error and how do I fix it?

like image 210
Stefan Avatar asked Jan 30 '10 20:01

Stefan


People also ask

Can a program cause a bluescreen?

Software: Incompatible software like apps or programs may cause conflicts the result in the BSOD. Hardware: Faulty memory (RAM), hard disk drive (HDD), solid-state drive (SSD), motherboard, processor, or a power supply unit (PSU) can all be responsible for the blue screen crashes.

What causes blue screen?

The blue screen happens when Windows encounters a critical error that stops the operating system from running. These critical errors can be the result of faulty hardware, faulty or low level hardware drivers, or faulty or low level apps that run within the Windows kernel.

How do I fix a blue screen error?

These errors can be caused by both hardware and software issues. If you added new hardware to your PC before the Blue Screen error, shut down your PC, remove the hardware, and try restarting. If you're having trouble restarting, you can start your PC in safe mode.

What causes Windows stop code?

However, various studies indicate that stop errors usually aren't caused by Microsoft Windows components. Instead, these errors are related to malfunctioning hardware drivers or drivers that are installed by third-party software. These drivers include video cards, wireless network cards, security programs, and so on.


2 Answers

As a first order approximation all bluescreens are caused by buggy drivers, and most driver bugs are race conditions. (see footnote 1) That is - it's not necessarily the specific operations, but the exact timing of them interacting with other things that are out of your control.

So if you can nail it down to a sequence of operations, then you can just avoid that sequence. but usually the only fix is to get better drivers - and not necessarily the latest drivers, sometimes its best to go back to an older set of drivers.

footnotes:

1 Of course, not all bluescreens are drivers, but they are all from kernel mode, it should never be possible for user mode code to make calls that crash in kernel mode, so when you hit a bluescreen, you have found a bug in some component that runs in kernel mode. A bluescreen is by definition not your bug (2) (or not only your bug).

2 unless you write drivers.

like image 61
John Knoeller Avatar answered Oct 10 '22 05:10

John Knoeller


It sounds like you have a buggy graphics driver. WPF by itself cannot trigger a blue screen -- but WPF does call DirectX, which in turn calls the graphics driver -- and if the graphics driver contains bugs, those can cause a blue screen.

You cannot fix this at the WPF level, because WPF is innocent in this particular problem. You need to update your graphics driver. A possible workaround if there are no updates or the latest version doesn't fix it is to disable hardware acceleration for WPF, as this may avoid hitting the buggy bit of the driver.

like image 22
itowlson Avatar answered Oct 10 '22 04:10

itowlson