【问题标题】:OmniSharp not functioning properly in one project but is in anotherOmniSharp 在一个项目中无法正常运行,但在另一个项目中
【发布时间】:2019-02-22 16:05:18
【问题描述】:

我有两个相同的项目,我用它们来创建带有 .NET Core JSON API 的全栈 Ember web-ui。我注意到在一个项目中,OmniSharp 没有提供include using 声明,但在另一个项目中提供了。此外,对于 OmniSharp 不提供include using 语句的项目,OmniSharp 确实提供了remove unused usings 的选项。当我选择此选项时,它会删除除两个 using 之外的所有语句,这是不正确的,因为现在无法构建应用程序。

我尝试卸载 VSCode 并删除 C:\windows\users 路径中的 .vscode 文件夹,其中包含已安装的扩展,以及删除所有临时文件。但是,这并不能解决问题。

考虑到 OmniSharp 在一个项目中工作,而不是在另一个项目中,那么我现在唯一能想到的就是 OmniSharp 是在项目级别配置的,或者给定项目中存在损坏。有没有人遇到过这个问题?关于如何解决/解决此问题的任何想法?

注意:我不想删除 OmniSharp 无法使用的项目,因为重建它需要大约一周的时间。

更新:

经过进一步研究,我在 OmniSharp 日志中发现了以下错误

项目系统“OmniSharp.Script.ScriptProjectSystem”抛出 初始化期间的异常。 System.IO.DirectoryNotFoundException: 找不到路径的一部分 'd:...\tmp\broccoli_merge_trees-input_base_path-YLNtHXfX.tmp\1-private'。在 System.IO.__Error.WinIOError(Int32 错误代码,字符串可能全路径) 在 System.IO.FileSystemEnumerableIterator1.CommonInit() at System.IO.FileSystemEnumerableIterator1..ctor(字符串路径,字符串 originalUserPath, String searchPattern, SearchOption searchOption, SearchResultHandler1 resultHandler, Boolean checkHost) at System.IO.DirectoryInfo.EnumerateFileSystemInfos(String searchPattern, SearchOption searchOption) at Microsoft.Extensions.FileSystemGlobbing.Abstractions.DirectoryInfoWrapper.<EnumerateFileSystemInfos>d__4.MoveNext() at System.Collections.Generic.List1.InsertRange(Int32 索引, IEnumerable`1 集合)在 Microsoft.Extensions.FileSystemGlobbing.Internal.MatcherContext.Match(DirectoryInfoBase 目录,字符串 parentRelativePath) 在 Microsoft.Extensions.FileSystemGlobbing.Internal.MatcherContext.Match(DirectoryInfoBase 目录,字符串 parentRelativePath) 在 Microsoft.Extensions.FileSystemGlobbing.Internal.MatcherContext.Match(DirectoryInfoBase 目录,字符串 parentRelativePath) 在 Microsoft.Extensions.FileSystemGlobbing.Internal.MatcherContext.Match(DirectoryInfoBase 目录,字符串 parentRelativePath) 在 Microsoft.Extensions.FileSystemGlobbing.Internal.MatcherContext.Match(DirectoryInfoBase 目录,字符串 parentRelativePath) 在 Microsoft.Extensions.FileSystemGlobbing.Internal.MatcherContext.Match(DirectoryInfoBase 目录,字符串 parentRelativePath) 在 Microsoft.Extensions.FileSystemGlobbing.Internal.MatcherContext.Execute() 在 Microsoft.Extensions.FileSystemGlobbing.MatcherExtensions.GetResultsInFullPath(Matcher 匹配器,字符串目录路径)在 OmniSharp.Script.ScriptProjectSystem.Initalize(IConfiguration 配置)在 OmniSharp.WorkspaceInitializer.Initialize(IServiceProvider serviceProvider, CompositionHost compositionHost)

【问题讨论】:

    标签: ember.js visual-studio-code intellisense vscode-settings omnisharp


    【解决方案1】:

    我将问题追溯到 Ember 项目中的 tmp 文件夹,其中填充了损坏的文件和文件夹。我安装了附加的 Ember clean-tmp 并运行它。清理 tmp 文件夹后,我重新启动 VSCode 并检查 OmniSharp 日志,异常错误消失了。因此,OmniSharp Using 语句开始工作了。

    故事的寓意:留意那个 tmp 文件夹!

    https://www.npmjs.com/package/ember-clean-tmp

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2021-03-11
      • 1970-01-01
      • 1970-01-01
      • 2015-06-16
      • 1970-01-01
      • 2020-08-16
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多