/// <summary>
        /// Asynchronously reads a value of property annotation on an error payload.
        /// </summary>
        /// <param name="propertyAnnotationName">The name of the property annotation to read.</param>
        /// <returns>
        /// A task that represents the asynchronous read operation.
        /// The value of the TResult parameter contains the value of the property annotation.
        /// </returns>
        /// <remarks>
        /// This method should read the property annotation value and return a representation of the value which will be later
        /// consumed by the resource reading code, or throw if there is something unexpected.
        ///
        /// Pre-Condition:  JsonNodeType.PrimitiveValue         The value of the property annotation property
        ///                 JsonNodeType.StartObject
        ///                 JsonNodeType.StartArray
        /// Post-Condition: JsonNodeType.EndObject              The end of the error object
        ///                 JsonNodeType.Property               The next property after the property annotation
        /// </remarks>
        private async Task <object> ReadErrorPropertyAnnotationValueAsync(string propertyAnnotationName)
        {
            Debug.Assert(!string.IsNullOrEmpty(propertyAnnotationName), "!string.IsNullOrEmpty(propertyAnnotationName)");
            Debug.Assert(
                propertyAnnotationName.StartsWith(JsonLightConstants.ODataAnnotationNamespacePrefix, StringComparison.Ordinal),
                "The method should only be called with OData. annotations");
            this.AssertJsonCondition(JsonNodeType.PrimitiveValue, JsonNodeType.StartObject, JsonNodeType.StartArray);

            if (string.Equals(propertyAnnotationName, ODataAnnotationNames.ODataType, StringComparison.Ordinal))
            {
                string typeName = ReaderUtils.AddEdmPrefixOfTypeName(
                    ReaderUtils.RemovePrefixOfTypeName(
                        await this.JsonReader.ReadStringValueAsync().ConfigureAwait(false)));

                if (typeName == null)
                {
                    throw new ODataException(Strings.ODataJsonLightPropertyAndValueDeserializer_InvalidTypeName(propertyAnnotationName));
                }

                this.AssertJsonCondition(JsonNodeType.Property, JsonNodeType.EndObject);


                return(typeName);
            }

            throw new ODataException(Strings.ODataJsonLightErrorDeserializer_PropertyAnnotationNotAllowedInErrorPayload(propertyAnnotationName));
        }
        /// <summary>
        /// Reads the 'type' and 'isNull' attributes of a value.
        /// </summary>
        /// <param name="typeName">The value of the 'type' attribute or null if no 'type' attribute exists.</param>
        /// <param name="isNull">The value of the 'isNull' attribute or null if no 'isNull' attribute exists.</param>
        /// <remarks>
        /// Pre-Condition:  XmlNodeType.Element    - The element to read attributes from.
        /// Post-Condition: XmlNodeType.Element    - The element to read attributes from.
        /// </remarks>
        protected void ReadNonEntityValueAttributes(out string typeName, out bool isNull)
        {
            this.AssertXmlCondition(XmlNodeType.Element);
            this.XmlReader.AssertNotBuffering();

            typeName = null;
            isNull   = false;

            while (this.XmlReader.MoveToNextAttribute())
            {
                if (this.XmlReader.NamespaceEquals(this.XmlReader.ODataMetadataNamespace))
                {
                    if (this.XmlReader.LocalNameEquals(this.AtomTypeAttributeName))
                    {
                        // m:type
                        typeName = ReaderUtils.AddEdmPrefixOfTypeName(ReaderUtils.RemovePrefixOfTypeName(this.XmlReader.Value));
                    }
                    else if (this.XmlReader.LocalNameEquals(this.ODataNullAttributeName))
                    {
                        // m:null
                        isNull = ODataAtomReaderUtils.ReadMetadataNullAttributeValue(this.XmlReader.Value);

                        // Once we find m:null we stop reading further since m:null trumps any other
                        // content (attributes or elements)
                        break;
                    }

                    //// Ignore all other attributes in the metadata namespace
                }

                //// Ignore all other attributes in all other namespaces
            }

            this.XmlReader.MoveToElement();
            this.AssertXmlCondition(XmlNodeType.Element);
            this.XmlReader.AssertNotBuffering();
        }