PencilKit crashing on iOS 15.1 on iPad

I am starting to work with PencilKit and have a small sample app set up with Swift. When I draw a line too long it will crash from com.apple.pencilkit.renderer with the following:

-[MTLDebugCommandBuffer lockPurgeableObjects]:2103: failed assertion `MTLResource 0x280584a10 (label: (null)), referenced in cmd buffer 0x107019400 (label: Live rendering command buffer) is in volatile or empty purgeable state at commit'

I can draw lots of small lines without issue. Doesn't seem to matter what size the canvas is or any other specific attributes I can determine. It's a quick sample so there's really not much going on, and this appears to be coming from pencil kit and metal under the hood.

I am using an iPad pro, iOS 15.1 and a pencil2 and using finger to draw with the same crash if it helps.

Some more experimentation, this doesn't happen with the pen tool as far as I can tell, only the pencil...

I having the same problem with pencil tool. This happens too often that it makes my app unusable if the are too many stroke on screen and user draw with pencil tool :(

Figured it out. Appears to be a bug with PKCanvas view. The issue is not present if you test on a device, in release mode, with the app running standalone (not connected to XCode). Took me a while to figure this out but I have been testing it for a week with small strokes, large, multiple strokes added quickly and still no crash. Apple, please fix this? annoying.

I'm still dealing with this exact same issue however to the best of my knowledge, release mode did not correct it. Have you seen a resolution to this in the updates?

PencilKit crashing on iOS 15.1 on iPad
 
 
Q