The
Catch
part of your code does not contain a return statement.
I would change your code and more the return statement at the end of the function.
Public Function GetFileContents(ByVal FullPath As String, Optional ByRef ErrInfo As String = "") As String
Dim strContents As String = ""
Dim objReader As StreamReader
Try
objReader = New StreamReader(FullPath)
strContents = objReader.ReadToEnd()
objReader.Close()
Catch Ex As Exception
ErrInfo = Ex.Message
End Try
Return strContents
End Function
This way all execution paths return a value.