When camping in bad weather I'm always asking myself if it is a good idea to cook in my tent with a gas cooker. Obviously there is the danger of fire. But how dangerous is this really? Can you easily burn down the tent? And are there any other dangers? Maybe carbon monoxide poising?
Absolutely not! Fire is the obvious risk, but carbon monoxide poisoning should be taken seriously as well. If the weather is bad, at the very least cook under the vestibule with maximum ventilation.
Others have brought up a great point about bear country. It's recommended to cook and eat at least 100 yards away from your camp site when there may be bears around.
The answers regarding flammability (and the ensuing death trap) and carbon monoxide poisoning are correct. Even in foul weather, cook outside your tent. If you do lots of camping in bad weather (New Zealand's West Coast?) get a tent with a vestibule.
There is one additional problem: In bear country, you never want to cook too close to your tent, because if you and your tent and everything inside it smells of food, guess who'll be coming to visit you at night?
In addition to the fire hazard, cooking food in your tent in bear country is a good recipe for waking up to find a bear trashing your campsite, and/or you.
We quite often cook on a small gas stove in the porch (vestibule) of the tent - as long as you are careful and don't leave it unattended, just be sensible.
I have seen a tent go up in flames, and they burn extremely quickly so I'm aware of the danger, but I've never felt at risk.
Thankfully in the UK we don't have to worry about Bears...
It really depends on the type of tent. You should not cook in a standard outdoor tent. However there are tents like the "Kohte" and the "Yurt" of (mainly German) scouts that are designed to have a fire burning inside. These tents are made of cotton and have no floor. Also they are heavier than typical expedition tents. As always you have to weigh the pros and cons yourself.
If you are in bear country, I agree 100% with everyone - cook somewhere else. 100m away minimum.
In winter, not in bear country, getting out of your tent to cook sucks. Fortunately, many mountaineers have discovered that some stoves do not produce excessive carbon monoxide. And there's a handy table in this article at Backpacking Light that describes some canister stoves that produce a reasonably low amount of carbon monoxide. Read the whole article series for the details.
Edit: That being said, cook in your vestibule (with the vestibule open if possible), it's much, much safer.
Most tents these days claim to have a "fireproof" coating - but I'd never really want to put this to the test! I have heard one horror story in particular (admittedly with a much older tent) that's made me wary enough to recommend never cooking inside.
The likelihood may be low (and that's not to say it is) but if it does go up in flames and you're inside it then you've lost all escape routes and you're surrounded by smoke and burning material - IMHO it's just not a risk worth taking. And yes, other dangers like carbon monoxide poisoning are definitely possible, even likely if it's in an enclosed space.