Hey everybody! As the title mentions I'm having some surprising difficulties with the IntersectionResult class. Long story short I check the intersection of 2 line elements (i know for a fact that these 2 lines intersect) with (link)
SetComparisonResult result = line1.Intersect(line2, out resultArray);
It's all nice and fine at this point since the result and resultArray are not null. I can get the IntersectionResult out of the IntersectionResultArray for example by:
IntersectionResult intResult = resultArray.get_Item(0);
But I'm intersected in IntersectionResult.Parameter property (link), and when i try to get the value of this parameter an InvalidOperationException is thrown. Checking the Parameter property documentation again it claims that it happens when it has not been set yet "Thrown in the getter when this property has not been set by the method providing the result. ".
Checking this Parameter property in debug reveals that it's not the only one failing. As you can see on the picture the "Distance", "EdgeObject", "EdgeParameter" and "Parameter" all fail with InvalidOperationException.

This issue occurred to me in a C# addin in all current version versions (22->25). For testing purposes I've created a python script that you can paste into RevitPytonShell and it results is the same error across all versions.
results = clr.Reference[DB.IntersectionResultArray]()
t = DB.Transaction(doc, "Line Creation")
t.Start()
lineV = DB.Line.CreateBound(DB.XYZ(0,0,0), DB.XYZ(0,10,0))
lineH = DB.Line.CreateBound(DB.XYZ(-5,5,0), DB.XYZ(5,5,0))
doc.Create.NewDetailCurve(uidoc.ActiveView, lineV)
doc.Create.NewDetailCurve(uidoc.ActiveView, lineH)
result = lineV.Intersect(lineH, results)
intResult = results.get_Item(0)
print("XYZPoint: {}".format(intResult.XYZPoint))
print("Distance: {}".format(intResult.Distance))
print("EdgeObject: {}".format(intResult.EdgeObject))
print("EdgeParameter: {}".format(intResult.EdgeParameter))
print("Parameter: {}".format(intResult.Parameter))
t.Commit()
Even if it's outside of a Transaction (since Line creation and Line.Intersect does not require that), the results are the same.
results = clr.Reference[DB.IntersectionResultArray]()
lineV = DB.Line.CreateBound(DB.XYZ(0,0,0), DB.XYZ(0,10,0))
lineH = DB.Line.CreateBound(DB.XYZ(-5,5,0), DB.XYZ(5,5,0))
result = lineV.Intersect(lineH, results)
intResult = results.get_Item(0)
print("XYZPoint: {}".format(intResult.XYZPoint))
print("Distance: {}".format(intResult.Distance))
print("EdgeObject: {}".format(intResult.EdgeObject))
print("EdgeParameter: {}".format(intResult.EdgeParameter))
print("Parameter: {}".format(intResult.Parameter))
Would appreciate any help with this problem!