I am serializing GdiPlusRasterLayers to file and then deserializing them on different machines. The problem I am experiencing is this:
When I take the deserialized raster, add it to a Layer, add the layer to an Overlay and add the overlay to the Map, everything seems to work fine. There is a hidden issue however; there is a bug in the .NET deserialization method that causes waaaay too much memory to be allocated for the deserialized class. A 6MB bitmap winds up with a 120MB allocation. This eats up memory pretty fast in out application.
To get around the issue, I make a new GdiPlusRasterLayer instance and DeepClone the giant instance delivered by the .NET deserializer into the new instance, then just let the giant go out of scope and the GC takes care of getting the memory back. Then I add the new instance to a Layer, add the layer to an Overlay and add the overlay to the Map. This time however, the Map complains that the file listed in the PathFilename can't be found. (again, if I use the original Layer instance, it doesn't seem to care that the file isn't there).
How can I tell the new Layer not to look for the filename and just render the image it already has? (like the giant one does)
Dave