Skip to content

Commit 5db4f45

Browse files
authored
Add System.Threading assembly reference and token (#2303)
Introduce a SystemThreading AssemblyReference in InteropReferences (name: System.Threading, version 10.0.0.0, imported into CorLibScope) and switch the Interlocked TypeReference to be created from that reference. Also add a matching public key token byte array WellKnownPublicKeyTokens.SystemThreading. This centralizes the System.Threading reference and ensures the Interlocked type is resolved from the same assembly reference.
1 parent f85e924 commit 5db4f45

2 files changed

Lines changed: 16 additions & 1 deletion

File tree

src/WinRT.Interop.Generator/References/InteropReferences.cs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,16 @@ public InteropReferences(
154154
publicKey: false,
155155
publicKeyOrToken: WellKnownPublicKeyTokens.SystemNumericsVectors).Import(_corLibTypeFactory.CorLibScope);
156156

157+
/// <summary>
158+
/// Gets the <see cref="AssemblyReference"/> for <c>System.Threading.dll</c>.
159+
/// </summary>
160+
/// <remarks><inheritdoc cref="SystemThreading" path="/remarks/node()"/></remarks>
161+
public AssemblyReference SystemThreading => field ??= new AssemblyReference(
162+
name: "System.Threading"u8,
163+
version: new Version(10, 0, 0, 0),
164+
publicKey: false,
165+
publicKeyOrToken: WellKnownPublicKeyTokens.SystemThreading).Import(_corLibTypeFactory.CorLibScope);
166+
157167
/// <summary>
158168
/// Gets the <see cref="AssemblyReference"/> for <c>WinRT.Projection.dll</c>.
159169
/// </summary>
@@ -517,7 +527,7 @@ public InteropReferences(
517527
/// <summary>
518528
/// Gets the <see cref="AsmResolver.DotNet.TypeReference"/> for <see cref="System.Threading.Interlocked"/>.
519529
/// </summary>
520-
public TypeReference Interlocked => field ??= _corLibTypeFactory.CorLibScope.CreateTypeReference("System.Threading"u8, "Interlocked"u8);
530+
public TypeReference Interlocked => field ??= SystemThreading.CreateTypeReference("System.Threading"u8, "Interlocked"u8);
521531

522532
/// <summary>
523533
/// Gets the <see cref="AsmResolver.DotNet.TypeReference"/> for <see cref="System.Runtime.InteropServices.MemoryMarshal"/>.

src/WinRT.Interop.Generator/References/WellKnownPublicKeyTokens.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,4 +27,9 @@ internal static class WellKnownPublicKeyTokens
2727
/// The public key data for <c>System.Numerics.Vectors.dll</c>.
2828
/// </summary>
2929
public static readonly byte[] SystemNumericsVectors = [0xB0, 0x3F, 0x5F, 0x7F, 0x11, 0xD5, 0x0A, 0x3A];
30+
31+
/// <summary>
32+
/// The public key data for <c>System.Threading.dll</c>.
33+
/// </summary>
34+
public static readonly byte[] SystemThreading = [0xB0, 0x3F, 0x5F, 0x7F, 0x11, 0xD5, 0x0A, 0x3A];
3035
}

0 commit comments

Comments
 (0)