We have a method which takes care for reporting unexpected errors.
Our handling code (vb.net 4.0):
Private paUnhandledException As Exception
Private Function GetMessage(Detailed As Boolean) As String
Dim stackMsg, msg As String
Dim ex As Exception = Me.paUnhandledException
If Detailed Then
stackMsg = ex.ToString()
ElseIf (Not String.IsNullOrEmpty(ex.StackTrace)) Then
stackMsg = ex.StackTrace
Dim l As Integer = 0
Try
l = stackMsg.IndexOf(System.Environment.NewLine)
If l > 0 Then
l = stackMsg.IndexOf(System.Environment.NewLine, l + 1)
End If
If l > 0 Then
l = stackMsg.IndexOf(System.Environment.NewLine, l + 1)
End If
Catch
l = -1
End Try
If l > 0 Then
stackMsg = stackMsg.Substring(0, l - 1)
End If
Else
stackMsg = ex.ToString
End If
msg = String.Format("{1}{2}",ex.Message, stackMsg)
Return msg
End Function
Usually we receive reports similar to this:
Dynamic SQL Error SQL error code = -206 Column unknown PRINTING.INACTIVE At line 1, column 688
FirebirdSql.Data.FirebirdClient.FbException (0x80004005): Dynamic SQL Error SQL error code = -206 Column unknown PRINTING.INACTIVE At line 1, column 688 ---> Dynamic SQL Error SQL error code = -206 Column unknown PRINTING.INACTIVE At line 1, column 688 at FirebirdSql.Data.FirebirdClient.FbCommand.ExecuteReader(CommandBehavior behavior) at FirebirdSql.Data.FirebirdClient.FbCommand.ExecuteDbDataReader(CommandBehavior behavior) at System.Data.Common.DbCommand.System.Data.IDbCommand.ExecuteReader(CommandBehavior behavior)
We have received following report:
Dynamic SQL Error SQL error code = -104 a string constant is delimited by double quotes
Dynamic SQL Error SQL error code = -104 a string constant is delimited by double quotes
The problem - there is no stack trace.
I have did some research, read forums, stumbled upon those posts: exception with no stack trace - how? and Empty StackTrace. Possible?.
Exception itself is not NULL, as we get text from ex.Message. If the exception was rethrown, even in this case there would be at least one row in stack trace - as of the point where it was rethrown. Similar if the exception originated in another thread. I do not think it has something to do with database system we are using - Firebird.
I have few possibilities how empty stack trace might have happened:
- OutOfMemory - program somehow went OOM, thus no stack trace
- Exception at
.toString
So far we do not know how to simulate this error, nor have access to EventLogs from machine it originated.
Any corrections to my assumptions? What am I missing? Thanks in advance.