I'm not sure if this is against any rules, but if so please remove this post. I just wanted to pass on what I think appears to be a bargain and I know this fault seems to affect a lot of owners!
My newly acquired A6 has the issue where the car thinks the door is always closed. No interior light, no puddle light, no red hazard light and, of course, the most frustrating issue is that the car has a habit of locking itself with the keys inside if you're not careful. I fitted a 2nd hand lock unit last week and everything worked perfectly for a day or so, but the problem returned and so I was about to bite the bullet and phone the local Audi dealer but then I came across a new lock unit both on ebay from a German seller and from a UK site called d2autoparts Front Right/Driver Side Locking Mechanism 4B2837016G

It's obviously aftermarket and of unknown quality, but it arrived today and looks identical to the one I removed minus of course the manufacturer and Audi part numbers. This one has very little in terms of numbers or branding on it. It even has what looks like the exact same pesky microswitch that detects if the door is open or closed.
I'll be fitting it this weekend, or possibly tomorrow depending on how work goes, so I will keep you updated and also report back on the longevity of the lock should it fail prematurely. I figure that if it lasts a few years then that'll do me.

Hope this might help others in the same situation.