【问题标题】:My package did not load. How can I interpret the activity log我的包裹没有加载。我如何解释活动日志
【发布时间】:2019-12-29 11:40:32
【问题描述】:

我的 VSPackage 没有为一位用户正确加载到 Visual Studio 2019。

用户已向我发送了部分活动日志:

<entry>
  <record>2206</record>
  <time>2019/12/13 10:44:12.579</time>
  <type>Information</type>
  <source>VisualStudio</source>
  <description>Begin package load [MultiLanguagePackage]</description>
  <guid>{8FA8895A-868F-4319-82FD-A4805D8953CE}</guid>
</entry>

<entry>
  <record>2207</record>
  <time>2019/12/13 10:44:12.616</time>
  <type>Error</type>
  <source>VisualStudio</source>

  <description>SetSite failed for package [MultiLanguagePackage]
  Source: 'Microsoft.VisualStudio.Shell.15.0'; 
  Description: Der Objektverweis wurde nicht auf eine Objektinstanz festgelegt.
  System.NullReferenceException: 
  Der Objektverweis wurde nicht auf eine Objektinstanz festgelegt.   
  bei Microsoft.VisualStudio.Shell.DialogPage.SetPropertyValue(PropertyDescriptor descriptor, Object automationObject, Object value)   
  bei Microsoft.VisualStudio.Shell.DialogPage.LoadSettingFromStorage(PropertyDescriptor prop)   
  bei Microsoft.VisualStudio.Shell.DialogPage.LoadSettingsFromStorage()   
  bei Microsoft.VisualStudio.Shell.DialogPage.set_Site(ISite value)   
  bei System.ComponentModel.Container.Add(IComponent component, String name)   
  bei System.ComponentModel.Container.Add(IComponent component)   
  bei Microsoft.VisualStudio.Shell.Package.GetDialogPage(Type dialogPageType)   
  bei MultiLangServices.SettingsService.InitOptionsPages(Package p) in C:\VSPackage_Version_7_1\Project\MultiLangServices\Services\SettingsService.cs:Zeile 24.   
  bei MultiLanguage2019.MultiLanguagePackage.&lt;InitializeAsync&gt;d__2.MoveNext()
  --- Ende der Stapel&#x00FC;berwachung vom vorhergehenden Ort, an dem die Ausnahme ausgel&#x00F6;st wurde ---   
  bei System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)   
  bei System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)   
  bei Microsoft.VisualStudio.Shell.AsyncPackage.&lt;&gt;c__DisplayClass20_0.&lt;&lt;Microsoft-VisualStudio-Shell-Interop-IAsyncLoadablePackageInitialize-Initialize&gt;b__1&gt;d.MoveNext()
  --- Ende der Stapel&#x00FC;berwachung vom vorhergehenden Ort, an dem die Ausnahme ausgel&#x00F6;st wurde ---   
  bei System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)   
  bei System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)   
  bei Microsoft.VisualStudio.Shell.UIThreadReentrancyScope.WaitOnTaskCompleteInternal(Task task, CancellationToken cancel, Int32 ms)   
  bei Microsoft.VisualStudio.Services.VsTask.&lt;&gt;c__DisplayClass100_1.&lt;InternalGetResult&gt;b__1()   
  bei Microsoft.VisualStudio.Services.VsTask.IgnoreObjectDisposedException(Action action)   
  bei Microsoft.VisualStudio.Services.VsTask.&lt;&gt;c__DisplayClass100_0.&lt;InternalGetResult&gt;b__0()   
  bei Microsoft.VisualStudio.Services.VsTask.&lt;&gt;c__DisplayClass108_0.&lt;InvokeWithWaitDialog&gt;b__0()   
  bei Microsoft.VisualStudio.Services.VsTask.InvokeWithWaitDialog[T](Func`1 function)   
  bei Microsoft.VisualStudio.Services.VsTask.InvokeWithWaitDialog(Action action)   
  bei Microsoft.VisualStudio.Services.VsTask.InternalGetResult(Boolean ignoreUIThreadCheck)   
  bei Microsoft.VisualStudio.Services.VsTask.GetResult()</description>

  <guid>{8FA8895A-868F-4319-82FD-A4805D8953CE}</guid>
  <hr>80004003 - E_POINTER</hr>
  <errorinfo></errorinfo>
</entry>

<entry>
  <record>2208</record>
  <time>2019/12/13 10:44:12.618</time>
  <type>Error</type>
  <source>VisualStudio</source>
  <description>End package load [MultiLanguagePackage]</description>
  <guid>{8FA8895A-868F-4319-82FD-A4805D8953CE}</guid>
  <hr>80004003 - E_POINTER</hr>
  <errorinfo></errorinfo>
</entry>

我该如何解释这些信息?
它是否包含任何有用的指向错误原因的指针?

我的包包含对 NuGet 包 Micorosft.VisualStudio.SDK 版本 16.0.202 的引用。

它不包含对 Microsoft.VisualStudio.Shell.15.0 的特定引用

【问题讨论】:

    标签: visual-studio-2019 visual-studio-extensions vsix vspackage


    【解决方案1】:

    我假设MultiLanguageService 类属于你的包实现——它正在做一些导致NullReferenceException 的事情。此类错误应易于定位;堆栈跟踪告诉您MultiLangServices.SettingsService.InitOptionsPages(Package p) in ...SettingsService.cs:Zeile 24 出现问题。只需在第 24 行下一个断点,然后验证一切是否按预期运行。

    我认为它与您引用的某个 SDK 包或程序集无关。如果代码适用于大多数用户,那么代码中肯定有某些内容在某些情况下可能会失败;例如,如果缺少配置值,则会导致报告的NullReferenceException 异常。我会检查实现并至少添加一个适当的异常处理程序,以便下次向活动日志报告更精确的错误。

    【讨论】:

    • 谢谢。我相当盲目地没有发现这一点。我当然可以添加一个异常处理程序。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-05-18
    • 2014-10-20
    • 2011-11-25
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多