1
\$\begingroup\$

I'm running Unity 2020.1 on Ubuntu 20.04.

My OmniSharp extension for VSCode is crashing on startup. I had everything working properly with intellisense and all but then I rebooted. Now when I open the unity C# solution file in VSCode I get the following output from OmniSharp.

Starting OmniSharp server at 2020-11-28, 4:00:21 p.m.
    Target: /home/timmeh/work/unity/3_Project_Boost/3_Project_Boost.sln

OmniSharp server started.
    Path: /home/timmeh/.vscode/extensions/ms-dotnettools.csharp-1.23.6/.omnisharp/1.37.3/run
    PID: 3596

[info]: OmniSharp.Stdio.Host
        Starting OmniSharp on ubuntu 20.4 (x64)
[info]: OmniSharp.Services.DotNetCliService
        DotNetPath set to dotnet
[info]: OmniSharp.MSBuild.Discovery.MSBuildLocator
        Located 1 MSBuild instance(s)
            1: StandAlone 16.8.0 - "/home/timmeh/.vscode/extensions/ms-dotnettools.csharp-1.23.6/.omnisharp/1.37.3/omnisharp/.msbuild/Current/Bin"
[info]: OmniSharp.MSBuild.Discovery.MSBuildLocator
        MSBUILD_EXE_PATH environment variable set to '/home/timmeh/.vscode/extensions/ms-dotnettools.csharp-1.23.6/.omnisharp/1.37.3/omnisharp/.msbuild/Current/Bin/MSBuild.exe'
[info]: OmniSharp.MSBuild.Discovery.MSBuildLocator
        Registered MSBuild instance: StandAlone 16.8.0 - "/home/timmeh/.vscode/extensions/ms-dotnettools.csharp-1.23.6/.omnisharp/1.37.3/omnisharp/.msbuild/Current/Bin"
            CscToolExe = csc.exe
            MSBuildToolsPath = /home/timmeh/.vscode/extensions/ms-dotnettools.csharp-1.23.6/.omnisharp/1.37.3/omnisharp/.msbuild/Current/Bin
            CscToolPath = /home/timmeh/.vscode/extensions/ms-dotnettools.csharp-1.23.6/.omnisharp/1.37.3/omnisharp/.msbuild/Current/Bin/Roslyn
            BypassFrameworkInstallChecks = true
            MSBuildExtensionsPath = /home/timmeh/.vscode/extensions/ms-dotnettools.csharp-1.23.6/.omnisharp/1.37.3/omnisharp/.msbuild
[info]: OmniSharp.Cake.CakeProjectSystem
        Detecting Cake files in '/home/timmeh/work/unity/3_Project_Boost'.
[info]: OmniSharp.Cake.CakeProjectSystem
        Could not find any Cake files
[info]: OmniSharp.MSBuild.ProjectSystem
        Detecting projects in '/home/timmeh/work/unity/3_Project_Boost/3_Project_Boost.sln'.
[info]: OmniSharp.MSBuild.ProjectManager
        Queue project update for '/home/timmeh/work/unity/3_Project_Boost/Assembly-CSharp.csproj'
[info]: OmniSharp.Script.ScriptProjectSystem
        Detecting CSX files in '/home/timmeh/work/unity/3_Project_Boost'.
[info]: OmniSharp.Script.ScriptProjectSystem
        Could not find any CSX files
[info]: OmniSharp.WorkspaceInitializer
        Invoking Workspace Options Provider: OmniSharp.Roslyn.CSharp.Services.CSharpFormattingWorkspaceOptionsProvider, Order: 0
[info]: OmniSharp.MSBuild.ProjectManager
        Loading project: /home/timmeh/work/unity/3_Project_Boost/Assembly-CSharp.csproj
[info]: OmniSharp.WorkspaceInitializer
        Invoking Workspace Options Provider: OmniSharp.Roslyn.CSharp.Services.Completion.CompletionOptionsProvider, Order: 0
