Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Out of memory on loStringBuilder.ToString()
Message
De
06/06/2011 16:38:14
 
 
À
06/06/2011 16:09:08
Information générale
Forum:
ASP.NET
Catégorie:
Problèmes
Versions des environnements
Environment:
VB 9.0
OS:
Windows 7
Network:
Windows 2003 Server
Database:
MS SQL Server
Application:
Web
Divers
Thread ID:
01513090
Message ID:
01513205
Vues:
41
>Is the exception occurring at loStringBuilder.ToString() or is it occuring somewhere in the CreateFileEncoding() method when the method attempts to do something with the string?

Here is CreateFileEncoding():
        ' Create a file by passing an encoding
        ' expC1 String
        ' expC2 File
        ' expC3 Encoding
        ' expL1 If we log the error if the file cannot be deleted
        Public Function CreateFileEncoding(ByVal tcString As String, ByVal tcFile As String, _
         ByVal tcEncoding As System.Text.Encoding, ByVal tlLogError As Boolean) As Boolean
            Dim llSuccess As Boolean = False
            Dim lnCounter As Integer = 0
            Dim lnDelay As Integer = 250
            Dim lnRetry As Integer = 8
            Dim loFileStream As FileStream
            Dim loStreamWriter As IO.StreamWriter

            For lnCounter = 1 To lnRetry

                Try
                    loFileStream = New FileStream(tcFile, FileMode.Create)
                    loStreamWriter = New StreamWriter(loFileStream, tcEncoding)
                    loStreamWriter.Write(tcString)
                    loStreamWriter.Close()
                    loFileStream.Close()
                    llSuccess = True
                    Exit For

                Catch loError As Exception

                    ' If we have not reached the maximum tries of 8, we retry
                    If lnCounter < 8 Then

                        ' Wait for a timeout before retrying
                        System.Threading.Thread.Sleep(lnDelay)

                        Continue For
                    End If

                    ' If we log the error
                    If tlLogError Then

                        ' Get the proper definition as per the current scope
                        If oProcess Is Nothing Then
                            oApp.ErrorSetup(loError)
                        Else
                            oProcess.ErrorSetup(loError)
                        End If

                    End If

                End Try

            Next

            Return llSuccess
        End Function
So, it happens at the loStringBuilder.ToString() location.
Michel Fournier
Level Extreme Inc.
Designer, architect, owner of the Level Extreme Platform
Subscribe to the site at https://www.levelextreme.com/Home/DataEntry?Activator=55&NoStore=303
Subscription benefits https://www.levelextreme.com/Home/ViewPage?Activator=7&ID=52
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform