I have a Windows Mobile Forms application that uses the System.IO.Compression DeflateStream class to Compress a bitmap image of a signature, which it does well compressing from ~86kB to ~6kB.
Once compressed, the byte array is written to a SQL CE Database (into an Image datatype column), which is later transferred to a staging database via MS Sync Framework.
Once in the staging database, I have a Windows Service which will read the signature data, decompress it and turn it back into a bitmap.
Unfortunately, when I try to decompress the byte array, I get the following exception "Index was outside the bounds of the array.".
Before I introduced Compression, this system worked 100%.
Now, I've tested in the Client (Windows Mobile) application that I can compress the Image to a byte array, then decompress the byte array back to an image and that works. Also, I have the same Compress/Decompress helper methods in the Client and Server applications.
I'm wondering where the problem lies; Is there a difference between the Compact Framework 3.5 and .NET Framework 3.5 implementations of DeflateStream that renders them incompatible? Or is there some issue with writing a compressed Byte Array to an Image
column in a table and reading it back?
Here is the code for my Compress/Decompress helper methods:
View Complete Post