Quantcast
Channel: Community | MonoGame - Latest topics
Viewing all articles
Browse latest Browse all 6821

Potential Bug with IntermediateSerializer

$
0
0

@CaliCoder wrote:

Hi

Two potential bugs with IntermediateSerializer. Im basing this off Shawn Hargreaves sumary of the XNA implementation here

1) Get and Set not public
In XNA, the following property would not be serialized or de-serialized because only the get is public, the set is not implemented.

public override Type ObjectSpawnClass { get { return typeof(RpgLibrary.SomeClass); } }

With the 3.6 install, Intermediate Serializer throws a "Exception thrown: 'System.NotImplementedException' in MonoGame.Framework.Content.Pipeline.dll" with "Unhandled primitive typeSystem.IntPtr!""

Adding a [ContentSerializerIgnore] is a simple workaround.

2) [ContentSerializer(Optional = true)] not respected
The attribute [ContentSerializer(Optional = true)] applied to a object property does not appear to be respected when serializing a class where that object is null. Instead it will attempt to serialize the null object and throw a confusing "System.Reflection.TargetException" exception. XNA did not work this way, that property was skipped during serialization.

This was a very handy feature. When adding a new object to a class, its not viable to manually fixup 100's of data files. Rather, I would add that class, flag it as optional then fixup the data files as time allowed.

Thanks!

Posts: 2

Participants: 2

Read full topic


Viewing all articles
Browse latest Browse all 6821

Trending Articles