Bring the water to boil in a large pot. Fill a large bowl with ice water. Add the beans and salt to the boiling water. Cover and cook for 6 minutes, or until crisp-tender and still bright green. Drain the beans in a colander, then plunge them into the ice water to stop the cooking. Drain in the colander again. Pat with paper towels to dry completely.
CARAMELIZE THE ONIONS:
In a large skillet, heat the olive oil over medium-high heat. Add the onions and let cook, stirring occasionally. Reduce the heat after about 10 minutes to medium-low. Sprinkle the onions with sugar, and continue to cook, stirring every so often to prevent over-browning or burning, until the onions are caramelized and soft. This should take a good 20 to 30 minutes (don't rush it with a higher heat), and the onions should be caramel-colored and sweet. Set aside to cool.
PREPARE THE TOPPING:
In a food processor, place the bread (or stuffing cubes), butter and seasonings and pulse about 10 times. Scrape the crumbs into a medium bowl, and stir in the onions; set aside. If making ahead, transfer to a storage container and refrigerate.
PREPARE THE SAUCE:
Melt the butter in a skillet until shimmery. Add the mushrooms, garlic, salt and pepper. Stirring often, cook until the mushrooms begin to soften and exude their liquid, about 6 minutes. Stir in the flour and cook for 1 minute. Add the chicken broth and sherry and bring to a simmer. Add the half and half; simmer until the sauce thickens, about 10 to 15 minutes. Taste and adjust the seasonings. Stir in the cooked beans until they're evenly distributed throughout the sauce.
COOK:
DIRECTIONS FOR COOKING RIGHT AWAY: Preheat oven to 425°F. Transfer the bean mixture to large greased baking dish or 9x13 casserole. Top the beans with the topping and bake for 20 to 30 minutes.
DIRECTIONS FOR COOKING LATER: Transfer the mixture to a large greased baking dish or 9x13 casserole. Cover with plastic wrap and refrigerate. When ready to bake, return to room temperature (it takes about 2 hours to reach room temperature). Remove the plastic wrap. Heat in a preheated 425°F. oven for about 30 to 35 minutes. Add the topping and bake for another 15 minutes.
Notes
*This recipe is gluten-free adaptable. Use gluten-free bread, or use dried bread stuffing cubes that are gluten free. Whole foods sells a dried bread cube stuffing mix during the fall holidays that is excellent. Also use GF flour in place of all-purpose flour and be sure to use GF chicken broth.