Dreamescaper / GenerateAspNetCoreClient

DotNet tool to generate HTTP client classes from ASP.NET Core api controllers.
MIT License
63 stars 5 forks source link

.Net 8 isnt supported #21

Closed valentasm1 closed 9 months ago

valentasm1 commented 9 months ago

After upgrading project to .net8 it stopped working

Time Elapsed 00:00:02.12
Unhandled exception. System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation.
 ---> System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation.
 ---> System.TypeInitializationException: The type initializer for 'System.Net.Quic.MsQuicApi' threw an exception.
 ---> System.TypeLoadException: Could not load type 'ManagedToUnmanagedOut' from assembly 'System.Runtime, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.
   at Interop.Advapi32.RegOpenKeyEx(SafeRegistryHandle hKey, String lpSubKey, Int32 ulOptions, Int32 samDesired, SafeRegistryHandle& hkResult)
   at Microsoft.Win32.RegistryKey.OpenSubKey(String name, Boolean writable)
   at Microsoft.Win32.RegistryKey.OpenSubKey(String name)
   at System.Net.Quic.MsQuicApi.IsTls13Disabled(Boolean isServer)
   at System.Net.Quic.MsQuicApi..cctor()
   --- End of inner exception stack trace ---
   at System.Net.Quic.MsQuicApi.get_IsQuicSupported()
   at System.Net.Quic.QuicListener.get_IsSupported()
   at Microsoft.AspNetCore.Hosting.WebHostBuilderQuicExtensions.UseQuic(IWebHostBuilder hostBuilder)
   at Microsoft.AspNetCore.Hosting.WebHostBuilderQuicExtensions.UseQuic(IWebHostBuilder hostBuilder, Action`1 configureOptions)
   at Microsoft.AspNetCore.Hosting.WebHostBuilderKestrelExtensions.UseKestrel(IWebHostBuilder hostBuilder)
   at Microsoft.AspNetCore.Hosting.WebHostBuilderKestrelExtensions.UseKestrel(IWebHostBuilder hostBuilder, Action`2 configureOptions)
   at Microsoft.AspNetCore.WebHost.ConfigureWebDefaults(IWebHostBuilder builder)
   at Microsoft.Extensions.Hosting.GenericHostBuilderExtensions.<>c__DisplayClass1_0.<ConfigureWebHostDefaults>b__0(IWebHostBuilder webHostBuilder)
   at Microsoft.Extensions.Hosting.GenericHostWebHostBuilderExtensions.ConfigureWebHost(IHostBuilder builder, Func`3 createWebHostBuilder, Action`1 configure, Action`1 configureWebHostBuilder)
   at Microsoft.Extensions.Hosting.GenericHostWebHostBuilderExtensions.ConfigureWebHost(IHostBuilder builder, Action`1 configure, Action`1 configureWebHostBuilder)
   at Microsoft.Extensions.Hosting.GenericHostBuilderExtensions.ConfigureWebHostDefaults(IHostBuilder builder, Action`1 configure, Action`1 configureOptions)
   at Microsoft.Extensions.Hosting.GenericHostBuilderExtensions.ConfigureWebHostDefaults(IHostBuilder builder, Action`1 configure)
   at Product.Program.CreateHostBuilder(String[] args) in C:\src\Product\Program.cs:line 41
   at System.RuntimeMethodHandle.InvokeMethod(Object target, Void** arguments, Signature sig, Boolean isConstructor)
   at System.Reflection.MethodInvoker.Invoke(Object obj, IntPtr* args, BindingFlags invokeAttr)
   --- End of inner exception stack trace ---
   at System.Reflection.MethodInvoker.Invoke(Object obj, IntPtr* args, BindingFlags invokeAttr)
   at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
   at System.Reflection.MethodBase.Invoke(Object obj, Object[] parameters)
   at GenerateAspNetCoreClient.Command.ServiceProviderResolver.GetServiceProvider(Assembly assembly) in /home/runner/work/GenerateAspNetCoreClient/GenerateAspNetCoreClient/GenerateAspNetCoreClient.Command/ServiceProviderResolver.cs:line 62
   at GenerateAspNetCoreClient.Command.GenerateClientCommand.GetApiExplorer(Assembly assembly, String environment) in /home/runner/work/GenerateAspNetCoreClient/GenerateAspNetCoreClient/GenerateAspNetCoreClient.Command/GenerateClientCommand.cs:line 40
   at GenerateAspNetCoreClient.Command.GenerateClientCommand.Invoke(Assembly assembly, GenerateClientOptions options) in /home/runner/work/GenerateAspNetCoreClient/GenerateAspNetCoreClient/GenerateAspNetCoreClient.Command/GenerateClientCommand.cs:line 19
   at System.RuntimeMethodHandle.InvokeMethod(Object target, Void** arguments, Signature sig, Boolean isConstructor)
   at System.Reflection.MethodInvoker.Invoke(Object obj, IntPtr* args, BindingFlags invokeAttr)
   --- End of inner exception stack trace ---
   at System.Reflection.MethodInvoker.Invoke(Object obj, IntPtr* args, BindingFlags invokeAttr)
   at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
   at System.Reflection.MethodBase.Invoke(Object obj, Object[] parameters)
   at GenerateAspNetCoreClient.Program.CreateClient(GenerateClientOptions options) in /home/runner/work/GenerateAspNetCoreClient/GenerateAspNetCoreClient/GenerateAspNetCoreClient/Program.cs:line 34
   at GenerateAspNetCoreClient.Program.<>c.<Main>b__0_0(GenerateClientOptions options) in /home/runner/work/GenerateAspNetCoreClient/GenerateAspNetCoreClient/GenerateAspNetCoreClient/Program.cs:line 18
   at CommandLine.ParserResultExtensions.WithParsed[T](ParserResult`1 result, Action`1 action)
   at GenerateAspNetCoreClient.Program.Main(String[] args) in /home/runner/work/GenerateAspNetCoreClient/GenerateAspNetCoreClient/GenerateAspNetCoreClient/Program.cs:line 16
valentasm1 commented 9 months ago

I think it is related https://github.com/Dreamescaper/GenerateAspNetCoreClient/pull/20

Dreamescaper commented 9 months ago

I have published v2.0 to nuget. Please let me know if you have any issues! https://www.nuget.org/packages/GenerateAspNetCoreClient.Refit/2.0.0

valentasm1 commented 9 months ago

It works now. Thank you for fast response