コード例 #1
0
        public async Task <string> NavigateToErrorListItemAsync(int item, bool isPreview, bool shouldActivate, CancellationToken cancellationToken)
        {
            await JoinableTaskFactory.SwitchToMainThreadAsync(cancellationToken);

            var errorList = await GetRequiredGlobalServiceAsync <SVsErrorList, IErrorList>(cancellationToken);

            ErrorSource errorSource = 0;

            if (errorList.AreBuildErrorSourceEntriesShown)
            {
                errorSource |= ErrorSource.Build;
            }

            if (errorList.AreOtherErrorSourceEntriesShown)
            {
                errorSource |= ErrorSource.Other;
            }

            var minimumSeverity =
                errorList.AreMessagesShown ? __VSERRORCATEGORY.EC_MESSAGE :
                errorList.AreWarningsShown ? __VSERRORCATEGORY.EC_WARNING :
                __VSERRORCATEGORY.EC_ERROR;

            var items = await GetErrorItemsAsync(errorSource, minimumSeverity, cancellationToken);

            items[item].NavigateTo(isPreview, shouldActivate);
            return(GetMessage(items[item]));
        }
コード例 #2
0
        private async Task <ImmutableArray <ITableEntryHandle> > GetErrorItemsAsync(ErrorSource errorSource, __VSERRORCATEGORY minimumSeverity, CancellationToken cancellationToken)
        {
            await JoinableTaskFactory.SwitchToMainThreadAsync(cancellationToken);

            var errorList = await GetRequiredGlobalServiceAsync <SVsErrorList, IErrorList>(cancellationToken);

            var args = await errorList.TableControl.ForceUpdateAsync().WithCancellation(cancellationToken);

            return(args.AllEntries
                   .Where(item =>
            {
                if (item.GetCategory() > minimumSeverity)
                {
                    return false;
                }

                if (item.GetErrorSource() is not {
                } itemErrorSource ||
                    !errorSource.HasFlag(itemErrorSource))
                {
                    return false;
                }

                return true;
            })
                   .ToImmutableArray());
        }
コード例 #3
0
 public DatabaseImportManager(ErrorSource error_source, TrackPrimarySourceChooser chooser,
                              int [] primarySourceIds, string baseDirectory) : this(chooser)
 {
     this.error_source  = error_source;
     primary_source_ids = primarySourceIds;
     base_directory     = baseDirectory;
 }
コード例 #4
0
ファイル: spIU_Job.cs プロジェクト: PaulNichols/Old-Projects
        /// <summary>
        /// This method allows you to reset the parameter object. Please note that this
        /// method resets all the parameters members except the connection information and
        /// the command time-out which are left in their current state.
        /// </summary>
        public void Reset()
        {
            this.internal_Param_RETURN_VALUE = System.Data.SqlTypes.SqlInt32.Null;

            this.internal_Param_JobId = System.Data.SqlTypes.SqlInt32.Null;
            this.internal_Param_JobId_UseDefaultValue = this.useDefaultValue;

            this.internal_Param_Description = System.Data.SqlTypes.SqlString.Null;
            this.internal_Param_Description_UseDefaultValue = this.useDefaultValue;

            this.internal_Param_Price = System.Data.SqlTypes.SqlMoney.Null;
            this.internal_Param_Price_UseDefaultValue = this.useDefaultValue;

            this.internal_Param_StartDate = System.Data.SqlTypes.SqlDateTime.Null;
            this.internal_Param_StartDate_UseDefaultValue = this.useDefaultValue;

            this.internal_Param_EndDate = System.Data.SqlTypes.SqlDateTime.Null;
            this.internal_Param_EndDate_UseDefaultValue = this.useDefaultValue;

            this.internal_Param_CustomerId = System.Data.SqlTypes.SqlInt32.Null;
            this.internal_Param_CustomerId_UseDefaultValue = this.useDefaultValue;

            this.errorSource    = ErrorSource.NotAvailable;
            this.sqlException   = null;
            this.otherException = null;
        }
