TargetParameterCountException

Feb 28, 2014 at 10:40 PM
YAXSerializer serializer = new YAXSerializer(typeof(Class1));
Class1 testCase = new Class1();
string someString = serializer.Serialize(testCase);

 public  class Class1
    {
      ModelVisual3D _vis3d = new ModelVisual3D();
      public ModelVisual3D Vis3d
      {
          get
          {
              return _vis3d;
          }
          set
          {
              if (value != _vis3d)
              {
                  _vis3d = value;
              }
          }
      }
    }
The above fails at:
private XElement MakeBaseElement(XElement insertionLocation, XName name, object value, out bool alreadyAdded)
{
...
                XElement elem = ser.SerializeBase(value, name);
...
}
with a System.Reflection.TargetParameterCountException.

I was trying this for the first time so might have made some mistake. Still it is unhandled by YAX.
Coordinator
Mar 1, 2014 at 8:25 AM
Is there any way I can see the definition for ModelVisual3D?
Mar 1, 2014 at 9:55 AM
It's in System.Windows.Media.Media3D.
Mar 10, 2014 at 5:57 PM
I did wonder if there was any information?
Coordinator
Mar 15, 2014 at 11:21 AM
Edited Mar 15, 2014 at 11:22 AM
The problem is that YAXLib tries to serialize/deserialize indexer properties, which it shouldn't. I fixed the issue which will be available in 2.13 binary. Meanwhile you can build the latest source code and use it:
https://yaxlib.codeplex.com/SourceControl/latest
Mar 16, 2014 at 11:11 PM
That is great news, thanks - now hopefully won't have to revisit the nightmare that is binary serialisation of DependencyObjects :-)