microsoft / VSExtensibility

A repo for upcoming changes to extensibility in Visual Studio, the new extensibility model, and language server protocol.
MIT License
369 stars 48 forks source link

Rust LSP server never kicks in #421

Open phil1234567891011 opened 1 month ago

phil1234567891011 commented 1 month ago

Hi,

please let me know how to trigger that LSP example

The RustExtension and RustLanguageServerProvider classes never kick in no breakpoint are registered and nothing happens as I drop a .rs or .rust file in visual studio instance

InitializeServices is never called

thanks for your help as this is really a niche feature, I struggle to find answers for this

matteo-prosperi commented 1 month ago

Hello, did you follow the instructions in the readme?

Especially this section:

This sample requires installing Rust and copying rust-analyzer.exe found under releases named "rust-analyzer-x86_64-pc-windows-msvc.zip" into the project folder.

I did a quick test:

I can hit breakpoints in the extension and I see a successful initialization of the server:

image

I can also see that multiple LSP features are now active (some quick actions, some errors and warnings, the navigation bar at the top of the document). Please keep in mind that this project is only meant to show how to create an extension that starts an external LSP server executable, it's not meant to provide a fully working LSP server for Rust to be used in Visual Studio.

image
phil1234567891011 commented 1 month ago

[edite: I noticed an exception in the output window, see below] yes,

but not a single breakpoint is reachable dropping an .rs file does not trigger anything

image

image

I have an exception

JsonRpc Error: 10 : 'ServiceHub.Host.Extensibility.exe' (CoreCLR: clrhost): Loaded 'C:\DevStudio\Vs2022\dotnet\net8.0\runtime\shared\Microsoft.NETCore.App\8.0.7\System.Diagnostics.StackTrace.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'ServiceHub.Host.Extensibility.exe' (CoreCLR: clrhost): Loaded 'C:\DevStudio\Vs2022\dotnet\net8.0\runtime\shared\Microsoft.NETCore.App\8.0.7\System.Reflection.Metadata.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
Exception thrown from request "4" for method startService: System.AggregateException: One or more errors occurred. (Cannot get type 'RustLanguageServerProviderExtension.RustExtension' from assembly 'RustLanguageServerProvider, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' for RustLanguageServerProviderExtension.RustLanguageServerProvider: Could not load file or assembly 'Microsoft.ServiceHub.Framework, Version=4.6.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. An operation is not legal in the current state. (0x80131509) -> Version for 'Microsoft.ServiceHub.Framework, Version=4.5.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' in shared context is older than the version 'Microsoft.ServiceHub.Framework, Version=4.6.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' requested. This is not a supported scenario.)
 ---> System.ArgumentException: Cannot get type 'RustLanguageServerProviderExtension.RustExtension' from assembly 'RustLanguageServerProvider, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' for RustLanguageServerProviderExtension.RustLanguageServerProvider: Could not load file or assembly 'Microsoft.ServiceHub.Framework, Version=4.6.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. An operation is not legal in the current state. (0x80131509) -> Version for 'Microsoft.ServiceHub.Framework, Version=4.5.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' in shared context is older than the version 'Microsoft.ServiceHub.Framework, Version=4.6.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' requested. This is not a supported scenario.
 ---> System.IO.FileLoadException: Could not load file or assembly 'Microsoft.ServiceHub.Framework, Version=4.6.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. An operation is not legal in the current state. (0x80131509)
File name: 'Microsoft.ServiceHub.Framework, Version=4.6.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'
 ---> System.InvalidOperationException: Version for 'Microsoft.ServiceHub.Framework, Version=4.5.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' in shared context is older than the version 'Microsoft.ServiceHub.Framework, Version=4.6.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' requested. This is not a supported scenario.
   at Microsoft.ServiceHub.HostLib.SharedLoadContext.Load(AssemblyName assemblyName)
   at ServiceHub.Host.ExtensibilityHostSharedLoadContext.Load(AssemblyName assemblyName)
   at Microsoft.ServiceHub.HostLib.SharedLoadContext.Microsoft.ServiceHub.HostStub.IAssemblyLoader.LoadAssembly(AssemblyName assemblyName)
   at Microsoft.ServiceHub.HostLib.ServiceLoadContext.Load(AssemblyName assemblyName)
   at System.Runtime.Loader.AssemblyLoadContext.ResolveUsingLoad(AssemblyName assemblyName)
   at System.Runtime.Loader.AssemblyLoadContext.Resolve(IntPtr gchManagedAssemblyLoadContext, AssemblyName assemblyName)
   at System.Reflection.RuntimeAssembly.<GetTypeCore>g____PInvoke|26_0(QCallAssembly __assembly_native, Byte* __typeName_native, IntPtr* __nestedTypeNames_native, Int32 __nestedTypeNamesLength_native, ObjectHandleOnStack __retType_native)
   at System.Reflection.RuntimeAssembly.GetTypeCore(QCallAssembly assembly, String typeName, ReadOnlySpan`1 nestedTypeNames, Int32 nestedTypeNamesLength, ObjectHandleOnStack retType)
   at System.Reflection.RuntimeAssembly.GetTypeCore(String typeName, ReadOnlySpan`1 nestedTypeNames, Boolean throwOnError, Boolean ignoreCase)
   at System.Reflection.TypeNameParser.GetType(String typeName, ReadOnlySpan`1 nestedTypeNames, String assemblyNameIfAny)
   at System.Reflection.TypeNameParser.NamespaceTypeName.ResolveType(TypeNameParser& parser, String containingAssemblyIfAny)
   at System.Reflection.TypeNameParser.Parse()
   at System.Reflection.TypeNameParser.GetType(String typeName, Boolean throwOnError, Boolean ignoreCase, Assembly topLevelAssembly)
   at Microsoft.ServiceHub.HostStub.ServiceManager.GetServiceModuleType(ServiceModuleInfo smi)
   --- End of inner exception stack trace ---
   at Microsoft.ServiceHub.HostStub.ServiceManager.GetServiceModuleType(ServiceModuleInfo smi)
   at Microsoft.ServiceHub.HostStub.ServiceManager.StartServiceAsync(ServiceModuleInfo smi, String serviceActivationOptions)
   at Microsoft.ServiceHub.HostLib.Host.StartServiceAsync(ServiceModuleInfo smi, ServiceActivationOptions serviceActivationOptions)
   --- End of inner exception stack trace ---
JsonRpc Error: 10 : System.AggregateException: One or more errors occurred. (Cannot get type 'RustLanguageServerProviderExtension.RustExtension' from assembly 'RustLanguageServerProvider, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' for RustLanguageServerProviderExtension.RustLanguageServerProvider: Could not load file or assembly 'Microsoft.ServiceHub.Framework, Version=4.6.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. An operation is not legal in the current state. (0x80131509) -> Version for 'Microsoft.ServiceHub.Framework, Version=4.5.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' in shared context is older than the version 'Microsoft.ServiceHub.Framework, Version=4.6.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' requested. This is not a supported scenario.)
 ---> System.ArgumentException: Cannot get type 'RustLanguageServerProviderExtension.RustExtension' from assembly 'RustLanguageServerProvider, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' for RustLanguageServerProviderExtension.RustLanguageServerProvider: Could not load file or assembly 'Microsoft.ServiceHub.Framework, Version=4.6.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. An operation is not legal in the current state. (0x80131509) -> Version for 'Microsoft.ServiceHub.Framework, Version=4.5.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' in shared context is older than the version 'Microsoft.ServiceHub.Framework, Version=4.6.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' requested. This is not a supported scenario.
 ---> System.IO.FileLoadException: Could not load file or assembly 'Microsoft.ServiceHub.Framework, Version=4.6.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. An operation is not legal in the current state. (0x80131509)
File name: 'Microsoft.ServiceHub.Framework, Version=4.6.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'
 ---> System.InvalidOperationException: Version for 'Microsoft.ServiceHub.Framework, Version=4.5.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' in shared context is older than the version 'Microsoft.ServiceHub.Framework, Version=4.6.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' requested. This is not a supported scenario.
   at Microsoft.ServiceHub.HostLib.SharedLoadContext.Load(AssemblyName assemblyName)
   at ServiceHub.Host.ExtensibilityHostSharedLoadContext.Load(AssemblyName assemblyName)
   at Microsoft.ServiceHub.HostLib.SharedLoadContext.Microsoft.ServiceHub.HostStub.IAssemblyLoader.LoadAssembly(AssemblyName assemblyName)
   at Microsoft.ServiceHub.HostLib.ServiceLoadContext.Load(AssemblyName assemblyName)
   at System.Runtime.Loader.AssemblyLoadContext.ResolveUsingLoad(AssemblyName assemblyName)
   at System.Runtime.Loader.AssemblyLoadContext.Resolve(IntPtr gchManagedAssemblyLoadContext, AssemblyName assemblyName)
   at System.Reflection.RuntimeAssembly.<GetTypeCore>g____PInvoke|26_0(QCallAssembly __assembly_native, Byte* __typeName_native, IntPtr* __nestedTypeNames_native, Int32 __nestedTypeNamesLength_native, ObjectHandleOnStack __retType_native)
   at System.Reflection.RuntimeAssembly.GetTypeCore(QCallAssembly assembly, String typeName, ReadOnlySpan`1 nestedTypeNames, Int32 nestedTypeNamesLength, ObjectHandleOnStack retType)
   at System.Reflection.RuntimeAssembly.GetTypeCore(String typeName, ReadOnlySpan`1 nestedTypeNames, Boolean throwOnError, Boolean ignoreCase)
   at System.Reflection.TypeNameParser.GetType(String typeName, ReadOnlySpan`1 nestedTypeNames, String assemblyNameIfAny)
   at System.Reflection.TypeNameParser.NamespaceTypeName.ResolveType(TypeNameParser& parser, String containingAssemblyIfAny)
   at System.Reflection.TypeNameParser.Parse()
   at System.Reflection.TypeNameParser.GetType(String typeName, Boolean throwOnError, Boolean ignoreCase, Assembly topLevelAssembly)
   at Microsoft.ServiceHub.HostStub.ServiceManager.GetServiceModuleType(ServiceModuleInfo smi)
   --- End of inner exception stack trace ---
   at Microsoft.ServiceHub.HostStub.ServiceManager.GetServiceModuleType(ServiceModuleInfo smi)
   at Microsoft.ServiceHub.HostStub.ServiceManager.StartServiceAsync(ServiceModuleInfo smi, String serviceActivationOptions)
   at Microsoft.ServiceHub.HostLib.Host.StartServiceAsync(ServiceModuleInfo smi, ServiceActivationOptions serviceActivationOptions)
   --- End of inner exception stack trace ---, startService, 4, Newtonsoft.Json.Linq.JToken[]
JsonRpc Error: 10 : Exception thrown from request "5" for method startService: System.AggregateException: One or more errors occurred. (Cannot get type 'RustLanguageServerProviderExtension.RustExtension' from assembly 'RustLanguageServerProvider, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' for RustLanguageServerProviderExtension.RustLanguageServerProvider: Could not load file or assembly 'Microsoft.ServiceHub.Framework, Version=4.6.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. An operation is not legal in the current state. (0x80131509) -> Version for 'Microsoft.ServiceHub.Framework, Version=4.5.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' in shared context is older than the version 'Microsoft.ServiceHub.Framework, Version=4.6.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' requested. This is not a supported scenario.)
 ---> System.ArgumentException: Cannot get type 'RustLanguageServerProviderExtension.RustExtension' from assembly 'RustLanguageServerProvider, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' for RustLanguageServerProviderExtension.RustLanguageServerProvider: Could not load file or assembly 'Microsoft.ServiceHub.Framework, Version=4.6.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. An operation is not legal in the current state. (0x80131509) -> Version for 'Microsoft.ServiceHub.Framework, Version=4.5.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' in shared context is older than the version 'Microsoft.ServiceHub.Framework, Version=4.6.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' requested. This is not a supported scenario.
 ---> System.IO.FileLoadException: Could not load file or assembly 'Microsoft.ServiceHub.Framework, Version=4.6.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. An operation is not legal in the current state. (0x80131509)
File name: 'Microsoft.ServiceHub.Framework, Version=4.6.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'
 ---> System.InvalidOperationException: Version for 'Microsoft.ServiceHub.Framework, Version=4.5.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' in shared context is older than the version 'Microsoft.ServiceHub.Framework, Version=4.6.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' requested. This is not a supported scenario.
   at Microsoft.ServiceHub.HostLib.SharedLoadContext.Load(AssemblyName assemblyName)
   at ServiceHub.Host.ExtensibilityHostSharedLoadContext.Load(AssemblyName assemblyName)
   at Microsoft.ServiceHub.HostLib.SharedLoadContext.Microsoft.ServiceHub.HostStub.IAssemblyLoader.LoadAssembly(AssemblyName assemblyName)
   at Microsoft.ServiceHub.HostLib.ServiceLoadContext.Load(AssemblyName assemblyName)
   at System.Runtime.Loader.AssemblyLoadContext.ResolveUsingLoad(AssemblyName assemblyName)
   at System.Runtime.Loader.AssemblyLoadContext.Resolve(IntPtr gchManagedAssemblyLoadContext, AssemblyName assemblyName)
   at System.Reflection.RuntimeAssembly.<GetTypeCore>g____PInvoke|26_0(QCallAssembly __assembly_native, Byte* __typeName_native, IntPtr* __nestedTypeNames_native, Int32 __nestedTypeNamesLength_native, ObjectHandleOnStack __retType_native)
   at System.Reflection.RuntimeAssembly.GetTypeCore(QCallAssembly assembly, String typeName, ReadOnlySpan`1 nestedTypeNames, Int32 nestedTypeNamesLength, ObjectHandleOnStack retType)
   at System.Reflection.RuntimeAssembly.GetTypeCore(String typeName, ReadOnlySpan`1 nestedTypeNames, Boolean throwOnError, Boolean ignoreCase)
   at System.Reflection.TypeNameParser.GetType(String typeName, ReadOnlySpan`1 nestedTypeNames, String assemblyNameIfAny)
   at System.Reflection.TypeNameParser.NamespaceTypeName.ResolveType(TypeNameParser& parser, String containingAssemblyIfAny)
   at System.Reflection.TypeNameParser.Parse()
   at System.Reflection.TypeNameParser.GetType(String typeName, Boolean throwOnError, Boolean ignoreCase, Assembly topLevelAssembly)
   at Microsoft.ServiceHub.HostStub.ServiceManager.GetServiceModuleType(ServiceModuleInfo smi)
   --- End of inner exception stack trace ---
   at Microsoft.ServiceHub.HostStub.ServiceManager.GetServiceModuleType(ServiceModuleInfo smi)
   at Microsoft.ServiceHub.HostStub.ServiceManager.StartServiceAsync(ServiceModuleInfo smi, String serviceActivationOptions)
   at Microsoft.ServiceHub.HostLib.Host.StartServiceAsync(ServiceModuleInfo smi, ServiceActivationOptions serviceActivationOptions)
   --- End of inner exception stack trace ---
JsonRpc Error: 10 : System.AggregateException: One or more errors occurred. (Cannot get type 'RustLanguageServerProviderExtension.RustExtension' from assembly 'RustLanguageServerProvider, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' for RustLanguageServerProviderExtension.RustLanguageServerProvider: Could not load file or assembly 'Microsoft.ServiceHub.Framework, Version=4.6.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. An operation is not legal in the current state. (0x80131509) -> Version for 'Microsoft.ServiceHub.Framework, Version=4.5.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' in shared context is older than the version 'Microsoft.ServiceHub.Framework, Version=4.6.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' requested. This is not a supported scenario.)
 ---> System.ArgumentException: Cannot get type 'RustLanguageServerProviderExtension.RustExtension' from assembly 'RustLanguageServerProvider, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' for RustLanguageServerProviderExtension.RustLanguageServerProvider: Could not load file or assembly 'Microsoft.ServiceHub.Framework, Version=4.6.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. An operation is not legal in the current state. (0x80131509) -> Version for 'Microsoft.ServiceHub.Framework, Version=4.5.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' in shared context is older than the version 'Microsoft.ServiceHub.Framework, Version=4.6.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' requested. This is not a supported scenario.
 ---> System.IO.FileLoadException: Could not load file or assembly 'Microsoft.ServiceHub.Framework, Version=4.6.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. An operation is not legal in the current state. (0x80131509)
File name: 'Microsoft.ServiceHub.Framework, Version=4.6.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'
 ---> System.InvalidOperationException: Version for 'Microsoft.ServiceHub.Framework, Version=4.5.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' in shared context is older than the version 'Microsoft.ServiceHub.Framework, Version=4.6.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' requested. This is not a supported scenario.
   at Microsoft.ServiceHub.HostLib.SharedLoadContext.Load(AssemblyName assemblyName)
   at ServiceHub.Host.ExtensibilityHostSharedLoadContext.Load(AssemblyName assemblyName)
   at Microsoft.ServiceHub.HostLib.SharedLoadContext.Microsoft.ServiceHub.HostStub.IAssemblyLoader.LoadAssembly(AssemblyName assemblyName)
   at Microsoft.ServiceHub.HostLib.ServiceLoadContext.Load(AssemblyName assemblyName)
   at System.Runtime.Loader.AssemblyLoadContext.ResolveUsingLoad(AssemblyName assemblyName)
   at System.Runtime.Loader.AssemblyLoadContext.Resolve(IntPtr gchManagedAssemblyLoadContext, AssemblyName assemblyName)
   at System.Reflection.RuntimeAssembly.<GetTypeCore>g____PInvoke|26_0(QCallAssembly __assembly_native, Byte* __typeName_native, IntPtr* __nestedTypeNames_native, Int32 __nestedTypeNamesLength_native, ObjectHandleOnStack __retType_native)
   at System.Reflection.RuntimeAssembly.GetTypeCore(QCallAssembly assembly, String typeName, ReadOnlySpan`1 nestedTypeNames, Int32 nestedTypeNamesLength, ObjectHandleOnStack retType)
   at System.Reflection.RuntimeAssembly.GetTypeCore(String typeName, ReadOnlySpan`1 nestedTypeNames, Boolean throwOnError, Boolean ignoreCase)
   at System.Reflection.TypeNameParser.GetType(String typeName, ReadOnlySpan`1 nestedTypeNames, String assemblyNameIfAny)
   at System.Reflection.TypeNameParser.NamespaceTypeName.ResolveType(TypeNameParser& parser, String containingAssemblyIfAny)
   at System.Reflection.TypeNameParser.Parse()
   at System.Reflection.TypeNameParser.GetType(String typeName, Boolean throwOnError, Boolean ignoreCase, Assembly topLevelAssembly)
   at Microsoft.ServiceHub.HostStub.ServiceManager.GetServiceModuleType(ServiceModuleInfo smi)
   --- End of inner exception stack trace ---
   at Microsoft.ServiceHub.HostStub.ServiceManager.GetServiceModuleType(ServiceModuleInfo smi)
   at Microsoft.ServiceHub.HostStub.ServiceManager.StartServiceAsync(ServiceModuleInfo smi, String serviceActivationOptions)
   at Microsoft.ServiceHub.HostLib.Host.StartServiceAsync(ServiceModuleInfo smi, ServiceActivationOptions serviceActivationOptions)
   --- End of inner exception stack trace ---, startService, 5, Newtonsoft.Json.Linq.JToken[]
JsonRpc Error: 10 : Exception thrown from request "6" for method startService: System.AggregateException: One or more errors occurred. (Cannot get type 'RustLanguageServerProviderExtension.RustExtension' from assembly 'RustLanguageServerProvider, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' for RustLanguageServerProviderExtension.RustLanguageServerProvider: Could not load file or assembly 'Microsoft.ServiceHub.Framework, Version=4.6.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. An operation is not legal in the current state. (0x80131509) -> Version for 'Microsoft.ServiceHub.Framework, Version=4.5.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' in shared context is older than the version 'Microsoft.ServiceHub.Framework, Version=4.6.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' requested. This is not a supported scenario.)
 ---> System.ArgumentException: Cannot get type 'RustLanguageServerProviderExtension.RustExtension' from assembly 'RustLanguageServerProvider, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' for RustLanguageServerProviderExtension.RustLanguageServerProvider: Could not load file or assembly 'Microsoft.ServiceHub.Framework, Version=4.6.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. An operation is not legal in the current state. (0x80131509) -> Version for 'Microsoft.ServiceHub.Framework, Version=4.5.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' in shared context is older than the version 'Microsoft.ServiceHub.Framework, Version=4.6.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' requested. This is not a supported scenario.
 ---> System.IO.FileLoadException: Could not load file or assembly 'Microsoft.ServiceHub.Framework, Version=4.6.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. An operation is not legal in the current state. (0x80131509)
File name: 'Microsoft.ServiceHub.Framework, Version=4.6.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'
 ---> System.InvalidOperationException: Version for 'Microsoft.ServiceHub.Framework, Version=4.5.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' in shared context is older than the version 'Microsoft.ServiceHub.Framework, Version=4.6.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' requested. This is not a supported scenario.
   at Microsoft.ServiceHub.HostLib.SharedLoadContext.Load(AssemblyName assemblyName)
   at ServiceHub.Host.ExtensibilityHostSharedLoadContext.Load(AssemblyName assemblyName)
   at Microsoft.ServiceHub.HostLib.SharedLoadContext.Microsoft.ServiceHub.HostStub.IAssemblyLoader.LoadAssembly(AssemblyName assemblyName)
   at Microsoft.ServiceHub.HostLib.ServiceLoadContext.Load(AssemblyName assemblyName)
   at System.Runtime.Loader.AssemblyLoadContext.ResolveUsingLoad(AssemblyName assemblyName)
   at System.Runtime.Loader.AssemblyLoadContext.Resolve(IntPtr gchManagedAssemblyLoadContext, AssemblyName assemblyName)
   at System.Reflection.RuntimeAssembly.<GetTypeCore>g____PInvoke|26_0(QCallAssembly __assembly_native, Byte* __typeName_native, IntPtr* __nestedTypeNames_native, Int32 __nestedTypeNamesLength_native, ObjectHandleOnStack __retType_native)
   at System.Reflection.RuntimeAssembly.GetTypeCore(QCallAssembly assembly, String typeName, ReadOnlySpan`1 nestedTypeNames, Int32 nestedTypeNamesLength, ObjectHandleOnStack retType)
   at System.Reflection.RuntimeAssembly.GetTypeCore(String typeName, ReadOnlySpan`1 nestedTypeNames, Boolean throwOnError, Boolean ignoreCase)
   at System.Reflection.TypeNameParser.GetType(String typeName, ReadOnlySpan`1 nestedTypeNames, String assemblyNameIfAny)
   at System.Reflection.TypeNameParser.NamespaceTypeName.ResolveType(TypeNameParser& parser, String containingAssemblyIfAny)
   at System.Reflection.TypeNameParser.Parse()
   at System.Reflection.TypeNameParser.GetType(String typeName, Boolean throwOnError, Boolean ignoreCase, Assembly topLevelAssembly)
   at Microsoft.ServiceHub.HostStub.ServiceManager.GetServiceModuleType(ServiceModuleInfo smi)
   --- End of inner exception stack trace ---
   at Microsoft.ServiceHub.HostStub.ServiceManager.GetServiceModuleType(ServiceModuleInfo smi)
   at Microsoft.ServiceHub.HostStub.ServiceManager.StartServiceAsync(ServiceModuleInfo smi, String serviceActivationOptions)
   at Microsoft.ServiceHub.HostLib.Host.StartServiceAsync(ServiceModuleInfo smi, ServiceActivationOptions serviceActivationOptions)
   --- End of inner exception stack trace ---
JsonRpc Error: 10 : System.AggregateException: One or more errors occurred. (Cannot get type 'RustLanguageServerProviderExtension.RustExtension' from assembly 'RustLanguageServerProvider, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' for RustLanguageServerProviderExtension.RustLanguageServerProvider: Could not load file or assembly 'Microsoft.ServiceHub.Framework, Version=4.6.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. An operation is not legal in the current state. (0x80131509) -> Version for 'Microsoft.ServiceHub.Framework, Version=4.5.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' in shared context is older than the version 'Microsoft.ServiceHub.Framework, Version=4.6.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' requested. This is not a supported scenario.)
 ---> System.ArgumentException: Cannot get type 'RustLanguageServerProviderExtension.RustExtension' from assembly 'RustLanguageServerProvider, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' for RustLanguageServerProviderExtension.RustLanguageServerProvider: Could not load file or assembly 'Microsoft.ServiceHub.Framework, Version=4.6.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. An operation is not legal in the current state. (0x80131509) -> Version for 'Microsoft.ServiceHub.Framework, Version=4.5.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' in shared context is older than the version 'Microsoft.ServiceHub.Framework, Version=4.6.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' requested. This is not a supported scenario.
 ---> System.IO.FileLoadException: Could not load file or assembly 'Microsoft.ServiceHub.Framework, Version=4.6.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. An operation is not legal in the current state. (0x80131509)
File name: 'Microsoft.ServiceHub.Framework, Version=4.6.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'
 ---> System.InvalidOperationException: Version for 'Microsoft.ServiceHub.Framework, Version=4.5.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' in shared context is older than the version 'Microsoft.ServiceHub.Framework, Version=4.6.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' requested. This is not a supported scenario.
   at Microsoft.ServiceHub.HostLib.SharedLoadContext.Load(AssemblyName assemblyName)
   at ServiceHub.Host.ExtensibilityHostSharedLoadContext.Load(AssemblyName assemblyName)
   at Microsoft.ServiceHub.HostLib.SharedLoadContext.Microsoft.ServiceHub.HostStub.IAssemblyLoader.LoadAssembly(AssemblyName assemblyName)
   at Microsoft.ServiceHub.HostLib.ServiceLoadContext.Load(AssemblyName assemblyName)
   at System.Runtime.Loader.AssemblyLoadContext.ResolveUsingLoad(AssemblyName assemblyName)
   at System.Runtime.Loader.AssemblyLoadContext.Resolve(IntPtr gchManagedAssemblyLoadContext, AssemblyName assemblyName)
   at System.Reflection.RuntimeAssembly.<GetTypeCore>g____PInvoke|26_0(QCallAssembly __assembly_native, Byte* __typeName_native, IntPtr* __nestedTypeNames_native, Int32 __nestedTypeNamesLength_native, ObjectHandleOnStack __retType_native)
   at System.Reflection.RuntimeAssembly.GetTypeCore(QCallAssembly assembly, String typeName, ReadOnlySpan`1 nestedTypeNames, Int32 nestedTypeNamesLength, ObjectHandleOnStack retType)
   at System.Reflection.RuntimeAssembly.GetTypeCore(String typeName, ReadOnlySpan`1 nestedTypeNames, Boolean throwOnError, Boolean ignoreCase)
   at System.Reflection.TypeNameParser.GetType(String typeName, ReadOnlySpan`1 nestedTypeNames, String assemblyNameIfAny)
   at System.Reflection.TypeNameParser.NamespaceTypeName.ResolveType(TypeNameParser& parser, String containingAssemblyIfAny)
   at System.Reflection.TypeNameParser.Parse()
   at System.Reflection.TypeNameParser.GetType(String typeName, Boolean throwOnError, Boolean ignoreCase, Assembly topLevelAssembly)
   at Microsoft.ServiceHub.HostStub.ServiceManager.GetServiceModuleType(ServiceModuleInfo smi)
   --- End of inner exception stack trace ---
   at Microsoft.ServiceHub.HostStub.ServiceManager.GetServiceModuleType(ServiceModuleInfo smi)
   at Microsoft.ServiceHub.HostStub.ServiceManager.StartServiceAsync(ServiceModuleInfo smi, String serviceActivationOptions)
   at Microsoft.ServiceHub.HostLib.Host.StartServiceAsync(ServiceModuleInfo smi, ServiceActivationOptions serviceActivationOptions)
   --- End of inner exception stack trace ---, startService, 6, Newtonsoft.Json.Linq.JToken[]
Microsoft Visual Studio Professional 2022
Version 17.10.5
VisualStudio.17.Release/17.10.5+35122.118
Microsoft .NET Framework
Version 4.8.04161

Installed Version: Professional

Visual C++ 2022   00476-80000-00000-AA830
Microsoft Visual C++ 2022

ASP.NET and Web Tools   17.10.344.38934
ASP.NET and Web Tools

Azure App Service Tools v3.0.0   17.10.344.38934
Azure App Service Tools v3.0.0

Azure Functions and Web Jobs Tools   17.10.344.38934
Azure Functions and Web Jobs Tools

C# Tools   4.10.0-3.24324.8+04fb39164c99c519832109f21b22630bc9246fce
C# components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.

Common Azure Tools   1.10
Provides common services for use by Azure Mobile Services and Microsoft Azure Tools.

Microsoft JVM Debugger   1.0
Provides support for connecting the Visual Studio debugger to JDWP compatible Java Virtual Machines

NuGet Package Manager   6.10.2
NuGet Package Manager in Visual Studio. For more information about NuGet, visit https://docs.nuget.org/

Razor (ASP.NET Core)   17.10.3.2427201+4f57d1de251e654812adde201c0265a8ca7ca31d
Provides languages services for ASP.NET Core Razor.

SQL Server Data Tools   17.10.178.1
Microsoft SQL Server Data Tools

TypeScript Tools   17.0.30327.2001
TypeScript Tools for Microsoft Visual Studio

Visual Basic Tools   4.10.0-3.24324.8+04fb39164c99c519832109f21b22630bc9246fce
Visual Basic components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.

Visual F# Tools   17.10.0-beta.24228.1+dd749058c91585e9b5dae62b0f8df892429ee28f
Microsoft Visual F# Tools
matteo-prosperi commented 1 month ago

I see that you are using VS 17.10 but, looking at the error, I think you are using the VisualStudio.Extensibility 17.11 packages to build the extension. Make sure to use the VisualStudio.Extensibility 17.10 packages if you want to target VS 17.10 and newer. You can find the 17.10 samples in the corresponding branch of this repo.

olegtk commented 1 month ago

@phil1234567891011 please confirm that using 17.10 packages fixes this issue. Thanks!

phil1234567891011 commented 1 month ago

the error is gone, yet the problem persists, nothing happens as I drag drop a file in VS and no breakpoints are reachable

image

image

image

phil1234567891011 commented 4 weeks ago

can anyone on your side repro this issue ? what else could I check to have this example work ?

thanks for your help