Пример #1
0
        public TaskListEntry(BuildError error, object owner)
        {
            parentObject = error.SourceTarget as WorkspaceObject;
            file         = error.FileName;
            this.owner   = owner;

            column = error.Column;
            line   = error.Line;
            code   = error.ErrorNumber;

            SetMessage(error.ErrorText, code);

            if (error.IsWarning)
            {
                severity = error.ErrorNumber == "COMMENT" ? TaskSeverity.Information : TaskSeverity.Warning;
            }
            else
            {
                severity = TaskSeverity.Error;
            }
            priority = TaskPriority.Normal;

            category    = error.Subcategory;
            helpKeyword = error.HelpKeyword;
        }
Пример #2
0
        //methods
        private static Exception GetResultException(string _msg)
        {
            BuildError _be = BuildError.ExpandedNodeIdInvalidSyntax;
            Exception  _ex = new ServiceResultException(TraceMessage.BuildErrorTraceMessage(_be, _msg), _be.ToString() + _msg);

            return(_ex);
        }
Пример #3
0
        //[TestMethod]
        public void BuildErrorReflectionTestMethod()
        {
            PropertyInfo[] _importer = typeof(BuildError).GetProperties(BindingFlags.Static | BindingFlags.GetProperty | BindingFlags.Public);
            Assert.IsNotNull(_importer);
            Assert.IsTrue(_importer.Length > 0);
            List <NamedBuildError> _ListNamedBuildError = new List <NamedBuildError>();

            foreach (PropertyInfo _item in _importer)
            {
                BuildError      _be            = (BuildError)_item.GetMethod.Invoke(null, new Object[] { });
                NamedBuildError _newBuildError = new NamedBuildError()
                {
                    Name       = _item.Name,
                    Descriptor = _be.Descriptor,
                    Focus      = _be.Focus,
                    Identifier = _be.Identifier
                };
                _ListNamedBuildError.Add(_newBuildError);
            }
            BuildErrorsCollection _errorList = new BuildErrorsCollection()
            {
                ListOfBuildErrors = _ListNamedBuildError.ToArray()
            };

            XmlFile.WriteXmlFile <BuildErrorsCollection>(_errorList, @"BuildErrorsCollection.xml", System.IO.FileMode.Create, "BuildErrorsCollection.xmls");
        }
Пример #4
0
        static BuildError CreateErrorFromString(string errorString)
        {
            // When IncludeDebugInformation is true, prevents the debug symbols stats from breaking this.
            if (errorString.StartsWith("Lua ", StringComparison.InvariantCulture))
            {
                return(null);
            }

            Match match = regex_error.Match(errorString);

            if (!match.Success)
            {
                return(null);
            }

            var error = new BuildError();
            //error.FileName = match.Result ("${file}") ?? "";

            string path = match.Result("${file}") ?? "";

            error.FileName = path;

            string line = match.Result("${line}");

            error.Line = string.IsNullOrEmpty(line) ? 0 : Int32.Parse(line);


            error.IsWarning = false;
            //error.ErrorNumber = match.Result("${line}");
            error.ErrorText = match.Result("${message}");
            return(error);
        }
Пример #5
0
        public void LogError(
            Instance instance,
            Type pluginType,
            StructureMapException ex,
            IEnumerable<BuildDependency> dependencies)
        {
            if (_buildErrors.ContainsKey(instance))
            {
                BuildError existingError = _buildErrors[instance];
                addDependenciesToError(instance, dependencies, existingError);
            }

            if (_brokenInstances.Contains(instance))
            {
                return;
            }

            InstanceToken token = ((IDiagnosticInstance) instance).CreateToken();
            var error = new BuildError(pluginType, instance);
            error.Exception = ex;

            _buildErrors.Add(instance, error);

            addDependenciesToError(instance, dependencies, error);
        }
        static void ParserOutputFile(NMEProject project, BuildResult result, StringBuilder output, string filename)
        {
            StreamReader reader = File.OpenText(filename);

            string line;

            while ((line = reader.ReadLine()) != null)
            {
                output.AppendLine(line);

                line = line.Trim();
                if (line.Length == 0 || line.StartsWith("\t"))
                {
                    continue;
                }

                BuildError error = CreateErrorFromString(project, line);
                if (error != null)
                {
                    result.Append(error);
                }
            }

            reader.Close();
        }
Пример #7
0
 public void ReportError(BuildError error)
 {
     if (ReportedError != null)
     {
         ReportedError(this, new BuildErrorEventArgs(error));
     }
 }
