The runtime has encountered a fatal error

3

The runtime has encountered a fatal error. The address of the error 0x6a0a7c6d on thread 0x1f70. The error code is 0x80131623. This may be a bug in the CLR or in the unsafe or non-verifiable portions of user code. Often the source of this error formed by marshal user errors for COM-interop or PInvoke, which may damage the stack.

Does anyone know how to track down this problem and what he actually mean?!

the code where this happen is the following:

        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

The odd thing in this is if i set a breakpoint inside this sub and then hit f5 i dont get any errors only if i dont have any breakpoints on this sub i will get the error.

Any ideas?

EDIT:

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

The error happens when the if condition is true, but if i set a breakpoint even outside the if condition the code will run with no problems, if i take the breakpoint out there is not error at all. Thanks

vb.net
asked on Stack Overflow Oct 24, 2013 by Rui • edited Oct 24, 2013 by Rui

1 Answer

1

The error code is 0x80131623

That's COR_E_FAILFAST, a very nasty CLR crash. Usually triggered when it discovers that the stack was corrupted by a buffer overflow, the program instantly terminates with a "fail fast" process exit. It is malware counter-measure, stack buffer overflows were a traditional way to infect a program.

These crashes were not entirely uncommon in the early days of .NET 4.0, the first version that has the CLR built with the "buffer security check" option turned on, /GS option for the C++ compiler. It's been quite a while since I've seen anybody report it however, they got fixed and current CLR revisions do not suffer from false alarms anymore.

Difficult to give proper advice, it is very unlikely to have anything to do with your code. You do want to make sure that your .NET and VS revisions are up to date. Be sure to enable Windows Update so your .NET version can be updated, ensure you've got the latest VS service pack. If you can repro the crash well then you'll have a shot at getting help from Microsoft Support.

Just in case: it can be triggered by your own code intentionally. Usually done in an event handler for the AppDomain.UnhandledException event, Environment.FailFast() is a common way to terminate the program instantly.

answered on Stack Overflow Oct 24, 2013 by Hans Passant

User contributions licensed under CC BY-SA 3.0