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 COM interop ELEMDESC #1254

Merged
merged 1 commit into from
Jul 2, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/Common/src/NativeMethods.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5397,7 +5397,7 @@ public enum tagVARFLAGS
[StructLayout(LayoutKind.Sequential)]
public unsafe struct tagELEMDESC
{
public NativeMethods.tagTYPEDESC* tdesc;
public NativeMethods.tagTYPEDESC tdesc;
public NativeMethods.tagPARAMDESC paramdesc;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -719,7 +719,7 @@ private static void ProcessFunctions(UnsafeNativeMethods.ITypeInfo typeInfo, IDi

unsafe
{
typeDesc = *funcDesc.elemdescFunc.tdesc;
typeDesc = funcDesc.elemdescFunc.tdesc;
Copy link
Member

Choose a reason for hiding this comment

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

Are all the unsafe blocks still needed? (Also in the definition of the struct.)

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 needed but I think this specific insertion was for preview 7 so I assumed less code churn was preferred. They definitely should be removed after preview 7 though.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, I was going for the minimal change for preview 7. :)

}
}
else
Expand All @@ -734,7 +734,7 @@ private static void ProcessFunctions(UnsafeNativeMethods.ITypeInfo typeInfo, IDi
ref readonly NativeMethods.tagELEMDESC ed = ref UnsafeNativeMethods.PtrToRef<NativeMethods.tagELEMDESC>(funcDesc.lprgelemdescParam);
unsafe
{
typeDesc = *ed.tdesc;
typeDesc = ed.tdesc;
}
}
pi = ProcessDataCore(typeInfo, propInfoList, funcDesc.memid, nameDispID, in typeDesc, funcDesc.wFuncFlags);
Expand Down Expand Up @@ -973,7 +973,7 @@ private static void ProcessVariables(UnsafeNativeMethods.ITypeInfo typeInfo, IDi

unsafe
{
PropInfo pi = ProcessDataCore(typeInfo, propInfoList, varDesc.memid, nameDispID, in *varDesc.elemdescVar.tdesc, varDesc.wVarFlags);
PropInfo pi = ProcessDataCore(typeInfo, propInfoList, varDesc.memid, nameDispID, in varDesc.elemdescVar.tdesc, varDesc.wVarFlags);
if (pi.ReadOnly != PropInfo.ReadOnlyTrue)
{
pi.ReadOnly = PropInfo.ReadOnlyFalse;
Expand Down