public static ValidationError CreateFromException(Exception ex) { var vError = new ValidationError { ErrorMessage = ex.Message, ErrorNumber = ex.HResult.ToString(), Severity = ValiationErrorSeverity.Error }; return vError; }
public static ValidationError CreateFromCommonDiagnostic(CommonDiagnostic diag) { var vError = new ValidationError { ErrorMessage = diag.Info.GetMessage(), ErrorNumber = diag.Info.MessageIdentifier, Severity = GetValidationErrorSeverity(diag.Info.Severity.ToString()), Line = diag.Location.GetLineSpan(true).StartLinePosition.Line, Column = diag.Location.GetLineSpan(true).StartLinePosition.Character }; return vError; }
public static ValidationError CreateFromCompileError(CompilerError compilerError) { var vError = new ValidationError { ErrorMessage = compilerError.ErrorText, ErrorNumber = compilerError.ErrorNumber, WarningLevel = compilerError.IsWarning ? 1 : 0, Severity = compilerError.IsWarning ? ValiationErrorSeverity.Warning : ValiationErrorSeverity.Error, Line = compilerError.Line - 1, Column = compilerError.Column - 1, FileName = compilerError.FileName }; return vError; }
private bool IsValidationErrorAlreadyInList(ValidationError error, List<ValidationError> errors) { var findError = errors.FirstOrDefault( e => e.Line == error.Line && e.Column == error.Column && e.ErrorNumber == error.ErrorNumber); if (findError != null) return true; return false; }
private bool CanSkipValidationError(ValidationError error, int numLines) { //On last code line for interactive project - if missing ; - not really an error if (this.ProjectType == ProjectType.Script && this.Language == Language.CSharp && error.Line == numLines - 1 && error.ErrorNumber == "CS1002") return true; return false; }