当前位置: 首页>>代码示例>>C#>>正文


C# CodeLocation.ToString方法代码示例

本文整理汇总了C#中CodeLocation.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# CodeLocation.ToString方法的具体用法?C# CodeLocation.ToString怎么用?C# CodeLocation.ToString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CodeLocation的用法示例。


在下文中一共展示了CodeLocation.ToString方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: EVException

 public EVException([CallerFilePath] string callerFilePath = "",
                    [CallerLineNumber] int callerLineNumber = 0, 
                    [CallerMemberName] string callerMemberName = "")
 {
     CodeLocation codeLocation = new CodeLocation(callerFilePath, callerLineNumber, callerMemberName);
     this.AddNamedProperty("EVExceptionConstructionLocation", codeLocation.ToString());
 }
开发者ID:Rajeshbharathi,项目名称:CGN.Paralegal,代码行数:7,代码来源:EVException.cs

示例2: PersistentUncoveredLocationStore

        public PersistentUncoveredLocationStore(CodeLocation cl,
            TypeEx explorableType, int termIndex, int fitnessvalue, FactorySuggestionStore fss)
        {
            this.CodeLocation = cl.ToString();
            this.MethodSignature = MethodOrFieldAnalyzer.GetMethodSignature(cl.Method);
            TypeDefinition declaringType;
            if (!cl.Method.TryGetDeclaringType(out declaringType))
            {
                //TODO:Error
            }

            this.ExplorableType = explorableType.ToString();
            this.Offset = cl.Offset;
            this.AssemblyShortName = declaringType.Module.Assembly.Location;
            this.declaringTypeStr = declaringType.ToString();
            this.Fitnessvalue = fitnessvalue;
            this.TermIndex = termIndex;
            this.parentfss = fss;
        }
开发者ID:spati2,项目名称:ICSE-2011-Covana,代码行数:19,代码来源:PersistentUncoveredLocationStore.cs

示例3: AddFieldsOfUncoveredCodeLocations

        /// <summary>
        /// Adds a field to an unsuccessful code location.         
        /// </summary>
        /// <param name="location"></param>
        /// <param name="fields"></param>
        public void AddFieldsOfUncoveredCodeLocations(CodeLocation location, SafeList<Field> fields, FieldModificationType fmt, 
            Term condition, string terms, int fitnessval, TypeEx explorableType, SafeList<TypeEx> allFieldTypes)
        {
            //No need to process this location.
            if (fields.Count == 0)
            {
                return;
            }

            Field targetField;
            TypeEx declaringType;   //This declaring type is considered as explorable type in the rest of the analysis
            if (!PexMeFactoryGuesser.GetTargetExplorableField(this, fields, out targetField, out declaringType))
            {
                this.Log.LogError(WikiTopics.MissingWikiTopic, "factoryguesser",
                   "Failed to retrieve the target field for uncovered location " + location.ToString());
                return;
            }

            //Compare the declaring type and actual explorable type.
            //If there is a inheritance relation, use the actual one
            if (explorableType.IsAssignableTo(declaringType))
            {
                declaringType = explorableType;
            }

            var uclskey = UncoveredCodeLocationStore.GetKey(location.ToString(), declaringType.ToString(), condition.UniqueIndex);
            UncoveredCodeLocationStoreList uclslist;
            if (!this.unCoveredLocationDic.TryGetValue(uclskey, out uclslist))
            {
                uclslist = new UncoveredCodeLocationStoreList();
                uclslist.Location = location;
                uclslist.ExplorableType = declaringType.ToString();
                uclslist.TermIndex = condition.UniqueIndex;
                this.unCoveredLocationDic[uclskey] = uclslist;
            }

            var ucls = new UncoveredCodeLocationStore();
            ucls.Location = location;
            ucls.ExplorableType = declaringType;
            ucls.TargetField = targetField;
            ucls.AllFields.AddRange(fields);
            ucls.AllFieldTypes.AddRange(allFieldTypes);
            ucls.TermIndex = condition.UniqueIndex;
            //add the sequence of method calls
            ucls.MethodCallSequence = new MethodSignatureSequence();
            foreach (var m in this.LastExecutedFactoryMethodCallSequence)
            {
                ucls.MethodCallSequence.Sequence.Add(MethodOrFieldAnalyzer.GetMethodSignature(m));
            }
            ucls.IsADefectDetectingSequence = this.DefectDetectingSequence;
            ucls.CUTMethodCallSequence = this.LastExecutedCUTMethodCallSequence;

            if (!uclslist.StoreList.Contains(ucls))
            {
                ucls.TextualTerms.Add(terms);
                ucls.DesiredFieldModificationType = fmt;
                ucls.Fitnessvalue = fitnessval;
                uclslist.StoreList.Add(ucls);
            }
        }
开发者ID:spati2,项目名称:ICSE-2011-Covana,代码行数:65,代码来源:PexMeDynamicDatabase.cs

示例4: GetMetadata

        private static IEnumerable<KeyValuePair<string, string>> GetMetadata(CodeLocation dataLocation, string[] record, Dictionary<string, int> metadataColumns)
        {
            if (dataLocation != CodeLocation.Unknown)
                yield return new KeyValuePair<string, string>(MetadataKeys.DataLocation, dataLocation.ToString());

            if (metadataColumns != null)
            {
                foreach (KeyValuePair<string, int> metadataColumn in metadataColumns)
                {
                    // Ignore metadata columns that are absent.
                    int columnIndex = metadataColumn.Value;
                    if (columnIndex < record.Length)
                        yield return new KeyValuePair<string, string>(metadataColumn.Key, record[columnIndex]);
                }
            }
        }
