The Agatha Christie story “The Body In The Library” is a good example of a mockery of a trope that so thoroughly killed it that no-one remembers the original trope.
But in mystery stories, it was common for a dead body to turn up in a library with a mystery being about how the killer got in or out, often due to a closed room mystery. A secret passage or a means to sneakily enter and leave the room without anyone knowing. The library itself had a spectacular element to it that facilitated the mystery.
But what made the book so unique was the fact that there was nothing of note about the library - it had no secret passages, the doors weren’t locked, there was no reason to keep it isolated at all, nothing.
What makes the story so strange was the fact that a random-ass corpse just turned up out of nowhere.
It worked well with the book >!The Murder of Roger Ackroyd!< since at that point, it was a firmly established rule of the mystery genre that the narrator couldn’t be the killer of the story. In fact, >!Agatha Christie!< was a member of the Detection Club which practiced the Knox Decalogue of mystery rules, one of which was “The Narrator can’t be the killer”.
Also, there was an episode of the TV series McDonald & Dodds that does this rather well and makes perfect sense in context. >!The “Victim” was a social media influencer who wanted to quit but was being stalked by an obsessive fan so made use of an upcoming plastic surgery procedure to switch places with the fan to make her think she could get a procedure for free, instead using it as a means of murdering the fan and faking her own death as she fled the country.!<