Skip to main content

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

The Type Arguments Cannot be Inferred from the Usage

The ComboBox, List Box, and TagBox includes the DataAsync property. It allows you to bind the component to a strongly typed collection that is loaded asynchronously.

The following exception occurs if you declare the DataAsync function with an incorrect signature:

The type arguments for method ‘TypeInference.CreateDxComboBox_0<T>’ cannot be inferred from the usage. Try specifying the type arguments explicitly.

To resolve the issue, ensure that the function signature meets the following requirements:

  • The type of the returned value is Task<IEnumerable<T>>.
  • The function has a parameter of the CancellationToken type.
@using System.Threading;
@using System.Threading.Tasks;

<DxComboBox DataAsync="@GetDataAsync" @bind-Value="@Value" />

@code {
    City Value { get; set; }

    public class City {
        // ...
    }

    public Task<IEnumerable<City>> GetDataAsync(CancellationToken ct = default) {
        // ...
    }
}