Vb.net error setting iNeroDrive to NeroDrive

vbimport

#1

I use VB.NET. I have created a web service to create an ISO on the fly and return it to the client app that is requesting it.

The error I am getting is “Specified cast is not valid.”

This is the Code I am using:

    <WebMethod()> _
    Public Function testGetImageRecorder() As String
        Dim nNero As New NEROLib.Nero
        Dim nDrives As NEROLib.NeroDrives
        Dim nDrive As NEROLib.NeroDrive

        Try
            nDrives = nNero.GetDrives(NEROLib.NERO_MEDIA_TYPE.NERO_MEDIA_CDR)
            For Each nD As NEROLib.NeroDrive In nDrives
                If nD.DeviceName = "Image Recorder" Then
                    nDrive = CType(nD, NEROLib.NeroDrive)
                    Exit For
                End If
            Next
            If nDrive Is Nothing Then
                Return "No Supported Drives Found"
            Else
                Return nDrive.DeviceName
            End If
        Catch ex As Exception
            Return ex.Message
        End Try
    End Function

Setting nDrive to nD causes the error (because the NeroDrives.Item is defined as an INeroDrive).

When I paste this code into an EXE, it all works… why would I get a cast error in the Web Service and not the EXE?

Please help! After 2 weeks of searching, all my google result links are Purple (visited links)!!!


#2

Has no one else had this problem? Is it a version bug? Will Version 7 fix it?