當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。