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

Stop throwing OutOfMemoryException for GDI+ errors in System.Drawing #12627

Open
JeremyKuhne opened this issue Dec 11, 2024 · 0 comments
Open
Assignees
Labels
area-System.Drawing System.Drawing issues 📖 documentation: breaking A change in behavior that could be breaking for applications. Needs to be documented. enhancement Product code improvement that does NOT require public API changes/additions
Milestone

Comments

@JeremyKuhne
Copy link
Member

GDI+ returns Status.OutOfMemory for many general purpose errors. This is deeply confusing for users and almost never happens due to an actual lack of memory.

I'm inclined to change this behavior to always throw InvalidOperationException with a message along the lines of:

GDI+ returned Status.OutOfMemory. This is usually a general error and not a lack of memory.

I can't know for sure that there isn't a low memory situation, but if it is other things are likely to fail imminently for lack of memory anyway.

I'd offer an AppContext opt-out switch that would throw with the old behavior.

@JeremyKuhne JeremyKuhne added 📖 documentation: breaking A change in behavior that could be breaking for applications. Needs to be documented. area-System.Drawing System.Drawing issues enhancement Product code improvement that does NOT require public API changes/additions labels Dec 11, 2024
@JeremyKuhne JeremyKuhne added this to the 10.0 Preview1 milestone Dec 11, 2024
@JeremyKuhne JeremyKuhne self-assigned this Dec 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-System.Drawing System.Drawing issues 📖 documentation: breaking A change in behavior that could be breaking for applications. Needs to be documented. enhancement Product code improvement that does NOT require public API changes/additions
Projects
None yet
Development

No branches or pull requests

1 participant