Mono.StackFrameData.SetLocation C# (CSharp) Méthode

SetLocation() private méthode

private SetLocation ( string file, int lineNumber ) : void
file string
lineNumber int
Résultat void
		internal void SetLocation (string file, int lineNumber)
		{
			File = file;
			LineNumber = lineNumber;
		}

Usage Example

Exemple #1
0
		public bool TryResolveLocation (StackFrameData sfData, SeqPointInfo seqPointInfo)
		{
			if (!assembly.MainModule.HasSymbols)
				return false;

			TypeDefinition type = null;
			var nested = sfData.TypeFullName.Split ('+');
			var types = assembly.MainModule.Types;
			foreach (var ntype in nested) {
				if (type == null) {
					// Use namespace first time.
					type = types.FirstOrDefault (t => t.FullName == ntype);
				} else {
					type = types.FirstOrDefault (t => t.Name == ntype);
				}

				if (type == null) {
					logger.LogWarning ("Could not find type: {0}", ntype);
					return false;
				}

				types = type.NestedTypes;
			}

			var parensStart = sfData.MethodSignature.IndexOf ('(');
			var methodName = sfData.MethodSignature.Substring (0, parensStart).TrimEnd ();
			var methodParameters = sfData.MethodSignature.Substring (parensStart);
			var method = type.Methods.FirstOrDefault (m => CompareName (m, methodName) && CompareParameters (m.Parameters, methodParameters));
			if (method == null) {
				logger.LogWarning ("Could not find method: {0}", methodName);
				return false;
			}

			int ilOffset;
			if (sfData.IsILOffset) {
				ilOffset = sfData.Offset;
			} else {
				if (seqPointInfo == null)
					return false;

				ilOffset = seqPointInfo.GetILOffset (method.MetadataToken.ToInt32 (), sfData.MethodIndex, sfData.Offset);
			}

			if (ilOffset < 0)
				return false;

			SequencePoint sp = null;
			foreach (var instr in method.Body.Instructions) {
				if (instr.SequencePoint != null)
					sp = instr.SequencePoint;
				
				if (instr.Offset >= ilOffset) {
					sfData.SetLocation (sp.Document.Url, sp.StartLine);
					return true;
				}
			}

			return false;
		}
All Usage Examples Of Mono.StackFrameData::SetLocation