Hi folks,
I'm trying to read in a hardcoded bitmap image into a bitmap object. I keep getting the same error:
System.ArgumentException: Parameter is not valid.
This is the code i have...
const string fakeByteData = "AAECAwQFBgcICQoLDA0ODxAREhMUFRYXGBkaGxwdHh8gISIjJCUmJygpKissLS4vMDEyMzQ1Njc4OTo7PD0+P0BBQkNERUZHSElKS0xNTk9QUVJTVFVWV1hZWltcXV5fYGFiY2RlZmdoaWprbG1ub3BxcnN0dXZ3eHl6e3x9fn+AgYKDhIWGh4iJiouMjY6PkJGSk5SVlpeYmZqbnJ2en6ChoqOkpaanqKmqq6ytrq+wsbKztLW2t7i5uru8vb6/wMHCw8TFxsfIycrLzM3Oz9DR0tPU1dbX2Nna29zd3t/g4eLj5OXm5+jp6uvs7e7v8PHy8/T19vf4+fr7/P3+/w==";
Stream stream = new MemoryStream(Encoding.ASCII.GetBytes(fakeByteData));
var bitmap = new Bitmap(stream);
Yes, i've not used any 'using
' statements of disposed off stuff, because I was trying to see why this piece of byte data was erroring. This is some random code i have in a very temporary unit test.
I'm assuming the content of the fakeByteData
is legit.
Can anyone shed some light, here?