[KnownBaseType] does not generate serializer for subtypes?
- Dominant language
- C#
- Stars
- 10.9k
- Forks
- 2.1k
- Avg merge
- 15h 1m
- Merged PRs (30d)
- 345
Description
As [doc ](https://dotnet.github.io/orleans/docs/grains/code_generation.html#generate-serializers-for-all-subtypes) says
> Adding [KnownBaseType] to an interface or class instructs the code generator to generate serialization code for all types which inherit/implement that type.
I have an interface in assembly annotated with `[KnownBaseType]`.
And there is a class in a different assembly implementing this interface.
After successfully compilation, I checked the binary containing the class, there is no serializer generated.
Only if `[Serializable]` annotation is added for this class, serializer is generated.
It seems `[KnownBaseType]` does not work as the document stats?
Both assemblies have the following reference.
all
runtime; build; native; contentfiles; analyzers; buildtransitive
The following screenshot shows the serializer generated when `[Serializable]` is added

The following screenshot shows the serializer is missing when `[Serializable]` is removed; but the class implements an interface annotated with `[KnownBaseType]` from another assembly.

Contributor guide
Assessment
This issue has not been assessed yet.