stride
stride copied to clipboard
[Assets] Update Microsoft.CodeAnalysis version to 3.8.0
PR Details
Update some packages dependencies.
Description
Avalonia.Diagnostics 11.0.x depends on that minimum version.
Note that the same package version was already referenced in Stride.Core.CompilerServices (commit 9f96ca3f99800d1468339e9dc2f497321d8dfb48), but wasn't updated in other projects at the time.
Related Issue
Independent of #1908, but would be nice to merge both.
Motivation and Context
Required to start building a prototype of a new Game Studio using Avalonia.
Types of changes
- [ ] Docs change / refactoring / dependency upgrade
- [x] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing functionality to change)
Checklist
- [ ] My change requires a change to the documentation.
- [ ] I have added tests to cover my changes.
- [ ] All new and existing tests passed.
Getting an exception when creating a new project in the editor:
System.Reflection.ReflectionTypeLoadException: Unable to load one or more of the requested types.
Method 'GetChangeSignatureOptions' in type 'RoslynPad.Roslyn.LanguageServices.ChangeSignature.ChangeSignatureOptionsService' from assembly 'RoslynPad.Roslyn, Version=3.6.0.0, Culture=neutral, PublicKeyToken=null' does not have an implementation.
Could not load type 'Microsoft.CodeAnalysis.Diagnostics.IHostDiagnosticAnalyzerPackageProvider' from assembly 'Microsoft.CodeAnalysis.Features, Version=3.8.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.
Could not load type 'Microsoft.CodeAnalysis.FindSymbols.SymbolAndProjectId' from assembly 'Microsoft.CodeAnalysis.Workspaces, Version=3.8.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.
at System.Reflection.RuntimeModule.GetTypes(RuntimeModule module)
at System.Reflection.RuntimeAssembly.get_DefinedTypes()
at Stride.Assets.Presentation.AssetEditors.ScriptEditor.RoslynHost.<>c.<CreateCompositionContext>b__5_0(Assembly x) in J:\stride\sources\editor\Stride.Assets.Presentation\AssetEditors\ScriptEditor\RoslynHost.cs:line 73
at System.Linq.Enumerable.SelectManySingleSelectorIterator`2.MoveNext()
at System.Linq.Enumerable.SelectEnumerableIterator`2.MoveNext()
at System.Composition.TypedParts.TypedPartExportDescriptorProvider..ctor(IEnumerable`1 types, AttributedModelProvider attributeContext)
at System.Composition.Hosting.ContainerConfiguration.CreateContainer()
at Stride.Assets.Presentation.AssetEditors.ScriptEditor.RoslynHost.CreateCompositionContext() in J:\stride\sources\editor\Stride.Assets.Presentation\AssetEditors\ScriptEditor\RoslynHost.cs:line 76
at Stride.Assets.Presentation.AssetEditors.ScriptEditor.RoslynHost..ctor() in J:\stride\sources\editor\Stride.Assets.Presentation\AssetEditors\ScriptEditor\RoslynHost.cs:line 44
at Stride.Assets.Presentation.AssetEditors.ProjectWatcher.<>c.<.ctor>b__13_2() in J:\stride\sources\editor\Stride.Assets.Presentation\AssetEditors\ProjectWatcher.cs:line 72
at System.Threading.Tasks.Task`1.InnerInvoke()
at System.Threading.Tasks.Task.<>c.<.cctor>b__272_0(Object obj)
at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state)
System.TypeLoadException: Method 'GetChangeSignatureOptions' in type 'RoslynPad.Roslyn.LanguageServices.ChangeSignature.ChangeSignatureOptionsService' from assembly 'RoslynPad.Roslyn, Version=3.6.0.0, Culture=neutral, PublicKeyToken=null' does not have an implementation.
System.TypeLoadException: Could not load type 'Microsoft.CodeAnalysis.Diagnostics.IHostDiagnosticAnalyzerPackageProvider' from assembly 'Microsoft.CodeAnalysis.Features, Version=3.8.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.
System.TypeLoadException: Could not load type 'Microsoft.CodeAnalysis.FindSymbols.SymbolAndProjectId' from assembly 'Microsoft.CodeAnalysis.Workspaces, Version=3.8.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.
Likely just need to upgrade RoslynPad in Stride.Assets.Presentation.csproj to match Microsoft.CodeAnalysis's version.
I tried upgrading RoslynPad a while ago and failed because it changed the API we integrate with in a custom way to support the script editor. Seems there's a lot needed in understanding the internals of Roslyn workspaces and how they may be used to support multiple projects as we currently have it in GameStudio. RoslynPad operates on a different project model somehow.
Yes, I was going to ask if it break RoslynPad. But since this PR is just a step toward a possible Avalonia, there is no actual need to merge it in master right away. If needed for Avalonia, it can be part of the Avalonia branch. That way, we can delay when we break or replace the RolsynPad feature.
Note: I am fine to have a discussion about if we should remove the C# in-editor scripting or replace it with something else (is it easy to embed VS Code? if we were to chose a better lib, is it worth doing in the current WPF editor if it's going to eventually be replaced?) But for now we can just keep thing as is and treat this PR as something that should target the future Avalonia branch rather than master to avoid breaking things unnecessarily.
I've made tests in which I replaced the external reference to RoslynPad as a package and instead integrate only the necessary parts inside Stride solution. I was succesful in doing so, but it is complex because RoslynPad depends on a pre-build step that allows it to access internal members inside the Roslyn ("Microsoft.CodeAnalysis.*") assemblies, and anytime we update those package references, it may broke the RoslynPad integration.
The rationale for integrating RoslynPad (the minimal possible code) into Stride was that it allowed us to tailor it more to our specific needs, to define easily things like icons, themes, etc., to fix bugs specific to Stride project system, etc. Right now, RoslynPad is updated not very regularly, so it's frustrating to wait for RoslynPad to update to support newer SDKs or specific features.