[mono-vb] FileSystem.FileOpen

Andy Hume andyhume32 at yahoo.co.uk
Mon May 18 11:15:47 EDT 2009


The cause of this is reported as bug 504791  "NRE in FileSystem.FileOpen due
to compiler problem" (https://bugzilla.novell.com/show_bug.cgi?id=504791)

A bug in the Mono VB compiler generates bad code in the Mono VB-Runtime
library which causes the NullRefEx.  So it's not something that's in your
program's code and I can't immediately see a simple workaround -- well apart
from changing to .NET's native System.IO classes.  Maybe Rolf can suggest
another workaround...

Andy



Easy_Rider9999 wrote:
> 
> I get this Error
> 
> LinuxErr: Application Error  at 15.05.2009 17:45:05 gstatus:
> tvMed_MouseMove HotTracking CodeLoc: _frmImportText.mnuFileOpenT_Click
> Version: 0.7.8.33413
> System.NullReferenceException: Object reference not set to an instance of
> an object
>   at Microsoft.VisualBasic.FileSystem.FileOpen (Int32 FileNumber,
> System.String FileName, OpenMode Mode, OpenAccess Access, OpenShare Share,
> Int32 RecordLength) [0x00000] in
> /media/disk-1/Downloads/Linux/mono-basic-2.4/vbruntime/Microsoft.VisualBasic/Microsoft.VisualBasic/FileSystem.vb:291 
>   at Repetit.net.T.SQLite.frmImportText.mnuFileOpentT_Click (System.Object
> sender, System.EventArgs e) [0x00000] 
>  Innerexception: 
> 
> In this procedure (as well in a similar procedure):
> 
> Private Sub mnuFileOpentT_Click(ByVal sender As System.Object, ByVal e As
> System.EventArgs) Handles mnuFileOpentT.Click
>     Dim FileName As String
>     Dim FileNr, fLen As Integer
>     cdlg1.CheckFileExists = True
>     If cdlg1.ShowDialog = Windows.Forms.DialogResult.OK Then
>       Try
>         FileName = cdlg1.FileName
>         FileNr = FileSystem.FreeFile
>         fLen = CInt(FileSystem.FileLen(FileName))
>         FileSystem.FileOpen(FileNr, FileName, OpenMode.Input,
> OpenAccess.Read, OpenShare.Shared)
>         txtImport.Text = FileSystem.InputString(FileNr, fLen)
> 
>       Catch ex As Exception
> #If Linux Then
>         LinuxErr(ex, "_frmImportText.mnuFileOpenT_Click")
> #Else
>         Throw New ApplicationException("_frmImportText.mnuFileOpenT_Click
> Error", ex)
> #End If
>       Finally
>         Try
>           FileSystem.FileClose(FileNr)
>         Catch
>         End Try
>       End Try
>       'FileNr = modFileFunc.Fileopener(FileName, modFileFunc.READFILE,
> False)
>       'txtImport.Text = InputString(FileNr, CInt(FileLen(FileName)))
>       'FileClose(FileNr)
>     End If
>     
> 
>   End Sub
> 
> What can I do?
> 
> Regards
> 
> Hans
> 
> 
> P.S. Execution wit .Net Framework gives not error. I get this error only
> with Mono 2.4!
> 

-- 
View this message in context: http://www.nabble.com/FileSystem.FileOpen-tp23565338p23597752.html
Sent from the Mono - VB mailing list archive at Nabble.com.



More information about the Mono-vb mailing list