Bring a large pot of salted water to a boil. Add the green beans and blanch for 4 to 5 minutes until bright green and just tender. Drain and immediately plunge into ice water to stop the cooking, then drain again and set aside.
In a large skillet, melt 2 tablespoons of butter over medium-high heat. Add the mushrooms and cook, stirring occasionally, until browned and their liquid has evaporated, about 6 to 8 minutes. Add sliced shallots and cook until soft and golden, another 3-5 minutes. toss in rosemary sprigs. Stir in the garlic and cook for 30 seconds until fragrant.
Push everything to the sides and melt the remaining 2 tablespoons of butter in the center. Whisk in the flour and cook for 1 to 2 minutes, stirring constantly, until it smells toasty. Slowly pour in the broth, whisking as you go to keep it smooth, then whisk in the heavy cream. Bring to a simmer and cook until thickened enough to coat a spoon, about 3 to 4 minutes. Remove rosemary sprigs. Season with salt and pepper.
Add the blanched green beans to the sauce and toss to coat. Top with the crispy fried onions if that's your thing.
Reheat in oven if needed, 325 for 5-10 minutes. Be sure not to overcook the greenbeans when blanching if you do intend on re heating.