OmniSharp not functioning properly in one project but is in another

删除回忆录丶 提交于 2019-12-11 18:45:44

问题


I have two identical projects that I am using to create a full stack Ember web-ui with .NET Core JSON API. I notice that in one project, OmniSharp is not providing the include using statement, but it does in the other project. Additionally, for the project where OmniSharp does not provide the include using statement, OmniSharp does provide an option to remove unused usings. When I select this option, it removes all but two using statements, which is incorrect because now the application will not build.

I tried uninstalling VSCode and deleting the .vscode folder in the C:\windows\users path, which contains the installed extensions, as well as deleting all temp files. However, this does not solve the problem.

Considering that OmniSharp works in one project, but not the other, then the only thing that I can think of at this point is that either OmniSharp is configured at the project level or there is a corruption in the given project. Has anyone ever experienced this problem? Any ideas on how I can address/fix this?

Note: I would hate to delete the project that OmniSharp does not work in because it would take about a week to rebuild it.

Update:

After additional research, I found the following error in the OmniSharp Log

The project system 'OmniSharp.Script.ScriptProjectSystem' threw exception during initialization. System.IO.DirectoryNotFoundException: Could not find a part of the path 'd:...\tmp\broccoli_merge_trees-input_base_path-YLNtHXfX.tmp\1-private'. at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath) at System.IO.FileSystemEnumerableIterator1.CommonInit() at System.IO.FileSystemEnumerableIterator1..ctor(String path, String 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 index, IEnumerable`1 collection) at Microsoft.Extensions.FileSystemGlobbing.Internal.MatcherContext.Match(DirectoryInfoBase directory, String parentRelativePath) at Microsoft.Extensions.FileSystemGlobbing.Internal.MatcherContext.Match(DirectoryInfoBase directory, String parentRelativePath) at Microsoft.Extensions.FileSystemGlobbing.Internal.MatcherContext.Match(DirectoryInfoBase directory, String parentRelativePath) at Microsoft.Extensions.FileSystemGlobbing.Internal.MatcherContext.Match(DirectoryInfoBase directory, String parentRelativePath) at Microsoft.Extensions.FileSystemGlobbing.Internal.MatcherContext.Match(DirectoryInfoBase directory, String parentRelativePath) at Microsoft.Extensions.FileSystemGlobbing.Internal.MatcherContext.Match(DirectoryInfoBase directory, String parentRelativePath) at Microsoft.Extensions.FileSystemGlobbing.Internal.MatcherContext.Execute() at Microsoft.Extensions.FileSystemGlobbing.MatcherExtensions.GetResultsInFullPath(Matcher matcher, String directoryPath) at OmniSharp.Script.ScriptProjectSystem.Initalize(IConfiguration configuration) at OmniSharp.WorkspaceInitializer.Initialize(IServiceProvider serviceProvider, CompositionHost compositionHost)


回答1:


I traced the problem to the tmp folder in the Ember project filling up with files and folders that became broken. I installed the add-on Ember clean-tmp and ran that. Once the tmp folder was cleaned, I restarted VSCode and checked the OmniSharp Log and the exception errors went away. Consequently, the OmniSharp Using statement started working agian.

Moral of the story: keep an eye on that tmp folder!

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



来源:https://stackoverflow.com/questions/54830949/omnisharp-not-functioning-properly-in-one-project-but-is-in-another

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!