This is a migrated thread and some comments may be shown as answers.

Telerik under netcore 3.1 retro-compatibility issue

11 Answers 239 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
David
Top achievements
Rank 1
David asked on 17 Feb 2020, 01:26 PM

Hello,

I currently have a working .netcore 2.2 web project that has telerik 2019.1.115 installed. This project has .netframework 4.7.2 references.

In the process of migrating .netcore from 2.2 to 3.1, we have encountered retro-compatibility issues. From the moment we upgraded our .netcore version, we started getting errors on loading libraries in the startup class on endpoint configuration :

 

"Unable to load one or more of the requested types.\r\nCould not load file or assembly 'System.Data.Linq, Version=4.0.0.0'. The system cannot find the file specified.\r\nCould not load file or assembly 'System.Data.Linq, Version=4.0.0.0'.

 

After alot of investigation, we pinpointed that the combination of .netcore 3.1 and telerik together was causing this problem. After migration to 3.1, if we remove the telerik libraries and references, the endpoints get configured properly and we are able to access the website. When adding back the telerik package, the endpoints immediately fail to configure.

Any help would be appreciated

David

11 Answers, 1 is accepted

Sort by
0
Veselin Tsvetanov
Telerik team
answered on 20 Feb 2020, 10:15 AM

Hello David,

You have mentioned that the project in question uses the 2019.1.115 version of the Telerik UI for ASP.NET Core. Have you tested to upgrade that version to R1 2020.1.114? That is the version that officially provides support for .Net Core 3.1. If you have, and the result is the same, I would like to ask you to send us a small isolated sample replicating the problem. To prepare that you could remove all views, controllers, external and database dependencies from your project and leave a single view with a single controller with very simple content. 

Regards,
Veselin Tsvetanov
Progress Telerik

Get quickly onboarded and successful with Telerik UI for ASP.NET Core with the dedicated Virtual Classroom technical training, available to all active customers.
0
David
Top achievements
Rank 1
answered on 20 Feb 2020, 07:28 PM

Hello Veselin,

Thank you for your reply. I was indeed trying to create a sample project for you to reproduce this issue just yesterday only to find out that this problem only occurs on our .netframework472 library and not in a new one. I tried playing with references with it but unfortunately I don't have enough time on my hands right now so I am postponing the migration to 3.1 to a later date for now.

When we do pick this up once more I will try to remember to post our problem & solution here.

Thanks again

David

0
Veselin Tsvetanov
Telerik team
answered on 25 Feb 2020, 01:45 PM

Hello David,

Thank you for the further information provided. Feel free to write back when you continue migrating to .Net Core 3.1.

Regards,
Veselin Tsvetanov
Progress Telerik

Get quickly onboarded and successful with Telerik UI for ASP.NET Core with the dedicated Virtual Classroom technical training, available to all active customers.
0
David
Top achievements
Rank 1
answered on 09 Nov 2020, 08:52 PM

Hello,

So I am back on the .netcore 3.1 migration and I'm having the same issues as I used to have. I will work on a sample project to submit but for now here is what I've done :

  1. Created a new sample .net core 3.1 web app project
  2. Imported my legacy library as a dependency
  3. Hit play
  4. Site runs fine

 

  1. Created a new sample Telerik .netcore 3.1 v2020.3.1021 web app project
  2. Imported my legacy library as a dependency
  3. Hit play
  4. Site crashes on startup

 

Screenshots in attachment.

Does Telerik pre-load or pre-validate imported libraries?

The library in question is pretty big and has some legacy (notably .DBML data context (System.data.linq)) references but those are not used in the .netcore website.

We do not have this problem with .netcore 2.2 and Telerik 2019.1.220

Any help would be appreciated

Thank you very much!

David

0
David
Top achievements
Rank 1
answered on 10 Nov 2020, 06:54 PM

Here is the stacktrace returned by the error above.

I don't see any Kendo references in the mix but when I remove the Telerik libraries from the project, the error does not occur.

I couldn't replicate the issue in a sample project just yet.

