2015-11-10 22 views
1

對不便,我有一個問題。 我在VB.NET中有一個非常不常見的錯誤(請參閱下面的錯誤)。 我認爲這是所有關於COM問題,但我不知道它。 這是我在winsock_dataArrival函數時發生的。 請幫助和尊重,我只是一個.NET初學者。 我還附上了下圖。ReportAvOnComRelease檢測到

ReportAvOnComRelease檢測

Message: An exception was caught but handled while releasing a COM interface pointer through Marshal.Release or Marshal.ReleaseComObject or implicitly after the corresponding RuntimeCallableWrapper was garbage collected. This is the result of a user refcount error or other problem with a COM object's Release. Make sure refcounts are managed properly. The COM interface pointer's original vtable pointer was 0x27582bb8. While these types of exceptions are caught by the CLR, they can still lead to corruption and data loss so if possible the issue causing the exception should be addressed 

代碼:

Private Sub Winsock1_DataArrival(ByVal eventSender As System.Object, ByVal eventArgs As AxMSWinsockLib.DMSWinsockControlEvents_DataArrivalEvent) Handles Winsock1.DataArrival 

     Dim strData As String = "" 
     Dim msg As String 
     Dim i As Integer 
     Static bmsg As Boolean 

     On Error Resume Next 
     peer.GetData(strData) 
     peer.RemoteHost = HOST 

     If checkMSG(i) Then 
      If b_QALoad Then 
       dlgQA.setMSG() 
      Else 
       If MsgBox("You have " & i & " unread message(s)." & vbCrLf & "Do you want to read it now?", MsgBoxStyle.YesNo + MsgBoxStyle.Information, MYPS_ABR) = MsgBoxResult.Yes Then 
        dlgQA.ShowDialog() 
       End If 
      End If 
     End If 
    End Sub 

ReportAvOnComRelease was detected image

+0

使用古老的VB6 Winsock控件是一個錯誤。改爲使用System.Net命名空間中的類。 –

+0

UP!需要幫助感謝管理員。 =)) –

回答

0

當下面的代碼觸發,可以說,它是在模塊1 .. 「frmdlg .closeform()「

調用此方法.. 代碼:

Public Sub closeform() 
     Me.Close() 
    End Sub 

在此之後,我在那個模塊1退出的話,我現在就在模塊2。我注意到一些代碼。 還有「Me.Close」,我想知道它已經關閉,但程序再次調用它。 然後,我把它變成了與此同時的評論。 然後,VIOLA!沒有更多的錯誤發生。 ^^