kontent-ai / delivery-sdk-net

Kontent.ai Delivery .NET SDK

Home Page:https://www.nuget.org/packages/Kontent.Ai.Delivery

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

.NET 6 Linked Content not populated

ClaytonHunt opened this issue · comments

Brief bug description

In a .NET 6 API, Linked Items are returning as null

Repro steps

  1. Add code to create delivery client
  2. Request a page
  3. Look at Sections property, it will be an Enumerable with the correct number of elements, but all the elements are null

Expected behavior

I would expect Sections to be filled with the linked content objects.

Test environment

  • Platform/OS: Windows, .NET 6
  • Browser: N/A
  • Version: 15.0.1

Additional context

I found this error in a .NET 6 Blazor WASM Hosted project I have started working on

Screenshots

image
image

Hello @ClaytonHunt,

thanks for reaching out. Actually, we are just validating moving from netstandard 2.0 which the SDK currently targets to net 6 (draft in #296) since .NET 6 is about to be released next week.

But this change requires a new major release if we want to be strict since "Support for older frameworks is being dropped, including frameworks older than .NET Framework 4.6.1, .NET Core 3.1, and .NET Standard 2.0", So if we decide to make this change, we will include official .NET 6 support in version 16.


I guess you have scaffolded the app using dotnet new blazorwasm right?

May I also ask for a specific .NET SDK version you are using?

This would help us to create a replicable environment and try to identify the root cause. Or, if you are willing to, you could try the Source Link for debuugin directly from your project.


Assuming the number of sections being returned (13) is correct. My guess is the SDKs does not know the actual type mapping for codename of a type<->model since there is no Type provider registered.

Could you test out registering the type provider? You can generate one by withtypeprovider argument using Kentico.Kontent.ModelGenerator utility.

Thanks for responding. My .NET 6 framework version is: 6.0.100-rc.2.21505.57

I think I have a solution working now. I was missing the WithTypeProvider in the DeliveryClientBuilder configuration. It would be a separate Issue, but just as a heads up for your .NET 6 updates:

I get the following error when using an injected IDeliveryClient
image

Again, I can get the code working and look forward to updating to the latest Kentico version when it is ready for .NET 6