While trying to track down a fatal null pointer language exceptions (c000027b) in a UWP C#/XAML store project with WinDbg, I cannot get to the CLR Exception object because of a missing SOS debugging extention for Microsoft.NET.CoreRuntime. I was unable to locate a matching sos.dll. What am I missing?
Note: The app crash is reproducible, but only happens when not debugging. So running the project under the Visual Studio debugger is unfortunately not a solutions in this case.
[...]
0:009> dt -a6 000001c37c6587e0 combase!PSTOWED_EXCEPTION_INFORMATION_V2
[0] @ 000001c3`7c6587e0
---------------------------------------------
0x000001c3`7a8c8348
+0x000 Header : _STOWED_EXCEPTION_INFORMATION_HEADER
+0x008 ResultCode : 80004003
+0x00c ExceptionForm : 0y01
+0x00c ThreadId : 0y000000000000000000100001111100 (0x87c)
+0x010 ExceptionAddress : 0x00007ffb`e61f24dd Void
+0x018 StackTraceWordSize : 8
+0x01c StackTraceWords : 5
+0x020 StackTrace : 0x000001c3`7c658a80 Void
+0x010 ErrorText : 0x00007ffb`e61f24dd "赈???"
+0x028 NestedExceptionType : 0x314f454c
+0x030 NestedException : 0x000001c3`7b2f8348 Void
[...]
0:009> dpS 0x000001c3`7c658a80 L5
00007ffb`e61d76a7 combase!RoOriginateLanguageException+0x57 [d:\th\com\combase\winrt\error\error.cpp @ 1083]
00007ffb`af285df7 mscorlib_ni+0x6a5df7
00007ffb`af232b76 mscorlib_ni+0x652b76
00007ffb`af232d30 mscorlib_ni+0x652d30
0:009> .formats 0x314f454c
Evaluate expression:
Hex: 00000000`314f454c
Decimal: 827278668
Octal: 0000000000006123642514
Binary: 00000000 00000000 00000000 00000000 00110001 01001111 01000101 01001100
Chars: ....1OEL
Time: Wed Mar 20 01:37:48 1996
Float: low 3.01619e-009 high 0
Double: 4.0873e-315
0:009> !sos.dumpccw 0x000001c3`7b2f8348
The call to LoadLibrary(sos) failed, Win32 error 0n2
"The system cannot find the file specified."
Please check your debugger configuration and/or network access.
0:009> !sos.dumpccw
The call to LoadLibrary(sos) failed, Win32 error 0n2
"The system cannot find the file specified."
Please check your debugger configuration and/or network access.
0:009> .cordll -ve -u -l
CLRDLL: Unable to get version info for 'C:\Program Files\WindowsApps\Microsoft.NET.CoreRuntime.1.0_1.0.23430.0_x64__8wekyb3d8bbwe\SOS.dll', Win32 error 0n87
Cannot Automatically load SOS
CLRDLL: Loaded DLL C:\Program Files\WindowsApps\Microsoft.NET.CoreRuntime.1.0_1.0.23430.0_x64__8wekyb3d8bbwe\mscordaccore.dll
CLR DLL status: Loaded DLL C:\Program Files\WindowsApps\Microsoft.NET.CoreRuntime.1.0_1.0.23430.0_x64__8wekyb3d8bbwe\mscordaccore.dll
0:009> .chain
[...]
Extension DLL chain:
dbghelp: image 10.0.10586.15, API 10.0.6, built Fri Nov 20 06:55:01 2015
[path: C:\Program Files (x86)\Windows Kits\10\Debuggers\x64\dbghelp.dll]
ext: image 10.0.10586.15, API 1.0.0, built Fri Nov 20 06:55:08 2015
[path: C:\Program Files (x86)\Windows Kits\10\Debuggers\x64\winext\ext.dll]
exts: image 10.0.10586.15, API 1.0.0, built Fri Nov 20 06:54:07 2015
[path: C:\Program Files (x86)\Windows Kits\10\Debuggers\x64\WINXP\exts.dll]
uext: image 10.0.10586.15, API 1.0.0, built Fri Nov 20 06:54:02 2015
[path: C:\Program Files (x86)\Windows Kits\10\Debuggers\x64\winext\uext.dll]
ntsdexts: image 10.0.10586.15, API 1.0.0, built Fri Nov 20 07:28:14 2015
[path: C:\Program Files (x86)\Windows Kits\10\Debuggers\x64\WINXP\ntsdexts.dll]
Thank you magicandre1981 and Andrew Richards for your help! With the CLRStack provided by Andrew Richards I was able to narrow down the problematic part to a single method. After an initial workaround based on catching a generic exception, further investigation showed that a Uri passed to the BitmapImage constructor BitmapImage(Uri) cannot reliably be retrieved back via the UriSource property.
A person more knowledgeable about the internal caching mechanism of BitmapImage could may be shed some light on this behaviour. If the BitmapImage internal caching comes into operation, accessing BitmapImage.UriSource.OriginalString may apparently raise a null pointer exception, even if BitmapImage(Uri) was used with a valid Uri to construct the BitmapImage object.
My amended serialisation method does no longer access BitmapImage.UriSource.OriginalString, but instead maintains that Uri with an additional private property of the CastImage class. Problem solved.
many sosdll reside in the .net framework directory
search and load it
ok, with the help of the Windbg Extension PDE.dll from Andrew Richards, after running
!PDE.dpx -dse
to shows all Stowed Exceptions (those 0xC000027B exceptions) I see 5 Stowed Exceptions:Showing those exceptions only show
E_UNEXPECTED - Unexpected failure
as error:I'll ask him after the christmas holiday if his Team saw such crash dumps before.