c# - How to save IBuffer object into JPG file in IsolatedStorage -


so have ibuffer object , want save content phone isolated storage jpg. i've tried following gives me error nullreferenceexception.

i suspect stream not created how make work ibuffer?

          using (isolatedstoragefile store = isolatedstoragefile.getuserstoreforapplication())             {                 using (isolatedstoragefilestream filestream = store.createfile(filepath))                 {                     memorystream stream = new memorystream();                     photo.imagebuffer.asstream().copyto(stream);                     bitmapimage bitmap = new bitmapimage();                     writeablebitmap wb = new writeablebitmap(bitmap);                      //encode writeablebitmap object jpeg stream.                     extensions.savejpeg(wb, filestream, (int)photo.dimensions.width, (int)photo.dimensions.height, 0, 100);                                        }             } 

error message

{system.nullreferenceexception: object reference not set instance of object. @ ms.internal.xcpimports.checkhresult(uint32 hr) @ ms.internal.xcpimports.writeablebitmap_createfromsource(writeablebitmap wb, intptr ptrmemory, bitmapsource source, boolean& bhasprotectedcontent) @ system.windows.media.imaging.writeablebitmap..ctor(bitmapsource source) @ lensblurx.helpers.isohelper.<savejpg>d__0.movenext() --- end of stack trace previous location exception thrown --- @ system.runtime.compilerservices.taskawaiter.throwfornonsuccess(task task) @ system.runtime.compilerservices.taskawaiter.handlenonsuccessanddebuggernotification(task task) @ system.runtime.compilerservices.taskawaiter.getresult() @ lensblurx.pages.photopage.<saveasync>d__12.movenext() --- end of stack trace previous location exception thrown --- @ system.runtime.compilerservices.taskawaiter.throwfornonsuccess(task task) @ system.runtime.compilerservices.taskawaiter.handlenonsuccessanddebuggernotification(task task)  @ system.runtime.compilerservices.taskawaiter.getresult()  @ lensblurx.pages.photopage.<save_click>d__1e.movenext()} 


Comments

Popular posts from this blog

google api - Incomplete response from Gmail API threads.list -

Installing Android SQLite Asset Helper -

Qt Creator - Searching files with Locator including folder -