Melt the butter in a heavy casserole and sauté the onions until soft. Add the rice, stirring to coat it with the butter. Pour over the stock, bring it to the boil and cover the pot. Simmer the rice for 30 minutes.
Add the diced red pepper and the corn and continue cooking until the liquid is absorbed and the rice and corn are tender (about 15-30 minutes more.)
Be careful not to overcook the rice as it tends to lose its fragrance and characteristic robust texture, and can coagulate, due to the starch that's released.
Fluff up with a fork, taste for seasoning, and serve.