Why not just use
Dim dm As Bitmap = DirectCast(Image.FromFile(Filename), Bitmap)
bm.SelectActiveFrame(FrameDimension.Page, FrameNumber)
If you are getting the error on the same file each time, then it is likely that the file contains bad information, or info that .NET does not understand. I would use a Try...Catch statement, log my problems and review the files outside the code to see if they have a common factor as the first stage.