Hi HKPR,
It looks like you have found a remedy. Another remedy seems to be deleting the project and Function resource and redeploying the Function.
To ensure your feedback is heard I'd recommend posting it below:
Azure Functions
https://feedback.azure.com/d365community/forum/9df02822-f224-ec11-b6e6-000d3a4f0da0
And reporting issues on GitHub:
https://github.com/Azure/Azure-Functions
If this is helpful please accept answer.