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

ArgumentException when creating WindowIcon from Bitmap #14541

Closed
mnvfs opened this issue Feb 8, 2024 · 1 comment
Closed

ArgumentException when creating WindowIcon from Bitmap #14541

mnvfs opened this issue Feb 8, 2024 · 1 comment

Comments

@mnvfs
Copy link

mnvfs commented Feb 8, 2024

Describe the bug

Since updating to version 11.0.8 I get an ArgumentException with the message "Unable to load bitmap from provided data" when creating WindowIcon from a Bitmap.

To Reproduce

Simple use the WindowIcon ctor with the Bitmap parameter.

Expected behavior

No exception is thrown.

Environment

  • OS: Windows 10 22H2 OS Build 19045.3803
  • Avalonia-Version: 11.0.8

Additional context

I was able to debug the problem and for me it seems that the problem is that in Win32Platofrm.LoadIcon(IBitmapImpl) does not reset the create MemoryStreams position. Therefore any further call uses an empty array which in the end leads to the ArgumentException.
When I use the Stream parameter ctor of WindowIcon with a stream created by myself (and the position reset) everything works fine.

@maxkatz6
Copy link
Member

maxkatz6 commented Feb 9, 2024

Already fixed by #13445 in master. Will release 11.0.9 with a fix today.

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

Successfully merging a pull request may close this issue.

2 participants