The brief
The A6 had been stalling, hard to start, hesitating, and the check engine light was on. He brought it in. That cluster of symptoms points at the crankshaft position sensor. The crankshaft sensor reads the crank's position and speed and feeds that to the engine computer, which uses it for the timing of the spark and the injection. When it fails or starts to fail, the computer loses or misreads that signal, so the engine cuts out, won't start, or runs rough, and the light comes on. A failed crankshaft sensor doesn't recover, so it needs replacing.
The diagnosis
A diagnostic scan pulled the fault to the crankshaft position sensor, the signal dropping out or reading wrong, which is exactly the stalling, the hard starting and the hesitation. The wiring back to the computer was checked and was fine, so it was the sensor itself, and the rest of the engine checked out. That's a sensor replacement, you don't repair it, so the call was a new genuine sensor, fitted and the codes cleared.
The work
The old crankshaft position sensor was removed, the mounting cleaned up, and a new genuine Audi-spec sensor fitted, connected up, every fastener torqued to spec. The fault code was cleared and the engine started and run to confirm the signal was clean and steady. A road test confirmed a clean start, steady running, no stalling, no hesitation, and the light staying off.
The outcome
A clean start, steady running, no stalling, no hesitation, and no warning light. The A6 went home running properly again. A failed crankshaft sensor leaves the engine without the timing reference it depends on, so changing it put the running right and cleared the light at its source.