MemoryStream exception in Designer

Hi,
I have store a .lst project into database like:

ListLabel LL = new ListLabel();
LL.DataSource = CreateDataSet();
byte[] report = GetReportFromDatabase();
MemoryStream memStream = new MemoryStream(report);
LL.Design(LlProject.List, memStream);
LL.Dispose();

But when I made some modification of the project using the Designer, when I close it an exception occurs:

“Memory Stream is not expandable”

and the modifications are not saved.
Which could be the issue? How can I solve it?

Thanks

A MemoryStream over a byte array is not expandable indeed. See this StackOverflow post for a number of possible fixes :slight_smile::
c# - Memory stream is not expandable - Stack Overflow

Thanks, I solved it using
var memStream = new MemoryStream(0)
initialized to 0, then it can be extended.

1 Like