开发者ID:dougrathbone,项目名称:mbunit-v3,代码行数:16,代码来源:CsvDataSet.cs

示例5: HandleTargetBranch

        /// <summary>
        /// Gets called when an un-explored branch is encountered during program execution
        /// </summary>
        /// <param name="executionNode"></param>
        /// <param name="explorableType"></param>
        public void HandleTargetBranch(CodeLocation location, Term condition, TermManager termManager, TypeEx explorableType)
        {
            var accessedFields = new SafeList<Field>();

            if (PexMeConstants.IGNORE_UNCOV_BRANCH_IN_SYSTEM_LIB)
            {
                if(IsUncoveredLocationInSystemLib(location))
                {
                    this.host.Log.LogWarning(WikiTopics.MissingWikiTopic, "uncoveredlocation",
                        "Ignoring the uncovered location " + location.ToString() + ", since it is in system library");
                    return;
                }
            }

            Term unnegatedCondition;
            bool bNegated = false;
            if (termManager.TryGetInnerLogicallyNegatedValue(condition, out unnegatedCondition))
                bNegated = true;
            else
                unnegatedCondition = condition;

            var culpritFields = new SafeList<Field>();
            Term left, right;
            BinaryOperator binOp;

            SafeStringBuilder sbTerm = new SafeStringBuilder();
            this.ConvertTermToText(new SafeStringWriter(sbTerm), condition, termManager);

            //Handling only binary conditions. TODO: Needs to check what are the other conditions
            //The related code is in TermSolver function
            if (!termManager.TryGetBinary(unnegatedCondition, out binOp, out left, out right))
            {
                this.host.Log.LogWarning(WikiTopics.MissingWikiTopic, PexMeLogCategories.Term,
                    "Handling only binary operations in terms");
                return;
            }

            if (PexMeConstants.USE_TERM_SOLVER)
            {
                //TODO: Temporarily ignoring the scenario where both the sides are symbolic values
                if (!termManager.IsValue(left) && !termManager.IsValue(right))
                {
                    this.host.Log.LogWarning(WikiTopics.MissingWikiTopic, PexMeLogCategories.Term,
                       "Handling only binary operations where atleast one side of the condition is concrete. Current expression has both sides symbolic");
                    return;
                }

                SafeDictionary<Field, FieldValueHolder> expectedFieldValues;
                SafeDictionary<Field, FieldValueHolder> actualFieldValues;
                SafeList<Field> allFieldsInCondition;
                SafeList<TypeEx> allFieldTypes;
                TermSolver.SolveTerm(this.explorationComponent, condition, binOp,
                    out actualFieldValues, out expectedFieldValues, out allFieldsInCondition, out allFieldTypes);

                //Compute an intersection to identify culprit fields
                List<Field> actualKeys = actualFieldValues.Keys.ToList();
                List<Field> expectedKeys = expectedFieldValues.Keys.ToList();

                AddToCulpritField(allFieldsInCondition, culpritFields);
                if (culpritFields.Count == 0)
                {
                    this.host.Log.LogWarning(WikiTopics.MissingWikiTopic, PexMeLogCategories.Term,
                        "Failed to retrieve culprit fields from the uncovered branch");
                }
                else
                {
                    foreach (Field field in culpritFields)
                    {
                        FieldModificationType fieldfmt;
                        int fitnessval;
                        FitnessMeasure.ComputeFitnessValue(field, actualFieldValues[field], expectedFieldValues[field], this.host, out fieldfmt, out fitnessval);

                        if (fieldfmt == FieldModificationType.UNKNOWN)
                            continue;
                        this.pmd.AddFieldsOfUncoveredCodeLocations(location, allFieldsInCondition, fieldfmt,
                            condition, sbTerm.ToString(), fitnessval, explorableType, allFieldTypes);
                    }
                }
            }
            else
            {
                FieldModificationType fmt;
                if (!termManager.IsValue(left) && !termManager.IsValue(right))
                {
                    SafeDictionary<Field, FieldValueHolder> leftFieldValues;
                    SafeList<TypeEx> leftFieldTypes;
                    var leftAccessedFields = GetInvolvedFields(this.host, termManager, left, out leftFieldValues, out leftFieldTypes);
                    if (leftAccessedFields.Count > 0)
                        AddToCulpritField(leftAccessedFields, culpritFields);

                    SafeDictionary<Field, FieldValueHolder> rightFieldValues;
                    SafeList<TypeEx> rightFieldTypes;
                    var rightAccessedFields = GetInvolvedFields(this.host, termManager, right, out rightFieldValues, out rightFieldTypes);
                    if (rightAccessedFields.Count > 0)
                        AddToCulpritField(rightAccessedFields, culpritFields);
//.........这里部分代码省略.........
开发者ID:spati2,项目名称:ICSE-2011-Covana,代码行数:101,代码来源:TargetBranchAnalyzer.cs


注:本文中的CodeLocation.ToString方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。