private static IMarshallingGenerator ValidateByValueMarshalKind(TypePositionInfo info, StubCodeContext context, IMarshallingGenerator generator)
        {
            if (generator is Forwarder)
            {
                // Forwarder allows everything since it just forwards to a P/Invoke.
                return(generator);
            }

            if (info.IsByRef && info.ByValueContentsMarshalKind != ByValueContentsMarshalKind.Default)
            {
                throw new MarshallingNotSupportedException(info, context)
                      {
                          NotSupportedDetails = Resources.InOutAttributeByRefNotSupported
                      };
            }
            else if (info.ByValueContentsMarshalKind == ByValueContentsMarshalKind.In)
            {
                throw new MarshallingNotSupportedException(info, context)
                      {
                          NotSupportedDetails = Resources.InAttributeNotSupportedWithoutOut
                      };
            }
            else if (info.ByValueContentsMarshalKind != ByValueContentsMarshalKind.Default &&
                     !generator.SupportsByValueMarshalKind(info.ByValueContentsMarshalKind, context))
            {
                throw new MarshallingNotSupportedException(info, context)
                      {
                          NotSupportedDetails = Resources.InOutAttributeMarshalerNotSupported
                      };
            }
            return(generator);
        }
 public bool SupportsByValueMarshalKind(ByValueContentsMarshalKind marshalKind, StubCodeContext context)
 {
     return(_manualMarshallingGenerator.SupportsByValueMarshalKind(marshalKind, context));
 }
Example #3
0
 public bool SupportsByValueMarshalKind(ByValueContentsMarshalKind marshalKind, StubCodeContext context) => _inner.SupportsByValueMarshalKind(marshalKind, context);