servicestack - ToOptimizedResult on an HttpResult causes a StackOverflow exception -


i'm using v3.9.56.0 , i'm encountering stack overflow exception when call tooptimizedresult (called own service runner) on returned httpresult service. when dig deeper found exception coming jsonserializer.

here snippet of code being returned:

return new httpresult(new fileinfo(path.combine(path, file)), true) 

this happening because tooptimizedresult expects receive dto response object can compress create compressedresult response.

however providing httpresult wrapper byte[]/string dto response object of file loading, wrapper complex type, , isn't want trying optimise.

if file binary should return byte[] of contents, if plain text return string. tooptimizedresult can optimise data.

// binary file type return file.readallbytes(path.combine(path, file));  // returns byte[]  // plain text file type return file.readalltext(path.combine(path, file));  // returns string 

Comments

Popular posts from this blog

java - WrongTypeOfReturnValue exception thrown when unit testing using mockito -

php - Magento - Deleted Base url key -

android - How to disable Button if EditText is empty ? -