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

Fix ArgumentException with FromWidth/Height options in InteropBitmap #10706

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

h3xds1nz
Copy link
Member

@h3xds1nz h3xds1nz commented Apr 4, 2025

Fixes #10397

Description

Fixes an ArgumentException that would occur in any case the sizing options passed would be created via FromHeight and FromWidth factory methods due to invalid arguments passed to GetScaledWidthAndHeight (self).

Instead the correct values to pass are the source bitmap dimensions. In case there's no clip rect provided, we must retrieve the width/height as we don't have it yet available during initialization, otherwise pass the clip rect.

Customer Impact

Customers will be able to scale InteropBitmap without any exceptions upon creation.

Regression

It is the case in NetFX as well.

Testing

Tests are included.

Risk

Low, from non-working to working properly.

Microsoft Reviewers: Open in CodeFlow

@h3xds1nz h3xds1nz requested review from a team as code owners April 4, 2025 18:03
@dotnet-policy-service dotnet-policy-service bot added PR metadata: Label to tag PRs, to facilitate with triage Community Contribution A label for all community Contributions labels Apr 4, 2025
Copy link

codecov bot commented Apr 4, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 11.39672%. Comparing base (3cc9d57) to head (e84ca6e).

Additional details and impacted files
@@                 Coverage Diff                 @@
##                main      #10706         +/-   ##
===================================================
+ Coverage   11.17950%   11.39672%   +0.21721%     
===================================================
  Files           3314        3315          +1     
  Lines         665182      665437        +255     
  Branches       74668       74669          +1     
===================================================
+ Hits           74364       75838       +1474     
+ Misses        589525      588296       -1229     
- Partials        1293        1303         +10     
Flag Coverage Δ
Debug 11.39672% <100.00000%> (+0.21721%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Community Contribution A label for all community Contributions PR metadata: Label to tag PRs, to facilitate with triage
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Imaging.CreateBitmapSourceFromHIcon crash: Value does not fall within the expected range.
1 participant