Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Business Central Cloud "24.1.18927.19282" breaking changes #3003

Closed
MikkelGlerup opened this issue Jun 12, 2024 · 0 comments
Closed

Business Central Cloud "24.1.18927.19282" breaking changes #3003

MikkelGlerup opened this issue Jun 12, 2024 · 0 comments

Comments

@MikkelGlerup
Copy link

Using the client to connect and retrieve data from Business Central Cloud 24.1.18927.19282 will break and throw the error System.InvalidOperationException: 'This operation is only valid on generic types.'

This exception was originally thrown at this call stack:
    System.RuntimeType.GetGenericTypeDefinition() in RuntimeType.cs
    Microsoft.OData.Client.Metadata.ODataTypeInfo.GetKeyProperties()
    Microsoft.OData.Client.Metadata.ODataTypeInfo.KeyProperties.get()
    [Call Stack Truncated]

Assemblies affected

Microsoft.Odata.Client 7.0.0 and up
Microsoft.Odata.Core 7.0.0 and up
Microsoft.Odata.Edm 7.0.0 and up

Reproduce steps

Make any query request with an Odata context to a business Central Cloud version 24.1.18927.19282 and up
var linesQuery = new DataServiceCollection<ExtendedSalesInvoiceLine?>(_CustomApiContext.ExtendedSalesInvoiceLines.Where(s => s.DocumentId == salesOrder.Id));
this line of code will cause this to throw an excpetion

Expected result

A list of SalesInvoiceLines that matches the given id.

Actual result

Code throws exception

This exception was originally thrown at this call stack:
    System.RuntimeType.GetGenericTypeDefinition() in RuntimeType.cs
    Microsoft.OData.Client.Metadata.ODataTypeInfo.GetKeyProperties()
    Microsoft.OData.Client.Metadata.ODataTypeInfo.KeyProperties.get()
    Microsoft.OData.Client.Metadata.ClientTypeUtil.GetKeyPropertiesOnType(System.Type, out bool)
    Microsoft.OData.Client.ClientEdmModel.GetTypeHierarchy(System.Type, out System.Reflection.PropertyInfo[], out bool)
    Microsoft.OData.Client.ClientEdmModel.GetOrCreateEdmType(System.Type)
    Microsoft.OData.Client.ClientEdmModel.CreateEdmProperty(Microsoft.OData.Edm.IEdmStructuredType, System.Reflection.PropertyInfo)
    Microsoft.OData.Client.ClientEdmModel.GetOrCreateEdmTypeInternal.AnonymousMethod__0(Microsoft.OData.Client.Providers.EdmEntityTypeWithDelayLoadedProperties)
    Microsoft.OData.Client.Providers.EdmEntityTypeWithDelayLoadedProperties.EnsurePropertyLoaded()
    Microsoft.OData.Client.Providers.EdmEntityTypeWithDelayLoadedProperties.DeclaredProperties.get()
    ...
    [Call Stack Truncated]

Additional detail

I have tested and confirmed that if the code is run towards version Business Central version 24.0.16410.17628 and below it will work, thus leading me to believe the issue it with Odata.

Business Central will force update all environment latest 15 july.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant