internal static XamlMember ActivityTemplateFactoryBuilderImplementationMember(XamlSchemaContext schemaContext)
        {
            PropertyInfo implementationPropertyInfo = typeof(ActivityTemplateFactoryBuilder).GetProperty(ImplementationPropertyName);

            SharedFx.Assert(implementationPropertyInfo != null, "ActivityTemplateFactoryBuilder.Implementation should be defined as a public property of ActivityTemplateFactoryBuilder.");
            return(new XamlMember(implementationPropertyInfo, schemaContext));
        }
        // there are two kind of attribute:
        // 1) in lined : argument="some value"
        // 2) <argument>
        //       <Expression ....../>
        //    </argument>
        // here, for (1) return the source location of "some value".
        // for (2) return null
        private static SourceLocation GetInlineAttributeValueLocation(LineColumnPair startPoint, SourceTextScanner sourceTextScanner)
        {
            const char SingleQuote             = '\'';
            const char DoubleQuote             = '"';
            const char StartAngleBracket       = '<';
            Tuple <LineColumnPair, char> start = sourceTextScanner.SearchCharAfter(startPoint, SingleQuote, DoubleQuote, StartAngleBracket);

            if (start == null)
            {
                return(null);
            }

            if (start.Item2 == StartAngleBracket)
            {
                return(null);
            }

            Tuple <LineColumnPair, char> end = sourceTextScanner.SearchCharAfter(start.Item1, start.Item2);

            if (end == null)
            {
                SharedFx.Assert("end of SourceLocation is not found");
                return(null);
            }

            return(new SourceLocation(null, start.Item1.LineNumber, start.Item1.ColumnNumber, end.Item1.LineNumber, end.Item1.ColumnNumber));
        }
        private WorkflowSymbol GetWorkflowSymbol(string fileName, object deserializedObject, Dictionary <object, SourceLocation> sourceLocations)
        {
            if (deserializedObject != null)
            {
                Activity deserializedRootElement = GetRootWorkflowElement(deserializedObject);
                if (deserializedRootElement != null)
                {
                    try
                    {
                        deserializedRootElement = GetRootElementForSymbol(deserializedObject, deserializedRootElement);
                        return(new WorkflowSymbol
                        {
                            FileName = fileName,
                            Symbols = SourceLocationProvider.GetSymbols(deserializedRootElement, sourceLocations)
                        });
                    }
                    catch (Exception ex)
                    {
                        if (SharedFx.IsFatal(ex))
                        {
                            throw;
                        }

                        // This happens when the workflow is invalid so GetSymbols fails.
                        // ---- exception here.
                    }
                }
            }

            return(null);
        }
Exemple #4
0
        public override void WriteStartObject(XamlType type)
        {
            switch (this.currentState)
            {
            case ActivityTemplateFactoryBuilderWriterStates.InitialState:
                if (type.Equals(new XamlType(typeof(ActivityTemplateFactoryBuilder), this.schemaContext)))
                {
                    this.queuedNodes  = new XamlNodeQueue(this.schemaContext);
                    this.currentState = ActivityTemplateFactoryBuilderWriterStates.BufferingState;
                }
                else
                {
                    this.currentState = ActivityTemplateFactoryBuilderWriterStates.BypassState;
                    this.underlyingWriter.WriteStartObject(type);
                }

                break;

            case ActivityTemplateFactoryBuilderWriterStates.BypassState:
                this.underlyingWriter.WriteStartObject(type);
                break;

            default:
                SharedFx.Assert(
                    this.currentState == ActivityTemplateFactoryBuilderWriterStates.BufferingState ||
                    this.currentState == ActivityTemplateFactoryBuilderWriterStates.BufferingNameState ||
                    this.currentState == ActivityTemplateFactoryBuilderWriterStates.BufferingTargetTypeState,
                    "These are the only possible ActivityTemplateFactoryBuilderWriterStates.");
                SharedFx.Assert("It is impossible to start any object during the buffering state.");
                break;
            }
        }
