For initial troubleshooting purpose, you can call System.IO.File.Exists method to determine if the path leads to a file.
http://msdn.microsoft.com/en-us/library/system.io.file.exists(v=vs.110).aspx
This function does not verify whether the application can read the file, because that may depend on access permissions and/or whether another application has an exclusive lock on that file.
To further check that the file can be opened for read, use System.IO.File.OpenRead method. Again, this is only for initial troubleshooting purpose, because opening a file is a time-consuming and system resource-consuming operation. Keep in mind every opened file needs to be closed, even when it is only done for troubleshooting, because it will lock the file, and that may prevent other parts of the application from operating normally and complicate the troubleshooting effort.
http://msdn.microsoft.com/en-us/library/system.io.file.openread(v=vs.110).aspx
----
Here is more technical detail from the underlying library's perspective. If this explanation looks unfamiliar to you, feel free to skip over it.
The error code is 0x80070002, which means "The system cannot find the file specified".
Usually, when the underlying library returns 0x80070002, it means it cannot open the file for examination. Because of this, it cannot determine whether the file is an image file or not. If the file can be opened and the underlying library determined that it is not an image file, a different error code would be returned.
Assuming "mypath" in your exception log is a placeholder for the actual path of the image, please make sure:
- The path should be a full path, not a relative path. The C# (.NET) SDK should have performed the automatic conversion from relative path to absolute path.
- The path is valid and points to a file.
- Sometimes the underlying library may be stumbled by unusual characters in the path string. The underlying library uses Win32 API to access the file.
- If the path string is very long (longer than, say, 250 characters), the underlying library expects a special prefix to be added to the path. Note that the C#.NET SDK should automatically take care of these details, therefore SDK users should not need to handle this aspect.
- The process (application) has access permissions to that file.
- The file is not being locked by another application, or by some other modules in Laserfiche
If "mypath" is literally copied from the exception message, then it is certain that an invalid path has been passed into the underlying library.