VB
An object-oriented programming language developed by Microsoft that is implemented on the .NET Framework. Previously known as Visual Basic .NET.
2,718 questions
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Hello
I am using dispose pattern to clear Postgresql resources. Occasionally following exception is thrown. Do you have ideas what can cause this exception?
Tools.DebugOut - 01.03.2023 16:44:14:004 - err - SystemClass.Destroy - PMem : 15045.852/32767.551 - VMem : 132099361.086/134217727.875 - de-CH - - trace: System.NullReferenceException: Der Objektverweis wurde nicht auf eine Objektinstanz festgelegt.
bei Npgsql.NpgsqlConnection.Close(Boolean wasBroken)
bei Npgsql.NpgsqlConnection.Dispose(Boolean disposing)
bei System.ComponentModel.Component.Dispose()
bei DataFactory.Dispose(Boolean disposing)
bei SystemClass.Destroy() -
Protected Overrides Sub Finalize()
Dispose(False)
End Sub
Public Sub Dispose() Implements IDisposable.Dispose
Dispose(True)
GC.SuppressFinalize(Me)
End Sub
Protected Overridable Sub Dispose(disposing As Boolean)
If _disposed Then
Exit Sub
End If
If disposing Then
Dim conn As Npgsql.NpgsqlConnection = CType(Me.m_Conn, Npgsql.NpgsqlConnection)
If conn IsNot Nothing Then
conn.Dispose()
conn = Nothing
End If
Dim trans As Npgsql.NpgsqlTransaction = CType(Me.m_Transaction, Npgsql.NpgsqlTransaction)
If trans IsNot Nothing Then
trans.Dispose()
trans = Nothing
End If
End If
_disposed = True
End Sub
Private _disposed As Boolean