-
Notifications
You must be signed in to change notification settings - Fork 106
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
Remove the need for GuidGenerator/IIDOptimizer for all ABI interfaces. #1360
Remove the need for GuidGenerator/IIDOptimizer for all ABI interfaces. #1360
Conversation
/cc @jkoritzinsky |
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.
Instead of exposing ReadOnlySpan<byte>
at the APi level. Can we make the span member a private static and make a public Guid
property that just returns new Guid(span)
?
We could but copying a span around is cheaper I think? This is all internal to the projection code anyway. Nevermind, new Guid(span) should do the same thing. |
Given this is an API surface change, can I get you to retarget this PR to |
It's not breaking though? I can retarget but that also retargets the factory caching PR. |
Right, it is not breaking but anyone moving to this version of CsWinRT to generate their projection will probably need to update all their dependent projections to ones that has these changes. So, they at a minimum will need the updated Windows SDK projection, which will need to increment its assembly version, and possibly other dependent projections based on the APIs being projected. We try to minimize how often we do such changes by grouping them together. If the factory caching PR is dependent on this, we can mitigate the assembly version impact on that PR by only doing it for exclusive interfaces (i.e includes factory interfaces) rather than all. And then having the PR in the |
I don't think that's true? You could just do this for one projection and it should work fine, since it is only done for types internal to the current projection? |
This PR generates ReadOnlySpan for guids for all ABI types which can then be efficiently passed to QI methods by doing
MemoryMarshal.Read<Guid>(span)
.The C# compiler since .NET7 optimizes the byte array to a readonly data section as it sees that there are no ways the byte array can be changed, resulting in less byte arrays created.
There are a few places left with this PR where generics can show up and we need to decide how we generate IIDs for those, for example IList.