(this answer assumes protobuf-net v2)
If you mean Serializer.PrepareSerializer<T>() , then it will definitely check all child types, so the type model will be prepared for them (which means: it will determine which fields / properties, etc. are required for serialization). It will precompile (i.e. IL-emit) the code for the parent class, but (looking at the code), and not specifically for derived types. If there are no answers, derived types will be compiled when necessary. I think! I can do a thorough check if you really want to.
However, if you use RuntimeTypeModel.Default.CompileInPlace() , it builds the whole model - everything known is ready. Of course, this leaves the dilemma with the need to first talk about them, p
I will double check to see at what point the preparers of serialization subtypes are prepared to be sure. Perhaps it makes sense to cascade them.
Update:
it looks like it does cascade to derived types, but not to the parent type (if any):
[Test] public void CheckTypeSpecificCompileInPlaceCascadesToBaseAndChildTypes() { var model = TypeModel.Create(); model[typeof(B)].CompileInPlace(); Assert.IsTrue(model.IsPrepared(typeof(D)), "D"); // sub-sub-type Assert.IsTrue(model.IsPrepared(typeof(C)), "C"); // sub-type Assert.IsTrue(model.IsPrepared(typeof(B)), "B"); // self Assert.IsTrue(model.IsPrepared(typeof(A)), "A"); // base-type } [Test] public void CheckGlobalCompileInPlaceCascadesToBaseAndChildTypes() { var model = TypeModel.Create(); model.Add(typeof (B), true); // give the model a clue! model.CompileInPlace(); Assert.IsTrue(model.IsPrepared(typeof(D)), "D"); // sub-sub-type Assert.IsTrue(model.IsPrepared(typeof(C)), "C"); // sub-type Assert.IsTrue(model.IsPrepared(typeof(B)), "B"); // self Assert.IsTrue(model.IsPrepared(typeof(A)), "A"); // base-type }
This is where the second test passes; the first test did not specify āAā, so the subtypes (āCā and āDā) were fully compiled. Since the base type will still be compiled on demand, this is probably great, but I could probably make it a path for ancestor types if that were useful.
( IsPrepared method exists only in my local copy)