No, è esattamente il contrario: l' errrore è MOLTO più probabile che avvenga su fs... con Using non lo puoi gestire.
Dopo millanta ricerche sul web, sono arrivato alla soluzione:
codice:
Private Shared Function LeggeLogFile() As String
Dim LogFile As String
Dim fs As FileStream = Nothing
Try
fs = New FileStream(My.Settings.LogPath & "\PokerStars.log.0", FileMode.Open, _
FileAccess.Read, FileShare.ReadWrite)
Using sr As StreamReader = New StreamReader(fs)
fs.Seek(0, SeekOrigin.Begin)
LogFile = sr.ReadToEnd()
fs = Nothing
End Using
Return LogFile
Catch ex As Exception
Return Nothing
Finally
If fs IsNot Nothing Then fs.Dispose()
End Try
End Function
Così il primo avviso è sparito. Dichiarando Shared la Function è sparito anche il terzo. Rimane il secondo avviso, ma è evidente che è un errore dell' analisi, visto che il secondo fs.Dispose() è condizionale