http://netmf.codeplex.com/
client_v4_2/CLR/Libraries/CorLib/corlib_native_System_Resources_ResourceManager.cpp
if(offset + length >= size) { length -= size - offset; }
Seems like this is wrong in at least a couple of ways. I think:
if((offset + length) > size) { length = (size - offset); }Is both clearer and less buggy.
So I think in your first case you ended up with:
if(0 + 8 >= 8) { length -= 8 - 0; }So your length ended up as 0 in this case.
if(0 + 20 >= 8) { length -= 8 - 0; }So your length ended up as 12 in this case (8 bytes of your resource data and four bytes of god knows what).
Happy to submit a patch, but I need to spend an hour and figure out how to do it and get the code. I was able to figure this out by browsing the source on CodePlex.
I'd say in the interim just make your resource one byte larger than you need. So nine bytes and then just know that the first eight are the "real" resource.