Sometimes "Invalid Operation" or some random error just dosen't cut it because InnerException holds more details.
Try using this:
Try using this:
VB.NET:
Public Function FullException(ByVal ex As Exception) As String
Dim CurrentEx = ex
Dim FullExceptionText As String = CurrentEx.Message
GetInnerText:
If Not CurrentEx.InnerException Is Nothing Then
CurrentEx = CurrentEx.InnerException
FullExceptionText += vbCrLf & CurrentEx.Message
GoTo GetInnerText
End If
FullExceptionText += vbCrLf & ex.StackTrace
Return FullExceptionText
End Function