Mysteries are often presented as a game, in which the audience tries to guess whodunit along with the detective. Removing or minimizing the gruesome circumstances of the murder itself gives the genre a grand potential for comedy, particularly the dark kind which fits in perfectly with the blood-soaked goings-on. Even dramatic murder mysteries such as Agatha Christie's can't resist an arch moment here and there, and when full-bore laughs are called for, the genre proves a durable fit.
Source:https://www.cbr.com/best-murder-mystery-comedy-movies-of-all-time/