示例#1
0
        private static int VerifyAndGetStartIndex(string value, Type createMapType)
        {
            var index = 0;

            if (Serializer.EatListStartChar(value, ref index))
            {
                throw new InvalidOperationException(String.Format("Map definitions are not expected to be lists."));
            }

            if (!Serializer.EatMapStartChar(value, ref index))
            {
                //Don't throw ex because some KeyValueDataContractDeserializer don't have '{}'
                Tracer.Instance.WriteDebug("WARN: Map definitions should start with a '{0}', expecting serialized type '{1}', got string starting with: {2}",
                                           JsWriter.MapStartChar, createMapType != null ? createMapType.Name : "Dictionary<,>", value.Substring(0, value.Length < 50 ? value.Length : 50));
            }
            return(index);
        }