Running mode: developer I was getting blank frontend page. I checked system.log and debug.log in magento and found out there was some errors related to some broken reference.
main.INFO: Broken reference: the 'logger' element cannot be added as child to 'after.body.start', because the latter doesn't exist  
main.INFO: Broken reference: the 'theme.active.editor' element cannot be added as child to 'after.body.start', because the latter doesn't exist  
The frontend page was showing blank but it was actually loading some html. I check for solution and found an answer in this thread https://stackoverflow.com/questions/55928892/magento-2-blank-page-but-not-empty
This thread suggested to delete the global.php file located in generated/metadata, and following this solved my issue and front end of my website loaded properly.
But now whenever I run the command
php bin/magento setup:di:compile
the global.php file is generated again and my website's frontend shows blank page again and deleting global.php solves it. I got some information related to global.php file in this thread Purpose of magento\generated\metadata\global.php file and is it safe to delete this file?
According to above thread
"The code compiler creates generated/metadata/global.php, which is a PHP serialized map of all constructor definitions mixed with object linking configuration defined in di.xml. di.xml is the dependency injection configuration. There is a global app/etc/di.xml and there can one defined for every module ."
This also happens when I run my website in production mode, and deleting global.php solves it. Now my question is why magento is generating global.php file if it is neither using it in developer mode nor production mode as deleting this file does not give any error and the website works perfectly.
And also broken reference error in fresh install of magento, does it means that it is some bug related to magento and how can one debug this problem further. I am asking how to debug it because as we can see in the error there is no mention of any file just a reference 'after.body.start'.
Update: I am running it locally on my PC, and I am using xampp version-3.2.3 on windows operating system.