Пример #8
0
 public void RequestNavigateToError(BuildError error)
 {
     if (NavigateToErrorRequested != null)
     {
         NavigateToErrorRequested(this, new BuildErrorEventArgs(error));
     }
 }
Пример #9
0
 private void ErrorReceived(BuildError error, string message = null)
 {
     Log(new LogData(
             message ?? error.FullMessage,
             error.Type == BuildError.BuildErrorType.Warning ? LogType.Warning : LogType.Error,
             error));
 }
Пример #10
0
        private void HandleOptLinkOutput(BuildResult br, string linkerOutput)
        {
            var matches = optlinkRegex.Matches(linkerOutput);

            foreach (Match match in matches)
            {
                var error = new BuildError();

                // Get associated D source file
                if (match.Groups ["obj"].Success)
                {
                    var obj = Project.GetAbsoluteChildPath(new FilePath(match.Groups ["obj"].Value)).ChangeExtension(".d");

                    foreach (var pf in Project.Files)
                    {
                        if (pf.FilePath == obj)
                        {
                            error.FileName = pf.FilePath;
                            break;
                        }
                    }
                }

                error.ErrorText = "Linker error " + match.Groups ["code"].Value + " - " + match.Groups ["message"].Value;

                br.Append(error);
            }
        }
Пример #11
0
        private void ProcessErrorData(string message, List <BuildError> errors, ref string multilineError)
        {
            if (message == null)
            {
                return;
            }
            var fullMessage = message;

            if (multilineError != null && message.StartsWith(" "))
            {
                fullMessage = multilineError + message;
            }
            else if (message.EndsWith("referenced in:"))
            {
                multilineError = message;
                Log(new LogData(message, LogType.Error));
                return;
            }
            else
            {
                multilineError = null;
            }

            var error = new BuildError(fullMessage);

            errors.Add(error);
            ErrorReceived(error, message);
        }
Пример #12
0
 public void HandleError(BuildError error)
 {
     error.ErrorText = FixEncoding(error.ErrorText);
     error.FileName  = FixEncoding(error.FileName);
     error.Column    = FixColumn(error.FileName, error.Line, error.Column);
     nextFilter.HandleError(error);
 }
Пример #13
0
        public SDTask(BuildError error)
        {
            if (error == null)
            {
                throw new ArgumentNullException("error");
            }
            type = error.IsWarning ? TaskType.Warning : TaskType.Error;
            int line   = Math.Max(error.Line, 1);
            int column = Math.Max(error.Column, 1);

            if (!string.IsNullOrEmpty(error.FileName))
            {
                hasLocation       = error.Line >= 1;
                this.position     = new PermanentAnchor(FileName.Create(error.FileName), line, column);
                position.Deleted += position_Deleted;
            }
            if (string.IsNullOrEmpty(error.ErrorCode))
            {
                description = error.ErrorText;
            }
            else
            {
                description = error.ErrorText + " (" + error.ErrorCode + ")";
            }
            if (error.ContextMenuAddInTreeEntry != null)
            {
                ContextMenuAddInTreeEntry = error.ContextMenuAddInTreeEntry;
            }
            this.Tag        = error.Tag;
            this.BuildError = error;
        }
Пример #14
0
 public TaskListEntry(BuildError error, object owner)
 {
     parentObject = error.SourceTarget as WorkspaceObject;
     file         = error.FileName;
     this.owner   = owner;
     description  = error.ErrorText;
     column       = error.Column;
     line         = error.Line;
     if (!string.IsNullOrEmpty(error.ErrorNumber))
     {
         description += " (" + error.ErrorNumber + ")";
     }
     if (error.IsWarning)
     {
         severity = error.ErrorNumber == "COMMENT" ? TaskSeverity.Information : TaskSeverity.Warning;
     }
     else
     {
         severity = TaskSeverity.Error;
     }
     priority    = TaskPriority.Normal;
     code        = error.ErrorNumber;
     category    = error.Subcategory;
     helpKeyword = error.HelpKeyword;
 }
