在Vscode中调试C#代码时出现System.TypeLoadException

时间:2019-10-07 08:36:25

标签: c# debugging visual-studio-code mono

当我安装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).

1 个答案:

答案 0 :(得分:1)

尝试设置Omnisharp:在vscode中使用Global Mono永不代替auto。 为我工作。