Closed Zutki closed 3 years ago
The standalone msbuild shipped with OmniSharp-roslyn does not have full .Net Framework support by itself. You'll need to install mono and run through that.
There are a couple of suggestions for telling OmniSharp-roslyn to use the mono libraries in the wiki article about Unity setup, see if that works.
Hi, thanks for your reply. I have tired running nvim with the FrameworkPathOverrride set up. FrameworkPathOverride=/lib/mono/4.8-api nvim Assets/cube.cs
It still however does not work.
Now I am getting this log.
OmniSharp server started.
Path: /home/david/.cache/omnisharp-vim/omnisharp-roslyn/run
Target: /home/david/unityProjects/SurvivalGame/SurvivalGame/SurvivalGame.sln
PID: 2155935
[info]: OmniSharp.Stdio.Host
Starting OmniSharp on arch 0.0 (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/david/.cache/omnisharp-vim/omnisharp-roslyn/omnisharp/.msbuild/Current/Bin"
[info]: OmniSharp.MSBuild.Discovery.MSBuildLocator
MSBUILD_EXE_PATH environment variable set to '/home/david/.cache/omnisharp-vim/omnisharp-roslyn/omnisharp/.msbuild/Current/Bin/MSBuild.exe'
[info]: OmniSharp.MSBuild.Discovery.MSBuildLocator
Registered MSBuild instance: StandAlone 16.8.0 - "/home/david/.cache/omnisharp-vim/omnisharp-roslyn/omnisharp/.msbuild/Current/Bin"
CscToolExe = csc.exe
MSBuildToolsPath = /home/david/.cache/omnisharp-vim/omnisharp-roslyn/omnisharp/.msbuild/Current/Bin
CscToolPath = /home/david/.cache/omnisharp-vim/omnisharp-roslyn/omnisharp/.msbuild/Current/Bin/Roslyn
BypassFrameworkInstallChecks = true
MSBuildExtensionsPath = /home/david/.cache/omnisharp-vim/omnisharp-roslyn/omnisharp/.msbuild
[info]: OmniSharp.WorkspaceInitializer
Invoking Workspace Options Provider: OmniSharp.Roslyn.CSharp.Services.CSharpFormattingWorkspaceOptionsProvider, Order: 0
[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.Cake.CakeProjectSystem
Detecting Cake files in '/home/david/unityProjects/SurvivalGame/SurvivalGame'.
[info]: OmniSharp.Cake.CakeProjectSystem
Could not find any Cake files
[info]: OmniSharp.MSBuild.ProjectSystem
Detecting projects in '/home/david/unityProjects/SurvivalGame/SurvivalGame/SurvivalGame.sln'.
[info]: OmniSharp.MSBuild.ProjectManager
Queue project update for '/home/david/unityProjects/SurvivalGame/SurvivalGame/Assembly-CSharp.csproj'
[info]: OmniSharp.Script.ScriptProjectSystem
Detecting CSX files in '/home/david/unityProjects/SurvivalGame/SurvivalGame'.
[info]: OmniSharp.Script.ScriptProjectSystem
Could not find any CSX files
[info]: OmniSharp.WorkspaceInitializer
Configuration finished.
[info]: OmniSharp.Stdio.Host
Omnisharp server running using Stdio at location '/home/david/unityProjects/SurvivalGame/SurvivalGame' on host -1.
[info]: OmniSharp.MSBuild.ProjectManager
Loading project: /home/david/unityProjects/SurvivalGame/SurvivalGame/Assembly-CSharp.csproj
[info]: OmniSharp.OmniSharpWorkspace
Miscellaneous file: /home/david/unityProjects/SurvivalGame/SurvivalGame/Assets/cube.cs added to workspace
Replaying requests for buffer 1
Can't find custom attr constructor image: /home/david/unityProjects/SurvivalGame/SurvivalGame/Library/ScriptAssemblies/Unity.Rider.Editor.dll mtoken: 0x0a000007 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/david/Unity/Hub/Editor/2020.2.2f1/Editor/Data/NetStandard/ref/2.0.0/netstandard.dll type:Object member:(null) assembly:/home/david/Unity/Hub/Editor/2020.2.2f1/Editor/Data/NetStandard/ref/2.0.0/netstandard.dll type:Attribute member:(null) assembly:/home/david/unityProjects/SurvivalGame/SurvivalGame/Library/ScriptAssemblies/UnityEngine.TestRunner.dll type:TestRunCallbackAttribute member:(null) assembly:/home/david/unityProjects/SurvivalGame/SurvivalGame/Library/ScriptAssemblies/UnityEngine.TestRunner.dll type:TestRunCallbackAttribute member:(null)
JSON error: Vim(let):E474: Unidentified byte: Can't find custom attr constructor image: /home/david/unityProjects/SurvivalGame/SurvivalGame/Library/ScriptAssemblies/Unity.Rider.Editor.dll mtoken: 0x0a000007 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/david/Unity/Hub/Editor/2020.2.2f1/Editor/Data/NetStandard/ref/2.0.0/netstandard.dll type:Object member:(null) assembly:/home/david/Unity/Hub/Editor/2020.2.2f1/Editor/Data/NetStandard/ref/2.0.0/netstandard.dll type:Attribute member:(null) assembly:/home/david/unityProjects/SurvivalGame/SurvivalGame/Library/ScriptAssemblies/UnityEngine.TestRunner.dll type:TestRunCallbackAttribute member:(null) assembly:/home/david/unityProjects/SurvivalGame/SurvivalGame/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/david/Unity/Hub/Editor/2020.2.2f1/Editor/Data/NetStandard/ref/2.0.0/netstandard.dll type:Object member:(null) assembly:/home/david/Unity/Hub/Editor/2020.2.2f1/Editor/Data/NetStandard/ref/2.0.0/netstandard.dll type:Attribute member:(null) assembly:/home/david/unityProjects/SurvivalGame/SurvivalGame/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 <284d11f275764cafba668d0e682555f7>:0
at Microsoft.Build.Tasks.AssemblyInformation.get_FrameworkNameAttribute () [0x00028] in <284d11f275764cafba668d0e682555f7>:0
at Microsoft.Build.Tasks.AssemblyDependency.AssemblyMetadata..ctor (System.String path) [0x00019] in <284d11f275764cafba668d0e682555f7>:0
at Microsoft.Build.Tasks.AssemblyInformation+<>c.<GetAssemblyMetadata>b__21_0 (System.String p) [0x00000] in <284d11f275764cafba668d0e682555f7>: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 <284d11f275764cafba668d0e682555f7>: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 <284d11f275764cafba668d0e682555f7>: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 <284d11f275764cafba668d0e682555f7>:0
at Microsoft.Build.Tasks.ReferenceTable.FindDependenciesAndScatterFiles (Microsoft.Build.Tasks.Reference reference, System.Collections.Generic.List`1[T] newEntries) [0x0003a] in <284d11f275764cafba668d0e682555f7>:0
at Microsoft.Build.Tasks.ReferenceTable.FindAssociatedFiles () [0x000ea] in <284d11f275764cafba668d0e682555f7>:0
at Microsoft.Build.Tasks.ReferenceTable.ComputeClosure () [0x0000a] in <284d11f275764cafba668d0e682555f7>: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 <284d11f275764cafba668d0e682555f7>: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 <284d11f275764cafba668d0e682555f7>:0
at Microsoft.Build.Tasks.ResolveAssemblyReference.Execute () [0x00000] in <284d11f275764cafba668d0e682555f7>:0
at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute () [0x00029] in <f7274894ce154696afba1f0ffcd06434>: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 <f7274894ce154696afba1f0ffcd06434>:0
[warn]: OmniSharp.MSBuild.ProjectManager
Failed to load project file '/home/david/unityProjects/SurvivalGame/SurvivalGame/Assembly-CSharp.csproj'.
All projects loaded
/home/david/unityProjects/SurvivalGame/SurvivalGame/Assembly-CSharp.csproj
/home/david/.cache/omnisharp-vim/omnisharp-roslyn/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/david/Unity/Hub/Editor/2020.2.2f1/Editor/Data/NetStandard/ref/2.0.0/netstandard.dll type:Object member:(null) assembly:/home/david/Unity/Hub/Editor/2020.2.2f1/Editor/Data/NetStandard/ref/2.0.0/netstandard.dll type:Attribute member:(null) assembly:/home/david/unityProjects/SurvivalGame/SurvivalGame/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 <284d11f275764cafba668d0e682555f7>:0 ^@ at Microsoft.Build.Tasks.AssemblyInformation.get_FrameworkNameAttribute () [0x00028] in <284d11f275764cafba668d0e682555f7>:0 ^@ at Microsoft.Build.Tasks.AssemblyDependency.AssemblyMetadata..ctor (System.String path) [0x00019] in <284d11f275764cafba668d0e682555f7>:0 ^@ at Microsoft.Build.Tasks.AssemblyInformation+<>c.<GetAssemblyMetadata>b__21_0 (System.String p) [0x00000] in <284d11f275764cafba668d0e682555f7>: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 <284d11f275764cafba668d0e682555f7>: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 <284d11f275764cafba668d0e682555f7>: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 <284d11f275764cafba668d0e682555f7>:0 ^@ at Microsoft.Build.Tasks.ReferenceTable.FindDependenciesAndScatterFiles (Microsoft.Build.Tasks.Reference reference, System.Collections.Generic.List`1[T] newEntries) [0x0003a] in <284d11f275764cafba668d0e682555f7>:0 ^@ at Microsoft.Build.Tasks.ReferenceTable.FindAssociatedFiles () [0x000ea] in <284d11f275764cafba668d0e682555f7>:0 ^@ at Microsoft.Build.Tasks.ReferenceTable.ComputeClosure () [0x0000a] in <284d11f275764cafba668d0e682555f7>: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 <284d11f275764cafba668d0e682555f7>: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 <284d11f275764cafba668d0e682555f7>:0 ^@ at Microsoft.Build.Tasks.ResolveAssemblyReference.Execute () [0x00000] in <284d11f275764cafba668d0e682555f7>:0 ^@ at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute () [0x00029] in <f7274894ce154696afba1f0ffcd06434>: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 <f7274894ce154696afba1f0ffcd06434>:0
[fail]: OmniSharp.MSBuild.ProjectManager
Attempted to update project that is not loaded: /home/david/unityProjects/SurvivalGame/SurvivalGame/Assembly-CSharp.csproj
Workspace complete: 1 project(s)
Replaying on-load requests```
Hmm. Have you tried using the mono build of OmniSharp-roslyn, and setting OmniSharp-vim to start it in mono mode?
" init.vim
let g:OmniSharp_server_use_mono = 1
This will require you to reinstall the server, with :OmniSharpInstall
.
See if that works, and if not, try overriding the MSBuild location in either a project-local omnisharp.json
file, or a global ~/.omnisharp/omnisharp.json
file (described here) like this:
{
"MSBuild": {
"MSBuildOverride": {
"MSBuildPath": "/usr/lib/mono/msbuild/Current/bin/"
}
}
}
Beyond that, I'm not sure sorry. There have been various discussions on OmniSharp-roslyn issues indicating that Unity isn't exactly supported. I don't use it myself so can't offer any more than that.
Thank you for trying to help. I was unable to resolve the issue. But nonetheless I appreciate you trying to help.
Please do come back with results if you get things working, for the sake of future Unity users who might run up against the same things.
Did you try those 2 options in my previous comment?
I tried the two options you provided but I still got errors. For configuring the vimrc file I got the same error I opened the issue with. And I couldn't get the second option to work. If I set it to /lib/mono/msbuild/Current/bin/
I get a file not found error. And after looking around I found the file it was looking for was in a folder called xbuild. Then I got the following error.
This is what my msbuild folder looks like. If you need that information
Do you have community/mono-msbuild installed?
This OmniSharp-roslyn thread may be relevant too
I haven't tried mono-msbuild yet. I'll give it a shot when I have the time.
I have installed mono-msbuild. And have updated the omnisharp.json file. Now I am not getting the dll not found error. However when I run OmniSharpOpenLog
I get the following errors.
which looks like the error I got initially.
System Info: OS: Arch Linux Editor: NeoVim
Hi, I have been trying for hours to solve this issue but I have not been able to. When I open a .cs file the editor says it loaded the .sln file. However it doesn't appear to show any suggestions for unity. Upon typing
:OmniSharpOpenLog
I get the following output.Thank you for your time.