Suggestion: How to use some reflection for Registry.cs
?
#2288
Closed
riemannulus
started this conversation in
Ideas
Replies: 3 comments
-
AFAIK, @dahlia wrote this code. Could you have some advice on this suggestion? |
Beta Was this translation helpful? Give feedback.
0 replies
-
|
Beta Was this translation helpful? Give feedback.
0 replies
-
|
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Context
The problem with the current
Registry.cs
is to create a constructor that creates an empty object to deserialize an action.This is problematic for Actions that use non-nullable fields.
The cause of this behavior is that SysAction reflection is implemented by directly creating an empty object during the instantiation process and putting the value into
LoadPlainValue
.libplanet/Libplanet/Action/Sys/Registry.cs
Lines 48 to 49 in 8ff5677
Idea
If we use
Activator.CreateInstance
, maybe solve this problem.I wrote some code for a basic idea. (not tested)
https://gist.github.com/riemannulus/7405e0d361364c6afa0ab433905ae81c
Have any opinion on this issue? @libplanet
Beta Was this translation helpful? Give feedback.
All reactions