Skip to content

Latest commit

 

History

History
74 lines (57 loc) · 3.39 KB

File metadata and controls

74 lines (57 loc) · 3.39 KB
title Using Async Methods with ObjectDataSource
page_title How to Use Async Methods with ObjectDataSource
description Learn how to work with async methods in Telerik Reporting ObjectDataSource when binding data. Async methods are natively supported as of 2026 Q1 (20.0.26.402).
slug objectdatasource-does-not-support-async-methods
tags telerik, reporting, objectdatasource, async, await, task, data binding
published true
type troubleshooting
res_type kb

Environment

Product Progress® Telerik® Reporting
Version Prior to 20.0.26.402

Description

When configuring an ObjectDataSource with an async method that returns a Task<T>, the ObjectDataSource wizard displays Task members (such as AsyncState, CreationOptions, IsCanceled, etc.) instead of the actual data properties.

Cause

In versions prior to 2026 Q1 (20.0.26.402), the ObjectDataSource component does not support async methods. The reporting engine expects synchronous data retrieval and does not automatically await Task objects returned by async methods.

As of Telerik Reporting 2026 Q1 (20.0.26.402), the ObjectDataSource component natively supports async methods that return Task and ValueTask. No workaround is needed for that version and later.

Solution

If you are using Telerik Reporting 2026 Q1 (20.0.26.402) or later, async methods returning Task and ValueTask are supported natively. No changes are required.

If you are using an earlier version and cannot upgrade, use synchronous methods for data retrieval with ObjectDataSource. If you need to work with existing async methods, you can create a synchronous wrapper method:

public class MyData
{
    public int Id { get; set; }
    public string Name { get; set; }

    public static List<MyData> GetData()
    {
        return GetDataAsync().GetAwaiter().GetResult();
    }

    static Task<List<MyData>> GetDataAsync()
    {
        var resultList = new List<MyData>
        {
            new MyData { Id = 1, Name = "One" },
            new MyData { Id = 2, Name = "Two" },
            new MyData { Id = 3, Name = "Three" },
        };

        return Task.FromResult(resultList);
    }
}

In the ObjectDataSource configuration or ObjectDataSource Wizard, use the synchronous GetData() method instead of GetDataAsync().

See Also

  • Update the Designer Configuration File through the UI
  • Connecting the ObjectDataSource Component to a Data Source
  • ObjectDataSource Component