-
Notifications
You must be signed in to change notification settings - Fork 245
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unexpected empty InStream #7329
Comments
That's not unexpected behaviour as the Blob you have created an instream for is only local and ceases to exist after returning the instream. There's nothing anymore for the instream to read from. Maybe it should give an runtime error instead of just returning nothing. |
Seems a dupe of #7172 I agree, the stream requires its backing to be 'alive', and I think that's quite intuitive. But anything MS could do to help diagnose this (e.g. runtime error: stream was opened against a backing that has now gone away) would avoid the frequent 'gotcha'. |
I appreciate the confirmation. It has such a broad footprint that I was unsure whether or not this is a known limitation. Is there any other way to achieve this without protecting the lifecycle of the wrapper object, or to guard it in a more elegant way? Can the |
This really needs to go to the runtime team, it's not something we can address in the AL language itself. You should do one of the following:
|
1. Describe the bug
When a procedure returns or assigns an
InStream
object via a locally instantiated and referencedCodeunit "Temp Blob"
object theInStream
object becomes unexpectedly empty after the procedure returns and the call completes.2. To Reproduce
A workaround instantiates and holds the reference to the
Codeunit "Temp Blob"
object at higher level while it uses anInStream
from it. Worth noting: 1) I tried usingVAR
decoration for theInStream
and that did not help. 2) The workaround works whether theCodeunit "Temp Blob"
object is passed viaVAR
or it is returned.3. Expected behavior
The file downloaded via the browser is non-zero length.
4. Actual behavior
The file downloaded via the browser is zero length.
5. Versions:
The text was updated successfully, but these errors were encountered: