Skip to content

Conversation

@jlaanstra
Copy link
Collaborator

Alternative implementation that maintains static classes compared to #1359

@jlaanstra jlaanstra marked this pull request as ready for review October 21, 2023 05:54
Copy link
Member

@Sergio0694 Sergio0694 left a comment

Choose a reason for hiding this comment

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

Just leaving a couple more comments 😄

private static extern unsafe int CoGetContextToken(IntPtr* contextToken);

[DllImport("api-ms-win-core-com-l1-1-0.dll")]
private static extern int CoGetObjectContext(ref Guid riid, out IntPtr ppv);
Copy link
Member

Choose a reason for hiding this comment

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

Same note as in the other PR, could you make this use a blittable signature while at it?

Copy link
Member

@Sergio0694 Sergio0694 left a comment

Choose a reason for hiding this comment

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

Left a few comments 🙂
Also, Q: I see you removed INativeGuid, is that just because it'll all be done in another PR?

#endif
public static ObjectReference<I> ActivateInstance<
#if NET
[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.None)]
Copy link
Member

Choose a reason for hiding this comment

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

Is this actually needed? Isn't I already not annotated for any dynamic access in this context? 🤔

[UnconditionalSuppressMessage("ReflectionAnalysis", "IL2091:RequiresUnreferencedCode",
Justification = "No members of the generic type are dynamically accessed in this code path.")]
#endif
public unsafe ObjectReference<I> _ActivateInstance<I>()
Copy link
Member

Choose a reason for hiding this comment

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

Also double checking: I see you removed the [UnconditionalSuppressMessage] below. Is this one still needed or can it also be removed after the other changes you did?

%
internal static % Instance => _instance;
}
private static % _% = new %("%.%", %.IID);
Copy link
Member

Choose a reason for hiding this comment

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

Is this ever reassigned at runtime? If not, shouldn't this be readonly to improve codegen?

{
auto class_type_name = classType.TypeName();
w.write(R"(
private static BaseActivationFactory _%Factory = new BaseActivationFactory("%.%");
Copy link
Member

Choose a reason for hiding this comment

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

Same for this one, shouldn't it be readonly, or could this ever be reassigned?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants