Peel the papery skin off the shallots, being careful to leave them whole as whole as possible.
Put the butter into a saute pan over medium heat until it begins to bubble. Add the shallots, shaking the pan to coat them with butter, and brown on all sides until nicely caramelized to a rich, golden brown color. This will take about 6 to 8 minutes. Sprinkle with the sugar, add the salt, pepper, and stock, and bring to a boil. Pour the contents of the saute pan into a casserole or baking dish. Place into the oven for 20 minutes.
Check after 10 minutes to stir the contents of the dish and to ensure that the liquid has not evaporated. If it has, add several tablespoons of water to keep the dish moist until the shallots have cooked completely.
After the shallots have roasted for 20 minutes, the liquid will have evaporated and the shallots should be caramelized to a rich dark golden brown color and should be tender when pierced with a knife.