wpf icon indicating copy to clipboard operation
wpf copied to clipboard

Remove Marshal Exception/HRESULT proxies from SecurityHelper, simplify code

Open h3xds1nz opened this issue 1 year ago • 3 comments

Description

Continues the work on removing CAS remnants, this time again method proxies and "helpers" from SecurityHelper.

In this PR we remove GetHRForException from StreamAsIStream along with obsolete warning suppresions and also GetExceptionForHR plus ThrowExceptionForHR proxies.

  • _lastException was just storing the latest exception in a private field that was never read.
  • Technically we could just return COR_E_OBJECTDISPOSED in some cases instead of setting up a frame, conditionally throwing ObjectDisposedException, catching it just to retrieve the HResult and then returning it but I think it is out of scope for this PR.

Customer Impact

Decreased size of assemblies, cleaner codebase for developers.

Regression

No.

Testing

Local build.

Risk

Low.

Microsoft Reviewers: Open in CodeFlow

h3xds1nz avatar Oct 21 '24 17:10 h3xds1nz

@h3xds1nz this PR is good to be merged. Can you please resolve the merge conflicts?

himgoyalmicro avatar Apr 14 '25 13:04 himgoyalmicro

@himgoyalmicro Done :)

h3xds1nz avatar Apr 14 '25 14:04 h3xds1nz

Codecov Report

Attention: Patch coverage is 11.53846% with 23 lines in your changes missing coverage. Please review.

Project coverage is 12.83462%. Comparing base (72af9a5) to head (0c13826). Report is 18 commits behind head on main.

Additional details and impacted files
@@                 Coverage Diff                 @@
##                main       #9977         +/-   ##
===================================================
+ Coverage   11.25778%   12.83462%   +1.57683%     
===================================================
  Files           3315        3316          +1     
  Lines         665229      665427        +198     
  Branches       74668       74667          -1     
===================================================
+ Hits           74890       85405      +10515     
+ Misses        589035      577806      -11229     
- Partials        1304        2216        +912     
Flag Coverage Δ
Debug 12.83462% <11.53846%> (+1.57683%) :arrow_up:

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

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

codecov[bot] avatar Apr 14 '25 14:04 codecov[bot]