Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

无法序列化 ResourceImage #500

Closed
ForteScarlet opened this issue Nov 10, 2022 · 1 comment
Closed

无法序列化 ResourceImage #500

ForteScarlet opened this issue Nov 10, 2022 · 1 comment
Assignees
Labels
bug 这是个BUG

Comments

@ForteScarlet
Copy link
Member

版本号

v3.0.0

附加版本

No response

问题描述

Messages 序列化模块中没有 ResourceImage 的多态信息

复现方式

val json = j.encodeToString(Messages.serializer, buildMessages {
+File("1").toResource().toImage()
})

相关日志

Class 'ResourceImage' is not registered for polymorphic serialization in the scope of 'Element'.
Mark the base class as 'sealed' or register the serializer explicitly.
kotlinx.serialization.SerializationException: Class 'ResourceImage' is not registered for polymorphic serialization in the scope of 'Element'.
Mark the base class as 'sealed' or register the serializer explicitly.

其他补充

No response

@ForteScarlet ForteScarlet added bug 这是个BUG v3 labels Nov 10, 2022
@ForteScarlet ForteScarlet self-assigned this Nov 10, 2022
@ForliyScarlet ForliyScarlet added the 等待确认 等待负责人员的确认 label Nov 10, 2022
@ForteScarlet ForteScarlet removed the 等待确认 等待负责人员的确认 label Nov 10, 2022
@ForteScarlet
Copy link
Member Author

ResourceImage 可以序列化,但是存在限制和条件,并且不可靠。不建议直接对 ResourceImage 进行序列化。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 这是个BUG
Projects
None yet
Development

No branches or pull requests

2 participants