-
Notifications
You must be signed in to change notification settings - Fork 988
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
Consolidate IStream code #1481
Consolidate IStream code #1481
Conversation
using System.IO; | ||
using System.Runtime.InteropServices; | ||
|
||
internal static partial class Interop |
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 is all taken from https://github.com/dotnet/corefx/tree/master/src/System.Drawing.Common/src/System/Drawing/Internal/GPStream.cs which is basically a more performant version of the previous class
60018bd
to
0989c47
Compare
Codecov Report
@@ Coverage Diff @@
## master #1481 +/- ##
===================================================
+ Coverage 25.79151% 25.82417% +0.03266%
===================================================
Files 802 804 +2
Lines 268189 268148 -41
Branches 37965 37968 +3
===================================================
+ Hits 69170 69247 +77
+ Misses 194099 193980 -119
- Partials 4920 4921 +1
|
src/System.Windows.Forms.Design.Editors/src/Misc/UnsafeNativeMethods.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 pulling my impl over! You beat me to it. :) It is wayyy faster than the current code.
We should clean up the interface definitions and do some basic cleanup and auditing of them as we bring them over into new files. I've left comments to the main things we should be looking for.
Pay particular attention to anything that takes a pointer. I've seen a number of cases where foo*
is defined as int
in the interfaces. :( Note that I find it much easier to audit these things by having an unmanaged project to search in the Solution Explorer for definitions. You can clone my Interop project for a simple one to do searches in. It can be a little easier to find the right definition by searching for IID
, so IID_IStream
for IStream
. The interface def is typically right below it.
When we get into v5 I'll help fix some of these further and go into more detail where they're not being done efficiently. In general they're not in great shape, with a lot of things being defined incorrectly.
2c7d84c
to
f49bff7
Compare
It looks like this would fix behavior regarding optional output arguments, in Read/Write/CopyTo/Seek. Currently this causing problems with imagelist resource loading, when comctl32.dll:ImageList_Read() is used with managed IStream wrapper, see [1]. Looking forward for this getting merged. |
Awesome - we love unintended good consequences! We should also do an audit of other interfaces to see if there's other problems |
This needs to go through Tell-Mode process. Please fill out the template below: Customer Impact Regression? Risk** |
Let's add the Tell-Mode label when we're all approved and ready to merge so I can discuss in shiproom/tactics. |
src/Common/src/Interop/Ole32/Interop.StgCreateDocfileOnILockBytes.cs
Outdated
Show resolved
Hide resolved
src/Common/src/Interop/Ole32/Interop.StgOpenStorageOnILockBytes.cs
Outdated
Show resolved
Hide resolved
src/Common/src/Interop/Richedit/Interop.IRichEditOleCallback.cs
Outdated
Show resolved
Hide resolved
src/Common/src/Interop/Richedit/Interop.IRichEditOleCallback.cs
Outdated
Show resolved
Hide resolved
src/Common/src/Interop/Richedit/Interop.IRichEditOleCallback.cs
Outdated
Show resolved
Hide resolved
src/Common/src/Interop/Richedit/Interop.IRichEditOleCallback.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.
There a couple of broken API defs, but mostly nits. The definitions that are broken have always been broken- @hughbe didn't introduce any problems. We were lucky that the existing definitions mostly worked or perhaps unlucky that we didn't fail hard all the time on the bad defs.
I think it would be better to yank the [MarshalAs] for bool
to BOOL
and just pass Interop.BOOL
for clarity. Given that there is one bool
defined wrong, it is probably worth making that change to the code here.
@hughbe, thanks a ton for cleaning the existing stuff up. There are a lot of problems in the existing COM imports, it's exciting to see them get fixed up!
I did another line-by-line review of the imports and found a few other existing problems. Outside of that my comments are all nits. |
f49bff7
to
4b1fac5
Compare
ee80ddc
to
9e3838c
Compare
9e3838c
to
08912d7
Compare
@JeremyKuhne how do we look now ! :D |
Thank you gentlemen |
Description:
Customer Impact:
Improved performance and no crashes if the user passes null parameters to IStream methods.
Regression:
None
Risk:
Possible incorrect definitions of interface/interop methods. These are tested with unit tests - any incorrectness would throw EntryPointNotFound exceptions and break tests.
Microsoft Reviewers: Open in CodeFlow