In romance a writer shouldn't kill off a favorite secondary character unless it's absolutely necessary. Romance is essentially the fantasy of happily ever after, and death of a loved character jars the reader's expectations.
If a nice character dies, it should be a noble death to save someone else's life, not a senseless death. The finest example of this is Sidney Carton in Dickens' TALE OF TWO CITIES.
Science fiction, fantasy, and mystery have a harder edge, and readers are more willing to accept a character's death. In fact, if no one dies, many sf and fantasy readers consider that a flaw in believability.
I must admit to an intense dislike of having the major character's longtime love interest killed, not only because I become attached to the character, but also because this is often writer laziness at its worst.
Usually, the love interest softens the major character, and the writer doesn't want any softness or mushy stuff. (Oh dear, someone might think I write those stupid romances so I'd better kill the love interest!) To bring the main character back to the way he or she was at the beginning of the series, the writer kills the love interest.
Of course, the most suicidal thing a writer can do in any genre novel is kill a beloved fictional pet or child. That will definitely drive readers away in droves.