Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

[Bug] Dictionary.keys failed to be displayed as metadata #1722

Open
bogdan opened this issue Jan 14, 2025 · 2 comments
Open

[Bug] Dictionary.keys failed to be displayed as metadata #1722

bogdan opened this issue Jan 14, 2025 · 2 comments
Labels
awaiting feedback Awaiting a response from a customer. Will be automatically closed after approximately 2 weeks.

Comments

@bogdan
Copy link

bogdan commented Jan 14, 2025

Describe the bug

When sending the result of Dictionary.keys as metadata, it is not properly dispayed without converting to array.

Steps to reproduce

                Bugsnag.notifyError(NSError(domain: "test", code: 1)) { event in
                    event.addMetadata(["hello": 1, "world": 2].keys, key: "keys", section: "nserror")
                    return true
                }

Results in:

image

@clr182 clr182 added the awaiting feedback Awaiting a response from a customer. Will be automatically closed after approximately 2 weeks. label Feb 12, 2025
@clr182
Copy link

clr182 commented Feb 12, 2025

Hi @bogdan

Dictionary.keys returns a LazyMapCollection which is not automatically serialized for metadata. Converting the keys to an array via (Array(dictionary.keys)) should resolve the issue and allow the keys to be displayed properly.

Here is an updated example code snippet:

Bugsnag.notifyError(NSError(domain: "test", code: 1)) { event in
    event.addMetadata(Array(["hello": 1, "world": 2].keys), key: "keys", section: "nserror")
    return true
}

@bogdan
Copy link
Author

bogdan commented Feb 12, 2025

Yeah, I guess so. It would be better if it would serialize LazyMapCollection properly because why not or throw an error that it can't.

Anyway, whatever you decide on it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
awaiting feedback Awaiting a response from a customer. Will be automatically closed after approximately 2 weeks.
Projects
None yet
Development

No branches or pull requests

2 participants