Skip to content
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

Incorrect exception when passing stream that does not expose a buffer #58

Closed
mpec opened this issue Apr 8, 2024 · 3 comments
Closed

Comments

@mpec
Copy link

mpec commented Apr 8, 2024

When passing a MemoryStream that does not expose buffer via this method: https://learn.microsoft.com/en-us/dotnet/api/system.io.memorystream.trygetbuffer?view=net-8.0 I get the following exception:

System.OverflowException:
   at Imageflow.Fluent.BufferedStreamSource.TryGetWrittenMemory (Imageflow.Net, Version=0.13.1.0, Culture=neutral, PublicKeyToken=null)
   at Imageflow.Fluent.BufferedStreamSource+<BorrowReadOnlyMemoryAsync>d__8.MoveNext (Imageflow.Net, Version=0.13.1.0, Culture=neutral, PublicKeyToken=null)
[snip]
, Message: Streams cannot exceed 2GB 

When running code:

var memorySource = BufferedStreamSource.BorrowEntireStream(sanitizedStream);
var info = await ImageJob.GetImageInfoAsync(memorySource, SourceLifetime.Borrowed);

I think this should be validated when creating BufferedStreamSource and more appropriate exception be thrown.

@lilith
Copy link
Member

lilith commented Apr 8, 2024 via email

@mpec
Copy link
Author

mpec commented Apr 8, 2024

@lilith lilith closed this as completed in 377b918 May 15, 2024
@lilith
Copy link
Member

lilith commented May 15, 2024

Thanks. This should be fixed in the next release, and will "just work" - it is supposed to fall back to using read methods

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants