diff --git a/src/Analyzers/Core/Analyzers/UseSystemHashCode/Analyzer.cs b/src/Analyzers/Core/Analyzers/UseSystemHashCode/Analyzer.cs
index 537c49ac89907..d4e73d2135564 100644
--- a/src/Analyzers/Core/Analyzers/UseSystemHashCode/Analyzer.cs
+++ b/src/Analyzers/Core/Analyzers/UseSystemHashCode/Analyzer.cs
@@ -16,7 +16,7 @@ namespace Microsoft.CodeAnalysis.UseSystemHashCode
/// Helper code to support both "UseSystemHashCodeCodeFixProvider" and
/// .
///
- internal partial struct Analyzer
+ internal readonly partial struct Analyzer
{
private readonly Compilation _compilation;
private readonly IMethodSymbol _objectGetHashCodeMethod;
diff --git a/src/EditorFeatures/Core.Wpf/SignatureHelp/Controller.Session_UpdateModel.cs b/src/EditorFeatures/Core.Wpf/SignatureHelp/Controller.Session_UpdateModel.cs
index 1e402ee2e4c91..6239491682fb3 100644
--- a/src/EditorFeatures/Core.Wpf/SignatureHelp/Controller.Session_UpdateModel.cs
+++ b/src/EditorFeatures/Core.Wpf/SignatureHelp/Controller.Session_UpdateModel.cs
@@ -18,7 +18,7 @@ internal partial class Controller
{
internal partial class Session
{
- internal struct SignatureHelpSelection
+ internal readonly struct SignatureHelpSelection
{
private readonly SignatureHelpItem _selectedItem;
private readonly bool _userSelected;
diff --git a/src/EditorFeatures/Core.Wpf/Workspaces/WpfTextBufferVisibilityTracker.cs b/src/EditorFeatures/Core.Wpf/Workspaces/WpfTextBufferVisibilityTracker.cs
index 977eb81698984..f9551b1388674 100644
--- a/src/EditorFeatures/Core.Wpf/Workspaces/WpfTextBufferVisibilityTracker.cs
+++ b/src/EditorFeatures/Core.Wpf/Workspaces/WpfTextBufferVisibilityTracker.cs
@@ -115,7 +115,7 @@ public void UnregisterForVisibilityChanges(ITextBuffer subjectBuffer, Action cal
public TestAccessor GetTestAccessor()
=> new TestAccessor(this);
- public struct TestAccessor
+ public readonly struct TestAccessor
{
private readonly WpfTextBufferVisibilityTracker _visibilityTracker;
diff --git a/src/EditorFeatures/Core/InlineRename/IEditorInlineRenameService.cs b/src/EditorFeatures/Core/InlineRename/IEditorInlineRenameService.cs
index d245010a9d0d8..903ac0a655cf1 100644
--- a/src/EditorFeatures/Core/InlineRename/IEditorInlineRenameService.cs
+++ b/src/EditorFeatures/Core/InlineRename/IEditorInlineRenameService.cs
@@ -18,7 +18,7 @@
namespace Microsoft.CodeAnalysis.Editor
{
- internal struct InlineRenameLocation
+ internal readonly struct InlineRenameLocation
{
public Document Document { get; }
public TextSpan TextSpan { get; }
@@ -65,7 +65,7 @@ internal enum InlineRenameFileRenameInfo
Allowed
}
- internal struct InlineRenameReplacement
+ internal readonly struct InlineRenameReplacement
{
public InlineRenameReplacementKind Kind { get; }
public TextSpan OriginalSpan { get; }
diff --git a/src/EditorFeatures/Core/InlineRename/InlineRenameSession.OpenTextBufferManager.cs b/src/EditorFeatures/Core/InlineRename/InlineRenameSession.OpenTextBufferManager.cs
index 69a3fafeba936..d43cc94f6b62c 100644
--- a/src/EditorFeatures/Core/InlineRename/InlineRenameSession.OpenTextBufferManager.cs
+++ b/src/EditorFeatures/Core/InlineRename/InlineRenameSession.OpenTextBufferManager.cs
@@ -651,7 +651,7 @@ private static RenameSpanKind GetRenameSpanKind(InlineRenameReplacementKind kind
}
}
- private struct SelectionTracking : IDisposable
+ private readonly struct SelectionTracking : IDisposable
{
private readonly int? _anchor;
private readonly int? _active;
diff --git a/src/EditorFeatures/Core/InlineRename/InlineRenameSession.cs b/src/EditorFeatures/Core/InlineRename/InlineRenameSession.cs
index 2fc41cda95f2d..7eea75e3889cb 100644
--- a/src/EditorFeatures/Core/InlineRename/InlineRenameSession.cs
+++ b/src/EditorFeatures/Core/InlineRename/InlineRenameSession.cs
@@ -945,7 +945,7 @@ internal bool IsInOpenTextBuffer(SnapshotPoint point)
internal TestAccessor GetTestAccessor()
=> new TestAccessor(this);
- public struct TestAccessor
+ public readonly struct TestAccessor
{
private readonly InlineRenameSession _inlineRenameSession;
diff --git a/src/EditorFeatures/Core/InlineRename/RenameTrackingSpan.cs b/src/EditorFeatures/Core/InlineRename/RenameTrackingSpan.cs
index b6ab33717dbe6..b3a699f1e91ab 100644
--- a/src/EditorFeatures/Core/InlineRename/RenameTrackingSpan.cs
+++ b/src/EditorFeatures/Core/InlineRename/RenameTrackingSpan.cs
@@ -6,7 +6,7 @@
namespace Microsoft.CodeAnalysis.Editor.Implementation.InlineRename
{
- internal struct RenameTrackingSpan
+ internal readonly struct RenameTrackingSpan
{
public readonly ITrackingSpan TrackingSpan;
public readonly RenameSpanKind Type;
diff --git a/src/EditorFeatures/Core/IntelliSense/ViewTextSpan.cs b/src/EditorFeatures/Core/IntelliSense/ViewTextSpan.cs
index fbdae8878739b..208c92e541bc9 100644
--- a/src/EditorFeatures/Core/IntelliSense/ViewTextSpan.cs
+++ b/src/EditorFeatures/Core/IntelliSense/ViewTextSpan.cs
@@ -21,7 +21,7 @@ namespace Microsoft.CodeAnalysis.Editor.Implementation.IntelliSense
/// which need to be mapped to ViewTextSpans before comparing to view positions
/// such as the current caret location.
///
- internal struct ViewTextSpan
+ internal readonly struct ViewTextSpan
{
public readonly TextSpan TextSpan;
@@ -29,7 +29,7 @@ public ViewTextSpan(TextSpan textSpan)
=> this.TextSpan = textSpan;
}
- internal struct DisconnectedBufferGraph
+ internal readonly struct DisconnectedBufferGraph
{
// The subject buffer's snapshot at the point of the initial model's creation
public readonly ITextSnapshot SubjectBufferSnapshot;
diff --git a/src/EditorFeatures/Core/NavigationBar/NavigationBarController.cs b/src/EditorFeatures/Core/NavigationBar/NavigationBarController.cs
index 73fe005351f10..8021eed1c93d9 100644
--- a/src/EditorFeatures/Core/NavigationBar/NavigationBarController.cs
+++ b/src/EditorFeatures/Core/NavigationBar/NavigationBarController.cs
@@ -305,7 +305,7 @@ private async Task ProcessItemSelectionAsync(NavigationBarItem item, Cancellatio
StartModelUpdateAndSelectedItemUpdateTasks();
}
- public struct TestAccessor
+ public readonly struct TestAccessor
{
private readonly NavigationBarController _navigationBarController;
diff --git a/src/EditorFeatures/Core/Shared/Utilities/VirtualTreePoint.cs b/src/EditorFeatures/Core/Shared/Utilities/VirtualTreePoint.cs
index 8d568386ee970..019afad8b44bc 100644
--- a/src/EditorFeatures/Core/Shared/Utilities/VirtualTreePoint.cs
+++ b/src/EditorFeatures/Core/Shared/Utilities/VirtualTreePoint.cs
@@ -9,7 +9,7 @@
namespace Microsoft.CodeAnalysis.Editor.Shared.Utilities
{
- internal struct VirtualTreePoint : IComparable, IEquatable
+ internal readonly struct VirtualTreePoint : IComparable, IEquatable
{
private readonly SyntaxTree _tree;
private readonly SourceText _text;
diff --git a/src/EditorFeatures/TestUtilities/EditAndContinue/RudeEditDiagnosticDescription.cs b/src/EditorFeatures/TestUtilities/EditAndContinue/RudeEditDiagnosticDescription.cs
index 7837cdfc71e93..dd5d81905fd14 100644
--- a/src/EditorFeatures/TestUtilities/EditAndContinue/RudeEditDiagnosticDescription.cs
+++ b/src/EditorFeatures/TestUtilities/EditAndContinue/RudeEditDiagnosticDescription.cs
@@ -11,7 +11,7 @@
namespace Microsoft.CodeAnalysis.EditAndContinue.UnitTests
{
- internal struct RudeEditDiagnosticDescription : IEquatable
+ internal readonly struct RudeEditDiagnosticDescription : IEquatable
{
private readonly RudeEditKind _rudeEditKind;
private readonly string _firstLine;
diff --git a/src/EditorFeatures/TestUtilities/LanguageServer/AbstractLanguageServerProtocolTests.InitializationOptions.cs b/src/EditorFeatures/TestUtilities/LanguageServer/AbstractLanguageServerProtocolTests.InitializationOptions.cs
index 7011e81bbcfc3..ad51bd00e01f1 100644
--- a/src/EditorFeatures/TestUtilities/LanguageServer/AbstractLanguageServerProtocolTests.InitializationOptions.cs
+++ b/src/EditorFeatures/TestUtilities/LanguageServer/AbstractLanguageServerProtocolTests.InitializationOptions.cs
@@ -11,7 +11,7 @@ namespace Roslyn.Test.Utilities
{
public abstract partial class AbstractLanguageServerProtocolTests
{
- internal record struct InitializationOptions()
+ internal readonly record struct InitializationOptions()
{
internal string[] SourceGeneratedMarkups { get; init; } = Array.Empty();
internal LSP.ClientCapabilities ClientCapabilities { get; init; } = new LSP.ClientCapabilities();
diff --git a/src/EditorFeatures/TestUtilities/SignatureHelp/SignatureHelpTestItem.cs b/src/EditorFeatures/TestUtilities/SignatureHelp/SignatureHelpTestItem.cs
index b221946397497..4144cce364caf 100644
--- a/src/EditorFeatures/TestUtilities/SignatureHelp/SignatureHelpTestItem.cs
+++ b/src/EditorFeatures/TestUtilities/SignatureHelp/SignatureHelpTestItem.cs
@@ -7,7 +7,7 @@
namespace Microsoft.CodeAnalysis.Editor.UnitTests.SignatureHelp
{
- public struct SignatureHelpTestItem
+ public readonly struct SignatureHelpTestItem
{
///
/// Includes prefix, signature, suffix.
diff --git a/src/Features/CSharp/Portable/ChangeSignature/UnifiedArgumentSyntax.cs b/src/Features/CSharp/Portable/ChangeSignature/UnifiedArgumentSyntax.cs
index 677096dc93f32..fe8c7822005b6 100644
--- a/src/Features/CSharp/Portable/ChangeSignature/UnifiedArgumentSyntax.cs
+++ b/src/Features/CSharp/Portable/ChangeSignature/UnifiedArgumentSyntax.cs
@@ -11,7 +11,7 @@
namespace Microsoft.CodeAnalysis.CSharp.ChangeSignature
{
- internal struct UnifiedArgumentSyntax : IUnifiedArgumentSyntax
+ internal readonly struct UnifiedArgumentSyntax : IUnifiedArgumentSyntax
{
private readonly SyntaxNode _argument;
diff --git a/src/Features/CSharp/Portable/Completion/CompletionProviders/DeclarationNameCompletionProvider.DeclarationInfo.cs b/src/Features/CSharp/Portable/Completion/CompletionProviders/DeclarationNameCompletionProvider.DeclarationInfo.cs
index 733df9974c11d..12ae4f0d1c8ab 100644
--- a/src/Features/CSharp/Portable/Completion/CompletionProviders/DeclarationNameCompletionProvider.DeclarationInfo.cs
+++ b/src/Features/CSharp/Portable/Completion/CompletionProviders/DeclarationNameCompletionProvider.DeclarationInfo.cs
@@ -17,7 +17,7 @@ namespace Microsoft.CodeAnalysis.CSharp.Completion.Providers
{
internal partial class DeclarationNameCompletionProvider
{
- internal struct NameDeclarationInfo
+ internal readonly struct NameDeclarationInfo
{
private static readonly ImmutableArray s_parameterSyntaxKind =
ImmutableArray.Create(new SymbolKindOrTypeKind(SymbolKind.Parameter));
diff --git a/src/Features/Core/Portable/AddConstructorParametersFromMembers/AddConstructorParametersFromMembersCodeRefactoringProvider.AddConstructorParameterResult.cs b/src/Features/Core/Portable/AddConstructorParametersFromMembers/AddConstructorParametersFromMembersCodeRefactoringProvider.AddConstructorParameterResult.cs
index e9a69a3bc3ce4..698c0988df56c 100644
--- a/src/Features/Core/Portable/AddConstructorParametersFromMembers/AddConstructorParametersFromMembersCodeRefactoringProvider.AddConstructorParameterResult.cs
+++ b/src/Features/Core/Portable/AddConstructorParametersFromMembers/AddConstructorParametersFromMembersCodeRefactoringProvider.AddConstructorParameterResult.cs
@@ -8,7 +8,7 @@ namespace Microsoft.CodeAnalysis.AddConstructorParametersFromMembers
{
internal partial class AddConstructorParametersFromMembersCodeRefactoringProvider
{
- private struct AddConstructorParameterResult
+ private readonly struct AddConstructorParameterResult
{
internal readonly ImmutableArray RequiredParameterActions;
internal readonly ImmutableArray OptionalParameterActions;
diff --git a/src/Features/Core/Portable/EmbeddedLanguages/Classification/AbstractEmbeddedLanguageClassificationService.cs b/src/Features/Core/Portable/EmbeddedLanguages/Classification/AbstractEmbeddedLanguageClassificationService.cs
index 5585601ac05d1..090411b36dff6 100644
--- a/src/Features/Core/Portable/EmbeddedLanguages/Classification/AbstractEmbeddedLanguageClassificationService.cs
+++ b/src/Features/Core/Portable/EmbeddedLanguages/Classification/AbstractEmbeddedLanguageClassificationService.cs
@@ -55,7 +55,7 @@ public void AddEmbeddedLanguageClassifications(
worker.Recurse(root);
}
- private ref struct Worker
+ private readonly ref struct Worker
{
private readonly AbstractEmbeddedLanguageClassificationService _owner;
private readonly Project _project;
diff --git a/src/Features/Core/Portable/EmbeddedLanguages/Classification/EmbeddedLanguageClassifierContext.cs b/src/Features/Core/Portable/EmbeddedLanguages/Classification/EmbeddedLanguageClassifierContext.cs
index 38882fad3998b..75167b50d72c5 100644
--- a/src/Features/Core/Portable/EmbeddedLanguages/Classification/EmbeddedLanguageClassifierContext.cs
+++ b/src/Features/Core/Portable/EmbeddedLanguages/Classification/EmbeddedLanguageClassifierContext.cs
@@ -10,7 +10,7 @@
namespace Microsoft.CodeAnalysis.Classification
{
- internal struct EmbeddedLanguageClassificationContext
+ internal readonly struct EmbeddedLanguageClassificationContext
{
private readonly ArrayBuilder _result;
diff --git a/src/Features/Core/Portable/Intents/IntentResult.cs b/src/Features/Core/Portable/Intents/IntentResult.cs
index b0bdf6f94587c..3137f8c340b9d 100644
--- a/src/Features/Core/Portable/Intents/IntentResult.cs
+++ b/src/Features/Core/Portable/Intents/IntentResult.cs
@@ -10,7 +10,7 @@ namespace Microsoft.CodeAnalysis.Features.Intents
///
/// Defines the text changes needed to apply an intent.
///
- internal struct IntentProcessorResult
+ internal readonly struct IntentProcessorResult
{
///
/// The changed solution for this intent result.
diff --git a/src/Features/Core/Portable/QuickInfo/CommonSemanticQuickInfoProvider.TokenInfo.cs b/src/Features/Core/Portable/QuickInfo/CommonSemanticQuickInfoProvider.TokenInfo.cs
index 55cf63603158d..8f3854940ed2d 100644
--- a/src/Features/Core/Portable/QuickInfo/CommonSemanticQuickInfoProvider.TokenInfo.cs
+++ b/src/Features/Core/Portable/QuickInfo/CommonSemanticQuickInfoProvider.TokenInfo.cs
@@ -8,7 +8,7 @@ namespace Microsoft.CodeAnalysis.QuickInfo
{
internal abstract partial class CommonSemanticQuickInfoProvider
{
- public struct TokenInformation
+ public readonly struct TokenInformation
{
public readonly ImmutableArray Symbols;
diff --git a/src/Features/Core/Portable/Snippets/SnippetData.cs b/src/Features/Core/Portable/Snippets/SnippetData.cs
index fd2a59d833e65..45129d9d68744 100644
--- a/src/Features/Core/Portable/Snippets/SnippetData.cs
+++ b/src/Features/Core/Portable/Snippets/SnippetData.cs
@@ -14,7 +14,7 @@ namespace Microsoft.CodeAnalysis.Snippets
/// Avoids using the Snippet and creating a TextChange/finding cursor
/// position before we know it was the selected CompletionItem.
///
- internal struct SnippetData
+ internal readonly struct SnippetData
{
public readonly string Description;
public readonly string SnippetIdentifier;
diff --git a/src/Features/Core/Portable/SolutionCrawler/SolutionCrawlerProgressReporter.cs b/src/Features/Core/Portable/SolutionCrawler/SolutionCrawlerProgressReporter.cs
index ec74b31ae7cf6..2facffefc757f 100644
--- a/src/Features/Core/Portable/SolutionCrawler/SolutionCrawlerProgressReporter.cs
+++ b/src/Features/Core/Portable/SolutionCrawler/SolutionCrawlerProgressReporter.cs
@@ -76,7 +76,7 @@ private void ChangeProgressStatus(ref int referenceCount, ProgressStatus status)
private void OnProgressChanged(ProgressData progressData)
=> ProgressChanged?.Invoke(this, progressData);
- private struct ProgressStatusRAII : IDisposable
+ private readonly struct ProgressStatusRAII : IDisposable
{
private readonly SolutionCrawlerProgressReporter _owner;
diff --git a/src/Features/Core/Portable/SpellCheck/AbstractSpellCheckSpanService.cs b/src/Features/Core/Portable/SpellCheck/AbstractSpellCheckSpanService.cs
index d79e52bf2b657..86667e986bae6 100644
--- a/src/Features/Core/Portable/SpellCheck/AbstractSpellCheckSpanService.cs
+++ b/src/Features/Core/Portable/SpellCheck/AbstractSpellCheckSpanService.cs
@@ -35,7 +35,7 @@ private static ImmutableArray GetSpans(Document document, Syntax
return spans.ToImmutable();
}
- private ref struct Worker
+ private readonly ref struct Worker
{
private readonly ISyntaxFactsService _syntaxFacts;
private readonly ISyntaxKinds _syntaxKinds;
diff --git a/src/Features/LanguageServer/Protocol/Handler/BufferedProgress.cs b/src/Features/LanguageServer/Protocol/Handler/BufferedProgress.cs
index ab0f1dd72ad19..b9185f7f98639 100644
--- a/src/Features/LanguageServer/Protocol/Handler/BufferedProgress.cs
+++ b/src/Features/LanguageServer/Protocol/Handler/BufferedProgress.cs
@@ -13,7 +13,7 @@ namespace Microsoft.CodeAnalysis.LanguageServer.Handler
/// expected to be. Namely, multiple client can be calling on it at the same
/// time. This is safe, though the order that the items are reported in when called concurrently is not specified.
///
- internal struct BufferedProgress : IProgress, IProgress, IDisposable
+ internal readonly struct BufferedProgress : IProgress, IProgress, IDisposable
{
///
/// The progress stream to report results to. May be for clients that do not support streaming.
diff --git a/src/Features/Lsif/Generator/Graph/Id.cs b/src/Features/Lsif/Generator/Graph/Id.cs
index a9af34d83f863..98411eb166ec2 100644
--- a/src/Features/Lsif/Generator/Graph/Id.cs
+++ b/src/Features/Lsif/Generator/Graph/Id.cs
@@ -11,7 +11,7 @@ namespace Microsoft.CodeAnalysis.LanguageServerIndexFormat.Generator.Graph
///
/// Used to distinguish what type of object this ID applies to. This is dropped in serialization, but simply helps
/// to ensure type safety in the code so we don't cross IDs of different types.
- internal struct Id : IEquatable>, ISerializableId where T : Element
+ internal readonly struct Id : IEquatable>, ISerializableId where T : Element
{
public Id(int id)
{
diff --git a/src/VisualStudio/CSharp/Impl/ProjectSystemShim/HACK_VariantStructure.cs b/src/VisualStudio/CSharp/Impl/ProjectSystemShim/HACK_VariantStructure.cs
index 4f45bcf53f6b3..abc59352eafd1 100644
--- a/src/VisualStudio/CSharp/Impl/ProjectSystemShim/HACK_VariantStructure.cs
+++ b/src/VisualStudio/CSharp/Impl/ProjectSystemShim/HACK_VariantStructure.cs
@@ -24,7 +24,7 @@ namespace Microsoft.VisualStudio.LanguageServices.CSharp.ProjectSystemShim
/// it to null instead of true.
///
[StructLayout(LayoutKind.Sequential)]
- internal struct HACK_VariantStructure
+ internal readonly struct HACK_VariantStructure
{
private readonly short _type;
diff --git a/src/VisualStudio/Core/Def/Diagnostics/VisualStudioVenusSpanMappingService.cs b/src/VisualStudio/Core/Def/Diagnostics/VisualStudioVenusSpanMappingService.cs
index 6bf596b2c15a8..887bb3252629c 100644
--- a/src/VisualStudio/Core/Def/Diagnostics/VisualStudioVenusSpanMappingService.cs
+++ b/src/VisualStudio/Core/Def/Diagnostics/VisualStudioVenusSpanMappingService.cs
@@ -263,7 +263,7 @@ private static bool IsOriginalLocationMovedAboveInFile(int originalLine, int ori
return false;
}
- private struct MappedSpan
+ private readonly struct MappedSpan
{
private readonly int _originalLine;
private readonly int _originalColumn;
diff --git a/src/VisualStudio/Core/Def/ExternalAccess/VSTypeScript/Api/VSTypeScriptContainedDocumentWrapper.cs b/src/VisualStudio/Core/Def/ExternalAccess/VSTypeScript/Api/VSTypeScriptContainedDocumentWrapper.cs
index 45928bdca550b..3a8b707fbe3ff 100644
--- a/src/VisualStudio/Core/Def/ExternalAccess/VSTypeScript/Api/VSTypeScriptContainedDocumentWrapper.cs
+++ b/src/VisualStudio/Core/Def/ExternalAccess/VSTypeScript/Api/VSTypeScriptContainedDocumentWrapper.cs
@@ -13,7 +13,7 @@
namespace Microsoft.VisualStudio.LanguageServices.ExternalAccess.VSTypeScript.Api
{
- internal struct VSTypeScriptContainedDocumentWrapper
+ internal readonly struct VSTypeScriptContainedDocumentWrapper
{
private readonly ContainedDocument _underlyingObject;
diff --git a/src/VisualStudio/Core/Def/ExternalAccess/VSTypeScript/Api/VSTypeScriptContainedLanguageWrapper.cs b/src/VisualStudio/Core/Def/ExternalAccess/VSTypeScript/Api/VSTypeScriptContainedLanguageWrapper.cs
index 8e0b1c27ac9a4..c70f56f7f6327 100644
--- a/src/VisualStudio/Core/Def/ExternalAccess/VSTypeScript/Api/VSTypeScriptContainedLanguageWrapper.cs
+++ b/src/VisualStudio/Core/Def/ExternalAccess/VSTypeScript/Api/VSTypeScriptContainedLanguageWrapper.cs
@@ -12,7 +12,7 @@
namespace Microsoft.VisualStudio.LanguageServices.ExternalAccess.VSTypeScript.Api
{
- internal struct VSTypeScriptContainedLanguageWrapper
+ internal readonly struct VSTypeScriptContainedLanguageWrapper
{
private readonly ContainedLanguage _underlyingObject;
diff --git a/src/VisualStudio/Core/Def/Interop/ComHandle.cs b/src/VisualStudio/Core/Def/Interop/ComHandle.cs
index b4ca1d33f23e9..09f2926d8acac 100644
--- a/src/VisualStudio/Core/Def/Interop/ComHandle.cs
+++ b/src/VisualStudio/Core/Def/Interop/ComHandle.cs
@@ -15,7 +15,7 @@ namespace Microsoft.VisualStudio.LanguageServices.Implementation.Interop
///
/// The COM interface type to keep a reference to
/// The managed object type to keep a reference to
- internal struct ComHandle
+ internal readonly struct ComHandle
where THandle : class
where TObject : class, THandle
{
diff --git a/src/VisualStudio/Core/Def/Interop/WeakComHandle.cs b/src/VisualStudio/Core/Def/Interop/WeakComHandle.cs
index 3ed24555ee619..ad2a6a436650e 100644
--- a/src/VisualStudio/Core/Def/Interop/WeakComHandle.cs
+++ b/src/VisualStudio/Core/Def/Interop/WeakComHandle.cs
@@ -10,7 +10,7 @@
namespace Microsoft.VisualStudio.LanguageServices.Implementation.Interop
{
- internal struct WeakComHandle
+ internal readonly struct WeakComHandle
where THandle : class
where TObject : class, THandle
{
diff --git a/src/VisualStudio/Core/Def/Packaging/PackageInstallerService.ProjectState.cs b/src/VisualStudio/Core/Def/Packaging/PackageInstallerService.ProjectState.cs
index 8ff01a2d56d8b..abe0bf47f6618 100644
--- a/src/VisualStudio/Core/Def/Packaging/PackageInstallerService.ProjectState.cs
+++ b/src/VisualStudio/Core/Def/Packaging/PackageInstallerService.ProjectState.cs
@@ -9,7 +9,7 @@ namespace Microsoft.VisualStudio.LanguageServices.Packaging
{
internal partial class PackageInstallerService
{
- private struct ProjectState
+ private readonly struct ProjectState
{
public static readonly ProjectState Disabled = new(isEnabled: false, ImmutableDictionary.Empty);
diff --git a/src/VisualStudio/Core/Def/Shared/VisualStudioImageIdService.cs b/src/VisualStudio/Core/Def/Shared/VisualStudioImageIdService.cs
index 18ba1a7fde585..74128e2a9ac05 100644
--- a/src/VisualStudio/Core/Def/Shared/VisualStudioImageIdService.cs
+++ b/src/VisualStudio/Core/Def/Shared/VisualStudioImageIdService.cs
@@ -24,7 +24,7 @@
namespace Microsoft.VisualStudio.LanguageServices.Shared
{
- internal struct CompositeImage
+ internal readonly struct CompositeImage
{
public readonly ImmutableArray Layers;
public readonly IImageHandle ImageHandle;
diff --git a/src/VisualStudio/Core/Impl/CodeModel/CodeModelProjectCache.CacheEntry.cs b/src/VisualStudio/Core/Impl/CodeModel/CodeModelProjectCache.CacheEntry.cs
index d3122fb7811b3..faf8322fc221d 100644
--- a/src/VisualStudio/Core/Impl/CodeModel/CodeModelProjectCache.CacheEntry.cs
+++ b/src/VisualStudio/Core/Impl/CodeModel/CodeModelProjectCache.CacheEntry.cs
@@ -10,7 +10,7 @@ namespace Microsoft.VisualStudio.LanguageServices.Implementation.CodeModel
{
internal sealed partial class CodeModelProjectCache
{
- private struct CacheEntry
+ private readonly struct CacheEntry
{
// NOTE: The logic here is a little bit tricky. We can't just keep a WeakReference to
// something like a ComHandle, since it's not something that our clients keep alive.
diff --git a/src/VisualStudio/Core/Impl/CodeModel/GlobalNodeKey.cs b/src/VisualStudio/Core/Impl/CodeModel/GlobalNodeKey.cs
index dd866c6cd5507..9d35f2bd41aa9 100644
--- a/src/VisualStudio/Core/Impl/CodeModel/GlobalNodeKey.cs
+++ b/src/VisualStudio/Core/Impl/CodeModel/GlobalNodeKey.cs
@@ -8,7 +8,7 @@
namespace Microsoft.VisualStudio.LanguageServices.Implementation.CodeModel
{
- internal struct GlobalNodeKey
+ internal readonly struct GlobalNodeKey
{
public readonly SyntaxNodeKey NodeKey;
public readonly SyntaxPath Path;
diff --git a/src/VisualStudio/Core/Impl/CodeModel/MethodXml/AbstractMethodXmlBuilder.AttributeInfo.cs b/src/VisualStudio/Core/Impl/CodeModel/MethodXml/AbstractMethodXmlBuilder.AttributeInfo.cs
index 12fb632c8ff1d..b304fbdca0c45 100644
--- a/src/VisualStudio/Core/Impl/CodeModel/MethodXml/AbstractMethodXmlBuilder.AttributeInfo.cs
+++ b/src/VisualStudio/Core/Impl/CodeModel/MethodXml/AbstractMethodXmlBuilder.AttributeInfo.cs
@@ -8,7 +8,7 @@ namespace Microsoft.VisualStudio.LanguageServices.Implementation.CodeModel.Metho
{
internal abstract partial class AbstractMethodXmlBuilder
{
- private struct AttributeInfo
+ private readonly struct AttributeInfo
{
public static readonly AttributeInfo Empty = new AttributeInfo();
diff --git a/src/VisualStudio/Core/Impl/CodeModel/ParentHandle.cs b/src/VisualStudio/Core/Impl/CodeModel/ParentHandle.cs
index 71ec8f17089bc..add283af16530 100644
--- a/src/VisualStudio/Core/Impl/CodeModel/ParentHandle.cs
+++ b/src/VisualStudio/Core/Impl/CodeModel/ParentHandle.cs
@@ -8,7 +8,7 @@
namespace Microsoft.VisualStudio.LanguageServices.Implementation.CodeModel
{
- internal struct ParentHandle
+ internal readonly struct ParentHandle
{
private readonly ComHandle