at System.Reflection.RuntimeModule.GetTypes(RuntimeModule module)
at System.Reflection.RuntimeAssembly.get_DefinedTypes()
at Microsoft.AspNetCore.Mvc.ApplicationParts.AssemblyPart.get_Types()
at Microsoft.AspNetCore.Mvc.Controllers.ControllerFeatureProvider.PopulateFeature(IEnumerable`1 parts, ControllerFeature feature)
at Microsoft.AspNetCore.Mvc.ApplicationParts.ApplicationPartManager.PopulateFeature[TFeature](TFeature feature)
at Microsoft.AspNetCore.Mvc.ApplicationModels.ControllerActionDescriptorProvider.GetControllerTypes()
at Microsoft.AspNetCore.Mvc.ApplicationModels.ControllerActionDescriptorProvider.GetDescriptors()
at Microsoft.AspNetCore.Mvc.ApplicationModels.ControllerActionDescriptorProvider.OnProvidersExecuting(ActionDescriptorProviderContext context)
at Microsoft.AspNetCore.Mvc.Infrastructure.DefaultActionDescriptorCollectionProvider.UpdateCollection()
at Microsoft.AspNetCore.Mvc.Infrastructure.DefaultActionDescriptorCollectionProvider.Initialize()
at Microsoft.AspNetCore.Mvc.Infrastructure.DefaultActionDescriptorCollectionProvider.GetChangeToken()
at Microsoft.AspNetCore.Mvc.Routing.ActionEndpointDataSourceBase.<>c__DisplayClass11_0.<Subscribe>b__0()
at Microsoft.Extensions.Primitives.ChangeToken.ChangeTokenRegistration`1..ctor(Func`1 changeTokenProducer, Action`1 changeTokenConsumer, TState state)
at Microsoft.Extensions.Primitives.ChangeToken.OnChange(Func`1 changeTokenProducer, Action changeTokenConsumer)
at Microsoft.AspNetCore.Mvc.Routing.ActionEndpointDataSourceBase.Subscribe()
at Microsoft.AspNetCore.Mvc.Routing.ControllerActionEndpointDataSource..ctor(IActionDescriptorCollectionProvider actions, ActionEndpointFactory endpointFactory)
at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor, Boolean wrapExceptions)
at System.Reflection.RuntimeConstructorInfo.Invoke(BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitConstructor(ConstructorCallSite constructorCallSite, RuntimeResolverContext context)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSiteMain(ServiceCallSite callSite, TArgument argument)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitCache(ServiceCallSite callSite, RuntimeResolverContext context, ServiceProviderEngineScope serviceProviderEngine, RuntimeResolverLock lockType)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitRootCache(ServiceCallSite singletonCallSite, RuntimeResolverContext context)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSite(ServiceCallSite callSite, TArgument argument)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.Resolve(ServiceCallSite callSite, ServiceProviderEngineScope scope)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.DynamicServiceProviderEngine.<>c__DisplayClass1_0.<RealizeService>b__0(ServiceProviderEngineScope scope)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.ServiceProviderEngine.GetService(Type serviceType, ServiceProviderEngineScope serviceProviderEngineScope)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.ServiceProviderEngineScope.GetService(Type serviceType)
at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService(IServiceProvider provider, Type serviceType)
at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService[T](IServiceProvider provider)
at Microsoft.AspNetCore.Builder.ControllerEndpointRouteBuilderExtensions.GetOrCreateDataSource(IEndpointRouteBuilder endpoints)
at Microsoft.AspNetCore.Builder.ControllerEndpointRouteBuilderExtensions.MapControllerRoute(IEndpointRouteBuilder endpoints, String name, String pattern, Object defaults, Object constraints, Object dataTokens)
at Test.Telerik.App.Web.Startup.<>c.<Configure>b__5_0(IEndpointRouteBuilder endpoints) in C:\test\Test.Telerik.App.Web\Startup.cs:line 63
at Microsoft.AspNetCore.Builder.EndpointRoutingApplicationBuilderExtensions.UseEndpoints(IApplicationBuilder builder, Action`1 configure)
at Test.Telerik.App.Web.Startup.Configure(IApplicationBuilder app, IWebHostEnvironment env) in C:\test\Test.Telerik.App.Web\Startup.cs:line 61
at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor, Boolean wrapExceptions)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at Microsoft.AspNetCore.Hosting.ConfigureBuilder.Invoke(Object instance, IApplicationBuilder builder)
at Microsoft.AspNetCore.Hosting.ConfigureBuilder.<>c__DisplayClass4_0.<Build>b__0(IApplicationBuilder builder)
at Microsoft.AspNetCore.Hosting.GenericWebHostBuilder.<>c__DisplayClass13_0.<UseStartup>b__2(IApplicationBuilder app)
at Microsoft.AspNetCore.Mvc.Filters.MiddlewareFilterBuilderStartupFilter.<>c__DisplayClass0_0.<Configure>g__MiddlewareFilterBuilder|0(IApplicationBuilder builder)
at Microsoft.AspNetCore.Server.IIS.Core.IISServerSetupFilter.<>c__DisplayClass2_0.<Configure>b__0(IApplicationBuilder app)
at Microsoft.AspNetCore.HostFilteringStartupFilter.<>c__DisplayClass0_0.<Configure>b__0(IApplicationBuilder app)
at Microsoft.AspNetCore.Hosting.GenericWebHostService.<StartAsync>d__31.MoveNext()
0
Veselin Tsvetanov
Telerik team
answered on 12 Nov 2020, 02:09 PM

