运行时遇到致命错误。线程 0x1f70 上的错误 0x6a0a7c6d 的地址。错误代码为 0x80131623。这可能是 CLR 或用户代码的不安全或不可验证部分中的错误。此错误的来源通常是由 COM-interop 或 PInvoke 的封送用户错误形成的,这可能会损坏堆栈。
有谁知道如何追查这个问题以及他的实际意思?!
发生这种情况的代码如下:
Public Sub Ok()
Try
BTWTariefID = 0
If Prijs > 0 Then
Dim formVraagBtw As New wndVraagBTW()
formVraagBtw.ShowDialog()
BTWTariefID = formVraagBtw.BTWID
End If
CreateOpmerking(Nothing, False, BTWTariefID)
Catch ex As Exception
WriteErrorLog("btnOk", New StackTrace().GetFrame(0).GetMethod.ToString(), ex)
End Try
End Sub
奇怪的是,如果我在这个 sub 中设置了一个断点,然后点击 f5,我不会得到任何错误,只有当我在这个 sub 上没有任何断点时,我才会得到错误。
有任何想法吗?
编辑:
Private Sub CreateOpmerking(gRegel As clsVerkooporderRegel, showBTWTarief As Boolean, btwTariefID As Integer)
Try
Dim dblPrijs As Double
If DMStr(Prijs).Trim = "" Then Prijs = "0"
If Opmerking.Length > 0 And Double.TryParse(Prijs, dblPrijs) Then
Else
dblPrijs = 0
End If
If OrderRegel Is Nothing Then
If gRegel Is Nothing Then
Parent.VMVerkoop.opmerkingsregel(Opmerking, dblPrijs, Aantal, Item, Gang, showBTWTarief, btwTariefID)
Else
Parent.VMVerkoop.opmerkingsregel(Opmerking, dblPrijs, gRegel.aantal, gRegel.orderregel.item, gRegel.orderregel.Gang, showBTWTarief, btwTariefID)
End If
Me.Parent.ModalVisibility = Visibility.Hidden
Me.Parent.Modal = Nothing
Else
OrderRegel.orderregel.opmerking = Opmerking
OrderRegel.orderregel.Omschrijving2 = Opmerking
OrderRegel.orderregel.prijs_per_stuk = dblPrijs
OrderRegel.orderregel.prijs_per_stuk_origineel = dblPrijs
OrderRegel.orderregel.btwtariefID = btwTariefID
OrderRegel.orderregel.aantal = Aantal
If Artikel IsNot Nothing Then OrderRegel.orderregel.artikelID = Artikel.ID
OrderRegel.regeltotaalnakorting = Aantal * dblPrijs
'Me.Parent.VMVerkoop.opmerkingsregel(Opmerking, dblPrijs, Aantal, Item, Gang, Artikel)
Me.Parent.ModalVisibility = Visibility.Hidden
Me.Parent.Modal = Nothing
Me.Parent.VMVerkoop.ververs_orderregels()
Opmerking = ""
End If
Catch ex As Exception
WriteErrorLog("CreateOpmerking", New StackTrace().GetFrame(0).GetMethod.ToString(), ex)
End Try
End Sub
当 if 条件为真时会发生错误,但是如果我在 if 条件之外设置断点,则代码将毫无问题地运行,如果我将断点取出,则根本没有错误。谢谢