Microsoft.NET.CoreRuntime的SOS调试扩展 [英] SOS Debugging Extensions for Microsoft.NET.CoreRuntime

查看:42
本文介绍了Microsoft.NET.CoreRuntime的SOS调试扩展的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在尝试使用WinDbg跟踪UWP C#/XAML存储项目中的致命空指针语言异常(c000027b)时,由于缺少Microsoft.NET.CoreRuntime的SOS调试范围,我无法到达CLR Exception对象.我找不到匹配的sos.dll.我想念什么?

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?

注意:应用程序崩溃是可重现的,但仅在未调试时才会发生.因此,不幸的是,在这种情况下,在Visual Studio调试器下运行项目不是解决方案.

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]

推荐答案

感谢magicandre1981和Andrew Richards的帮助!使用安德鲁·理查兹(Andrew Richards)提供的CLRStack,我可以将有问题的部分缩小为一个方法.在基于捕获通用异常的初始变通方法之后,进一步的研究表明,传递给BitmapImage构造函数BitmapImage(Uri)的Uri无法通过UriSource属性可靠地取回.

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.

一个对BitmapImage的内部缓存机制更了解的人可能会对此行为有所了解.如果BitmapImage内部缓存开始运行,即使BitmapImage(Uri)与有效的Uri一起用于构造BitmapImage对象,访问BitmapImage.UriSource.OriginalString显然也​​会引发空指针异常.

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.

我修改后的序列化方法不再访问BitmapImage.UriSource.OriginalString,而是使用CastImage类的其他私有属性维护该Uri.问题解决了.

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.

/// <summary>
/// Translates the current instance into a JsonObject.
/// </summary>
/// <returns>The current instance as a JsonObject.</returns>
public JsonObject Serialise()
{
    JsonObject jsonObject = new JsonObject();

    jsonObject.Add("Number", this.number.HasValue ? JsonValue.CreateNumberValue(this.number.Value) : JsonValue.CreateNullValue());
    jsonObject.Add("Category", (!string.IsNullOrEmpty(this.category)) ? JsonValue.CreateStringValue(this.category) : JsonValue.CreateNullValue());
    jsonObject.Add("Comment", (!string.IsNullOrEmpty(this.comment)) ? JsonValue.CreateStringValue(this.comment) : JsonValue.CreateNullValue());

    if (this.performer != null)
    {
        jsonObject.Add("Performer", this.performer.Serialise());
    }
    else
    {
        jsonObject.Add("Performer", JsonValue.CreateNullValue());
    }

    if (this.castImages != null)
    {
        jsonObject.Add("CastImages", this.castImages.Serialise());
    }
    else
    {
        jsonObject.Add("CastImages", JsonValue.CreateNullValue());
    }

    jsonObject.Add("CastClip", this.castClip != null ? JsonValue.CreateStringValue(this.castClip.ToString()) : JsonValue.CreateNullValue());


    return jsonObject;
}

这篇关于Microsoft.NET.CoreRuntime的SOS调试扩展的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