Deserializing a public property with a private setter

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Done
    • Priority: Major - P3
    • None
    • Affects Version/s: 0.5
    • Component/s: None
    • None
    • Environment:
      All
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      A public property with a private setter will throw. E.g::

      public IList<EventSession> Sessions

      { get; private set; }

      Error is occurring inBsonPropertyMapper.cs line 226 because call to propertyInfo.GetSetmethod() is throwing.

      public override Action<object, object> Setter {
      get {
      if (setter == null)

      { var setMethodInfo = propertyInfo.GetSetMethod(); // This throws var setMethodDelegate = (Action<TClass, TProperty>) Delegate.CreateDelegate(typeof(Action<TClass, TProperty>), setMethodInfo); setter = (obj, value) => setMethodDelegate((TClass) obj, (TProperty) value); }

      return setter;
      }
      }

            Assignee:
            Craig Wilson
            Reporter:
            Justin Dearing
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: