I don't disagree about whodunits--as whodunits--being at least potentially problematic. That said ...
I knew what was going on and who was doing it and why, and I knew (at least mostly) how they were going about it. I didn't know how the PCs were going to approach the situation, and I didn't know how they'd handle things--and it was at least in principle possible that they'd be able to demonstrate the merchant was innocent without digging up and triggering the larger problem.
As I said, I kinda ad-libbed myself into running that mystery. The merchant hired the party to escort him to the dwarven stronghold, and I ended up needing reason/s for him to be persona non grata there. I didn't think the PCs would continue with the job if he was guilty, so he wasn't. So, if he wasn't guilty, something else needed to be going on, and that something else was what the party ended up finding as they were solving what looked like a whodunit.
Yeah, there are ways to make it work. And I wouldn't say that my games don't wind up with some of this kind of content involved. It can sometimes come up as a natural progression of the game and what the players do.
Also, I want to clarify in regard to my recent posts....when I say "erred" or that things are "going to go poorly" or any of that, I only mean for my own tastes and what I am hoping to get out of a game, either as player or GM. There may be any number of games where this works great for all involved, and I realize that. A lot of this is just my preference.