internal XamlDebuggerXmlReader(TextReader underlyingTextReader, XamlSchemaContext schemaContext, Assembly localAssembly) { UnitTestUtility.Assert(underlyingTextReader != null, "underlyingTextReader should not be null and is ensured by caller."); this.xmlReaderWithSourceLocation = new XmlReaderWithSourceLocation(underlyingTextReader); this.underlyingReader = new XamlXmlReader(this.xmlReaderWithSourceLocation, schemaContext, new XamlXmlReaderSettings { ProvideLineInfo = true, LocalAssembly = localAssembly }); this.xamlLineInfo = (IXamlLineInfo)this.underlyingReader; UnitTestUtility.Assert(this.xamlLineInfo.HasLineInfo, "underlyingReader is constructed with the ProvideLineInfo option above."); this.schemaContext = schemaContext; this.objectDeclarationRecords = new Stack <XamlNode>(); this.initializationValueRanges = new Dictionary <XamlNode, DocumentRange>(); this.bufferedXamlNodes = new Queue <XamlNode>(); this.current = this.CreateCurrentNode(); this.SourceLocationFound += XamlDebuggerXmlReader.SetSourceLocation; }
public XamlDebuggerXmlReader(XamlReader underlyingReader, IXamlLineInfo xamlLineInfo, TextReader textReader) { this.underlyingReader = underlyingReader; this.xamlLineInfo = xamlLineInfo; this.xmlReaderWithSourceLocation = new XmlReaderWithSourceLocation(textReader); this.initializationValueRanges = new Dictionary <XamlNode, DocumentRange>(); // Parse the XML at once to get all the locations we wanted. while (this.xmlReaderWithSourceLocation.Read()) { } this.schemaContext = underlyingReader.SchemaContext; this.objectDeclarationRecords = new Stack <XamlNode>(); this.bufferedXamlNodes = new Queue <XamlNode>(); this.current = this.CreateCurrentNode(); this.SourceLocationFound += XamlDebuggerXmlReader.SetSourceLocation; }
protected override void Dispose(bool disposing) { base.Dispose(disposing); if (disposing) { if (this.underlyingReader != null) { ((IDisposable)this.underlyingReader).Dispose(); } this.underlyingReader = null; if (this.xmlReaderWithSourceLocation != null) { ((IDisposable)this.xmlReaderWithSourceLocation).Dispose(); } this.xmlReaderWithSourceLocation = null; } }