Пример #15
0
        /// <summary>
        /// Rebuilds assembly given the dirty files.
        /// </summary>
        /// <param name="filesToCompile">Dirty files to be recompiled in new assembly.</param>
        /// <returns>Path of the new assembly.</returns>
        private string rebuildAssembly(List <string> filesToCompile)
        {
            if (project.IsStartable)
            {
                NewAssemblyName = project.AssemblyName + "_enc.exe";
            }
            else
            {
                NewAssemblyName = project.AssemblyName + "_enc.dll";
            }
            string         path = TemporaryPath + NewAssemblyName;
            CompilerErrors errs = CSharpBackgroundCompiler.RecompileWithName(path, filesToCompile);

            CompileSuccessful = (errs != null && !errs.HasErrors);
            WorkbenchSingleton.SafeThreadAsyncCall(
                delegate() {
                if (!CompileSuccessful && errs != null)
                {
                    foreach (CompilerError err in errs)
                    {
                        BuildError error = new BuildError(err.FileName, err.Line, err.Column, err.ErrorNumber, err.ErrorText);
                        error.IsWarning  = err.IsWarning;
                        TaskService.Add(new Task(error));
                    }
                }
                else
                {
                    TaskService.Clear();
                }
            }
                );
            return(path);
        }
 static void AddErrors(AddError addError, IEnumerable <string> messages)
 {
     foreach (string message in messages)
     {
         BuildError error = CreateBuildError(message);
         addError(error.FileName, error.Line, error.Column, error.ErrorNumber, error.ErrorText);
     }
 }
Пример #17
0
        public THeaderType Create <THeaderType>(bool IsOperator, object orgPPAGUID) where THeaderType : class
        {
            try {
                var tInstance = Activator.CreateInstance(typeof(THeaderType));

                var props = tInstance.GetType().GetProperties();

                foreach (var prop in props)
                {
                    switch (prop.Name)
                    {
                    case "Item":
                        if (string.IsNullOrEmpty(orgPPAGUID.ToString().ToLower()))
                        {
                            throw new ArgumentException("Не указан идентификатор организации в ГИС");
                        }
                        prop.SetValue(tInstance, orgPPAGUID.ToString().ToLower());
                        break;

                    case "ItemElementName":
                        prop.SetValue(tInstance, Enum.Parse(prop.PropertyType, "orgPPAGUID"));
                        break;

                    case "MessageGUID":
                        prop.SetValue(tInstance, Guid.NewGuid().ToString());
                        break;

                    case "Date":
                        prop.SetValue(tInstance, DateTime.Now);
                        break;

                    case "IsOperatorSignatureSpecified":
                        if (IsOperator)
                        {
                            prop.SetValue(tInstance, true);
                        }
                        break;

                    case "IsOperatorSignature":
                        if (IsOperator)
                        {
                            prop.SetValue(tInstance, true);
                        }
                        break;
                    }
                }

                return(tInstance as THeaderType);
            }
            catch (SystemException exc) {
                BuildError?.Invoke(this, new ErrorEventArgs(true, "При сборке запроса произошла ошибка:" + exc.GetChainException()));
            }
            catch (Exception exc) {
                BuildError?.Invoke(this, new ErrorEventArgs(true, "При сборке запроса произошла ошибка:" + exc.GetChainException()));
            }

            return(null);
        }
Пример #18
0
 static void AddErrors(AddError addError, IEnumerable <DiagnosticMessageView> messages, DnxProject project)
 {
     foreach (DiagnosticMessageView message in messages)
     {
         BuildError error = CreateBuildError(message);
         error.SourceTarget = project.Project;
         addError(error.FileName, error.Line, error.Column, error.ErrorNumber, error.ErrorText);
     }
 }
Пример #19
0
        public void Create_an_instance_that_has_a_build_failure()
        {
            Instance instance = errorInstance().WithName("Bad");
            ValidationBuildSession session =
                validatedSession(registry => registry.InstanceOf <IWidget>().IsThis(instance));

            BuildError error = getFirstAndOnlyError(session);

            Assert.AreEqual(instance, error.Instance);
            Assert.AreEqual(typeof(IWidget), error.PluginType);
            Assert.IsNotNull(error.Exception);
        }
        static BuildError CreateErrorFromString(string errorString)
        {
            // When IncludeDebugInformation is true, prevents the debug symbols stats from breaking this.
            if (errorString.StartsWith("WROTE SYMFILE", StringComparison.Ordinal) ||
                errorString.StartsWith("OffsetTable", StringComparison.Ordinal) ||
                errorString.StartsWith("Compilation succeeded", StringComparison.Ordinal) ||
                errorString.StartsWith("Compilation failed", StringComparison.Ordinal))
            {
                return(null);
            }

            return(BuildError.FromMSBuildErrorFormat(errorString));
        }
Пример #21
0
        private void AddError(BuildError error)
        {
            var item = new ListViewItem(new string[]
            {
                error.Message,
                error.Location.FilePath.FileName,
                error.Location.Line.ToString(),
                error.Location.Column.ToString(),
            });

            item.Tag        = error;
            item.ImageIndex = _iconProvider.GetImageIndex(error.Severity);
            listView1.Items.Add(item);
        }
