c# - 在 Vscode 中调试 C# 代码时出现 System.TypeLoadException
问题描述
当我安装 C# 扩展时,一切正常。但是后来我安装了 Mono(并出于某种原因将其卸载)并且扩展现在不起作用
我再次尝试卸载并安装 dotnet3,但这没有任何意义。
Starting OmniSharp server at 10/7/2019, 11:23:01 AM
Target: /home/newusername77177/ProgrammingFolder/C#/Study
OmniSharp server started with Mono 6.4.0.
Path: /home/newusername77177/.vscode/extensions/ms-vscode.csharp-1.21.4/.omnisharp/1.34.4/omnisharp/OmniSharp.exe
PID: 9152
System.TypeLoadException: Could not load type of field 'McMaster.Extensions.CommandLineUtils.CommandLineApplication:_validationErrorHandler' (36) due to: Could not load file or assembly 'System.ComponentModel.DataAnnotations, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies.
at OmniSharp.Stdio.StdioCommandLineApplication..ctor () [0x00000] in <33949cd60c2b4bc38b57918b6c0a9e6f>:0
at OmniSharp.Stdio.Driver.Program+<>c__DisplayClass0_0.<Main>b__0 () [0x00006] in <5930e76072f14255af7d67dbd8f6513a>:0
at OmniSharp.HostHelpers.Start (System.Func`1[TResult] action) [0x0001c] in <2cb0afb412134712add1d51352aad594>:0
[ERROR] Error: OmniSharp server load timed out. Use the 'omnisharp.projectLoadTimeout' setting to override the default delay (one minute).
解决方案
尝试在 vscode 中设置 Omnisharp: Use Global Mono to never 而不是 auto。为我工作。
推荐阅读
- python - 新面板中的 Boxsizers
- wordpress - 插件中的 add_shortcode
- python - 为什么睡眠会干扰键盘抑制热键?
- reactjs - 反应蚂蚁设计日期时间选择器选择日期选项问题
- java - 无法从 Firestore 中删除字段
- flutter - Flutter - 如何创建遵循其父高度的流体/动态容器?
- angular - 尽管 RouterLink 导入,Angular Ionic 应用程序 RouterLink 仍无法正常工作
- c# - 存储在数据存储中的 UTC 时间或本地时间
- objective-c - 显示 NSString 值的最简单方法是什么?
- javascript - 如何检测用户何时使用 javascript 切换选项卡?