Bug Report T1275284
Visible to All Users

MongoDBDataSource - TargetException ('Object does not match target type') occurs when sorting records of different schemas

created 2 months ago (modified 2 months ago)

Steps to reproduce:

The collection being used contains fields like the following:

Code
{ "NameUser": "Pepe", "createdBy": { "_id": "123", "name": "Test 1", "profileId": "123 User" } }

In the dataset, createdBy is not guaranteed to exist for every record. Some records have it, while others do not.

Current results:

When sorting by a nested field (such as createdBy.profileId), the following issue occurs:

Instead of correctly handling the null or missing createdBy field, the sorting operation ignores all applied filters (e.g., city: "New York") and displays the entire collection's data without any restrictions.

Expected results:

Sorting by a valid field should not clear out/invalide the current filter expression, even if certain bound data records do not contain a given property path.

Call Stack
System.Private.CoreLib.dll!System.Reflection.MethodInvokerCommon.ValidateInvokeTarget(object target, System.Reflection.MethodBase method) Unknown System.ComponentModel.TypeConverter.dll!System.ComponentModel.ReflectPropertyDescriptor.GetValue(object component) Unknown DevExpress.Printing.v24.2.Core.dll!DevExpress.XtraReports.Native.Data.RelatedPropertyDescriptor.GetValue(object component) Unknown DevExpress.Data.v24.2.dll!DevExpress.Data.Helpers.BaseListDataControllerHelper.GetGetRowValueCore.AnonymousMethod__0(int i) Unknown DevExpress.Data.v24.2.dll!DevExpress.Data.Helpers.BaseListDataControllerHelper.GetGetRowValueCore.AnonymousMethod__4(int i) Unknown DevExpress.Data.v24.2.dll!DevExpress.Data.VisibleListSourceRowCollection.crtp_ValuesGetterCacheBuilderImpl<string>.CreateFullyCachedCacheLoaderIdentity.AnonymousMethod__0(System.Collections.Generic.IEnumerable<int> handles) Unknown DevExpress.Data.v24.2.dll!DevExpress.Data.VisibleListSourceRowCollection.SortRows(DevExpress.Data.Helpers.DataColumnSortInfo[] sortInfo) Unknown DevExpress.Data.v24.2.dll!DevExpress.Data.DataController.DoSortRows() Unknown DevExpress.Data.v24.2.dll!DevExpress.Data.DataController.DoRefreshDataOperations() Unknown DevExpress.Data.v24.2.dll!DevExpress.Data.DataController.OnRefresh(bool useRowsKeeper) Unknown DevExpress.Data.v24.2.dll!DevExpress.Data.DataController.DoRefreshCore(bool useRowsKeeper) Unknown DevExpress.Data.v24.2.dll!DevExpress.Data.DataController.DoRefresh(bool useRowsKeeper) Unknown DevExpress.Data.v24.2.dll!DevExpress.Data.DataControllerBase.DoRefresh() Unknown DevExpress.Data.v24.2.dll!DevExpress.Data.DataController.EndUpdateCore(bool sortUpdate) Unknown DevExpress.Data.v24.2.dll!DevExpress.Data.DataControllerBase.EndUpdate() Unknown DevExpress.Data.v24.2.dll!DevExpress.Data.DataController.UpdateSortGroup(DevExpress.Data.Helpers.DataColumnSortInfo[] sortInfo, int groupCount, DevExpress.Data.Helpers.SummarySortInfo[] summaryInfo) Unknown DevExpress.XtraReports.v24.2.dll!DevExpress.XtraReports.Native.Data.SortedListController.GroupData(DevExpress.XtraReports.UI.IGroupField[] groupFields) Unknown DevExpress.XtraReports.v24.2.dll!DevExpress.XtraReports.Native.Data.SortedListController.UpdateCore() Unknown DevExpress.XtraReports.v24.2.dll!DevExpress.XtraReports.Native.Data.SortedListController.Initialize(DevExpress.XtraReports.UI.IGroupField[] groupFields, DevExpress.XtraReports.UI.XRGroupSortingSummary[] sortingSummary, DevExpress.Data.Filtering.CriteriaOperator filterCriteria) Unknown DevExpress.XtraReports.v24.2.dll!DevExpress.XtraReports.UI.XtraReportBase.InitializeSortedController(DevExpress.Data.Browsing.ListBrowser listBrowser) Unknown

Answers approved by DevExpress Support

created 21 days ago

We have addressed the issue described in this ticket and will include a fix in our next maintenance update. Should you need to apply our fix prior to official release, you can request a hotfix here.

Important Notes:

  • Hotfixes may be unavailable for Early Access/Beta builds or updates set for release within a week.
  • .NET only: in the NuGet Package Manager, use your personal NuGet feed and check the "Include prerelease" option to view the hotfix package in the "Updates" tab.

    Disclaimer: The information provided on DevExpress.com and affiliated web properties (including the DevExpress Support Center) is provided "as is" without warranty of any kind. Developer Express Inc disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.

    Confidential Information: Developer Express Inc does not wish to receive, will not act to procure, nor will it solicit, confidential or proprietary materials and information from you through the DevExpress Support Center or its web properties. Any and all materials or information divulged during chats, email communications, online discussions, Support Center tickets, or made available to Developer Express Inc in any manner will be deemed NOT to be confidential by Developer Express Inc. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.