Пример #22
0
        private void addDependenciesToError(Instance instance, IEnumerable<BuildDependency> dependencies,
                                            BuildError error)
        {
            foreach (BuildDependency dependency in dependencies)
            {
                if (_brokenInstances.Contains(instance))
                {
                    continue;
                }

                error.AddDependency(dependency);
                _brokenInstances.Add(dependency.Instance);
            }
        }
        private BuildError CreateErrorFromString(string error_string)
        {
            // When IncludeDebugInformation is true, prevents the debug symbols stats from braeking this.
            if (error_string.StartsWith("WROTE SYMFILE") ||
                error_string.StartsWith("make[") ||
                error_string.StartsWith("OffsetTable") ||
                error_string.StartsWith("Compilation succeeded") ||
                error_string.StartsWith("Compilation failed"))
            {
                return(null);
            }

            return(BuildError.FromMSBuildErrorFormat(error_string));
        }
Пример #24
0
        public void Create_an_instance_that_fails_because_of_an_inline_child()
        {
            ValidationBuildSession session = validatedSession(
                r =>
            {
                r.InstanceOf <SomethingThatNeedsAWidget>().Is.OfConcreteType <SomethingThatNeedsAWidget>()
                .WithName("BadInstance")
                .CtorDependency <IWidget>().Is(errorInstance());
            });

            BuildError error = getFirstAndOnlyError(session);

            Assert.AreEqual("BadInstance", error.Instance.Name);
            Assert.AreEqual(typeof(SomethingThatNeedsAWidget), error.PluginType);
        }
        static BuildError CreateErrorFromString(string error_string)
        {
            var err = BuildError.FromMSBuildErrorFormat(error_string);

            if (err != null)
            {
                // Workaround for bug #484351. Vbnc incorrectly emits this warning.
                if (err.ErrorNumber == "VBNC2009" && err.ErrorText != null && err.ErrorText.IndexOf("optioninfer", StringComparison.Ordinal) != -1)
                {
                    return(null);
                }
            }

            return(err);
        }
Пример #26
0
        static BuildError CreateErrorFromString(string basePath, string error_string)
        {
            // When IncludeDebugInformation is true, prevents the debug symbols stats from braeking this.
            if (error_string.StartsWith("WROTE SYMFILE") ||
                error_string.StartsWith("OffsetTable") ||
                error_string.StartsWith("Compilation succeeded") ||
                error_string.StartsWith("Compilation failed"))
            {
                return(null);
            }

            Match match = regexError.Match(error_string);

            if (!match.Success)
            {
                return(null);
            }

            BuildError error    = new BuildError();
            FilePath   filename = match.Result("${file}");

            if (filename.IsNullOrEmpty)
            {
                filename = FilePath.Empty;
            }
            else if (!filename.IsAbsolute && basePath != null)
            {
                filename = filename.ToAbsolute(basePath);
            }
            error.FileName = filename;


            string line = match.Result("${line}");

            error.Line = !string.IsNullOrEmpty(line) ? Int32.Parse(line) : 0;

            string col = match.Result("${column}");

            if (!string.IsNullOrEmpty(col))
            {
                error.Column = col == "255+" ? -1 : Int32.Parse(col);
            }

            error.IsWarning   = match.Result("${level}") == "warning";
            error.ErrorNumber = match.Result("${number}");
            error.ErrorText   = match.Result("${message}");
            return(error);
        }
Пример #27
0
        public static void AddTask(string fileName, string message, int column, int line, TaskSeverity taskType)
        {
            // HACK: Use a compiler error since we cannot add an error
            // task otherwise (task type property is read-only and
            // no constructors usable).
            BuildError error = new BuildError();

            error.Column    = column;
            error.Line      = line;
            error.ErrorText = message;
            error.FileName  = fileName;
            error.IsWarning = false;

            //Task task = new Task(fileName, message, column, line);
            Task task = new Task(error);

            TaskService.Errors.Add(task);
        }
Пример #28
0
        public void AddError(Type pluginType, Instance instance, StructureMapException ex)
        {
            var rootCause = ex.Instances.First();
            var rootProblem = _errors.FirstOrDefault(x => x.RootInstance == rootCause);

            if (rootProblem != null)
            {
                rootProblem.AddDependency(new BuildDependency(pluginType, instance));
            }
            else
            {
                var error = new BuildError(pluginType, instance)
                {
                    Exception = ex
                };

                _errors.Add(error);
            }
        }