コード例 #5
0
        private void AddError(IList <IErrorListItem> errors, string file, int line, int column, int length, string errCode, string message,
                              string projectName, MessageSeverity sev, ErrorSource errorSource)
        {
            var item = new ErrorListItem()
            {
                Filename    = file,
                Line        = line,
                Column      = column,
                Length      = length,
                ErrorCode   = errCode,
                Message     = message,
                ProjectName = projectName,
                ErrorSource = errorSource,
                Severity    = sev,
                BuildTool   = errorSource == ErrorSource.Build ? "Build" : "Live",
                ProjectGuid = Project.ProjectIDGuid
                              //Manager = this
            };

            lock (this)
            {
                errors.Add(item);
                dirty = true;
            }
        }
コード例 #6
0
        private void SetupObjectFillAction(SqlTask sqlT, string colName)
        {
            sqlT.Actions.Add(colValue =>
            {
                try
                {
                    if (_row != null)
                    {
                        var propInfo = TypeInfo.GetInfoByPropertyNameOrColumnMapping(colName);
                        Object con   = null;
                        if (colValue != null)
                        {
                            if (TypeInfo.UnderlyingPropType[propInfo].IsEnum)
                            {
                                con = colValue;
                            }
                            else
                            {
                                con = Convert.ChangeType(colValue, TypeInfo.UnderlyingPropType[propInfo]);
                            }
                        }

                        propInfo.TrySetValue(_row, con, TypeInfo.UnderlyingPropType[propInfo]);
                    }
                }
                catch (Exception e)
                {
                    ThrowOrRedirectError(e, ErrorSource.ConvertErrorData <TOutput>(_row));
                    _row = default;
                }
            });
        }
コード例 #7
0
ファイル: CrossJoin.cs プロジェクト: whx76/etlbox
 private void CrossJoinData(TInput2 passingRow)
 {
     NLogStartOnce();
     if (!WasInMemoryTableLoaded)
     {
         InMemoryTarget.Completion.Wait();
         WasInMemoryTableLoaded = true;
     }
     foreach (TInput1 inMemoryRow in InMemoryData)
     {
         try
         {
             if (inMemoryRow != null && passingRow != null)
             {
                 TOutput result = CrossJoinFunc.Invoke(inMemoryRow, passingRow);
                 if (result != null)
                 {
                     if (!Buffer.SendAsync(result).Result)
                     {
                         throw new ETLBoxException("Buffer already completed or faulted!", this.Exception);
                     }
                     LogProgress();
                 }
             }
         }
         catch (ETLBoxException) { throw; }
         catch (Exception e)
         {
             ThrowOrRedirectError(e, string.Concat(ErrorSource.ConvertErrorData <TInput1>(inMemoryRow), "  |--| ",
                                                   ErrorSource.ConvertErrorData <TInput2>(passingRow)));
             LogProgress();
         }
     }
 }
コード例 #8
0
 public void ClearAllErrorsFrom(ProjectItemCodeDocument codeDocument, ErrorSource source)
 {
     foreach(var error in GetErrorsFromDocument(codeDocument)) {
         if(error.Source == source)
             this.Remove(error);
     }
 }
コード例 #9
0
 public void ClearAllErrorsFrom(ErrorSource source)
 {
     foreach(var error in GetAllErrors()) {
         if(error.Source == source)
             this.Remove(error);
     }
 }
コード例 #10
0
 internal CompileError(ErrorSource es, uint l, uint i, string m, string[] rs = null)
 {
     Source    = es;
     Line      = l;
     CharIndex = i;
     Message   = m;
     RuleStack = rs;
 }
コード例 #11
0
        /// <summary>
        /// This method allows you to reset the parameter object. Please note that this
        /// method resets all the parameters members except the connection information and
        /// the command time-out which are left in their current state.
        /// </summary>
        public void Reset()
        {
            this.internal_Param_RETURN_VALUE = System.Data.SqlTypes.SqlInt32.Null;

            this.errorSource    = ErrorSource.NotAvailable;
            this.sqlException   = null;
            this.otherException = null;
        }
