public void CreateArgumentState() { if (IsJniValueType) { var s = marshaler.CreateArgumentState(Value); // Note: Only valid if `Value` isn't 0, so don't do that! Assert.AreNotEqual(new JniArgumentValue(), s.JniArgumentValue); // JniValueMarshaler<T>.CreateArgumentState() for value types only // fills out the JniArgumentValue value, nothing else. Assert.IsFalse(s.ReferenceValue.IsValid); Assert.IsNull(s.PeerableValue); Assert.IsNull(s.Extra); marshaler.DestroyArgumentState(Value, ref s); Assert.AreEqual(new JniValueMarshalerState(), s); } else { var s = marshaler.CreateArgumentState(Value); if (s.PeerableValue != null) { Assert.AreEqual(s.PeerableValue.PeerReference, s.ReferenceValue); } Assert.IsTrue(s.ReferenceValue.IsValid); Assert.AreEqual(new JniArgumentValue(s.ReferenceValue), s.JniArgumentValue); marshaler.DestroyArgumentState(Value, ref s); Assert.AreEqual(new JniValueMarshalerState(), s); } }
public override void DestroyArgumentState(object value, ref JniValueMarshalerState state, ParameterAttributes synchronize) { Int32Marshaler.DestroyArgumentState((value as DemoValueType?)?.Value, ref state, synchronize); }