pointfreeco / swift-custom-dump

A collection of tools for debugging, diffing, and testing your application's data structures.
MIT License
800 stars 89 forks source link

NSNumber crashes CustomDump #27

Closed andreweades closed 3 years ago

andreweades commented 3 years ago

Dumping a struct with an NSNumber crashes CustomDump. Storing the number as Double fixes the issue for me. The NSNumber is coming out of CoreBluetooh's API so pretty old and low-level.

stephencelis commented 3 years ago

@andreweades Can you provide steps to reproduce? We have a test for NSNumber that is passing on all platforms, so I'm not quite sure why you're seeing a crash.

andreweades commented 3 years ago

OK. I can share the project with you...

andreweades commented 3 years ago

I went back to the commit that had the NSNumber crash. And of course, it works now. I'll keep digging to see if I can isolate the problem to something else.

andreweades commented 3 years ago

Here we go:

I can reproduce by setting the property to NSnumber.init()

And I will get these errors:

Found unexpected null pointer value while trying to cast value of type 'NSNumber' (0x7f99bc050278) to 'CustomDump.CustomDumpReflectable' (0x7f99cb832df0) 2021-10-09 16:06:24.738750+0100 BluetoothCentralCA[85223:1176312] Found unexpected null pointer value while trying to cast value of type 'NSNumber' (0x7f99bc050278) to 'CustomDump.CustomDumpReflectable' (0x7f99cb832df0) Found unexpected null pointer value while trying to cast value of type 'NSNumber' (0x7f99bc050278) to 'CustomDump.CustomDumpReflectable' (0x7f99cb832df0)

andreweades commented 3 years ago

I've shared a repo with you with the bug exposed. Hope this helps.