var serviceCollection = new ServiceCollection();
serviceCollection.AddAudioBypass();
var api = new VkApi(serviceCollection);
api.Authorize(new ApiAuthParams {
Login = Environment.GetEnvironmentVariable("LOGIN"),
Password = Environment.GetEnvironmentVariable("PASSWORD")
});
Log($"Auth success, userId is {api.UserId}");
В этом коде на строчке var api = new VkApi(serviceCollection); бросает System.TypeLoadException:
System.TypeLoadException: Не удалось загрузить тип "VkNet.Abstractions.IVkApiVersionManager" из сборки "VkNet, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null".
в System.Signature.GetSignature(Void* pCorSig, Int32 cCorSig, RuntimeFieldHandleInternal fieldHandle, IRuntimeMethodInfo methodHandle, RuntimeType declaringType)
в System.Signature..ctor(IRuntimeMethodInfo methodHandle, RuntimeType declaringType)
в System.Reflection.RuntimeConstructorInfo.get_Signature()
в System.Reflection.RuntimeConstructorInfo.GetParametersNoCopy()
в System.Reflection.RuntimeConstructorInfo.GetParameters()
в Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteFactory.CreateConstructorCallSite(Type serviceType, Type implementationType, CallSiteChain callSiteChain)
в Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteFactory.TryCreateExact(ServiceDescriptor descriptor, Type serviceType, CallSiteChain callSiteChain)
в Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteFactory.TryCreateExact(Type serviceType, CallSiteChain callSiteChain)
в Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteFactory.CreateCallSite(Type serviceType, CallSiteChain callSiteChain)
в Microsoft.Extensions.DependencyInjection.ServiceLookup.ServiceProviderEngine.CreateServiceAccessor(Type serviceType)
в System.Collections.Concurrent.ConcurrentDictionary`2.GetOrAdd(TKey key, Func`2 valueFactory)
в Microsoft.Extensions.DependencyInjection.ServiceLookup.ServiceProviderEngine.GetService(Type serviceType, ServiceProviderEngineScope serviceProviderEngineScope)
в Microsoft.Extensions.DependencyInjection.ServiceLookup.ServiceProviderEngine.GetService(Type serviceType)
в Microsoft.Extensions.DependencyInjection.ServiceProvider.GetService(Type serviceType)
в Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService(IServiceProvider provider, Type serviceType)
в Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService[T](IServiceProvider provider)
в VkNet.VkApi.Initialization(IServiceProvider serviceProvider)
в VkNet.VkApi..ctor(IServiceCollection serviceCollection)
в VkAudioTest.MainWindow.ButtonStart_OnClick(Object sender, RoutedEventArgs e) в C:\Users\saber-nyan\Documents\Workspace\Development\Workspaces\C#\VkAudioTest\MainWindow.xaml.cs:строка 25
Причина
В коммите vknet/vk@377ea2cbb51a3f1904a28dc9b149d11cd1fd8c9b файл VkNet/Abstractions/IVkApiVersionManager.cs и несколько других были перемещены в VkNet/Abstractions/Core/IVkApiVersionManager.cs
Описание бага
В этом коде на строчке
var api = new VkApi(serviceCollection);
бросаетSystem.TypeLoadException
:Причина
В коммите vknet/vk@377ea2cbb51a3f1904a28dc9b149d11cd1fd8c9b файл
VkNet/Abstractions/IVkApiVersionManager.cs
и несколько других были перемещены вVkNet/Abstractions/Core/IVkApiVersionManager.cs