[info]: OmniSharp.WorkspaceInitializer
        Invoking Workspace Options Provider: OmniSharp.Roslyn.CSharp.Services.RenameWorkspaceOptionsProvider, Order: 100
[info]: OmniSharp.WorkspaceInitializer
        Invoking Workspace Options Provider: OmniSharp.Roslyn.CSharp.Services.ImplementTypeWorkspaceOptionsProvider, Order: 110
[info]: OmniSharp.WorkspaceInitializer
        Invoking Workspace Options Provider: OmniSharp.Roslyn.CSharp.Services.BlockStructureWorkspaceOptionsProvider, Order: 140
[info]: OmniSharp.WorkspaceInitializer
        Configuration finished.
[info]: OmniSharp.Stdio.Host
        Omnisharp server running using Stdio at location '/home/timmeh/work/unity/3_Project_Boost' on host 3477.
Can't find custom attr constructor image: /home/timmeh/work/unity/3_Project_Boost/Library/ScriptAssemblies/Unity.Rider.Editor.dll mtoken: 0x0a000004 due to: Could not find method '.ctor' due to a type load error: Could not set up parent class, due to: Could not set up parent class, due to:  assembly:/home/timmeh/work/unity/installs/2020.1.10f1/Editor/Data/NetStandard/ref/2.0.0/netstandard.dll type:Object member:(null) assembly:/home/timmeh/work/unity/installs/2020.1.10f1/Editor/Data/NetStandard/ref/2.0.0/netstandard.dll type:Attribute member:(null) assembly:/home/timmeh/work/unity/3_Project_Boost/Library/ScriptAssemblies/UnityEngine.TestRunner.dll type:TestRunCallbackAttribute member:(null) assembly:/home/timmeh/work/unity/3_Project_Boost/Library/ScriptAssemblies/UnityEngine.TestRunner.dll type:TestRunCallbackAttribute member:(null)
[fail]: OmniSharp.MSBuild.ProjectLoader
        The "ResolveAssemblyReference" task failed unexpectedly.
