Neil, thank you for reacting. While we haven't tried to reproduce this with a simple example or isolated code, here's the relevant part of the code. It's (legacy) Delphi code, running in ArcMap 10.0 SP3.[...]
var
pPointOnLine: IPoint;
rDistOnLine: Double;
rDummy: Double;
bDummy: WordBool;
pTangent1: ILine;
[...]
begin
pTangent1 := CoLine.Create as ILine;
pPointOnLine := CoPoint.Create as IPoint;
pCurve.QueryPointAndDistance(esriExtendTangents, pPoint, False, pPointOnLine, rDistOnLine, rDummy, bDummy);
pCurve.QueryTangent(esriExtendTangents, rDistOnLine, False, 1.0, pTangent1);
[...]
At this point, pTangent1 has an empty geometry if rDistOnLine was exactly 0.0 before calling QueryTangent. pCurve is defined as ICurve, and given into the method, and so is pPoint, which is an IPoint having valid coordinates (so no var declaration for these). pCurve is actually a geometry coming straight from the database, pPoint is a click/snap-coordinate.Adding the following code right before QueryTangent makes the whole method working every single time: if (0.0 = rDistOnLine) then
rDistOnLine := Math.MinDouble;
The parts of code not supplied consist of handling errors, I skipped it from the example.