gpt4 book ai didi

visual-studio - 无法调试 VSIX 项目 : "Expected export ITextEditorFactoryService but found 0"

转载 作者:行者123 更新时间:2023-12-02 11:21:47 26 4
gpt4 key购买 nike

我在几个 VSIX 项目中工作,突然,由于某种原因,我无法正确调试它们。当我运行项目时,实验性 VS 实例打开没有问题,但是一旦我加载解决方案,问题就会开始。

首先,如果我加载的解决方案受源代码管理,我会收到以下错误消息:

The 'GitCollaborationPackage' package did not load correctly. The problem may have been caused by a configuration change or by the installation of another extension.



还有一个指向日志文件的链接,其中显示了一条显然不是很有用的错误消息:

LegacySitePackage failed for package [GitCollaborationPackage] Source: "" Description: Catastrophic failure (Exception from HRESULT: 0x8000FFFF (E_UNEXPECTED))



之后解决方案加载,但一旦我尝试打开文件,我就会收到此错误:

Expected 1 export(s) with contract name "Microsoft.VisualStudio.Text.Editor.ITextEditorFactoryService" but found 0 after applying applicable constraints.



我没有对我的项目进行任何重大更改,但以防万一我创建了一个全新的 VSIX 项目并立即运行它,并获得相同的结果。

按照 MSDN 中的建议,我尝试使用 delete Visual Studio's component cache and reset Visual Studio's settings ,无济于事。

那么这里发生了什么?我能做些什么来解决这个问题?

