C1Flex "SerializationException" when appyling theme and style has DataMap

Posted by: wknauf on 24 March 2024, 7:20 am EST

    • Post Options:
    • Link

    Posted 24 March 2024, 7:20 am EST

    This seems to be caused by the change for fixing https://developer.mescius.com/forums/winforms-edition/applying-theme-to-c1flexgrid-resets-cellstyle-datamap - now “CellStyle.BuildString” tries to serialize a DataMap. But in my sample, the datamap items are not serializable.

    This causes a crash with .643 - see attached sample FlexColDataType.zip:

    System.Reflection.TargetInvocationException
      HResult=0x80131604
      Message=Exception has been thrown by the target of an invocation.
      Source=System.Private.CoreLib
      StackTrace:
       at System.RuntimeMethodHandle.InvokeMethod(Object target, Span`1& arguments, Signature sig, Boolean constructor, Boolean wrapExceptions)
       at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) in /_/src/coreclr/System.Private.CoreLib/src/System/Reflection/RuntimeMethodInfo.cs:line 435
      This exception was originally thrown at this call stack:
        System.Runtime.Serialization.FormatterServices.InternalGetSerializableMembers(System.Type) in FormatterServices.cs
        System.Runtime.Serialization.FormatterServices.GetSerializableMembers.AnonymousMethod__5_0(System.Runtime.Serialization.MemberHolder) in FormatterServices.cs
        System.Collections.Concurrent.ConcurrentDictionary<TKey, TValue>.GetOrAdd(TKey, System.Func<TKey, TValue>)
        System.Runtime.Serialization.FormatterServices.GetSerializableMembers(System.Type, System.Runtime.Serialization.StreamingContext) in FormatterServices.cs
        System.Runtime.Serialization.Formatters.Binary.WriteObjectInfo.InitMemberInfo() in WriteObjectInfo.cs
        System.Runtime.Serialization.Formatters.Binary.WriteObjectInfo.InitSerialize(object, System.Runtime.Serialization.ISurrogateSelector, System.Runtime.Serialization.StreamingContext, System.Runtime.Serialization.Formatters.Binary.SerObjectInfoInit, System.Runtime.Serialization.IFormatterConverter, System.Runtime.Serialization.Formatters.Binary.ObjectWriter, System.Runtime.Serialization.SerializationBinder) in WriteObjectInfo.cs
        System.Runtime.Serialization.Formatters.Binary.ObjectWriter.Write(System.Runtime.Serialization.Formatters.Binary.WriteObjectInfo, System.Runtime.Serialization.Formatters.Binary.NameInfo, System.Runtime.Serialization.Formatters.Binary.NameInfo) in ObjectWriter.cs
        System.Runtime.Serialization.Formatters.Binary.ObjectWriter.WriteArrayMember(System.Runtime.Serialization.Formatters.Binary.WriteObjectInfo, System.Runtime.Serialization.Formatters.Binary.NameInfo, object) in ObjectWriter.cs
        System.Runtime.Serialization.Formatters.Binary.ObjectWriter.WriteArray(System.Runtime.Serialization.Formatters.Binary.WriteObjectInfo, System.Runtime.Serialization.Formatters.Binary.NameInfo, System.Runtime.Serialization.Formatters.Binary.WriteObjectInfo) in ObjectWriter.cs
        System.Runtime.Serialization.Formatters.Binary.ObjectWriter.Write(System.Runtime.Serialization.Formatters.Binary.WriteObjectInfo, System.Runtime.Serialization.Formatters.Binary.NameInfo, System.Runtime.Serialization.Formatters.Binary.NameInfo) in ObjectWriter.cs
        ...
        [Call Stack Truncated]
    Inner Exception 1:
    SerializationException: Type 'FlexColDataType.MyData' in Assembly 'FlexColDataType, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' is not marked as serializable.
    

    Making our DataMap data serializable is not really an option…

    My suggestion would be to store the DataMap content in some variable in C1FlexGrid.ThemeChanged and restore if afterwards instead of relying on the style string.

    And my own workaround will be to reset the datamap before applying a theme.

    Best regards

    Wolfgang

  • Posted 26 March 2024, 3:55 am EST

    Hi Wolfgang,

    Thank you for sharing all the details. We have escalated the issue to the development team to get their insights on this and will let you know as soon as possible.

    [Internal Tracking ID: C1WIN-31881]

    Best Regards,

    Kartik

  • Posted 3 June 2024, 5:56 am EST

    Hi Kartik,

    any roadmap for this?

    Best regards

    Wolfgang

  • Posted 3 June 2024, 9:01 am EST

    Hi Wolfgang,

    We are discussing the issue with the development team to get an ETA. We will let you know as soon as possible.

    Kind Regards,

    Kartik

  • Posted 3 June 2024, 11:48 pm EST

    Hi Wolfgang,

    As per the development team, this issue needs a little more research to determine if it can be completely fixed or not. They have provide an estimate of 2024v1 HF1/HF2 release for the fix.

    Thank you for your patience.

    Kind Regards,

    Kartik

  • Posted 10 July 2024, 5:45 am EST

    Hi Wolfgang,

    We are pleased to inform you that the issue has been resolved in the latest 2024v1 HF1 (664) release.

    Best Regards,

    Kartik

  • Posted 10 July 2024, 2:40 pm EST

    Thanks, I can confirm that the DataMap is not affected by setting a theme any more, and no crash occurs any longer

    Best regards

    Wolfgang

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels