It’s very unlikely that an object gets corrupted inside a gh file. If corruption occurs it’ll in all likelihood render the entire file corrupt as the files is a compressed byte-array, and it cannot be successfully decompressed if even a single byte is out of place.
There are four ways in which objects might fail to load:
- The object is defined by a plug-in which is not loaded.
- The plug-in which ‘owns’ the object is loaded but is an older version than the one loaded when the file was saved and the object has changed in a non-forward-compatible way.
- The plugin which ‘owns’ the object is loaded but has changed the way the object is (de)serialized and the developer hasn’t taken the appropriate steps to make sure older files still work.
- The code which (de)serializes the object is just buggy. It somehow fails to write the correct data it requires upon reading. A bug like this most likely only happens for particular states, otherwise the developer would have found the problem during even the most cursory test cycle.
(1) is obviously quite common, but also fixable without help from the developer. Just install the missing plug-in and you’re on your way (don’t save the file after loading fails, or relevant data will be lost)
(2) is also reasonably easy to fix, assuming you can upgrade to the newer version.
(3) is a bug and can only be fixed by the developer. Breaking backwards compatibility is easy if you’re not careful and it does happen.
(4) is a bug and needs to be fixed by the developer.
It is easy to embed the canvas as a bitmap inside the GH file. I already include a thumbnail, and it sounds like you’re just asking for a bigger version of that same image. I do not however think it a good solution. The canvas may only show part of the file, omitting something relevant. I could of course render the file to a large off-screen bitmap, but some *.gh files can cover lots of pixels, I quite often see files with individual objects way off in the distance, far away from other components. Should I include a 15,000x29,000 png file which contains 99% empty background grid?
The solution I’m planning (no idea yet whether it’ll work as well as I hope) is to parse as much information as possible from an object which fails to load via the correct channels. If I can get position, size, parameter types and names, maybe even parameter properties (flatten, simplify, expressions), I can create a placeholder component which doesn’t have any functionality but which does retain all connections, and can even maintain the actual file data, meaning that when the file is saved, the data that was not understood during loading isn’t actually lost.