When using Invoke Code in VB.Net - this issue does not appear.
When using Invoke Code in C# it does however occur.
Essentially when you have an error in your code, the line number is off by +1 as the index starts from 0 but the line numbers in the invoke code start at 1.
Here is a terrible example (just wanted an error warning to appear)
Invoke Code - Set to VB.NET
So the line numbers match the Warning.
Invoke Code - Set to C#
So not sure if the Line Count needs to be changed or whether the index just needs to be updated.