Spray your pan with non-stick cooking spray.
Saute your onions in a pan with a dab of butter, until they are clear.
Prepare your hashbrowns. I have found that 1/2 bag of frozen hashbrowns, un-thawed in the refrigerator the day you are cooking, works best for us. Some may prefer fresh potatoes.
Mix your soup, sour cream, melted butter, salt & pepper, cheese, and sauteed onions in a bowl, add in the hash browns to mix well, then pour into the baking dish.
Place in the oven and bake at 350 for 1 hour.
Crush your Corn Flakes into tiny bits.
Melt your butter on the stove and then pour over the corn flakes, mixing well.
When the hour is up, remove the dish from the oven, pour the cornflake mix on top, spreading the entire pan, and return to the oven for 15 minutes.