BoldSignA modern eSignature application with affordable pricing. Sign up today for unlimited document usage!
Hi, if I try to serialize a SFGrid, with parameter "SerializeColumns" equals to two, this exception is generated:
'Type 'System.RuntimeType' cannot be serialized. Consider marking it with the DataContractAttribute attribute, and marking all of its members you want serialized with the DataMemberAttribute attribute. Alternatively, you can ensure that the type is public and has a parameterless constructor - all public members of the type will then be serialized, and no attributes will be required.'
The class code is as follows:
/// <summary>
///
/// </summary>
[DataContract]
public class ItemSz
{
public ItemSz(Item item, IObjectSpace objSpace)
{
ObjSpace = objSpace;
Item = item;
Oid = item.Oid;
Id = item.Id;
Barcode = item.Barcode;
CreationDate= item.CreationDate;
PurchasePrice = item.PurchasePrice;
}
private IObjectSpace _objSpace;
public IObjectSpace ObjSpace
{
get => _objSpace;
set => _objSpace = value;
}
private Item _item;
public Item Item
{
get => _item;
set => _item = value;
}
private Guid _oid;
public Guid Oid
{
get => _oid;
set => _oid = value;
}
[DataMember]
private string _id;
public string Id
{
get => _id;
set => _id = value;
}
[DataMember]
private string _barcode;
public string Barcode
{
get => _barcode;
set => _barcode = value;
}
[DataMember]
private DateTime _creationDate;
public DateTime CreationDate
{
get => _creationDate;
set => _creationDate = value;
}
[DataMember]
private decimal _purchasePrice;
public decimal PurchasePrice
{
get => _purchasePrice;
set => _purchasePrice = value;
}
}
Hi Saverio,
We are currently checking your reported issue
with the provided information. We will update you with further details on December 22, 2022.
Hi Saverio,
Based on the provided information, we have prepared the sample, but we are unable to replicate the reported issue from our end.
Find the tested sample.
If the issue persists, share us the below things.
1. You are using DataContractAttribute to the Data class, can you specify the use for this?
How you are using this in serialization, and if possible, share the video demonstration.
2. Can you share serialization related code snippets?
3. If possible, modify the attached to reproduce the issue and provide a video illustration of the reported issue.
It will be more helpful for us to check the possibilities for resolving the reported problem.
Hi,
I found the source of the problem.
I have used the property "ColumnMemberType" for some of my columns, for example,
ColumnMemberType = typeof(string)
in a GridTextColumn.
I don't know why, and I'd be interested to know, but removing that line of code the exception is no longer thrown.
I would report this as a bug, unless you have an explanation why it happens.
Saverio,
We
are currently checking your reported scenario with the provided information. We
will update you with further details on December 29, 2022.
Saverio,
We have created a bug report for the reported issue “RuntimeType not support
exception occurs when ColumnMemberType is defined in GridColumn while
serialize”. We will fix this issue and include it in our upcoming Weekly NuGet
release scheduled for January 17, 2023.
You can track the status of this report through the following feedback link,
Feedback Link: https://www.syncfusion.com/feedback/40091/runtimetype-not-support-exception-occurs-when-columnmembertype-is-defined-in
Note: The provided feedback link is private, and you need to login to view this feedback.
Saverio,
We are pleased to inform you that we have resolved the issue of an exception
occurring while serializing a System.RunTimeType property that was reported.
However, we have identified a framework-level issue that occurs while
deserializing the System.RunTimeType property. We have created a query on
GitHub to address this issue.
GitHub Link: https://github.com/dotnet/runtime/issues/80590
We will update you with details once we get the solution from GitHub. We
appreciate your patience until then.