Exemple #5
0
        public override void WriteValue(object value)
        {
            switch (this.currentState)
            {
            case ActivityTemplateFactoryBuilderWriterStates.InitialState:
                SharedFx.Assert("It is impossible to write a value during InitialState");
                break;

            case ActivityTemplateFactoryBuilderWriterStates.BufferingState:
                this.queuedNodes.Writer.WriteValue(value);
                break;

            case ActivityTemplateFactoryBuilderWriterStates.BufferingNameState:
                this.className = (string)value;
                break;

            case ActivityTemplateFactoryBuilderWriterStates.BufferingTargetTypeState:
                this.targetType = (string)value;
                break;

            default:
                SharedFx.Assert(
                    this.currentState == ActivityTemplateFactoryBuilderWriterStates.BypassState,
                    "This is the only possible ActivityTemplateFactoryBuilderWriterStates");
                this.underlyingWriter.WriteValue(value);
                break;
            }
        }
        internal static XamlMember ActivityTemplateFactoryImplementationMemberForWriter(XamlSchemaContext schemaContext)
        {
            PropertyInfo implementationPropertyInfo = typeof(ActivityTemplateFactory).GetProperty(ImplementationPropertyName, BindingFlags.Instance | BindingFlags.NonPublic);

            SharedFx.Assert(implementationPropertyInfo != null, "ActivityTemplateFactory.Implementation should be defined as a protected property of ActivityTemplateFactory.");
            return(new XamlMember(implementationPropertyInfo, schemaContext));
        }
        internal static XamlMember ActivityTemplateFactoryBuilderTargetTypeMember(XamlSchemaContext schemaContext)
        {
            PropertyInfo namePropertyInfo = typeof(ActivityTemplateFactoryBuilder).GetProperty(TargetTypePropertyName);

            SharedFx.Assert(namePropertyInfo != null, "ActivityTemplateFactoryBuilder.TargetType should be defined as a public property of ActivityTemplateFactoryBuilder.");
            return(new XamlMember(namePropertyInfo, schemaContext));
        }
Exemple #8
0
        public static void PropagateLineInfo(XamlWriter targetWriter, int lineNumber, int linePosition)
        {
            IXamlLineInfoConsumer consumer = targetWriter as IXamlLineInfoConsumer;

            SharedFx.Assert(consumer != null && consumer.ShouldProvideLineInfo, "Should only call this function to write into a XamlNodeQueue.Writer, which is always IXamlLineInfoConsumer");
            consumer.SetLineInfo(lineNumber, linePosition);
        }
Exemple #9
0
        private ResolverResult(XamlTypeKind kind, ICollection <string> newProperties)
        {
            SharedFx.Assert(kind != XamlTypeKind.PartialSupported || newProperties != null, "newProperties should not be null when kind is XamlTypeKind.PartialSupported");

            this.Kind          = kind;
            this.NewProperties = newProperties;
        }
Exemple #10
0
        private LineColumnPair GetLocation(int index)
        {
            SharedFx.Assert(index >= 0 && index < this.source.Length, "index out of range");

            while (!this.IsIndexInScannedLine(index))
            {
                this.TryScanNextLine();
            }

            int line = this.indexCache.Count - 1;

            for (; line >= 0; --line)
            {
                if (index >= this.indexCache[line].Item1)
                {
                    break;
                }
            }

            SharedFx.Assert(line >= 0, "line < this.indexCache.Count");
            int column = index - this.indexCache[line].Item1;

            SharedFx.Assert(column < this.indexCache[line].Item2, "Should Not Happen");

            return(new LineColumnPair(line + 1, column + 1));
        }
Exemple #11
0
        // This method is a workaround for TFS
        public static void Transform(XamlReader reader, XamlWriter writer, IXamlLineInfo readerLineInfo, bool closeWriter)
        {
            IXamlLineInfoConsumer consumer = writer as IXamlLineInfoConsumer;

            SharedFx.Assert(consumer != null && consumer.ShouldProvideLineInfo, "Should only call this function to write into a XamlNodeQueue.Writer, which is always IXamlLineInfoConsumer");
            bool shouldPassLineNumberInfo = false;

            if (readerLineInfo != null)
            {
                shouldPassLineNumberInfo = true;
            }

            while (reader.Read())
            {
                if (shouldPassLineNumberInfo)
                {
                    consumer.SetLineInfo(readerLineInfo.LineNumber, readerLineInfo.LinePosition);
                }

                writer.WriteNode(reader);
            }

            if (closeWriter)
            {
                writer.Close();
            }
        }
Exemple #12
0
        // Tuple<current charactor, charactor index>
        // this Scan will replace \r\n=>\n \r=>\n
        // \r\n return: <\n, \n's index>
        // \r   return: <\n, \r's index>
        private IEnumerable <Tuple <char, int> > Scan(int index)
        {
            if (index < 0 || index >= this.source.Length)
            {
                SharedFx.Assert("index < 0 || index >= this.source.Length");
                yield break;
            }

            while (index < this.source.Length)
            {
                char currentChar = this.source[index];

                if (currentChar == Return)
                {
                    if (index + 1 < this.source.Length && this.source[index + 1] == NewLine)
                    {
                        ++index;
                    }

                    currentChar = NewLine;
                }

                yield return(Tuple.Create(currentChar, index));

                ++index;
            }
        }
Exemple #13
0
        public override void WriteGetObject()
        {
            switch (this.currentState)
            {
            case ActivityTemplateFactoryBuilderWriterStates.InitialState:
                SharedFx.Assert("It is impossible to end an object during InitialState");
                break;

            case ActivityTemplateFactoryBuilderWriterStates.BufferingState:
                this.queuedNodes.Writer.WriteGetObject();
                break;

            case ActivityTemplateFactoryBuilderWriterStates.BypassState:
                this.underlyingWriter.WriteGetObject();
                break;

            default:
                SharedFx.Assert(
                    this.currentState == ActivityTemplateFactoryBuilderWriterStates.BufferingNameState ||
                    this.currentState == ActivityTemplateFactoryBuilderWriterStates.BufferingTargetTypeState,
                    "These are the only possible ActivityTemplateFactoryBuilderWriterStates.");
                SharedFx.Assert("It is impossible to get an object when we are buffering the name / targetType.");
                break;
            }
        }
Exemple #14
0
        public override void WriteEndMember()
        {
            switch (this.currentState)
            {
            case ActivityTemplateFactoryBuilderWriterStates.InitialState:
                SharedFx.Assert("It is impossible to end a member during InitialState");
                break;

            case ActivityTemplateFactoryBuilderWriterStates.BufferingState:
                this.queuedNodes.Writer.WriteEndMember();
                break;

            case ActivityTemplateFactoryBuilderWriterStates.BypassState:
                this.underlyingWriter.WriteEndMember();
                break;

            default:
                SharedFx.Assert(
                    this.currentState == ActivityTemplateFactoryBuilderWriterStates.BufferingNameState ||
                    this.currentState == ActivityTemplateFactoryBuilderWriterStates.BufferingTargetTypeState,
                    "These are the only possible ActivityTemplateFactoryBuilderWriterStates.");

                // Intentionally skipped the end member of Name / TargetType node
                this.currentState = ActivityTemplateFactoryBuilderWriterStates.BufferingState;
                break;
            }
        }
Exemple #15
0
        public override void WriteStartMember(XamlMember xamlMember)
        {
            switch (this.currentState)
            {
            case ActivityTemplateFactoryBuilderWriterStates.InitialState:
                SharedFx.Assert("It is impossible to start a member during InitialState");
                break;

            case ActivityTemplateFactoryBuilderWriterStates.BufferingState:
                if (xamlMember == this.ActivityTemplateFactoryBuilderImplementationMember)
                {
                    xamlMember = this.ActivityTemplateFactoryImplementationMember;

                    if (!this.xamlLanguageNamespaceWritten)
                    {
                        // Required namespace for XAML x:Class
                        this.underlyingWriter.WriteNamespace(new NamespaceDeclaration("http://schemas.microsoft.com/winfx/2006/xaml", "x"));
                    }

                    this.underlyingWriter.WriteStartObject(this.ActivityTemplateFactoryType);
                    this.underlyingWriter.WriteStartMember(XamlLanguage.Class);
                    this.underlyingWriter.WriteValue(this.className);
                    this.underlyingWriter.WriteEndMember();
                    this.underlyingWriter.WriteStartMember(XamlLanguage.TypeArguments);
                    this.underlyingWriter.WriteValue(this.targetType);
                    this.underlyingWriter.WriteEndMember();
                    this.Transform(this.queuedNodes.Reader, this.underlyingWriter);
                    this.underlyingWriter.WriteStartMember(xamlMember);
                    this.currentState = ActivityTemplateFactoryBuilderWriterStates.BypassState;
                }

                if (xamlMember == this.ActivityTemplateFactoryBuilderNameMember)
                {
                    this.currentState = ActivityTemplateFactoryBuilderWriterStates.BufferingNameState;
                }
                else if (xamlMember == this.ActivityTemplateFactoryBuilderTargetTypeMember)
                {
                    this.currentState = ActivityTemplateFactoryBuilderWriterStates.BufferingTargetTypeState;
                }
                else
                {
                    this.queuedNodes.Writer.WriteStartMember(xamlMember);
                }

                break;

            case ActivityTemplateFactoryBuilderWriterStates.BypassState:
                this.underlyingWriter.WriteStartMember(xamlMember);
                break;

            default:
                SharedFx.Assert(
                    this.currentState == ActivityTemplateFactoryBuilderWriterStates.BufferingNameState ||
                    this.currentState == ActivityTemplateFactoryBuilderWriterStates.BufferingTargetTypeState,
                    "These are the only possible ActivityTemplateFactoryBuilderWriterStates.");
                SharedFx.Assert("It is impossible to get an object when we are buffering the name / targetType.");
                break;
            }
        }
Exemple #16
0
        public override ConstructorInfo GetConstructor()
        {
            Type            editorAttributeType = typeof(EditorAttribute);
            ConstructorInfo constructor         = editorAttributeType.GetConstructor(new Type[] { typeof(Type), typeof(Type) });

            SharedFx.Assert(constructor != null, "designerAttribute has a constructor that takes two argument of type System.Type and System.Type.");
            return(constructor);
        }
        public override ConstructorInfo GetConstructor()
        {
            Type            defaultValueAttributeType = typeof(DefaultValueAttribute);
            ConstructorInfo constructor = defaultValueAttributeType.GetConstructor(new Type[] { typeof(object) });

            SharedFx.Assert(constructor != null, "designerAttribute has a constructor that takes an argument of type System.Object.");
            return(constructor);
        }
Exemple #18
0
        private bool IsIndexInScannedLine(int index)
        {
            SharedFx.Assert(index >= 0 && index < this.source.Length, "invalid index");

            int last = this.indexCache.Count - 1;

            return(last >= 0 && index < this.indexCache[last].Item1 + this.indexCache[last].Item2);
        }
        internal WorkflowDesignerXamlHelper(IWorkflowDesignerXamlHelperExecutionContext executionContext)
        {
            this.executionContext = executionContext;
            SharedFx.Assert(this.executionContext != null, "this.executionContext != null");
            SharedFx.Assert(this.executionContext.XamlSchemaContext != null, "this.executionContext.XamlSchemaContext != null");

            this.dynamicActivityPropertyNameMember  = new XamlMember(typeof(DynamicActivityProperty).GetProperty("Name"), this.XamlSchemaContext);
            this.dynamicActivityPropertyValueMember = new XamlMember(typeof(DynamicActivityProperty).GetProperty("Value"), this.XamlSchemaContext);
        }
Exemple #20
0
        public ResolverResult Lookup(Type type)
        {
            SharedFx.Assert(type != null, "type should not be null");

            WeakReference value;

            if (this.cache.TryGetValue(type, out value))
            {
                return(value.Target as ResolverResult);
            }

            return(null);
        }
Exemple #21
0
        public void Update(Type type, ResolverResult result)
        {
            SharedFx.Assert(type != null, "type should not be null");
            SharedFx.Assert(result != null, "result should not be null");

            if (this.cache.ContainsKey(type))
            {
                this.cache[type] = new WeakReference(result);
            }
            else
            {
                this.cache.Add(type, new WeakReference(result));
            }
        }
Exemple #22
0
        public static ResolverResult Resolve(MultiTargetingSupportService multiTargetingService, Type type)
        {
            SharedFx.Assert(multiTargetingService != null, "multiTargetingService should not be null");
            SharedFx.Assert(type != null, "type should not be null");

            if (!multiTargetingService.IsSupportedType(type))
            {
                return(ResolverResult.Unknown);
            }

            ResolverResult result;

            Type reflectionType = multiTargetingService.GetReflectionType(type);

            PropertyInfo[] properties       = type.GetProperties(BindingFlags.Public | BindingFlags.Instance | BindingFlags.SetProperty);
            PropertyInfo[] targetProperties = reflectionType.GetProperties(BindingFlags.Public | BindingFlags.Instance | BindingFlags.SetProperty);

            List <string> newProperties = new List <string>();

            // Assume we don't remove properties in newer framework
            // We only compare property name here
            if (properties.Length > targetProperties.Length)
            {
                foreach (PropertyInfo propertyInfo in properties)
                {
                    bool found = false;
                    foreach (PropertyInfo targetProperty in targetProperties)
                    {
                        if (targetProperty.Name == propertyInfo.Name)
                        {
                            found = true;
                            break;
                        }
                    }

                    if (!found)
                    {
                        newProperties.Add(propertyInfo.Name);
                    }
                }

                result = new ResolverResult(newProperties);
            }
            else
            {
                result = ResolverResult.FullySupported;
            }

            return(result);
        }
 public override void WriteEndObject()
 {
     --this.currentDepth;
     SharedFx.Assert(this.currentDepth >= 0, "Unmatched WriteEndObject");
     if (this.currentDepth == this.debugSymbolDepth && this.writeDebugSymbol)
     {
         base.WriteStartMember(new XamlMember(DebugSymbol.SymbolName.MemberName,
                                              this.SchemaContext.GetXamlType(typeof(DebugSymbol)), true));
         base.WriteValue(EmptyWorkflowSymbol);
         base.WriteEndMember();
         this.writeDebugSymbol = false;
     }
     base.WriteEndObject();
     isWritingElementStyleString = false;
 }
Exemple #24
0
        public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType)
        {
            if (destinationType != typeof(InstanceDescriptor))
            {
                return(base.ConvertTo(context, culture, value, destinationType));
            }

            TAttribute attribute = value as TAttribute;

            SharedFx.Assert(value != null, "The usage should be guaranteed by the XAML stack");

            ConstructorInfo constructor = this.Constructor;
            ICollection     arguments   = this.attributeInfo.GetConstructorArguments(attribute, ref constructor);

            return(new InstanceDescriptor(constructor, arguments, this.attributeInfo.IsComplete));
        }
Exemple #25
0
        public static XamlType GetXamlType(ResolverResult resolverResult, XamlType oldXamlType)
        {
            SharedFx.Assert(oldXamlType != null, "oldXamlType should not be null");

            switch (resolverResult.Kind)
            {
            case XamlTypeKind.FullySupported:
                return(oldXamlType);

            case XamlTypeKind.PartialSupported:
                return(new XamlTypeWithExtraPropertiesRemoved(oldXamlType.UnderlyingType, oldXamlType.SchemaContext, resolverResult.NewProperties));

            default:
                SharedFx.Assert(resolverResult.Kind == XamlTypeKind.Unknown, "resolverResult.Kind should be XamlTypeKind.Unknown.");
                return(null);
            }
        }
        // Get root Activity. Currently only handle when the object is ActivityBuilder or Activity.
        // May return null if it does not know how to get the root activity.
        internal static Activity GetRootWorkflowElement(object rootModelObject)
        {
            SharedFx.Assert(rootModelObject != null, "Cannot pass null as rootModelObject");
            Activity rootWorkflowElement;
            IDebuggableWorkflowTree debuggableWorkflowTree = rootModelObject as IDebuggableWorkflowTree;

            if (debuggableWorkflowTree != null)
            {
                rootWorkflowElement = debuggableWorkflowTree.GetWorkflowRoot();
            }
            else
            {
                // Loose xaml case.
                rootWorkflowElement = rootModelObject as Activity;
            }

            return(rootWorkflowElement);
        }
Exemple #27
0
        // return created
        private bool TryScanNextLine()
        {
            int startIndex = 0;

            if (this.indexCache.Count > 0)
            {
                int tail = this.indexCache.Count - 1;
                startIndex = this.indexCache[tail].Item1 + this.indexCache[tail].Item2;
            }

            if (startIndex >= this.source.Length)
            {
                return(false);
            }

            int lastIndex = -1;

            foreach (Tuple <char, int> currentPair in this.Scan(startIndex))
            {
                lastIndex = currentPair.Item2;
                if (currentPair.Item1 == NewLine)
                {
                    break;
                }
            }

            if (lastIndex < 0)
            {
                SharedFx.Assert("lastIndex < 0");
                return(false);
            }

            int lineLength = lastIndex - startIndex + 1;

            this.indexCache.Add(Tuple.Create(startIndex, lineLength));
            return(true);
        }