更新:几个新发现:
  • 使用 devenv /safemode 运行 Visual Studio 时问题仍然存在。
  • 这发生在 VS 专业版中。我也安装了社区版,在那个版本中我可以毫无问题地进行调试。该死的,那个人也不知何故损坏了! :-(

  • 更新 2:修复 Visual Studio 没有帮助。

    最佳答案

    这不是答案,但已经两年了,问题仍然很严重,所以我认为为了将来的调查,添加一些细节可能是值得的。

    在我的机器上,实验实例今天早些时候可以工作,但现在它失败了。最常读取的初始错误

    The 'RoslynPackage' package did not load correctly. The problem may have been caused by a configuration change or by the installation of another extension. You can get more information by examining the file 'C:\Users...\AppData\Roaming\Microsoft\VisualStudio\15.0_b0b65856Exp\ActivityLog.xml'.



    但是失败的包偶尔会有所不同,无论如何,很快就会出现第二个错误(涉及 ITextEditorFactoryService)。

    删除 AppData 中的两个 VisualStudio\15.0_b0b65856Exp 文件夹也没有用,所以 我尝试卸载并重新安装 VS2017。那也没有帮助。

    我尝试调试“已知良好”的 Visual Studio 扩展。同样的错误。我尝试加载一个简单的文本文件。同样的错误。

    所以我转向了 Visual Studio 2019 社区(在故障开始之前已经安装了)。 VS 2019 也失败 ,但它的行为略有不同:第一个错误消息没有出现,第二个错误略有修改(注意“2”):

    Expected 1 export(s) with contract name "Microsoft.VisualStudio.Text.Editor.ITextEditorFactoryService2" but found 0 after applying applicable constraints.



    我注意到当我重新安装 VS2017 时,它仍然会使用上一次安装留下的设置。当实验实例开始时,它会问我想要哪个主题。我告诉它使用蓝色主题,它使用了几秒钟,但随后它加载了与主实例使用的主题相同的黑暗主题。这导致假设失败是由实验实例选择加载的“僵尸”配置设置引起的,我们只是不知道如何摆脱这种设置。但是,我尝试立即将 .cs 文件拖到实验实例上(在深色主题加载之前),但仍然出现错误。另外,我尝试了工具 -> 导入和导出设置 -> 重置所有设置(在实验实例内),但没有帮助。

    就我而言,命令行参数 /rootsuffix Exp /safemode防止错误发生,但这没有用,因为它还会阻止我尝试调试的 VSIX 加载。

    以下是 ActivityLog.xml 中提到“错误”一词的条目:
      <entry>
    <record>523</record>
    <time>2020/03/11 00:20:56.182</time>
    <type>Warning</type>
    <source>VisualStudio</source>
    <description>Unexpected system error mode before loading package [ProviderPackage]</description>
    <guid>{5F2E5E42-4192-4D79-A0D8-1D881E808829}</guid>
    </entry>

    <entry>
    <record>527</record>
    <time>2020/03/11 00:20:56.494</time>
    <type>Warning</type>
    <source>VisualStudio</source>
    <description>Unexpected system error mode before loading package [Microsoft.VisualStudio.Shell.Connected.Packages.PathTrustVerifier.PathTrustVerifierPackage]</description>
    <guid>{2F6B5046-3BB0-4825-B344-3F4238921119}</guid>
    </entry>

    <entry>
    <record>531</record>
    <time>2020/03/11 00:20:56.511</time>
    <type>Warning</type>
    <source>VisualStudio</source>
    <description>Unexpected system error mode before loading package [CSharpPackage]</description>
    <guid>{13C3BBB4-F18F-4111-9F54-A0FB010D9194}</guid>
    </entry>

    <entry>
    <record>534</record>
    <time>2020/03/11 00:20:56.590</time>
    <type>Warning</type>
    <source>VisualStudio</source>
    <description>Unexpected system error mode before loading package [RoslynPackage]</description>
    <guid>{6CF2E545-6109-4730-8883-CF43D7AEC3E1}</guid>
    </entry>

    <entry>
    <record>537</record>
    <time>2020/03/11 00:20:56.811</time>
    <type>Warning</type>
    <source>VisualStudio</source>
    <description>Unexpected system error mode before loading package [ErrorListPackage]</description>
    <guid>{4A9B7E50-AA16-11D0-A8C5-00A0C921A4D2}</guid>
    </entry>

    <entry>
    <record>541</record>
    <time>2020/03/11 00:20:57.014</time>
    <type>Warning</type>
    <source>VisualStudio</source>
    <description>Unexpected system error mode before loading package [Text Management Package]</description>
    <guid>{F5E7E720-1401-11D1-883B-0000F87579D2}</guid>
    </entry>

    <entry>
    <record>545</record>
    <time>2020/03/11 00:20:57.026</time>
    <type>Warning</type>
    <source>VisualStudio</source>
    <description>Unexpected system error mode before loading package [Microsoft.VisualStudio.Editor.Implementation.EditorPackage]</description>
    <guid>{E269B994-EF71-4CE0-8BCD-581C217372E8}</guid>
    </entry>

    <entry>
    <record>548</record>
    <time>2020/03/11 00:20:57.457</time>
    <type>Error</type>
    <source>VisualStudio</source>
    <description>LegacySitePackage failed for package [RoslynPackage]Source: &apos;Microsoft.VisualStudio.Composition&apos; Description: Expected 1 export(s) with contract name &quot;Microsoft.VisualStudio.LanguageServices.Implementation.TableDataSource.VisualStudioDiagnosticListTableCommandHandler&quot; but found 0 after applying applicable constraints.&#x000D;&#x000A;Microsoft.VisualStudio.Composition.CompositionFailedException: Expected 1 export(s) with contract name &quot;Microsoft.VisualStudio.LanguageServices.Implementation.TableDataSource.VisualStudioDiagnosticListTableCommandHandler&quot; but found 0 after applying applicable constraints.&#x000D;&#x000A; at Microsoft.VisualStudio.Composition.ExportProvider.GetExports(ImportDefinition importDefinition)&#x000D;&#x000A; at Microsoft.VisualStudio.Composition.ExportProvider.GetExports[T,TMetadataView](String contractName, ImportCardinality cardinality)&#x000D;&#x000A; at Microsoft.VisualStudio.Composition.ExportProvider.GetExport[T,TMetadataView](String contractName)&#x000D;&#x000A; at Microsoft.VisualStudio.Composition.ExportProvider.GetExport[T](String contractName)&#x000D;&#x000A; at Microsoft.VisualStudio.Composition.ExportProvider.GetExport[T]()&#x000D;&#x000A; at Microsoft.VisualStudio.Composition.ExportProvider.GetExportedValue[T]()&#x000D;&#x000A; at Microsoft.VisualStudio.ComponentModelHost.ComponentModel.GetService[T]()&#x000D;&#x000A; at Microsoft.VisualStudio.LanguageServices.Setup.RoslynPackage.LoadComponentsInUIContext()&#x000D;&#x000A; at Microsoft.VisualStudio.LanguageServices.Implementation.LanguageService.AbstractPackage.LoadComponentsInUIContextOnceSolutionFullyLoaded()&#x000D;&#x000A; at Microsoft.VisualStudio.LanguageServices.Setup.RoslynPackage.Initialize()&#x000D;&#x000A; at Microsoft.VisualStudio.Shell.Package.Microsoft.VisualStudio.Shell.Interop.IVsPackage.SetSite(IServiceProvider sp)</description>
    <guid>{6CF2E545-6109-4730-8883-CF43D7AEC3E1}</guid>
    <hr>80131500</hr>
    <errorinfo></errorinfo>
    </entry>

    <entry>
    <record>549</record>
    <time>2020/03/11 00:20:57.469</time>
    <type>Error</type>
    <source>VisualStudio</source>
    <description>SetSite failed for package [RoslynPackage](null)</description>
    <guid>{6CF2E545-6109-4730-8883-CF43D7AEC3E1}</guid>
    <hr>80131500</hr>
    <errorinfo></errorinfo>
    </entry>

    <entry>
    <record>551</record>
    <time>2020/03/11 00:20:57.479</time>
    <type>Warning</type>
    <source>VisualStudio</source>
    <description>Unexpected system error mode before loading package [Visual Studio Component Enumerator Package]</description>
    <guid>{588205E0-66E0-11D3-8600-00C04F6123B3}</guid>
    </entry>

    <entry>
    <record>555</record>
    <time>2020/03/11 00:20:57.490</time>
    <type>Error</type>
    <source>VisualStudio</source>
    <description>End package load [RoslynPackage]</description>
    <guid>{6CF2E545-6109-4730-8883-CF43D7AEC3E1}</guid>
    <hr>80131500</hr>
    <errorinfo></errorinfo>
    </entry>

    注意:上面的错误是ActivityLog.xml中的最后一个条目;第二个错误没有出现在这里。

    关于visual-studio - 无法调试 VSIX 项目 : "Expected export ITextEditorFactoryService but found 0",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46234281/

    26 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com