예제 #1
0
        TripleSlashCommentModel(string xml, SyntaxLanguage language, TripleSlashCommentParserContext context)
        {
            // Transform triple slash comment
            var doc = TripleSlashCommentTransformer.Transform(xml, language);

            _context = context;

            ResolveSeeCref(doc);
            ResolveSeeAlsoCref(doc);
            ResolveExceptionCref(doc);

            ResolveCodeSource(doc);
            _nav    = doc.CreateNavigator();
            Summary = GetSummary();
            Remarks = GetRemarks();
            Returns = GetReturns();

            Exceptions     = GetExceptions();
            Sees           = GetSees();
            SeeAlsos       = GetSeeAlsos();
            Examples       = GetExamples();
            Parameters     = GetParameters();
            TypeParameters = GetTypeParameters();
            IsInheritDoc   = GetIsInheritDoc();
        }
예제 #2
0
        public static TripleSlashCommentModel?CreateModel(string xml, TripleSlashCommentParserContext context)
        {
            if (context == null)
            {
                throw new ArgumentNullException(nameof(context));
            }

            if (string.IsNullOrEmpty(xml))
            {
                return(null);
            }

            // Quick turnaround for badly formed XML comment
            if (xml.StartsWith("<!-- Badly formed XML comment ignored for member ", StringComparison.Ordinal))
            {
                Logger.LogWarning($"Invalid triple slash comment is ignored: {xml}");
                return(null);
            }

            try
            {
                var model = new TripleSlashCommentModel(xml, SyntaxLanguage.CSharp, context);
                return(model);
            }
            catch (XmlException)
            {
                return(null);
            }
        }