Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

my .net program is causing a BSOD

Tags:

c#

.net

winforms

I am getting a blue screen when my windows winform application is run. It seems that only one user is getting this. I am not sure where at this time to look for the problem. I am however using some code that I found on CodeProject to trap mouse events and keyboard events http://www.codeproject.com/KB/cs/globalhook.aspx could this possibly be it?

I am looking for suggestions on how I might trap this error. It's only happening on one users computer out of 40, so I am a little perplexed - especially since this user is the primary stakeholder.

Update: We have one more incident - the common denominator is the docking port. The user was using the same docking port.

like image 635
fishhead Avatar asked Jul 12 '10 19:07

fishhead


People also ask

Can a program cause BSOD?

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.

How can I tell what program is causing BSOD?

Click the Restart button on the Startup Settings screen, and when your system reboots to the Startup Options page, hit the number beside Safe Mode or Safe Mode with Networking (if you want to use the Internet). Once your PC boots into Safe Mode, open the Event Viewer to check for the cause of the BSOD.

What could cause a blue screen BSOD?

BSoDs can be caused by poorly written device drivers or malfunctioning hardware, such as faulty memory, power supply issues, overheating of components, or hardware running beyond its specification limits. In the Windows 9x era, incompatible DLLs or bugs in the operating system kernel could also cause BSoDs.


2 Answers

It is impossible for your code to be causing a BSOD. If you're not running in kernel mode, then a BSOD isn't your fault (if you'll excuse the pun).

OTOH, I have seen managed code trigger a bug in a piece of kernel-mode code. This bug then caused a BSOD. In my case, the kernel-mode code was part of a piece of VPN software that wanted to understand what code you were running so it could decide whether or not to allow you access to the VPN. The code was using kernel-mode hooks to do this, and they had a bug that was triggered by the loading of large numbers of assemblies.

Apparently, they had never tested their code while Visual Studio was running. It loads add-ins and such at runtime, which triggered their bug. A piece of C# code that simply loaded large numbers of assemblies into an AppDomain (then unloaded the AppDomain and started over) also triggered their bug, so it wasn't a Visual Studio problem.

The moral of the story is that someone needs to look at the crash dump and figure out which piece of kernel-mode software caused the crash, then maybe you can figure out what was going on in the system to trigger the kernel-mode software to crash.

like image 89
John Saunders Avatar answered Sep 18 '22 18:09

John Saunders


The problem isn't going to be your app directly, but some issue with his system, so as roufamatic says check is event logs. However there are two common 'hardware' errors that tend to cause this sort of issue and you could profitably check these to see if they[ll give you a lead.

  1. Bad memory. If a memory error has developed it's not unusual to see a particular program that can 'cause' the bad memory to be accessed and so lead to a BSOD. If for example he's generally running fairly lightweight applications then it's possible for the memory error to be in a location that is not normally used. When you load up your app - particularly if it's got a large memory footprint and calling in lots of dependencies, you may well trigger the crash indirectly. So run a full check on the machine RAM.

  2. Printer drivers. This used to be more of a problem than it is now, but if you're running on XP then it still does pop up occasionally. Printer drivers are notoriously badly written and quite often buggy. It's not unheard of for an app to call a printer driver which in turns crashes the system. To check this just remove the printer drivers then reload them again afterwards.

EDIT: As pointed out in comments, any bad hardware or bad drivers can cause this sort of behaviour. I simply highlight memory and printer drivers because experience shows that these two are by far and away the most common causes so worth considering first.

like image 26
Cruachan Avatar answered Sep 18 '22 18:09

Cruachan