fix: CArchive reading/writing of CVariant used different types for type. Fixes #14744.
[tests] add improved tests of CArchive taking CVariant to verify fix of #14744