コード例 #12
0
        public void Build_SourceGenerateError_ThrowsException()
        {
            var source  = new ErrorSource();
            var builder = new CombinatorBuilder {
                Combinator = source
            };

            RunInspector(builder);
        }
コード例 #13
0
        protected void LogError(string path, string msg)
        {
            ThreadAssist.ProxyToMain(delegate {
                ErrorSource error_source = ServiceManager.SourceManager.MusicLibrary.ErrorSource;
                error_source.AddMessage(path, msg);

                Log.Error(path, msg, false);
            });
        }
        public void EndAction(MatsAction action, AuthenticationResult authenticationResult)
        {
            // todo(mats): map contents of authentication result to appropriate telemetry values.
            AuthOutcome outcome          = AuthOutcome.Succeeded;
            ErrorSource errorSource      = ErrorSource.Service;
            string      error            = string.Empty;
            string      errorDescription = string.Empty;

            EndAction(action, outcome, errorSource, error, errorDescription);
        }
コード例 #15
0
        public ParsingError(ErrorSource source, string message, Span span)
        {
            if (message == null)
            {
                throw new ArgumentNullException(nameof(message));
            }

            Source  = source;
            Message = message;
            Span    = span;
        }
コード例 #16
0
        /// <summary>
        /// This method allows you to reset the parameter object. Please note that this
        /// method resets all the parameters members except the connection information and
        /// the command time-out which are left in their current state.
        /// </summary>
        public void Reset()
        {
            this.internal_Param_RETURN_VALUE = System.Data.SqlTypes.SqlInt32.Null;

            this.internal_Param_Ord_GuidID = System.Data.SqlTypes.SqlGuid.Null;
            this.internal_Param_Ord_GuidID_UseDefaultValue = this.useDefaultValue;

            this.errorSource    = ErrorSource.NotAvailable;
            this.sqlException   = null;
            this.otherException = null;
        }
コード例 #17
0
 public Error(ErrorSource source, ErrorCode code)
 {
     if (code == ErrorCode.NoError)
     {
         error = (uint)ErrorCode.NoError;
     }
     else
     {
         error = ((uint)source & sourceMask) << sourceShift | ((uint)code & codeMask);
     }
 }
コード例 #18
0
        public async Task ShowErrorListAsync(ErrorSource errorSource, __VSERRORCATEGORY minimumSeverity, CancellationToken cancellationToken)
        {
            await JoinableTaskFactory.SwitchToMainThreadAsync(cancellationToken);

            var errorList = await GetRequiredGlobalServiceAsync <SVsErrorList, IErrorList>(cancellationToken);

            ((IVsErrorList)errorList).BringToFront();
            errorList.AreBuildErrorSourceEntriesShown = errorSource.HasFlag(ErrorSource.Build);
            errorList.AreOtherErrorSourceEntriesShown = errorSource.HasFlag(ErrorSource.Other);
            errorList.AreErrorsShown   = minimumSeverity >= __VSERRORCATEGORY.EC_ERROR;
            errorList.AreWarningsShown = minimumSeverity >= __VSERRORCATEGORY.EC_WARNING;
            errorList.AreMessagesShown = minimumSeverity >= __VSERRORCATEGORY.EC_MESSAGE;
        }
コード例 #19
0
        public async Task <ImmutableArray <string> > GetErrorsAsync(ErrorSource errorSource, __VSERRORCATEGORY minimumSeverity, CancellationToken cancellationToken)
        {
            await JoinableTaskFactory.SwitchToMainThreadAsync(cancellationToken);

            var errorItems = await GetErrorItemsAsync(errorSource, minimumSeverity, cancellationToken);

            var list = errorItems.Select(GetMessage).ToList();

            return(list
                   .OrderBy(x => x, StringComparer.OrdinalIgnoreCase)
                   .ThenBy(x => x, StringComparer.Ordinal)
                   .ToImmutableArray());
        }
