In the below code block it has failed in different spots during different debugging sessions. It has failed on the construction of the VintasoftImage object, the addition of the vintasoftimage object to the imaging.imagecollection, and it has also thrown the exception when setting the oImages imaging.imagecollection to nothing.
Code: Select all
Try
oTiffFile = New Tiff.TiffFile(strTempFileToWork)
intOriginalFilePageCount = oTiffFile.Pages.Count
oImages = New ImageCollection
AddHandler oImages.ImageSavingException, AddressOf oImages_ImageSavingException
For i As Integer = 0 To intOriginalFilePageCount - 1
oVImage = New VintasoftImage(oTiffFile.Pages(i).GetImage.GetAsBitmap, True)
oImages.Add(oVImage)
Next
blnRetValue = True
Catch ex As Exception
m_strLastError = "IsValidTifFile : Not able to Read all the pages of the tiff file " & strTiffFileNameWithPath
Finally
If oTiffFile IsNot Nothing Then oTiffFile.Dispose()
oTiffFile = Nothing
If oVImage IsNot Nothing Then oVImage.Dispose()
oVImage = Nothing
If oImages IsNot Nothing Then
RemoveHandler oImages.ImageSavingException, AddressOf oImages_ImageSavingException
oImages.Dispose()
End If
Try
oImages = Nothing
Catch ex As Exception
End Try
End Try