Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Fix: Debug.LogError annotation point not parsed correctly #279

Merged
merged 1 commit into from
Jul 20, 2024

Conversation

12joan
Copy link
Contributor

@12joan 12joan commented Jul 19, 2024

Changes

Correctly parse the annotation point for stack traces created by Debug.LogError.

Related Issues

Fixes #278

Successfully Failed Workflow Run Link

Note that the RuntimeUtils.cs:580 annotation (Debug.LogError) and the TestHelpers.cs:130 annotation (Assert.Fail) are both reported correctly.

https://github.com/anderbellstudios/pop-pixie/actions/runs/10002797271/job/27648683312#step:4:21445

Checklist

  • Read the contribution guide and accept the code of conduct
  • Docs (If new inputs or outputs have been added or changes to behavior that should be documented. Please make a PR
    in the documentation repo)
  • Readme (updated or not needed)
  • Tests (added, updated or not needed)

Copy link

Cat Gif

@GabLeRoux GabLeRoux requested a review from davidmfinol July 20, 2024 19:10
Copy link
Member

@GabLeRoux GabLeRoux left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Explanation of Regex Changes

Original Regex:

/at .* in ((?<path>[^:]+):(?<line>\d+))/

Updated Regex:

/at(?: .* in)? ((?<path>[^:]+):(?<line>\d+))/

Changes Explained:

  1. Introduction of Non-Capturing Group:

    • Original: at .* in
    • Updated: at(?: .* in)?
    • Explanation: The non-capturing group (?: .* in)? makes the .* in part optional. This change allows matching lines that do not strictly follow the "in" keyword structure.
  2. Regex Application:

    • Original: trace.match(/at .* in ((?<path>[^:]+):(?<line>\d+))/g);
    • Updated: trace.match(new RegExp(regex, 'g'));
    • Explanation: The regex is now reused with new RegExp(regex, 'g'), improving code maintainability by storing the regex pattern in a variable.

Purpose of Changes:

These updates improve the flexibility and robustness of the findAnnotationPoint function, allowing it to correctly parse a wider variety of stack trace formats, including those generated by Debug.LogError.


Looks good to me 👍

@davidmfinol davidmfinol merged commit 05a00ef into game-ci:main Jul 20, 2024
1 check passed
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Cannot find annotation point for Debug.LogError stack trace
3 participants