Пример #29
0
        public void Attach_dependency_to_the_build_error_but_do_not_create_new_error_for_dependency()
        {
            ValidationBuildSession session = validatedSession(r =>
            {
                r.InstanceOf <IWidget>().IsThis(errorInstance().WithName("BadInstance"));

                r.InstanceOf <SomethingThatNeedsAWidget>().Is.OfConcreteType <SomethingThatNeedsAWidget>()
                .WithName("DependentInstance")
                .CtorDependency <IWidget>().Is(x => x.TheInstanceNamed("BadInstance"));
            });

            BuildError error = getFirstAndOnlyError(session);

            Assert.AreEqual(1, error.Dependencies.Count);
            BuildDependency dependency = error.Dependencies[0];

            Assert.AreEqual(typeof(SomethingThatNeedsAWidget), dependency.PluginType);
            Assert.AreEqual("DependentInstance", dependency.Instance.Name);
        }
Пример #30
0
        public bool CreateBuildError(BuildErrorCreate model)
        {
            var entity =
                new BuildError()
            {
                OwnerId           = _userId,
                Title             = model.Title,
                LineNumber        = model.LineNumber,
                BuildErrorMessage = model.BuildErrorMessage,
                ProjectId         = model.ProjectId,
                Resolved          = model.Resolved,
                CreatedUtc        = DateTimeOffset.Now
            };

            using (var ctx = new ApplicationDbContext())
            {
                ctx.BuildErrors.Add(entity);
                return(ctx.SaveChanges() == 1);
            }
        }
Пример #31
0
 public Task(BuildError error)
 {
     type     = error.IsWarning ? TaskType.Warning : TaskType.Error;
     column   = Math.Max(error.Column - 1, 0);
     line     = Math.Max(error.Line - 1, 0);
     fileName = error.FileName;
     if (string.IsNullOrEmpty(error.ErrorCode))
     {
         description = error.ErrorText;
     }
     else
     {
         description = error.ErrorText + " (" + error.ErrorCode + ")";
     }
     if (error.ContextMenuAddInTreeEntry != null)
     {
         contextMenuAddInTreeEntry = error.ContextMenuAddInTreeEntry;
     }
     tag = error.Tag;
 }
        public bool TryBuild <TRequest>(BuilderOption option, out TRequest result) where TRequest : class
        {
            result = null;
            if (_container.Any(x => x.Key.RequestType == typeof(TRequest) && x.Key.Option.Equals(option)) == false)
            {
                BuildError?.Invoke(this, new ErrorEventArgs(true, $"При сборке запроса {nameof(TRequest)} произошла ошибка: нет зарегистрированного сборщика запроса"));
                return(false);
            }
            var type     = _container.FirstOrDefault(x => x.Key.RequestType == typeof(TRequest) && x.Key.Option.Equals(option)).Value;
            var instance = Activator.CreateInstance(type);
            var builder  = (IRequestBuilder <TRequest>)instance;

            try {
                result = builder.Build(option);
                return(true);
            }
            catch (Exception ex) {
                BuildError?.Invoke(this, new ErrorEventArgs(true, $"При сборке запроса {nameof(TRequest)} произошла ошибка:{ex.GetChainException()}"));
                return(false);
            }
        }
Пример #33
0
        private static string ParseErrorFileName(BuildError error)
        {
            if (error.File == null)
            {
                return(string.Empty);
            }
            if (error.File.Length == 5 && error.File[0] == 'l' && error.File[2] == 's')
            {
                int level, screen;

                if (Editroid.ROM.Projects.Project.Builder.ParseScreenFilename(error.File, out level, out screen))
                {
                    return(((LevelIndex)level).ToString() + " " + screen.ToString("X2") + " Load");
                }
            }
            if (error.File.StartsWith(ROM.Projects.Project.Builder.UserFilePrefix))
            {
                return(error.File.Substring(ROM.Projects.Project.Builder.UserFilePrefix.Length));
            }
            return(error.File);
        }
Пример #34
0
    void eventSource_ErrorRaised(object sender, BuildErrorEventArgs e)
    {
        // BuildErrorEventArgs adds LineNumber, ColumnNumber, File, amongst other parameters
        BuildError error = new BuildError() {
            File = e.File,
            Timestamp = e.Timestamp,
            LineNumber = e.LineNumber,
            ColumnNumber = e.ColumnNumber,
            Code = e.Code,
            Message = e.Message,
        };

        Errors.Add(error);
    }
Пример #35
0
 public OpenErrorEventArgs(BuildError error)
 {
     Error = error;
 }