Anthony writes, "What should an immigrant do if he or she gets charged with a crime while the immigration petition is still pending? Should he tell the USCIS or just wait for the petition to be approved? I would like to hear answers for both misdemeanors and felonies."
It seems that the USCIS does not expect you to update you on your criminal activities while an application is pending. Rather the USCIS relies on its own background check system to get to know what you have been up to. For instance, if you were arrested and fingerprinted, the USCIS will be able to see it in their background check system, which are always conducted yet once more before the final approval is granted. In cases where a personal interview with a USCIS officer is mandatory, for instance, in some adjustment of status petitions and naturalization, you will be under oath and promise to tell the truth. Particularly in case of naturalization it is a standard question: what has changed since you filed the application? By law, you are obliged to update the agent with the status, whether you have only been arrested and not convicted or that you have already been convicted and completed the sentence. For such interviews, it is best to have your file with you for that case. Depending on the petition and the outcome of the crime, your case maybe put on hold, denied, or you can be even arrested on the spot for deportation purposes.
So it is theoretically possible that you maybe granted an approval without the USCIS being aware of your crime because records are not always updated in real time. Unless it is a deportable offense, USCIS may not act on new information till you apply for another petition, for example, renewal or a new status. In any case, if you have committed any crime since the date of your last application, you should not leave the United States and try to reenter the country. The immigration checkpoints at an airport or land border crossing are often used by ICE to arrest aliens or to deny entry into the United States. In such cases it is best to seek legal help.