-
Notifications
You must be signed in to change notification settings - Fork 991
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 VARIANT code and add tests #3197
Conversation
Codecov Report
@@ Coverage Diff @@
## master #3197 +/- ##
====================================================
- Coverage 61.67065% 32.94489% -28.72576%
====================================================
Files 1287 865 -422
Lines 451933 254088 -197845
Branches 39511 36748 -2763
====================================================
- Hits 278710 83709 -195001
+ Misses 167822 165544 -2278
+ Partials 5401 4835 -566
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This code looks broken, do we want to fix it or should I open an issue?
src/System.Windows.Forms.Primitives/src/Interop/Ole32/Interop.VARIANT.cs
Outdated
Show resolved
Hide resolved
src/System.Windows.Forms.Primitives/src/Interop/Ole32/Interop.VARIANT.cs
Outdated
Show resolved
Hide resolved
src/System.Windows.Forms.Primitives/src/Interop/Ole32/Interop.VARIANT.cs
Outdated
Show resolved
Hide resolved
src/System.Windows.Forms.Primitives/src/Interop/Ole32/Interop.VARIANT.cs
Outdated
Show resolved
Hide resolved
src/System.Windows.Forms.Primitives/src/Interop/Ole32/Interop.VARIANT.cs
Outdated
Show resolved
Hide resolved
src/System.Windows.Forms.Primitives/src/Interop/Ole32/Interop.VARIANT.cs
Outdated
Show resolved
Hide resolved
src/System.Windows.Forms.Primitives/src/Interop/Ole32/Interop.VARIANT.cs
Outdated
Show resolved
Hide resolved
src/System.Windows.Forms.Primitives/src/Interop/Ole32/Interop.VARIANT.cs
Outdated
Show resolved
Hide resolved
src/System.Windows.Forms.Primitives/src/Interop/Ole32/Interop.VARIANT.cs
Outdated
Show resolved
Hide resolved
src/System.Windows.Forms.Primitives/src/Interop/Ole32/Interop.DEC.cs
Outdated
Show resolved
Hide resolved
src/System.Windows.Forms.Primitives/tests/Interop/Ole32/VARIANTTests.cs
Outdated
Show resolved
Hide resolved
src/System.Windows.Forms.Primitives/src/Interop/Ole32/Interop.VARIANT.cs
Outdated
Show resolved
Hide resolved
src/System.Windows.Forms.Primitives/src/Interop/Ole32/Interop.VARIANT.cs
Outdated
Show resolved
Hide resolved
src/System.Windows.Forms.Primitives/src/Interop/Ole32/Interop.VARIANT.cs
Outdated
Show resolved
Hide resolved
src/System.Windows.Forms.Primitives/src/Interop/Ole32/Interop.VARIANT.cs
Outdated
Show resolved
Hide resolved
e95e7ed
to
23f9461
Compare
src/System.Windows.Forms/src/System/Windows/Forms/AxHost.AxPerPropertyBrowsingEnum.cs
Outdated
Show resolved
Hide resolved
...Forms/src/System/Windows/Forms/ComponentModel/COM2Interop/COM2IPerPropertyBrowsingHandler.cs
Outdated
Show resolved
Hide resolved
Codecov Report
@@ Coverage Diff @@
## master #3197 +/- ##
====================================================
- Coverage 61.68011% 32.78626% -28.89385%
====================================================
Files 1288 866 -422
Lines 451935 254079 -197856
Branches 39511 36750 -2761
====================================================
- Hits 278754 83303 -195451
+ Misses 167786 165980 -1806
+ Partials 5395 4796 -599
|
Let me know if there’s anything to action :) |
Waiting for @JeremyKuhne's approval. |
all important points are covered Its still unclear what an "OLE property set" is and whether the code should support it or not (currently it does support some but not all cases, which makes little sense) - but that shouldn't hold up the PR as it was the same before. My thoughts are OLE property sets are that its something you shouldn't be supporting here and the corresponding cases could be removed, but I don't oppose leaving them as they are if there is no documentation to be found. |
src/System.Windows.Forms.Primitives/src/Interop/Ole32/Interop.VARIANT.cs
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for trying to get this into better shape! I've left comments for things I'd like to see changed/addressed.
Taking this farther we need to better handle / differentiate when we're working with PROPVARIANT
, VARIANT
, or TYPEDESC
. The headers have a decent table that shows what is used in which context. We want to make sure we're cleaning / copying appropriately based on what we have for content.
It would be good to give significant thought to how we might help prevent inadvertent leaking of native memory. I'd also like to spend time building confidence that we don't have situations where data hangs off the end of the VARIANT
.
src/System.Windows.Forms.Primitives/src/Interop/Ole32/Interop.DECIMAL.cs
Outdated
Show resolved
Hide resolved
src/System.Windows.Forms.Primitives/src/Interop/Ole32/Interop.VARIANT.cs
Outdated
Show resolved
Hide resolved
src/System.Windows.Forms.Primitives/src/Interop/Ole32/Interop.VARIANT.cs
Outdated
Show resolved
Hide resolved
src/System.Windows.Forms.Primitives/src/Interop/Ole32/Interop.VARIANT.cs
Outdated
Show resolved
Hide resolved
src/System.Windows.Forms.Primitives/src/Interop/Ole32/Interop.VARIANT.cs
Outdated
Show resolved
Hide resolved
src/System.Windows.Forms.Primitives/src/Interop/Ole32/Interop.VARIANT.cs
Outdated
Show resolved
Hide resolved
src/System.Windows.Forms.Primitives/src/Interop/Ole32/Interop.VARIANT.cs
Outdated
Show resolved
Hide resolved
src/System.Windows.Forms.Primitives/tests/Interop/Oleaut32/SAFEARRAYTests.cs
Outdated
Show resolved
Hide resolved
Overall looks good to me (at the level I understand this area). @JeremyKuhne please review again when you have time. |
f702d0e
to
ef7409d
Compare
/azp run |
Azure Pipelines successfully started running 1 pipeline(s). |
src/System.Windows.Forms.Primitives/tests/UnitTests/Interop/Oleaut32/VARIANTTests.cs
Outdated
Show resolved
Hide resolved
6157cef
to
d2b3604
Compare
In dotnet/winforms#3197 we were investigating what happens when you try to create an an array from SAFEARRAY with more than 32 dimensions. Found out that this throws `TypeLoadException`. Thought I'd come along and write some tests to validate this constraint in dotnet/runtime. Note: in In dotnet/winforms#3197 we wanted to `stackalloc` an `int` array to navigate through an n-dimensional array instead of manually allocating `int[]` which costs memory. Obviously we could only do this if `Array.Rank` is not something large such that `stackalloc` would cause `StackOverflowExceptions`. Is it safe to assume that we will not change `MAX_RANK`? Updated the comment in https://github.com/dotnet/runtime/blob/80d8920a54b0d73eb8423fe705583a0fd7ad1723/src/coreclr/src/vm/clsload.cpp#L3327-L3331 I think we do need this check! Note that I think mono will hit some assertions and (possibly?) crash: https://github.com/dotnet/runtime/blob/1cfccd2a7937117341b256847e613dd710a70adb/src/mono/mono/metadata/class-init.c#L920 /cc @akoeplinger for mono if it is relevant, @weltkante @JeremyKuhne @AaronRobinsonMSFT
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Several tests aren't locale agnostic Relates to #3121
Proposed Changes
VARENUM vtType = vt & ~VARENUM.TYPEMASK;
check should have beenVARENUM vtType = vt & VARENUM.TYPEMASK;
VARIANT
by moving finalizer into disposerMicrosoft Reviewers: Open in CodeFlow