Error "Duplicate type name assembly" when two datagrids are used on same page

Hi, I've got an error "duplicate type name within an assembly" when I put two datagrids on same page, see pictures attached.

Thank you,

Regards,


Attachment: Pictures_d60caa10.zip

4 Replies

RR Rajapandi Ravi Syncfusion Team March 17, 2025 10:11 AM UTC

Hi Jose,


Greetings from Syncfusion support


The error "Duplicate type name within an assembly" suggests that there might be a conflict with type definitions. This can happen due to:


  • Conflicting Assemblies: You might have multiple versions of the same assembly referenced in your project.
  • Anonymous Types: If PerformSelect is returning an anonymous type, ToList() might fail due to type ambiguity.
  • Dynamic Object Issues: If PerformSelect returns a dynamic object without a clear type, ToList() will not infer it correctly.


If PerformSelect returns a dynamic object, explicitly cast it to object before calling ToList(): Please refer the below code example for more information.


 

var aggregateResult = ((IEnumerable<object>)operation.PerformSelect(DataSource, str)).ToList();

 


For your convenience, we have prepared a sample with two Grid’s and handle the UrlDataSource method separately for both Grid’s and handled casting to resolve the reported problem. Please refer the below sample for more information.


Sample: Check the attachment.


Please get back to us if you need further assistance.


Regards,

Rajapandi R


Attachment: 196374sample_8299d415.zip


JO Jose March 17, 2025 05:03 PM UTC

Thank you for you kindly response, I've downloaded the sample and is just given me the same error.

Image_8051_1742230613022


I've just noticed that only happens on the first load, if i just accept the error and continue if stay running the app the error doesn't show any more, if you close the app an re run it the error shows (only once).


Thanks






RR Rajapandi Ravi Syncfusion Team March 21, 2025 12:34 PM UTC

Jose,


Thanks for your update.


We have confirmed that the reported scenario is a bug from our side and logged it as “Error "Duplicate Type Name Assembly" Occurs When Using Two DataGrid’s with Aggregates on the Same Page”. Thank you for taking the time to report this issue and helping us improve our product. At Syncfusion, we are committed to fixing all validated defects (subject to technical feasibility and Product Development Life Cycle ) and will include the defect fix in our upcoming patch release which will be rolled out on “April 8th , 2025”.


You can now track the current status of your request, review the proposed resolution timeline, and contact us for any further inquiries through the below link,


Feedback: https://www.syncfusion.com/feedback/66435/error-duplicate-type-name-assembly-occurs-when-using-two-datagrids-with-aggregates


Disclaimer: "Inclusion of this solution in the weekly release may change due to other factors including but not limited to QA checks and works reprioritization".



RR Rajapandi Ravi Syncfusion Team April 10, 2025 04:52 AM UTC

Jose,


Thanks for your patience.


We are glad to announce that, we have included the fix for the issue Error "Duplicate Type Name Assembly" Occurs When Using Two DataGrid’s with Aggregates on the Same Pagein our 29.1.37 release. So please upgrade to our latest version of the Syncfusion package to resolve the reported issue.


Root Cause: The issue occurs due to the createDynamicClass method being triggered within the internal.cs file when executing the performSelect method. Since both DataGrid components use UrlAdaptor and run in parallel, the typeName generated for both grids is not unique. Before the classCount++ operation increments, both URLs are triggered simultaneously, assigning the same type name ("DynamicClass1") to both requests. This results in a "Duplicate Type Name Assembly" error, as the system detects a conflicting class definition.


Solution: Fixed the issue by incrementing classCount++ before creating the dynamic type class, ensuring unique typeName values for each DataGrid instance running in parallel.


Sample: Check the attachment.


Feedback: https://www.syncfusion.com/feedback/66435/error-duplicate-type-name-assembly-occurs-when-using-two-datagrids-with-aggregates


We thank you for your support and appreciate your patience in waiting for this release. Please get back to us if you need any further assistance.


Attachment: 196374sample_e77a3b3a.zip

Loader.
Up arrow icon