Skip to content

Conversation

@AArnott
Copy link
Member

@AArnott AArnott commented Nov 11, 2022

This way, the reference can be converted by others into a pointer and passed around without fear that the data will move.

The new property looks like this:

static ref readonly Guid IComIID.Guid
{
    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    get
    {
        ReadOnlySpan<byte> data = new byte[] {
            0x0B,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x46 };
        return ref Unsafe.As<byte, Guid>(ref MemoryMarshal.GetReference(data));
    }
}

Also add non-marshaling runtime test project so we can verify the emitted guid has the right value.

@AArnott AArnott added the enhancement New feature or request label Nov 11, 2022
@AArnott
Copy link
Member Author

AArnott commented Nov 11, 2022

CC: @tannergooding @JeremyKuhne

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.

🚀 Nice!

@AArnott AArnott enabled auto-merge November 11, 2022 23:51
@AArnott
Copy link
Member Author

AArnott commented Nov 12, 2022

/azp run

@azure-pipelines
Copy link

Azure Pipelines could not run because the pipeline triggers exclude this branch/path.

This way, the reference can be converted by others into a pointer and passed around without fear that the data will move.

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

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants