Console app probem: PlatformNotSupportedException
I was using services very successfully in Wpf app, now when i need to use the same client in my console app i got exception : The type initializer for 'MagicOnion.Client.DynamicClient.DynamicClientBuilder`1' threw an exception.' PlatformNotSupportedException: Dynamic code generation is not supported on this platform.
Here is the same code i used in WPF APP: var channel = GrpcChannel.ForAddress("myAddress"); var proxy = MagicOnionClient.Create<IArmatura>(channel)!;
i found solution to my own problem. I just needed to set PublishAot parameter to false instead of true
This issue is stale because it has been open 180 days with no activity. Remove stale label or comment or this will be closed in 30 days.
How do I fix that? I want to use AOT @mayuki
System.PlatformNotSupportedException: Dynamic code generation is not supported on this platform.
at System.Reflection.Emit.AssemblyBuilder.ThrowDynamicCodeNotSupported()
at System.Reflection.Emit.AssemblyBuilder.EnsureDynamicCodeSupported()
at System.Reflection.Emit.AssemblyBuilder.DefineDynamicAssembly(AssemblyName name, AssemblyBuilderAccess access, IEnumerable`1 assemblyAttributes, Assembly callingAssembly)
at MagicOnion.Server.Glue.MagicOnionGlueService.CreateType()
at Microsoft.Extensions.DependencyInjection.MagicOnionServicesExtensions.AddMagicOnionCore(IServiceCollection services, Action`1 configureOptions)
at Microsoft.Extensions.DependencyInjection.MagicOnionServicesExtensions.AddMagicOnion(IServiceCollection services, Action`1 configureOptions)
at Program.<Main>$(String[] args) in E:\Projects\Company_Projects\TeraSync\TeraSync.Service\Program.cs:line 10
At the moment, MagicOnion do not support Native AOT on the server or client. We would like to support it in the future.