Update your game
As of 19th August 2018, Niantic has released an update which appears to include a patch that addresses this bug. The Android version is v0.115.3, I'm not sure of the iOS version number.
It's not a forced upgrade, so you may have to go into the Play Store/App Store on your device, and update the game manually.
What caused this?
Niantic released a statement regarding this bug:
We are aware of an issue on Android version 0.111.4 and iOS version 1.81.4 that causes Pokémon GO to become unresponsive when encountering a Pokémon that you have previously fed a Berry to. We are currently working on a fix but in the meantime, you will need to restart the app to continue playing.
It seems that feeding a berry to a Pokemon, fleeing from the capture screen, then re-entering the capture caused this issue.
What about my lost research task?
If your research task Pokemon capture was somehow lost in the process, then you may be able to recover it. According to user Borinkito who experienced similar issues:
If you have been impacted by this update, you may be able to recover your research task rewards. Please send your email address and Trainer nickname through this form and include the phrase #ResearchReward: Niantic Support Form
Borinkito - Unable to claim reward after completing field research, how can I fix this?