In a large skillet, melt the butter over medium to medium-high heat. Add the mushrooms and cook, stirring occasionally until browned, 3-5 minutes. Add the shallots, garlic and thyme; season with salt. Cook stirring occasionally, until the shallots soften, 2-3 minutes more.
Sprinkle with the flour; stir 1 minute. Stir in the sherry then the half-and-half and stock. Bring to a bubble and cook, stirring occasionally, until the sauce thickens, about 3 minutes. Season with white pepper. Add in both cheeses and stir until melted, about 2 minutes.
Meanwhile, bring a large pot of water to a boil for the pasta. Salt the water, add the pasta and cook 5 minutes. Add the green beans to the water and cook 2-3 minutes more, until the pasta is al dente. Drain the pasta and green beans in a colander then mix them into the mushroom cheese sauce. Transfer to a casserole dish and top with the fried onions.