Hello David,

Thank you for the additional information provided.

I am afraid we are not aware of an issue as described. That is why I will need to be able to reproduce and troubleshoot locally the problem in question. Therefore, I will be waiting for the sample that would allow me to isolate the cause for the error in question.

Regards,
Veselin Tsvetanov
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

0
David
Top achievements
Rank 1
answered on 12 Nov 2020, 03:10 PM

Hello Veselin,

This morning I was able to reproduce the issue I'm having. Unfortunately simply reproducing it didn't help me solve the problem I'm having.

I tried to attach a sample project but it is too large. I have instead attached only the two classes contained inside the test library.

What I have done to reproduce : 

  1. Create a new Telerik Web App in .netcore 3.1 v2020.3.1021
  2. Create a new .net framework 4.7.2 library
  3. Add System.dada.linq, System.configuration and a copy of Kendo.mvc.dll as dependencies to the Library.
  4. Add a project dependency on the web app to the library
  5. Create Class1 in Library using only legacy technologies
  6. Create Class2 in Library referencing Kendo for Data queries
  7. Start the application, crash on startup.

Thank you for helping me out on this!

David

0
David
Top achievements
Rank 1
answered on 12 Nov 2020, 03:14 PM
Here is a screenshot of the solution for your convenience
0
Veselin Tsvetanov
Telerik team
answered on 17 Nov 2020, 10:24 AM

Hello David,

Thank you for the sample provided and for the detailed explanation of the case.

As far as I can understand, you are using the Kendo.Mvc.dll distributed with the Telerik UI for ASP.NET Core 3.1 application to be referenced and used in a .Net Framework 4.7.2 class library. If that is the case, I am afraid the attempted would not work because the .Net Core 3.1 app and respectively the Kendo.Mvc.dll for a .Net Core 3.1 app implement .NET Standard 2.1. .Net Framework 4.7.2, however, implements .NET Standard 2.0, which is also implemented in .Net Core 2.x. The reason for not facing issues in the previous application (Core 2.2) is the fact that both .Net Framework 4.7.2 and .Net Core app 2.2 implement the same .NET Standard. Further information on the .NET Stanard implementation support could be found here:

https://docs.microsoft.com/en-us/dotnet/standard/net-standard#net-implementation-support

As per the scenario in question, you should choose one of the following options:

- Keep the Web app as .Net Core 2.2 app and keep the Class library as it is;

- Migrate the Web app to .Net Core 3.1 app (as you did) and migrate the Class library to either .NET Standard Class library (2.1+) or to .Net Core Class library (3.1). Note that is such a case there will be some changes in the Class library implementation. For example, the ChangeAction enum is no longer present in .Net Core.

Regards,
Veselin Tsvetanov
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

0
David
Top achievements
Rank 1
answered on 17 Nov 2020, 04:56 PM

Thank you for the reply, I understand what you are saying. I will update in the following days on the approach we choose to overcome this issue with.

David

0
Veselin Tsvetanov
Telerik team
answered on 20 Nov 2020, 02:26 PM

Hi David,

Take your time to resolve the discussed and let me know if you have any further questions on that.

Regards,
Veselin Tsvetanov
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

Tags
General Discussions
Asked by
David
Top achievements
Rank 1
Answers by
Veselin Tsvetanov
Telerik team
David
Top achievements
Rank 1
Share this question
or