StackFrameSourceCodeInfo.cs 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. // Copyright (c) .NET Foundation. All rights reserved.
  2. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. #nullable enable
  6. namespace Microsoft.Extensions.StackTrace.Sources
  7. {
  8. /// <summary>
  9. /// Contains the source code where the exception occurred.
  10. /// </summary>
  11. internal class StackFrameSourceCodeInfo
  12. {
  13. /// <summary>
  14. /// Function containing instruction
  15. /// </summary>
  16. public string? Function { get; set; }
  17. /// <summary>
  18. /// File containing the instruction
  19. /// </summary>
  20. public string? File { get; set; }
  21. /// <summary>
  22. /// The line number of the instruction
  23. /// </summary>
  24. public int Line { get; set; }
  25. /// <summary>
  26. /// The line preceding the frame line
  27. /// </summary>
  28. public int PreContextLine { get; set; }
  29. /// <summary>
  30. /// Lines of code before the actual error line(s).
  31. /// </summary>
  32. public IEnumerable<string> PreContextCode { get; set; } = Enumerable.Empty<string>();
  33. /// <summary>
  34. /// Line(s) of code responsible for the error.
  35. /// </summary>
  36. public IEnumerable<string> ContextCode { get; set; } = Enumerable.Empty<string>();
  37. /// <summary>
  38. /// Lines of code after the actual error line(s).
  39. /// </summary>
  40. public IEnumerable<string> PostContextCode { get; set; } = Enumerable.Empty<string>();
  41. /// <summary>
  42. /// Specific error details for this stack frame.
  43. /// </summary>
  44. public string? ErrorDetails { get; set; }
  45. }
  46. }