I don't have the emotional energy to truly get into my myriad feelings (which, yes, I still have, strongly, three years later) about killing Sharon off, making the whole damn show about Rusty vs. Stroh in the end, and Rusty and Provenza's actions in Stroh's death, but since you weren't around at the time, I'll just tell you that James Duff has given at least six different answers for why he did what he did, and one of them was to claim he wanted to show that without Sharon, everything went to shit, that Rusty and Provenza would never had done what they did if she'd been alive. (Mind you, this is an answer he gave after being raked over the coals for months, so I do not believe him, and it's stupid even if true, because it states that her influence on them died right along with her.)
Duff also said - as if this is an amusing anecdote - that he used to threaten TNT with killing off Sharon all the time to get what he wanted in season renewal negotiations. (This is not information he ever shared with Mary McDonnell in the past, but he did tell her heading into season six - which, while they hadn't officially been cancelled yet, they knew would be their last despite still being TNT's highest-rated show [the new exec hated it; he wanted "edgy" programming] - that he was going to do it.)
The only thing we will ever know as true is that the story of Stroh's death as we saw it is what he wanted to tell in the end, and that couldn't happen with Sharon alive. (She'd have never allowed Rusty to be anywhere near the scene to begin with, she wouldn't have allowed Rusty or Provenza to get away with it, etc.)
And, like you, I'm glad she didn't live to go through that; having to let the two of them face the consequences would have been a fate worse than death to her. But, holy shit, if the story you want to tell in the end requires giving your main character the world's most-rapidly progressing case of cardiomyopathy so she won't live to see two of your other characters who've changed so beautifully under her leadership and love take a shit on her legacy, maybe that's not the right story to go out on!
I like the way she dies itself (I love a death in the line of duty not involving a single bullet or drop of blood), I love the case her final four episodes were about, Tony Denison does great work with the scene where Sharon wants to postpone the wedding until she knows what's in store for her, Mary McDonnell knocks it out of the park and into another park on the other side of the country with Sharon's last day, the squad's reaction in the hospital to the news of her death is perfect, etc. There was good television in there.
But it wasn't worth it for what it took away. And that's all I can get into these days, because I've never reacted so strongly in my life to a fictional character's death and that night is still this surreal thing in my head.
Those season six threads are among the few parts of the old forum that can be found via the Wayback Machine, if you want to track down what everyone said at the time. Here's the thread for Sharon's final two episodes, and here's the one for the finale.