コード例 #20
0
        /// <summary>
        /// This method allows you to reset the parameter object. Please note that this
        /// method resets all the parameters members except the connection information and
        /// the command time-out which are left in their current state.
        /// </summary>
        public void Reset()
        {
            this.internal_Param_RETURN_VALUE = System.Data.SqlTypes.SqlInt32.Null;

            this.internal_Param_TitleId = System.Data.SqlTypes.SqlInt32.Null;
            this.internal_Param_TitleId_UseDefaultValue = this.useDefaultValue;

            this.internal_Param_Title = System.Data.SqlTypes.SqlString.Null;
            this.internal_Param_Title_UseDefaultValue = this.useDefaultValue;

            this.errorSource    = ErrorSource.NotAvailable;
            this.sqlException   = null;
            this.otherException = null;
        }
コード例 #21
0
 private IEnumerable <TOutput> MultiplicateRow(TInput row)
 {
     NLogStartOnce();
     if (row == null)
     {
         return(null);
     }
     try
     {
         return(MultiplicationFunc?.Invoke(row));
     }
     catch (Exception e)
     {
         ThrowOrRedirectError(e, ErrorSource.ConvertErrorData <TInput>(row));
         return(default);
コード例 #22
0
ファイル: RowTransformation.cs プロジェクト: bxjg1987/etlbox
 protected override void InternalInitBufferObjects()
 {
     TransformBlock = new TransformBlock <TInput, TOutput>(
         row =>
     {
         NLogStartOnce();
         try
         {
             InvokeInitActionOnce();
             return(InvokeTransformationFunc(row));
         }
         catch (Exception e)
         {
             ThrowOrRedirectError(e, ErrorSource.ConvertErrorData <TInput>(row));
             return(default);
コード例 #23
0
ファイル: BaseEntity.cs プロジェクト: mborysiak-sp/mvvm-wpf
        private void AddError(string ppty, string err, ErrorSource source)
        {
            List <AnError> _list;

            if (!errors.TryGetValue(ppty, out _list))
            {
                errors.Add(ppty, _list = new List <AnError>());
            }
            if (!_list.Any(x => x.Text == err))
            {
                _list.Add(new AnError {
                    Text = err, Source = source
                });
            }
        }
コード例 #24
0
        /// <summary>
        /// This method allows you to reset the parameter object. Please note that this
        /// method resets all the parameters members except the connection information and
        /// the command time-out which are left in their current state.
        /// </summary>
        public void Reset()
        {
            this.currentExecution = CurrentExecution.None;
            this.sqlCommand       = null;
            this.sqlDataReader    = null;

            this.internal_Param_RETURN_VALUE = System.Data.SqlTypes.SqlInt32.Null;

            this.internal_Param_Sup_GuidID = System.Data.SqlTypes.SqlGuid.Null;
            this.internal_Param_Sup_GuidID_UseDefaultValue = this.useDefaultValue;

            this.errorSource    = ErrorSource.NotAvailable;
            this.sqlException   = null;
            this.otherException = null;
        }
コード例 #25
0
        private static void WarnCallback(SSLCompiler compiler, ErrorSource source, uint line, string msg)
        {
            if (NoWarn)
            {
                return;
            }

            if ((source == ErrorSource.Parser) || (source == ErrorSource.Translator))
            {
                CConsole.Warn($"'{compiler.SourceFile}'[line {line}] - {msg}");
            }
            else
            {
                CConsole.Warn($"'{compiler.SourceFile}' - {msg}");
            }
        }
コード例 #26
0
        /// <summary>
        /// This method allows you to reset the parameter object. Please note that this
        /// method resets all the parameters members except the connection information and
        /// the command time-out which are left in their current state.
        /// </summary>
        public void Reset()
        {
            this.internal_Param_RETURN_VALUE = System.Data.SqlTypes.SqlInt32.Null;

            this.internal_Param_JobPartTypeId = System.Data.SqlTypes.SqlInt32.Null;
            this.internal_Param_JobPartTypeId_UseDefaultValue = this.useDefaultValue;

            this.internal_Param_Description = System.Data.SqlTypes.SqlString.Null;
            this.internal_Param_Description_UseDefaultValue = this.useDefaultValue;

            this.internal_Param_GeneralUnitCost = System.Data.SqlTypes.SqlMoney.Null;
            this.internal_Param_GeneralUnitCost_UseDefaultValue = this.useDefaultValue;

            this.errorSource    = ErrorSource.NotAvailable;
            this.sqlException   = null;
            this.otherException = null;
        }
コード例 #27
0
        /// <summary>
        /// This method allows you to reset the parameter object. Please note that this
        /// method resets all the parameters members except the connection information and
        /// the command time-out which are left in their current state.
        /// </summary>
        public void Reset()
        {
            this.internal_Param_RETURN_VALUE = System.Data.SqlTypes.SqlInt32.Null;

            this.internal_Param_Cat_LngID = System.Data.SqlTypes.SqlInt32.Null;
            this.internal_Param_Cat_LngID_UseDefaultValue = this.useDefaultValue;

            this.internal_Param_Cat_StrName = System.Data.SqlTypes.SqlString.Null;
            this.internal_Param_Cat_StrName_UseDefaultValue = this.useDefaultValue;

            this.internal_Param_ConsiderNull_Cat_StrName = System.Data.SqlTypes.SqlBoolean.Null;
            this.internal_Param_ConsiderNull_Cat_StrName_UseDefaultValue = this.useDefaultValue;

            this.errorSource    = ErrorSource.NotAvailable;
            this.sqlException   = null;
            this.otherException = null;
        }
        private void EndGenericAction(string actionId, string outcome, ErrorSource errorSource, string error, string errorDescription, string accountCid)
        {
            if (string.IsNullOrEmpty(actionId))
            {
                // This is an invalid action; we do not want to upload it.
                _errorStore.ReportError("Tried to end an action with an empty actionId", ErrorType.Action, ErrorSeverity.Warning);
                return;
            }

            ActionPropertyBag propertyBag = GetActionPropertyBagFromId(actionId);

            if (propertyBag == null)
            {
                _errorStore.ReportError("Trying to end an action that doesn't exist or was already uploaded", ErrorType.Action, ErrorSeverity.Warning);
                return;
            }

            if (propertyBag.ReadyForUpload)
            {
                return;
            }

            int startingCount = 1;
            var endTime       = DateTime.UtcNow;

            propertyBag.Add(ActionPropertyNames.OutcomeConstStrKey, outcome);
            propertyBag.Add(ActionPropertyNames.FailureSourceConstStrKey, MatsConverter.AsString(errorSource));
            propertyBag.Add(ActionPropertyNames.FailureConstStrKey, error);
            propertyBag.Add(ActionPropertyNames.FailureDescriptionConstStrKey, errorDescription);
            propertyBag.Add(ActionPropertyNames.EndTimeConstStrKey, DateTimeUtils.GetMillisecondsSinceEpoch(endTime));
            // propertyBag->Add(ActionPropertyNames::getAccountIdConstStrKey(), accountCid);  Commenting this out for GDPR reasons; once pipeline supports this we can upload again.
            propertyBag.Add(ActionPropertyNames.CountConstStrKey, startingCount);
            PopulateDuration(propertyBag);

            //Check if should aggregate here
            var contents = propertyBag.GetContents();

            if (_eventFilter.ShouldAggregateAction(contents))
            {
                EndAggregatedAction(actionId, propertyBag);
            }
            else
            {
                propertyBag.ReadyForUpload = true;
            }
        }
コード例 #29
0
ファイル: ErrorListInProcess.cs プロジェクト: Forgind/roslyn
        public async Task <ImmutableArray <string> > GetErrorsAsync(ErrorSource errorSource, __VSERRORCATEGORY minimumSeverity, CancellationToken cancellationToken)
        {
            await JoinableTaskFactory.SwitchToMainThreadAsync(cancellationToken);

            var errorItems = await GetErrorItemsAsync(cancellationToken);

            var list = new List <string>();

            foreach (var item in errorItems)
            {
                if (item.GetCategory() > minimumSeverity)
                {
                    continue;
                }

                if (!item.TryGetValue(StandardTableKeyNames.ErrorSource, out ErrorSource itemErrorSource) ||
                    !errorSource.HasFlag(itemErrorSource))
                {
                    continue;
                }

                var source    = item.GetBuildTool();
                var document  = Path.GetFileName(item.GetPath() ?? item.GetDocumentName()) ?? "<unknown>";
                var line      = item.GetLine() ?? -1;
                var column    = item.GetColumn() ?? -1;
                var errorCode = item.GetErrorCode() ?? "<unknown>";
                var text      = item.GetText() ?? "<unknown>";
                var severity  = item.GetCategory() switch
                {
                    __VSERRORCATEGORY.EC_ERROR => "error",
                    __VSERRORCATEGORY.EC_WARNING => "warning",
                    __VSERRORCATEGORY.EC_MESSAGE => "info",
                    var unknown => unknown.ToString(),
                };

                var message = $"({source}) {document}({line + 1}, {column + 1}): {severity} {errorCode}: {text}";
                list.Add(message);
            }

            return(list
                   .OrderBy(x => x, StringComparer.OrdinalIgnoreCase)
                   .ThenBy(x => x, StringComparer.Ordinal)
                   .ToImmutableArray());
        }
コード例 #30
0
 private void SetupDynamicObjectFillAction(SqlTask sqlT, string colName)
 {
     sqlT.Actions.Add(colValue =>
     {
         try
         {
             if (_row != null)
             {
                 dynamic r = _row as ExpandoObject;
                 ((IDictionary <String, Object>)r).Add(colName, colValue);
             }
         }
         catch (Exception e)
         {
             ThrowOrRedirectError(e, ErrorSource.ConvertErrorData <TOutput>(_row));
             _row = default;
         }
     });
 }
コード例 #31
0
        private void WrapAggregationAction(TInput row)
        {
            try
            {
                object key = GroupingFunc?.Invoke(row) ?? string.Empty;

                if (!AggregationData.ContainsKey(key))
                {
                    AddRecordToDict(key);
                }

                TOutput currentAgg = AggregationData[key];
                AggregationAction.Invoke(row, currentAgg);
            }
            catch (Exception e)
            {
                ThrowOrRedirectError(e, ErrorSource.ConvertErrorData <TInput>(row));
                return;
            }
        }
        public static string AsString(ErrorSource errorSource)
        {
            switch (errorSource)
            {
            case ErrorSource.AuthSdk:
                return("authsdk");

            case ErrorSource.Client:
                return("client");

            case ErrorSource.None:
                return("none");

            case ErrorSource.Service:
                return("service");

            default:
                return("unknown");
            }
        }
コード例 #33
0
ファイル: ErrorReport.cs プロジェクト: kapitanov/diploma
 /// <summary>
 /// Initializes new instance of <see cref="ErrorReport"/> class.
 /// </summary>
 /// <param name="task">
 /// An instance of <see cref="Task"/> that caused current exception.
 /// </param>
 /// <param name="exception">
 /// An instance of <see cref="Exception"/> class that caused current error.
 /// </param>
 /// <param name="source">
 /// An <see cref="ErrorSource"/> that caused current error.
 /// </param>
 public ErrorReport(Task task, Exception exception, ErrorSource source)
 {
     Task = task;
     Error = new Error(exception);
     Source = source;
 }
コード例 #34
0
ファイル: GeneralCore.cs プロジェクト: kapitanov/diploma
 private ExecutionResult ReportFailure(ITaskProvider taskProvider, Task task, ErrorSource source, Exception error)
 {
     taskProvider.FailTask(task.Id, new ErrorReport(task, error, source));
     return ExecutionResult.Failed(task.Id);
 }