I am trying to catch an exception but occasionally get an inner exception. I want to output both into a label.
I often get Object reference not set to instance of an object if there is no inner exception.
Catch ex As Exception
exError = ex.Message.ToString
If Not ex.InnerException.Message Is Nothing Then
exError &= "<br/>" & ex.InnerException.Message.ToString
End If
Return View()
End Try
Change it to:
Or, as StingyJack pointed out: