diff --git a/src/libraries/Common/src/SourceGenerators/DiagnosticInfo.cs b/src/libraries/Common/src/SourceGenerators/DiagnosticInfo.cs
new file mode 100644
index 00000000000000..74f44f99c62baa
--- /dev/null
+++ b/src/libraries/Common/src/SourceGenerators/DiagnosticInfo.cs
@@ -0,0 +1,60 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+
+using System;
+using System.Linq;
+using System.Numerics.Hashing;
+using Microsoft.CodeAnalysis;
+
+namespace SourceGenerators;
+
+///
+/// Descriptor for diagnostic instances using structural equality comparison.
+/// Provides a work-around for /~https://github.com/dotnet/roslyn/issues/68291.
+///
+internal readonly struct DiagnosticInfo : IEquatable
+{
+ public DiagnosticDescriptor Descriptor { get; private init; }
+ public object?[] MessageArgs { get; private init; }
+ public Location? Location { get; private init; }
+
+ public static DiagnosticInfo Create(DiagnosticDescriptor descriptor, Location? location, object?[]? messageArgs)
+ {
+ Location? trimmedLocation = location is null ? null : GetTrimmedLocation(location);
+
+ return new DiagnosticInfo
+ {
+ Descriptor = descriptor,
+ Location = trimmedLocation,
+ MessageArgs = messageArgs ?? Array.Empty