public static StackFrameModel ToStackFrameModel(this StackFrame stackFrame) { StackFrameModel model = new StackFrameModel(); model.FullyQualifiedLogicalName = stackFrame.Location.LogicalLocation.FullyQualifiedName; model.Message = stackFrame.Location?.Message?.Text; model.Module = stackFrame.Module; if (stackFrame.Location?.PhysicalLocation?.Address != null) { model.Address = stackFrame.Location.PhysicalLocation.Address.AbsoluteAddress; model.Offset = stackFrame.Location.PhysicalLocation.Address.OffsetFromParent ?? 0; } PhysicalLocation physicalLocation = stackFrame.Location?.PhysicalLocation; if (physicalLocation?.ArtifactLocation != null) { model.FilePath = physicalLocation.ArtifactLocation.Uri.ToPath(); Region region = physicalLocation.Region; if (region != null) { model.Region = region; model.Line = region.StartLine; model.Column = region.StartColumn; } } return(model); }
private void VerifyStackFrame(StackFrameModel model, StackFrame stackFrame, int resultId, int runIndex) { model.Should().NotBeNull(); model.ResultId.Should().Be(resultId); model.RunIndex.Should().Be(runIndex); if (stackFrame.Module == null) { stackFrame.Module.Should().BeNull(); } else { stackFrame.Module.Should().BeEquivalentTo(stackFrame.Module); } if (stackFrame.Location?.Message?.Text == null) { model.Message.Should().BeNull(); } else { model.Message.Should().BeEquivalentTo(stackFrame.Location.Message.Text); } if (stackFrame.Location?.LogicalLocation?.FullyQualifiedName == null) { model.FullyQualifiedLogicalName.Should().BeNull(); } else { model.FullyQualifiedLogicalName.Should().BeEquivalentTo(stackFrame.Location.LogicalLocation.FullyQualifiedName); } if (stackFrame.Location?.PhysicalLocation?.ArtifactLocation?.Uri == null) { model.FilePath.Should().BeNull(); } else { model.FilePath.Should().BeEquivalentTo(stackFrame.Location.PhysicalLocation.ArtifactLocation.Uri.ToPath()); } if (stackFrame.Location?.PhysicalLocation?.Region == null) { model.Region.Should().BeNull(); } else { model.Region.Should().NotBeNull(); model.Region.StartLine.Should().Be(stackFrame.Location.PhysicalLocation.Region.StartLine); model.Region.StartColumn.Should().Be(stackFrame.Location.PhysicalLocation.Region.StartColumn); model.Line.Should().Be(stackFrame.Location.PhysicalLocation.Region.StartLine); model.Column.Should().Be(stackFrame.Location.PhysicalLocation.Region.StartColumn); } if (stackFrame.Location?.PhysicalLocation?.Address == null) { model.Address.Should().Be(default);
public static StackFrameModel ToStackFrameModel(this StackFrame stackFrame) { StackFrameModel model = new StackFrameModel(); model.Address = stackFrame.Address; model.Column = stackFrame.Column; model.FullyQualifiedLogicalName = stackFrame.FullyQualifiedLogicalName; model.Line = stackFrame.Line; model.Message = stackFrame.Message; model.Module = stackFrame.Module; model.Offset = stackFrame.Offset; model.FilePath = stackFrame.Uri.ToPath(); return(model); }