Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Silverlight 5 - Debugging npctrl.dll crash

I'm getting a really frustrating silverlight plugin crash which affects both IE and firefox.

The error from the event log is:

Faulting application name: iexplore.exe, version: 9.0.8112.16421, time stamp: 0x4d76255d
Faulting module name: npctrl.dll, version: 5.0.61118.0, time stamp: 0x4ec5fc64
Exception code: 0xc0000094
Fault offset: 0x0001d720
Faulting process id: 0x434
Faulting application start time: 0x01ccf0b878b55ca7
Faulting application path: C:\Program Files (x86)\Internet Explorer\iexplore.exe
Faulting module path: c:\Program Files (x86)\Microsoft Silverlight\5.0.61118.0\npctrl.dll
Report Id: bd79af3d-5cab-11e1-8948-000c29de3e25

I've gotten as far as attaching WinDbg during the exception to get a little bit more information:

(17e4.13f8): Break instruction exception - code 80000003 (first chance)
*** ERROR: Symbol file could not be found.  Defaulted to export symbols for C:\Windows\SYSTEM32\ntdll.dll - 
ntdll!DbgBreakPoint:
00000000`77810530 cc              int     3
0:029> g
(17e4.1790): Integer divide-by-zero - code c0000094 (first chance)
First chance exceptions are reported before any exception handling.
This exception may be expected and handled.
*** ERROR: Symbol file could not be found.  Defaulted to export symbols for NPCTRL.dll     - 
NPCTRL+0x1d720:
7b59d720 f7f1            div     eax,ecx

Ok, so ntdll.dll is dividing by zero. I really have no idea how I can debug further. I've tried viewing some of the articles which explain how - but I think I'm limited based on the fact that there are no symbols available for ntdll.dll?

How can I narrow down what part of my code is leading to this error?

like image 825
Shaun Rowan Avatar asked Feb 21 '12 18:02

Shaun Rowan


3 Answers

After hours of debugging, I was able to replicate the problem in a small project. Just create a 'silverlight enabled web service', and reference it. Then switch over to using the client http stack:

WebRequest.RegisterPrefix("http://", WebRequestCreator.ClientHttp);
WebRequest.RegisterPrefix("https://", WebRequestCreator.ClientHttp);

Calling the service on my machine (and a coworkers as well) has about a 10-15% chance of crashing with the ntdll.dll error.

I found two ways to mitigate this problem.

1) Stop using the client networking stack. The problem never seems to happen with the browser stack

2) Access the silverlight application outside of VMWare. The problem seems to only happen from within a virtual machine. Thanks to RobSiklos for figuring this out.

Hope this helps someone.

like image 194
Shaun Rowan Avatar answered Nov 14 '22 08:11

Shaun Rowan


Set Vmware virtual machine to use only 1 processor and problem will not reproduce. From top of the screen Virtual Machine > Virtual Machine Settings > Processors - > Number of processor cores = 1.

like image 39
Levi 9 Serbia Avatar answered Nov 14 '22 06:11

Levi 9 Serbia


Are you running inside a vmware virtual machine? See here: http://communities.vmware.com/thread/394306?tstart=0

UPDATE (2013-03-15): According to the latest post in the forum thread linked above, it seems Microsoft has finally fixed this issue.

like image 1
RobSiklos Avatar answered Nov 14 '22 07:11

RobSiklos