-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Add Ts of grain classes that extend Grain<T> to consider for serializer generation #1211
Conversation
{ | ||
includedTypes.Add(type); | ||
if (!grainStateType.IsNested && !grainStateType.IsGenericParameter) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could probably remove the .IsNested
requirement and shift the IsGenericParameter
requirement into SerializerGeneratorManager.RecordTypeToGenerate
if it isn't there already (it should be in there)
LGTM after addressing the comment about deduplication/simplification. Thanks, Sergey :) |
debdec8
to
43ee518
Compare
@ReubenBond Good point. I think I addressed it. In the process I believe I also fixed a bug in |
22:26:36 Test method Tester.CodeGenTests.RuntimeCodeGenerationTests.RuntimeCodeGenNestedGenericTest threw exception: |
Hmm. That's why I was afraid to touch this logic. I'll try to step back a bit as the original version worked. |
43ee518
to
80dbe6b
Compare
I reverted my "bug fix" and added back an explicit check for |
But do we actually have a test that it generates the serializer? All state POCO classes in #1060 are marked with [Serializable]. |
I can't see the broken diff, but did you remove the |
@gabikliot We do have a couple of tests in VSO. They pointed to the issue. Once this is in, I think we should remove [Serializable] from all grain state classes. @ReubenBond What broken diff? I removed the code duplication that you pointed to, by moving the shared code to When I tried to remove the check for |
Add Ts of grain classes that extend Grain<T> to consider for serializer generation
Perhaps I'll look into refactoring the logic at another time, when the VSO tests are all ported and easy to run. |
if (typeInfo.IsSerializable) | ||
RecordType(type, module, targetAssembly, includedTypes); | ||
|
||
Type grainStateType; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
missing an else
here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think so. The grain class may be marked as [Serializable]
, yet it may also have a T
(grainStateType
) that needs to be recorded. An exotic case but not impossible.
This is to help #1060.
Today we generate serializers for grain state classes that extend GrainState. With #1060 any POCO class can represent grain state. This change adds Ts of all classes that extend Grain to consider for serializer generation.