HELP! - burnImage crashes after burn

vbimport

#1

I am trying to burn an iso image to a CDR, in a vb.net application. I’ve tried both BurnImage and BurnImage2, and both burn a perfect CD, but as soon as the burn completes, the program crashes, and gives the following error message:

“This application has requested the Runtime to terminate it in an unusual way. Please contact the application’s support team for more information.”

I have seen this error before, when I was writing a Nero file system burning app. But in that case the program wasn’t working yet anyway, and the error went away as I was modifying the code, so I never knew what caused it.

My code is below. If anyone can tell me how to fix it I would be very grateful. Alternately, if there is a better way to burn an iso, maybe with BurnIsoAudioCD, I would appreciate it if someone would let me know and post some code.

Please help.

Greg


#2

OOPS - Forgot to include my code. Here it is:

Private pDriveIsFinished As Boolean = True
Private WithEvents pObjCdDrive As NeroDrive
Private DrivesCollection As INeroDrives


Private Sub btnISO_One_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnISO_One.Click

    ' Path to source file
    Dim strSourcePath As String = "C:\TEST_ISO"
    Dim imageFilename As String = "Nero_.iso"
    Dim pathToFile As String = "C:\TEST_ISO" & "\" & imageFilename

    'Select the appropriate drive
    Dim Nero = New Nero
    DrivesCollection = Nero.GetDrives(NERO_MEDIA_CDR)
    pObjCdDrive = DrivesCollection.Item(0)

    Dim neroFlags As NERO_BURN_FLAGS
    neroFlags = NERO_BURN_FLAGS.NERO_BURN_FLAG_BUF_UNDERRUN_PROT Or _
                NERO_BURN_FLAGS.NERO_BURN_FLAG_CLOSE_SESSION Or _
                NERO_BURN_FLAGS.NERO_BURN_FLAG_WRITE

    pDriveIsFinished = False

    'Write the image to disc
    Try
        'pObjCdDrive.BurnImage2(pathToFile, neroFlags, 0, NERO_MEDIA_CDR)
        pObjCdDrive.BurnImage(pathToFile, neroFlags, 0)

    Catch err As Exception
        MsgBox("ERROR: " & err.ToString)

    End Try

    'Wait while the asynchronous operation is underway
    While Not pDriveIsFinished

        System.Windows.Forms.Application.DoEvents()

    End While


End Sub