Skip to content

Remove StructCache#818

Merged
danmoseley merged 8 commits intodotnet:masterfrom
sharwell:struct-cache
Apr 27, 2019
Merged

Remove StructCache#818
danmoseley merged 8 commits intodotnet:masterfrom
sharwell:struct-cache

Conversation

@sharwell
Copy link
Contributor

@sharwell sharwell commented Apr 17, 2019

Follow-up to #791. I will rebase this change after the change from @hughbe is merged.

@sharwell sharwell requested a review from a team as a code owner April 17, 2019 02:46
@codecov
Copy link

codecov bot commented Apr 17, 2019

Codecov Report

Merging #818 into master will increase coverage by 0.02015%.
The diff coverage is 0%.

@@                Coverage Diff                @@
##              master      #818         +/-   ##
=================================================
+ Coverage   28.05285%   28.073%   +0.02015%     
=================================================
  Files           1065      1065                 
  Lines         292530    292402        -128     
  Branches       38519     38508         -11     
=================================================
+ Hits           82063     82086         +23     
+ Misses        206407    206253        -154     
- Partials        4060      4063          +3
Flag Coverage Δ
#Debug 28.073% <0%> (+0.02015%) ⬆️
#production 18.38533% <0%> (+0.01809%) ⬆️
#test 98.66795% <ø> (ø) ⬆️

Copy link
Contributor

@weltkante weltkante left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please check if ELEMDESC is defined correctly

Copy link
Contributor

@weltkante weltkante Apr 17, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it correct making this a pointer? ELEMDESC embeds TYPEDESC by value, doing it by reference will lose the VARTYPE member and have the following PARAMDESC at the wrong alignment.

(That probably means the old struct was defined wrong too? If so this might need an additional code review of the callers to check if they need to be updated if they were previously coded/tested with wrong assumptions.)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not clear to me why it's defined this way and also not clear why it's not using System.Runtime.InteropServices.ComTypes.ELEMDESC. I would rather have tests in place before making functional changes to the signatures.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sharwell you may be able to track down the blame for this in the old source control system and followup with the author about why these lines are the way that they are

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've created follow up issue #896 to track the wrong definition

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't think these are necessary

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree, but I would prefer to have tests in place to verify before dropping them since I'm not 100%.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

They aren't necessary. I don't know if the marshaller ignores the redundancy here or if that makes it do extra work. @jkoritzinsky, are these just ignored or will they impact blittability logic?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The marshalling system ignores the redundancy here. Having these doesn't impact blittability.

@zsd4yr
Copy link
Contributor

zsd4yr commented Apr 19, 2019

#791 is merged

/cc @JeremyKuhne

@sharwell
Copy link
Contributor Author

I rebased this and addressed the resulting merge conflicts, but have not addressed the other feedback items yet.

@danmoseley
Copy link
Member

cc @JeremyKuhne

public /*NativeMethods.tagELEMDESC*/ IntPtr lprgelemdescParam = IntPtr.Zero;
public /*NativeMethods.tagELEMDESC*/ IntPtr lprgelemdescParam;

// cpb, Microsoft, the EE chokes on Enums in structs
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This isn't a true statement.

public IntPtr lprgscode = IntPtr.Zero;
public IntPtr lprgscode;

// This is marked as NATIVE_TYPE_PTR,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All of these comments (before the next member) should be removed- they're not correct.

public sealed class tagTYPEATTR {
public struct tagTYPEATTR {
public Guid guid;
[MarshalAs(UnmanagedType.U4)]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All of these can be removed. It doesn't matter if the field is int or uint when matching up DWORD. That said, prefer to the actual signed/unsigned type to match (e.g. uint for DWORD).

@@ -5239,53 +5233,53 @@ public interface IProvideClassInfo
}

[StructLayout(LayoutKind.Sequential)]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The attribute isn't needed- this is the default for structs.

Copy link
Member

@JeremyKuhne JeremyKuhne left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome that we're getting rid of these classes!

We should look at yanking all of these and using the ones defined in System.Runtime.InteropServices.ComTypes. They're correctly defined as structs so there won't be allocation issues like they're trying to avoid here.

Don't hesitate to ping me if you're finding any difficulties using the .NET types here.

@sharwell
Copy link
Contributor Author

We should look at yanking all of these and using the ones defined in System.Runtime.InteropServices.ComTypes

I think this is my preference, but they aren't the drop in replacements I was hoping for. I'll follow up with details next week and we can figure out the best plan for moving forward.

@zsd4yr
Copy link
Contributor

zsd4yr commented Apr 24, 2019

We should look at yanking all of these and using the ones defined in System.Runtime.InteropServices.ComTypes

I think this is my preference, but they aren't the drop in replacements I was hoping for. I'll follow up with details next week and we can figure out the best plan for moving forward.

I think this is the best idea moving forward. @sharwell I would love to see what you come up with next week 😄

For now, I am content to take this change if you are.

@danmoseley
Copy link
Member

@zsd4yr seems this can be merged?

@danmoseley
Copy link
Member

I'm going to merge this based on @zsd4yr approval above.

@danmoseley danmoseley merged commit 2dfd866 into dotnet:master Apr 27, 2019
JeremyKuhne added a commit to JeremyKuhne/winforms that referenced this pull request Jul 1, 2019
ELEMDESC doesn't contain a pointer. This fixes a regression introduced in dotnet#818.

Fixes dotnet#896
wtgodbe pushed a commit that referenced this pull request Jul 2, 2019
ELEMDESC doesn't contain a pointer. This fixes a regression introduced in #818.

Fixes #896
wtgodbe pushed a commit to wtgodbe/winforms that referenced this pull request Jul 2, 2019
ELEMDESC doesn't contain a pointer. This fixes a regression introduced in dotnet#818.

Fixes dotnet#896
AdamYoblick pushed a commit that referenced this pull request Jul 2, 2019
ELEMDESC doesn't contain a pointer. This fixes a regression introduced in #818.

Fixes #896
RussKie pushed a commit that referenced this pull request Jul 3, 2019
ELEMDESC doesn't contain a pointer. This fixes a regression introduced in #818.

Fixes #896

(cherry picked from commit 52be7e5)
@ghost ghost locked as resolved and limited conversation to collaborators Feb 6, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants