Beispiel #1
0
            //------------------------------------------------------------------------------
            // DefineSequencePoints() wrapper
            //------------------------------------------------------------------------------
            void ISymbolWriter.DefineSequencePoints(ISymbolDocumentWriter document,
                                                    int[] offsets,
                                                    int[] lines,
                                                    int[] columns,
                                                    int[] endLines,
                                                    int[] endColumns)
            {
                int spCount = 0;

                if (offsets != null)
                {
                    spCount = offsets.Length;
                }
                else if (lines != null)
                {
                    spCount = lines.Length;
                }
                else if (columns != null)
                {
                    spCount = columns.Length;
                }
                else if (endLines != null)
                {
                    spCount = endLines.Length;
                }
                else if (endColumns != null)
                {
                    spCount = endColumns.Length;
                }
                if (spCount == 0)
                {
                    return;
                }
                if ((offsets != null && offsets.Length != spCount) ||
                    (lines != null && lines.Length != spCount) ||
                    (columns != null && columns.Length != spCount) ||
                    (endLines != null && endLines.Length != spCount) ||
                    (endColumns != null && endColumns.Length != spCount))
                {
                    throw new ArgumentException();
                }

                // Sure, claim to accept any type that implements ISymbolDocumentWriter but the only one that actually
                // works is the one returned by DefineDocument. The .NET Framework ISymWrapper commits the same signature fraud.
                // Ideally we'd just return a sealed opaque cookie type, which had an internal accessor to
                // get the writer out.
                // Regardless, this cast is important for security - we cannot allow our caller to provide
                // arbitrary instances of this interface.
                SymDocumentWriter docwriter = (SymDocumentWriter)document;
                int hr = m_vtable.DefineSequencePoints(m_pWriter, docwriter.GetUnmanaged(), spCount !, offsets !, lines !, columns !, endLines !, endColumns !);

                if (hr < 0)
                {
                    throw Marshal.GetExceptionForHR(hr) !;
                }
            }
		public void DefineSequencePoints (SymDocumentWriter document, int[] offsets, int[] lines, int[] columns, int[] endLines, int[] endColumns)
		{
			m_writer.DefineSequencePoints (document.GetUnmanaged(), offsets.Length, offsets, lines, columns, endLines, endColumns);
		}