MAUI - Exception "Object reference not set to an instance of an object" thrown whenever Compare DataAnnotation is used

Hi, good day everyone.


I'm trying to create an app using MAUI, but every time I attempt to include the "Compare" validation on my model, using System.ComponentModel.DataAnnotations, it results in an exception being thrown at the DataForm, whenever I navigate to the field that has the compare validation and try to type anything on the field.


This exception is unhandled, thus it ends up sending me to App.g.i.cs, without fail.

unhandledexception.jpg


If I remove the "Compare" attribute, no exception is thrown and the field in question, that would use this compare, doesn't throw any exceptions.


I wanted to know if the CompareAttribute is currently not available for Syncfusion on MAUI. I looked up in the documentation (https://help.syncfusion.com/maui/dataform/data-annotationsand couldn't find it there, so I thought that maybe it could still not be supported for MAUI. But then I realized that RegularExpression and EmailAddress annotations are also not in the docs, but are working fine on my project. So now I'm confused on whether or not it's actually supported. Does anyone know?


4 Replies 1 reply marked as answer

SS SaiGanesh Sakthivel Syncfusion Team June 26, 2023 01:18 PM UTC

Hi Mateus,


#Regarding CompareAttribute thrown an exception

We have found and fixed the reported scenario from our end. We will include the issue fix in our weekly nuget release which is expected to roll out on July 4, 2023. We appreciate the patience until then.


Regards,
SaiGanesh Sakthivel


Marked as answer

MM Mateus M. replied to SaiGanesh Sakthivel June 26, 2023 01:42 PM UTC

I see! Thank you for the swift response, I will wait for the update before using the CompareAttribute again.



SS SaiGanesh Sakthivel Syncfusion Team July 4, 2023 11:44 AM UTC

Hi Mateus,


#Regarding CompareAttribute thrown an exception

We have fixed the issue from our end. Due to the testing phase, we have prepared patch including the fix. Before installing the patch, kindly remove bin and obj folders from all the projects of solution and clear NuGet cache.


Please refer our following KB document to clear nuget cache.

https://www.syncfusion.com/kb/6987/how-to-clear-nuget-cache

   

Set Up: https://syncfusion.com/Installs/support/patch/22.1.34/1587300/F183089/SyncfusionPatch_22.1.34_1587300_7042023063320264_F183089.exe

    

Nuget: https://syncfusion.com/Installs/support/patch/22.1.34/1587300/F183089/SyncfusionNuget_22.1.34_1587300_7042023063320264_F183089.zip


Disclaimer:    

Please note that we have created this patch for version 22.1.34 specifically to include the issue.

We will include the issue fix in our weekly nuget release which is expected to roll out on July 11, 2023. We appreciate your patience until then.  


Regards,   

SaiGanesh Sakthivel



VM Vidyalakshmi Mani Syncfusion Team July 12, 2023 08:51 AM UTC

Hi Mateus,

 

We have fixed the reported issue "CompareAttribute thrown an exception" and included the issue fix in our latest Weekly NuGet release update version 22.1.38, which is available for download at nuget.org.

 

We thank you for your support and appreciate your patience in waiting for this update. Please get in touch with us if you require any further assistance.


Loader.
Up arrow icon