System.TypeLoadException: Could not find method '.ctor' due to a type load error: Could not set up parent class, due to: Could not set up parent class, due to:  assembly:/home/timmeh/work/unity/installs/2020.1.10f1/Editor/Data/NetStandard/ref/2.0.0/netstandard.dll type:Object member:(null) assembly:/home/timmeh/work/unity/installs/2020.1.10f1/Editor/Data/NetStandard/ref/2.0.0/netstandard.dll type:Attribute member:(null) assembly:/home/timmeh/work/unity/3_Project_Boost/Library/ScriptAssemblies/UnityEngine.TestRunner.dll type:TestRunCallbackAttribute member:(null)
  at (wrapper managed-to-native) System.MonoCustomAttrs.GetCustomAttributesDataInternal(System.Reflection.ICustomAttributeProvider)
  at System.MonoCustomAttrs.GetCustomAttributesDataBase (System.Reflection.ICustomAttributeProvider obj, System.Type attributeType, System.Boolean inheritedOnly) [0x00010] in <9f0df102fe6e4cfea29d2e46f585d8a5>:0 
  at System.MonoCustomAttrs.GetCustomAttributesData (System.Reflection.ICustomAttributeProvider obj, System.Boolean inherit) [0x00011] in <9f0df102fe6e4cfea29d2e46f585d8a5>:0 
  at System.Reflection.CustomAttributeData.GetCustomAttributes (System.Reflection.Assembly target) [0x00000] in <9f0df102fe6e4cfea29d2e46f585d8a5>:0 
  at System.Reflection.RuntimeAssembly.GetCustomAttributesData () [0x00000] in <9f0df102fe6e4cfea29d2e46f585d8a5>:0 
  at Microsoft.Build.Tasks.AssemblyInformation.GetFrameworkName () [0x00025] in <de5a1b3cad9b40f1b4a72c6fbcf8f237>:0 
  at Microsoft.Build.Tasks.AssemblyInformation.get_FrameworkNameAttribute () [0x00028] in <de5a1b3cad9b40f1b4a72c6fbcf8f237>:0 
  at Microsoft.Build.Tasks.AssemblyDependency.AssemblyMetadata..ctor (System.String path) [0x00019] in <de5a1b3cad9b40f1b4a72c6fbcf8f237>:0 
  at Microsoft.Build.Tasks.AssemblyInformation+<>c.<GetAssemblyMetadata>b__21_0 (System.String p) [0x00000] in <de5a1b3cad9b40f1b4a72c6fbcf8f237>:0 
  at System.Collections.Concurrent.ConcurrentDictionary`2[TKey,TValue].GetOrAdd (TKey key, System.Func`2[T,TResult] valueFactory) [0x00034] in <9f0df102fe6e4cfea29d2e46f585d8a5>:0 
  at Microsoft.Build.Tasks.AssemblyInformation.GetAssemblyMetadata (System.String path, System.Collections.Concurrent.ConcurrentDictionary`2[TKey,TValue] assemblyMetadataCache, Microsoft.Build.Shared.AssemblyNameExtension[]& dependencies, System.String[]& scatterFiles, System.Runtime.Versioning.FrameworkName& frameworkName) [0x00006] in <de5a1b3cad9b40f1b4a72c6fbcf8f237>:0 
  at (wrapper delegate-invoke) <Module>.invoke_void_string_ConcurrentDictionary`2<string, AssemblyMetadata>_AssemblyNameExtension[]&_string[]&_FrameworkName&(string,System.Collections.Concurrent.ConcurrentDictionary`2<string, Microsoft.Build.Tasks.AssemblyDependency.AssemblyMetadata>,Microsoft.Build.Shared.AssemblyNameExtension[]&,string[]&,System.Runtime.Versioning.FrameworkName&)
  at Microsoft.Build.Tasks.SystemState.GetAssemblyMetadata (System.String path, System.Collections.Concurrent.ConcurrentDictionary`2[TKey,TValue] assemblyMetadataCache, Microsoft.Build.Shared.AssemblyNameExtension[]& dependencies, System.String[]& scatterFiles, System.Runtime.Versioning.FrameworkName& frameworkName) [0x00010] in <de5a1b3cad9b40f1b4a72c6fbcf8f237>:0 
  at Microsoft.Build.Tasks.ReferenceTable.GetUnifiedAssemblyMetadata (Microsoft.Build.Tasks.Reference reference, System.Collections.Generic.IEnumerable`1[Microsoft.Build.Tasks.UnifiedAssemblyName]& unifiedDependencies, System.String[]& scatterFiles) [0x00023] in <de5a1b3cad9b40f1b4a72c6fbcf8f237>:0 
  at Microsoft.Build.Tasks.ReferenceTable.FindDependenciesAndScatterFiles (Microsoft.Build.Tasks.Reference reference, System.Collections.Generic.List`1[T] newEntries) [0x0003a] in <de5a1b3cad9b40f1b4a72c6fbcf8f237>:0 
  at Microsoft.Build.Tasks.ReferenceTable.FindAssociatedFiles () [0x000ea] in <de5a1b3cad9b40f1b4a72c6fbcf8f237>:0 
  at Microsoft.Build.Tasks.ReferenceTable.ComputeClosure () [0x0000a] in <de5a1b3cad9b40f1b4a72c6fbcf8f237>:0 
  at Microsoft.Build.Tasks.ReferenceTable.ComputeClosure (System.Collections.Generic.IEnumerable`1[T] remappedAssembliesValue, Microsoft.Build.Framework.ITaskItem[] referenceAssemblyFiles, Microsoft.Build.Framework.ITaskItem[] referenceAssemblyNames, System.Collections.Generic.List`1[T] exceptions) [0x00038] in <de5a1b3cad9b40f1b4a72c6fbcf8f237>:0 
  at Microsoft.Build.Tasks.ResolveAssemblyReference.Execute (Microsoft.Build.Shared.FileExists fileExists, Microsoft.Build.Shared.DirectoryExists directoryExists, Microsoft.Build.Tasks.GetDirectories getDirectories, Microsoft.Build.Tasks.GetAssemblyName getAssemblyName, Microsoft.Build.Tasks.GetAssemblyMetadata getAssemblyMetadata, Microsoft.Build.Shared.GetRegistrySubKeyNames getRegistrySubKeyNames, Microsoft.Build.Shared.GetRegistrySubKeyDefaultValue getRegistrySubKeyDefaultValue, Microsoft.Build.Tasks.GetLastWriteTime getLastWriteTime, Microsoft.Build.Tasks.GetAssemblyRuntimeVersion getRuntimeVersion, Microsoft.Build.Shared.OpenBaseKey openBaseKey, Microsoft.Build.Tasks.GetAssemblyPathInGac getAssemblyPathInGac, Microsoft.Build.Tasks.IsWinMDFile isWinMDFile, Microsoft.Build.Tasks.ReadMachineTypeFromPEHeader readMachineTypeFromPEHeader) [0x00515] in <de5a1b3cad9b40f1b4a72c6fbcf8f237>:0 
  at Microsoft.Build.Tasks.ResolveAssemblyReference.Execute () [0x00077] in <de5a1b3cad9b40f1b4a72c6fbcf8f237>:0 
  at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute () [0x00029] in <25851c819cf84f6c96378e77482fea8f>:0 
  at Microsoft.Build.BackEnd.TaskBuilder.ExecuteInstantiatedTask (Microsoft.Build.BackEnd.ITaskExecutionHost taskExecutionHost, Microsoft.Build.BackEnd.Logging.TaskLoggingContext taskLoggingContext, Microsoft.Build.BackEnd.TaskHost taskHost, Microsoft.Build.BackEnd.ItemBucket bucket, Microsoft.Build.BackEnd.TaskExecutionMode howToExecuteTask) [0x002fc] in <25851c819cf84f6c96378e77482fea8f>:0 
[warn]: OmniSharp.MSBuild.ProjectManager
        Failed to load project file '/home/timmeh/work/unity/3_Project_Boost/Assembly-CSharp.csproj'.
/home/timmeh/work/unity/3_Project_Boost/Assembly-CSharp.csproj
/home/timmeh/.vscode/extensions/ms-dotnettools.csharp-1.23.6/.omnisharp/1.37.3/omnisharp/.msbuild/Current/Bin/Microsoft.Common.CurrentVersion.targets(2123,5): Error: The "ResolveAssemblyReference" task failed unexpectedly.
System.TypeLoadException: Could not find method '.ctor' due to a type load error: Could not set up parent class, due to: Could not set up parent class, due to:  assembly:/home/timmeh/work/unity/installs/2020.1.10f1/Editor/Data/NetStandard/ref/2.0.0/netstandard.dll type:Object member:(null) assembly:/home/timmeh/work/unity/installs/2020.1.10f1/Editor/Data/NetStandard/ref/2.0.0/netstandard.dll type:Attribute member:(null) assembly:/home/timmeh/work/unity/3_Project_Boost/Library/ScriptAssemblies/UnityEngine.TestRunner.dll type:TestRunCallbackAttribute member:(null)
  at (wrapper managed-to-native) System.MonoCustomAttrs.GetCustomAttributesDataInternal(System.Reflection.ICustomAttributeProvider)
  at System.MonoCustomAttrs.GetCustomAttributesDataBase (System.Reflection.ICustomAttributeProvider obj, System.Type attributeType, System.Boolean inheritedOnly) [0x00010] in <9f0df102fe6e4cfea29d2e46f585d8a5>:0 
  at System.MonoCustomAttrs.GetCustomAttributesData (System.Reflection.ICustomAttributeProvider obj, System.Boolean inherit) [0x00011] in <9f0df102fe6e4cfea29d2e46f585d8a5>:0 
  at System.Reflection.CustomAttributeData.GetCustomAttributes (System.Reflection.Assembly target) [0x00000] in <9f0df102fe6e4cfea29d2e46f585d8a5>:0 
  at System.Reflection.RuntimeAssembly.GetCustomAttributesData () [0x00000] in <9f0df102fe6e4cfea29d2e46f585d8a5>:0 
  at Microsoft.Build.Tasks.AssemblyInformation.GetFrameworkName () [0x00025] in <de5a1b3cad9b40f1b4a72c6fbcf8f237>:0 
  at Microsoft.Build.Tasks.AssemblyInformation.get_FrameworkNameAttribute () [0x00028] in <de5a1b3cad9b40f1b4a72c6fbcf8f237>:0 
  at Microsoft.Build.Tasks.AssemblyDependency.AssemblyMetadata..ctor (System.String path) [0x00019] in <de5a1b3cad9b40f1b4a72c6fbcf8f237>:0 
  at Microsoft.Build.Tasks.AssemblyInformation+<>c.<GetAssemblyMetadata>b__21_0 (System.String p) [0x00000] in <de5a1b3cad9b40f1b4a72c6fbcf8f237>:0 
  at System.Collections.Concurrent.ConcurrentDictionary`2[TKey,TValue].GetOrAdd (TKey key, System.Func`2[T,TResult] valueFactory) [0x00034] in <9f0df102fe6e4cfea29d2e46f585d8a5>:0 
  at Microsoft.Build.Tasks.AssemblyInformation.GetAssemblyMetadata (System.String path, System.Collections.Concurrent.ConcurrentDictionary`2[TKey,TValue] assemblyMetadataCache, Microsoft.Build.Shared.AssemblyNameExtension[]& dependencies, System.String[]& scatterFiles, System.Runtime.Versioning.FrameworkName& frameworkName) [0x00006] in <de5a1b3cad9b40f1b4a72c6fbcf8f237>:0 
  at (wrapper delegate-invoke) <Module>.invoke_void_string_ConcurrentDictionary`2<string, AssemblyMetadata>_AssemblyNameExtension[]&_string[]&_FrameworkName&(string,System.Collections.Concurrent.ConcurrentDictionary`2<string, Microsoft.Build.Tasks.AssemblyDependency.AssemblyMetadata>,Microsoft.Build.Shared.AssemblyNameExtension[]&,string[]&,System.Runtime.Versioning.FrameworkName&)
  at Microsoft.Build.Tasks.SystemState.GetAssemblyMetadata (System.String path, System.Collections.Concurrent.ConcurrentDictionary`2[TKey,TValue] assemblyMetadataCache, Microsoft.Build.Shared.AssemblyNameExtension[]& dependencies, System.String[]& scatterFiles, System.Runtime.Versioning.FrameworkName& frameworkName) [0x00010] in <de5a1b3cad9b40f1b4a72c6fbcf8f237>:0 
  at Microsoft.Build.Tasks.ReferenceTable.GetUnifiedAssemblyMetadata (Microsoft.Build.Tasks.Reference reference, System.Collections.Generic.IEnumerable`1[Microsoft.Build.Tasks.UnifiedAssemblyName]& unifiedDependencies, System.String[]& scatterFiles) [0x00023] in <de5a1b3cad9b40f1b4a72c6fbcf8f237>:0 
  at Microsoft.Build.Tasks.ReferenceTable.FindDependenciesAndScatterFiles (Microsoft.Build.Tasks.Reference reference, System.Collections.Generic.List`1[T] newEntries) [0x0003a] in <de5a1b3cad9b40f1b4a72c6fbcf8f237>:0 
  at Microsoft.Build.Tasks.ReferenceTable.FindAssociatedFiles () [0x000ea] in <de5a1b3cad9b40f1b4a72c6fbcf8f237>:0 
  at Microsoft.Build.Tasks.ReferenceTable.ComputeClosure () [0x0000a] in <de5a1b3cad9b40f1b4a72c6fbcf8f237>:0 
  at Microsoft.Build.Tasks.ReferenceTable.ComputeClosure (System.Collections.Generic.IEnumerable`1[T] remappedAssembliesValue, Microsoft.Build.Framework.ITaskItem[] referenceAssemblyFiles, Microsoft.Build.Framework.ITaskItem[] referenceAssemblyNames, System.Collections.Generic.List`1[T] exceptions) [0x00038] in <de5a1b3cad9b40f1b4a72c6fbcf8f237>:0 
  at Microsoft.Build.Tasks.ResolveAssemblyReference.Execute (Microsoft.Build.Shared.FileExists fileExists, Microsoft.Build.Shared.DirectoryExists directoryExists, Microsoft.Build.Tasks.GetDirectories getDirectories, Microsoft.Build.Tasks.GetAssemblyName getAssemblyName, Microsoft.Build.Tasks.GetAssemblyMetadata getAssemblyMetadata, Microsoft.Build.Shared.GetRegistrySubKeyNames getRegistrySubKeyNames, Microsoft.Build.Shared.GetRegistrySubKeyDefaultValue getRegistrySubKeyDefaultValue, Microsoft.Build.Tasks.GetLastWriteTime getLastWriteTime, Microsoft.Build.Tasks.GetAssemblyRuntimeVersion getRuntimeVersion, Microsoft.Build.Shared.OpenBaseKey openBaseKey, Microsoft.Build.Tasks.GetAssemblyPathInGac getAssemblyPathInGac, Microsoft.Build.Tasks.IsWinMDFile isWinMDFile, Microsoft.Build.Tasks.ReadMachineTypeFromPEHeader readMachineTypeFromPEHeader) [0x00515] in <de5a1b3cad9b40f1b4a72c6fbcf8f237>:0 
  at Microsoft.Build.Tasks.ResolveAssemblyReference.Execute () [0x00077] in <de5a1b3cad9b40f1b4a72c6fbcf8f237>:0 
  at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute () [0x00029] in <25851c819cf84f6c96378e77482fea8f>:0 
  at Microsoft.Build.BackEnd.TaskBuilder.ExecuteInstantiatedTask (Microsoft.Build.BackEnd.ITaskExecutionHost taskExecutionHost, Microsoft.Build.BackEnd.Logging.TaskLoggingContext taskLoggingContext, Microsoft.Build.BackEnd.TaskHost taskHost, Microsoft.Build.BackEnd.ItemBucket bucket, Microsoft.Build.BackEnd.TaskExecutionMode howToExecuteTask) [0x002fc] in <25851c819cf84f6c96378e77482fea8f>:0 

[fail]: OmniSharp.MSBuild.ProjectManager
        Attempted to update project that is not loaded: /home/timmeh/work/unity/3_Project_Boost/Assembly-CSharp.csproj

I've tried changing the useGlobalMono to each possible choice, but none of those help. I have another project using the exact same version of Unity, VSCode, etc. that does not exhibit the same problems. I'm not sure where to begin troubleshooting this.

\$\endgroup\$
2
\$\begingroup\$

In Unity Preferences, External Tools section, I turned on the options to generate .csproj files for

  • Registry Packages
  • Built-in Packages

Now OmniSharp starts without any errors and intellisense appears to be working correctly.

\$\endgroup\$
1
  • \$\begingroup\$ Thank you so much ! \$\endgroup\$ – BiAiB Jan 26 at 23:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.