I have some VB.NET code that includes clipping a raster to the extent of the map frame using the ITransformationOp.Clip method and I'm in the process of putting it through the ringer to make sure I have as many potential errors handled as possible. There is one scenario, that I'm having trouble with:
When the input raster is completely outside map frame extent, Arc throws an exception (ERROR 010092: Invalid output extent) and rightly so. So far, so good... However, if I then pan the map frame to include parts or all of the same raster and try to run the tool again, it throws the same error, even though the clip extent is now valid.
I can select a different raster and it works fine. But if I use the raster that was involved in the invalid extent error again, the error persists no matter where I pan/zoom the map to. The only way to get that raster to work again, is to remove the layer from the map and then add it back in again. Then the error does not come back as long as the clip extent is valid.
Why would this be and how do I work around this?