Corrupted form?

Not sure what's happened, but I have a RadzenTemplateForm that is giving me an error in the designer? The app generates, compiles and runs fine. There are 20 or 30 components in the form, as you can see on the outline. Why am I seeing this "invalid expression term ')'" error?

Something in the form definition has made Radzen generate invalid design time code. We can say more if we reproduce the problem at our side. You can send your application to info@radzen.com.

Ok, I emailed app to info@radzen.com. Are there any logs in Radzen that I can view that might help me narrow down the issue? I opened the meta file for that page and looked through the lines and it looks ok?

I got an error emailing my app from your mail server: info@radzen.com:

SMTP error from remote server for TEXT command, host: mx.zoho.com (136.143.191.44) reason: 552 5.7.1 The attachments you have added violate the Secure Attachment Policy.

This happens if the attachment is too big. Try deleting any bin, obj and wwwroot directories.

We got the application and reproduced the problem. We are now investigating what is causing this problem.

Meanwhile I found a workaround:

  1. Delete the TItem custom attribute.
  2. Create a page property of the desired type.
  3. Set the Data property of the form to the new property.

Then found the cause of the issue - using ${FMUBasicSettings} for TItem. This confuses Radzen that there is a property called FMUBasicSettings (which there isn't). Radzen then removes that property in design time because it does not know about it and it is likely to cause a design time exception. Ironically the opposite happens.

Using just FMUBasicSettings for TItem seems to fix the problem.

By the way if you create a property in Radzen and set the Data of the form to it Radzen should automatically infer the type and avoid the need to manually set TItem as a custom attribute.

Found my problem...I had set the Data to "basicSettings", but it was not a property, just a normal member! I changed it to a property and reset Data, and now the TItem in the razor is set to "dynamic"? I don't understand? I thought it would select "FMUBasicSettings"?

I even manually set the schema to FMUBasicSettings, but the TItem is "dynamic"?

Here's the razor:

<RadzenTemplateForm Data="@basicSettings" TItem="dynamic" Submit="@TemplateForm0Submit" @ref="@templateForm0">

And here's the properties, showing the schema as FMUBasicSettings:

So when I run it, I get this error:

Severity	Code	Description	Project	File	Line	Suppression State
Error	CS0029	Cannot implicitly convert type 'Radzen.Blazor.RadzenTemplateForm<dynamic>' to 'Radzen.Blazor.RadzenTemplateForm<FmuDeviceUi2.Pages.FMUBasicSettings>'	FmuDeviceUi2	C:\dev\prod\FMU\FMU-DeviceUI2\server\Pages\BasicSettings.razor	1	Active

Try my second suggestion. Also you can manually edit the json file to remove the "dynamic" setting.

Radzen currently parses only page properties - regular fields are unknown to it hence type inference does not work.

Yes, I have manually set TItem before...this is what caused my issue in the first place! I can use that to work around.

I just don't understand why using the "Schema" property doesn't generate the correct razor code?? Is this a bug in Radzen?

The Schema property is not used to set TItem.

Oh! How is TItem set, if you don't mind me asking? Where does the TItem value come from then?

I accidentally wiped out this page by clicking the autogen button in Schema...so I had to recover it by restoring a backed up meta json file. And I noticed since I made "basicSettings" a property, when I reset it this time...the TItem was generated as "FMUBasicSettings" as it should be? Not sure why it worked correctly this time, but I guess when you set the Data property, the code generator is supposed to put the datatype of the Data variable in the TItem? I've noticed this doesn't always work? In fact, I removed the Data property completely, and the old Data and TItem values were still in the razor page?

EDIT: nevermind...I already had the TItem attribute in there!

Sorry...I know I'm a pain! You are gonna find that I dive pretty deep into my dev tools and I like to understand how things work "under the covers"!

Thanks!

So I set a blank TItem, and it immediately caused the invalid expression term ')'" error! The generated razor was ok, but the designer blanked out with that error. As long as I know what's up, I can work around this. Thank you guys for all your help!!