Open NeelamYangal opened 2 months ago
Facing same issue in 112.0.0 version.
The issue can be easily resolved by using the latest .NET SDK (8+)
Also getting this error after upgrading restsharp, site is using .net framework 4.8.1. I can upgrade to Restsharp 111.2.0 but anything later will result in "Generic Types are Invalid".
Are you getting it at runtime or when you build your code?
I get that on runtime on all versions above 111.2.0 using .net framework 4.8.1
Same here, Getting it in the runtime.
Ok, that's not good. I thought you get it at compile time. It's a bummer that the compiler allows it when building for .NET Framework target, but it cannot be executed. It can easily be fixed, it's not required to use generic attributes.
[cid:927fcac1-16bb-4fd1-8010-d5b460536edc]
That would be great if it can be fixed as my client is isn't planning on moving to .net core in the near future. 🙁
From: Alexey Zimarev @.> Sent: 07 November 2024 13:07 To: restsharp/RestSharp @.> Cc: Sam Zubeidi @.>; Comment @.> Subject: Re: [restsharp/RestSharp] Getting [NotSupportedException: Generic types are not valid.] after upgrading version from 110.2.0 -> 112.0.0 (Issue #2264)
Ok, that's not good. I thought you get it at compile time. It's a bummer that the compiler allows it when building for .NET Framework target, but it cannot be executed. It can easily be fixed, it's not required to use generic attributes.
— Reply to this email directly, view it on GitHubhttps://github.com/restsharp/RestSharp/issues/2264#issuecomment-2462194946, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AH4PHUKZOLJEOCLLLENPNS3Z7NQYTAVCNFSM6AAAAABONT3PWGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDINRSGE4TIOJUGY. You are receiving this because you commented.
Issue Description I updated the RestSharp version from 110.2.0 to 112.0.0 and encountered the following issue immediately after the site loads: [NotSupportedException: Generic types are not valid.]
Expected behavior It should work as it did in version 110.2.0. I expect the same behavior even after upgrading.
Stack trace [NotSupportedException: Generic types are not valid.] EPiServer.Framework.Initialization.InitializationModule.EngineExecute(HostType hostType, Action`1 engineAction) +1384 EPiServer.Framework.Initialization.InitializationModule.FrameworkInitialization(HostType hostType) +226 EPiServer.Global..ctor() +42 GMGShop.Web.Global..ctor() +37 ASP.global_asax..ctor() in c:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files\root\5a2314ef\7a3fa5aa\App_global.asax.0.cs:0
[TargetInvocationException: Exception has been thrown by the target of an invocation.] System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandleInternal& ctor, Boolean& bNeedSecurityCheck) +0 System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, StackCrawlMark& stackMark) +142 System.Activator.CreateInstance(Type type, Boolean nonPublic) +107 System.RuntimeType.CreateInstanceImpl(BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes, StackCrawlMark& stackMark) +1473 System.Activator.CreateInstance(Type type, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes) +186 System.Activator.CreateInstance(Type type, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture) +28 System.Web.HttpRuntime.CreateNonPublicInstance(Type type, Object[] args) +80 System.Web.HttpApplicationFactory.GetSpecialApplicationInstance(IntPtr appContext, HttpContext context) +182 System.Web.Hosting.PipelineRuntime.InitializeApplication(IntPtr appContext) +369
[HttpException (0x80004005): Exception has been thrown by the target of an invocation.] System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +532 System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +111 System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +719
Additional Details I investigated further to determine which version might have caused the issue and found that the problem exists with RestSharp version 111.3.0. (If it helps to understand the issue)