Esempio n. 1
0
        public void FillExceptionInfo(ExceptionInfo info)
        {
            info.FillInfo(this);
            var otherInfos = info.OtherInfos;

            otherInfos.Add(nameof(TemplateKey), TemplateKey);
            int index = 1;

            foreach (var diagnostic in Errors)
            {
                FileLinePositionSpan lineSpan = diagnostic.Location.SourceTree.GetMappedLineSpan(
                    diagnostic.Location.SourceSpan);
                string errorMessage     = diagnostic.GetMessage();
                var    pos              = lineSpan.StartLinePosition;
                string formattedMessage = $"行:{pos.Line + 1},列:{pos.Character + 1},错误:{errorMessage}";

                otherInfos.Add($"Error{index++}", formattedMessage);
            }
            otherInfos.Add(nameof(CompileCode), CompileCode);
        }