Skip to content

Unable to place warning in custom location #154

Closed

Description

@rockyev

We are trying to integrate reportIssue directly into our logging system so that anytime an error message is logged, reportIssue is also called. However, even though we are explicitly passing file location metadata (fileID, filePath, line, column), the runtime warning still appears on the line where reportIssue is called, rather than the location that is passed through (where the actual error would be).

Is this a bug, or just a known limitation? I've noticed that by passing the location through, I can see the warning listed with the correct location on the left side of my Xcode, but the warning itself still appears on the line where reportIssue is called. See my screenshot below, which shows the runtime warning on reportIssue, but the location being passed through is pointing to a different file entirely.

Image

Steps to Reproduce

  • Create a logging function that calls reportIssue, passing in fileID, filePath, line, and column.
  • Use the function.
  • Observe that the purple runtime warning appears on the reportIssue line instead of where the function was called, despite the location being passed in to reportIssue.

Activity

  1. jshier commented on Mar 19, 2025

    @jshier

    Functions must also be marked @_transparent for that passthrough to work properly.

  2. mbrandonw commented on Mar 20, 2025

    @mbrandonw
    Member

    Hi @rockyev, @jshier is correct. You must make your helpers @_transparent in order for the purple runtime warning to be emitted at the caller of the function. It's annoying, but also Apple does not actually give us a public way of emitting these kinds of warnings. We are doing hacky things to unlock this functionality, and it's the best we can do.

    Since this isn't an issue with the library I am going to convert it to a discussion. Please feel free to continue the conversation over there!

  3. locked and limited conversation to collaborators on Mar 20, 2025
  4. converted this issue into a discussion #155 on Mar 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions