stride
stride copied to clipboard
Script editor seems broken, no syntax highlight
Release Type: Stride 4.1.0.1 (.Net 6.0)
Version: https://github.com/stride3d/stride/commit/56a4015641f9d9127f2aab9c920573b660b72d15
Platform(s): Windows 10 21H2 19044.1766
Describe the bug Syntax hightlight describes any kind of data type as an error. Also intellicode does not display any information. May perhaps System.Reactive and System.Reactive.Linq could not be compatible with .Net 6?
To Reproduce Steps to reproduce the behavior:
- Just open a solution in GameStudio and make or or load a C# script.
Expected behavior Normal syntax highlighting and intellicode info.
Screenshots
Log and callstacks
If any, please attach here any log or callstack (preferably in a .txt
file using GitHub drag and drop)
Additional context Add any other context about the problem here.
I believe this is #1033 again.
Yes, but I believe a different cause, this time.
Why are we seeing red squigglies? It's because none of the project metadata references are being loaded (mscorlib, NuGet packages, etc). This happens because MSBuild encounters an error while loading the project.
https://github.com/stride3d/stride/blob/d0e9ff2118fb146e0413ae8f841732099999cb68/sources/editor/Stride.Assets.Presentation/AssetEditors/ProjectWatcher.cs#L371
When inspecting msbuildWorkspace.Diagnostics
I could see the following:
Msbuild failed when processing the file 'C:\Users\<user>\Documents\Stride Projects\Test\Test\Test.csproj' with message: C:\Program Files\dotnet\sdk\6.0.405\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Sdk.FrameworkReferenceResolution.targets: (90, 5): The "ProcessFrameworkReferences" task failed unexpectedly.
System.IO.FileLoadException: Could not load file or assembly 'NuGet.Frameworks, Version=6.3.1.1, Culture=neutral, PublicKeyToken=31bf3856ad364e35'. Could not find or load a specific file. (0x80131621)
File name: 'NuGet.Frameworks, Version=6.3.1.1, Culture=neutral, PublicKeyToken=31bf3856ad364e35'
---> System.IO.FileLoadException: Could not load file or assembly 'NuGet.Frameworks, Version=6.3.1.1, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.
at System.Runtime.Loader.AssemblyLoadContext.LoadFromPath(IntPtr ptrNativeAssemblyLoadContext, String ilPath, String niPath, ObjectHandleOnStack retAssembly)
at System.Runtime.Loader.AssemblyLoadContext.LoadFromAssemblyPath(String assemblyPath)
at Microsoft.Build.Shared.MSBuildLoadContext.Load(AssemblyName assemblyName)
at System.Runtime.Loader.AssemblyLoadContext.ResolveUsingLoad(AssemblyName assemblyName)
at System.Runtime.Loader.AssemblyLoadContext.Resolve(IntPtr gchManagedAssemblyLoadContext, AssemblyName assemblyName)
at System.Linq.Enumerable.WhereEnumerableIterator`1.ToList()
at Microsoft.NET.Build.Tasks.ProcessFrameworkReferences.ExecuteCore()
at Microsoft.NET.Build.Tasks.TaskBase.Execute()
at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
at Microsoft.Build.BackEnd.TaskBuilder.ExecuteInstantiatedTask(ITaskExecutionHost taskExecutionHost, TaskLoggingContext taskLoggingContext, TaskHost taskHost, ItemBucket bucket, TaskExecutionMode howToExecuteTask)
This is a known issue of MSBuild being shipped with it's own version of NuGet. Each Stride user could use a different .NET SDK and have a different version of NuGet required, so this issue will occur in the future again.
It's been reported before:
https://github.com/microsoft/MSBuildLocator/issues/127
https://github.com/microsoft/MSBuildLocator/issues/86
But this was happening in MSBuildLocator
and solved with a workaround.
However, MSBuild itself can use a different pathway for loading assemblies and we're hitting the issue here (changed in commit):
https://github.com/dotnet/msbuild/blob/03de075bf00cadc8cf6e884f1719ea1d2da5b30e/src/Shared/MSBuildLoadContext.cs#L108
The LoadFromAssemblyPath
is invoked directly on AssemblyLoadContext.Default
which means we don't have a chance to capture it and use a different ALC.
The exception is thrown because Stride references a lower version of the assembly than SDK wants. For details why it is thrown see this SO and this answer to it.
I was not able to find a workaround that would load the NuGet.Frameworks
(or any other potentially mismatched dll) into a different ALC or otherwise make the issue go away.
Another option is to update the dependency version on NuGet, which I'm going to do, but it's a matter of time before they break again.
On a side note, seems we're stuck to Roslyn 3.6.0 as updating to 4.4.0 breaks error notifications.
Hi, I also stumbled upon this issue and fixed it by installing the 2013 C++ redistribution from here.
I also reinstalled the NuGet packages.
More info on how I solved it is here
I'm having this issue in the latest version of Stride Game Studio (4.2.0.2067).
The problem is limited to the native editor, while VS 2022 17.9.1 works just fine.
The project also builds fine from either program. None of the suggested solutions have changed anything.
This is a fresh Stride install, as I am completely new to it.
This wouldn't be as annoying if Stride would open the script in my default IDE upon double clicking the script.