Exemple #28
0
        internal Tuple <LineColumnPair, char> SearchCharAfter(LineColumnPair startPoint, params char[] charsToSearch)
        {
            SharedFx.Assert(startPoint != null, "startPoint != null");

            int line   = startPoint.LineNumber - 1;
            int column = startPoint.ColumnNumber - 1;

            HashSet <char> charsToSearchSet = new HashSet <char>(charsToSearch);
            int            index            = this.GetIndex(line, column);

            if (index < 0)
            {
                return(null);
            }

            bool firstLoop = true;

            foreach (Tuple <char, int> currentPair in this.Scan(index))
            {
                if (firstLoop)
                {
                    firstLoop = false;
                }
                else
                {
                    if (charsToSearchSet.Contains(currentPair.Item1))
                    {
                        LineColumnPair location = this.GetLocation(currentPair.Item2);
                        SharedFx.Assert(location != null, "invalid location");
                        return(Tuple.Create(location, currentPair.Item1));
                    }
                }
            }

            return(null);
        }
Exemple #29
0
        private int GetIndex(int line, int column)
        {
            while (this.indexCache.Count <= line)
            {
                if (!this.TryScanNextLine())
                {
                    break;
                }
            }

            if (this.indexCache.Count <= line)
            {
                SharedFx.Assert(string.Format(CultureInfo.CurrentCulture, "line out of range:({0},{1})", line + 1, column + 1));
                return(-1);
            }

            if (column >= this.indexCache[line].Item2)
            {
                SharedFx.Assert(string.Format(CultureInfo.CurrentCulture, "column out of range:({0},{1})", line + 1, column + 1));
                return(-1);
            }

            return(this.indexCache[line].Item1 + column);
        }
Exemple #30
0
        public override bool Read()
        {
            switch (this.currentState)
            {
            case ActivityTemplateFactoryBuilderReaderStates.InitialState:
                bool hasMoreNodes = this.underlyingReader.Read();
                if (this.underlyingReader.NodeType == XamlNodeType.StartObject && IsActivityTemplateFactoryType(this.underlyingReader.Type))
                {
                    Type underlyingType = this.underlyingReader.Type.UnderlyingType;
                    Type targetType     = underlyingType.IsGenericType ? underlyingType.GetGenericArguments()[0] : null;

                    this.currentState = ActivityTemplateFactoryBuilderReaderStates.ReadingFromBufferState;
                    this.queuedNodes  = new XamlNodeQueue(this.schemaContext);
                    this.queuedNodes.Writer.WriteStartObject(this.ActivityTemplateFactoryBuilderType, (IXamlLineInfo)this.underlyingReader);

                    string className;

                    while (this.underlyingReader.Read())
                    {
                        if (this.underlyingReader.NodeType == XamlNodeType.StartMember && this.underlyingReader.Member == XamlLanguage.Class)
                        {
                            this.underlyingReader.Read();
                            className = (string)this.underlyingReader.Value;
                            this.underlyingReader.Read();
                            this.queuedNodes.Writer.WriteStartMember(this.ActivityTemplateFactoryBuilderNameMember, (IXamlLineInfo)this.underlyingReader);
                            this.queuedNodes.Writer.WriteValue(className, (IXamlLineInfo)this.underlyingReader);
                            this.queuedNodes.Writer.WriteEndMember((IXamlLineInfo)this.underlyingReader);
                            if (targetType != null)
                            {
                                this.queuedNodes.Writer.WriteStartMember(this.ActivityTemplateFactoryBuilderTargetTypeMember, (IXamlLineInfo)this.underlyingReader);
                                object targetTypeString = targetType;
                                this.queuedNodes.Writer.WriteValue(targetTypeString);
                                this.queuedNodes.Writer.WriteEndMember();
                            }
                        }
                        else if (this.underlyingReader.NodeType == XamlNodeType.StartMember && this.IsActivityTemplateFactoryImplementationMember(this.underlyingReader.Member))
                        {
                            this.queuedNodes.Writer.WriteStartMember(this.ActivityTemplateFactoryBuilderImplementationMember, (IXamlLineInfo)this.underlyingReader);
                            return(true);
                        }
                    }
                }

                return(hasMoreNodes);

            case ActivityTemplateFactoryBuilderReaderStates.ReadingFromBufferState:
                if (this.queuedNodes.Reader.Read())
                {
                    return(true);
                }
                else
                {
                    this.currentState = ActivityTemplateFactoryBuilderReaderStates.BypassState;
                    this.queuedNodes  = null;
                    return(this.underlyingReader.Read());
                }

            default:
                SharedFx.Assert(this.currentState == ActivityTemplateFactoryBuilderReaderStates.BypassState, "This is the only remaining ActivityTemplateFactoryBuilderReaderStates.");
                return(this.underlyingReader.Read());
            }
        }