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 _comHandle; diff --git a/src/VisualStudio/Core/Impl/CodeModel/SyntaxNodeKey.cs b/src/VisualStudio/Core/Impl/CodeModel/SyntaxNodeKey.cs index 3d6b9775e0da9..7a86e3ed5cfb5 100644 --- a/src/VisualStudio/Core/Impl/CodeModel/SyntaxNodeKey.cs +++ b/src/VisualStudio/Core/Impl/CodeModel/SyntaxNodeKey.cs @@ -14,7 +14,7 @@ namespace Microsoft.VisualStudio.LanguageServices.Implementation.CodeModel /// ordinal value. The ordinal value is used to distinguish nodes which have the same /// qualified name -- for example, across partial classes within the same tree. /// - internal struct SyntaxNodeKey : IEquatable + internal readonly struct SyntaxNodeKey : IEquatable { private readonly string _name; private readonly int _ordinal; diff --git a/src/VisualStudio/IntegrationTest/New.IntegrationTests/InProcess/InputKey.cs b/src/VisualStudio/IntegrationTest/New.IntegrationTests/InProcess/InputKey.cs index 5d9c3f8df07c3..c3b87eccdabe8 100644 --- a/src/VisualStudio/IntegrationTest/New.IntegrationTests/InProcess/InputKey.cs +++ b/src/VisualStudio/IntegrationTest/New.IntegrationTests/InProcess/InputKey.cs @@ -8,7 +8,7 @@ namespace Roslyn.VisualStudio.IntegrationTests.InProcess { - internal struct InputKey + internal readonly struct InputKey { public readonly ImmutableArray Modifiers; public readonly VirtualKeyCode VirtualKeyCode; diff --git a/src/VisualStudio/Xaml/Impl/Features/Completion/XamlCompletionContext.cs b/src/VisualStudio/Xaml/Impl/Features/Completion/XamlCompletionContext.cs index e1b8c7fbf01e4..5109e40a0c245 100644 --- a/src/VisualStudio/Xaml/Impl/Features/Completion/XamlCompletionContext.cs +++ b/src/VisualStudio/Xaml/Impl/Features/Completion/XamlCompletionContext.cs @@ -11,7 +11,7 @@ namespace Microsoft.VisualStudio.LanguageServices.Xaml.Features.Completion /// /// Contextual information needed for processing completion requests. /// - internal struct XamlCompletionContext + internal readonly struct XamlCompletionContext { public XamlCompletionContext(TextDocument document, int offset, char triggerChar = '\0') { diff --git a/src/VisualStudio/Xaml/Impl/Features/DocumentSpan.cs b/src/VisualStudio/Xaml/Impl/Features/DocumentSpan.cs index c1ff9d281cc8c..335ba3b2c3148 100644 --- a/src/VisualStudio/Xaml/Impl/Features/DocumentSpan.cs +++ b/src/VisualStudio/Xaml/Impl/Features/DocumentSpan.cs @@ -10,7 +10,7 @@ namespace Microsoft.CodeAnalysis.Editor.Xaml.Features { [DebuggerDisplay("{GetDebuggerDisplay(),nq}")] - internal struct DocumentSpan + internal readonly struct DocumentSpan { public Document Document { get; } public TextSpan TextSpan { get; } diff --git a/src/Workspaces/CSharp/Portable/Classification/Worker.cs b/src/Workspaces/CSharp/Portable/Classification/Worker.cs index 27072349786ed..a75a8e2e4f296 100644 --- a/src/Workspaces/CSharp/Portable/Classification/Worker.cs +++ b/src/Workspaces/CSharp/Portable/Classification/Worker.cs @@ -20,7 +20,7 @@ namespace Microsoft.CodeAnalysis.CSharp.Classification /// artifacts T T is normally either ClassificationSpan or a Tuple (for testing purposes) /// and constructed via provided factory. /// - internal ref partial struct Worker + internal readonly ref partial struct Worker { private readonly TextSpan _textSpan; private readonly ArrayBuilder _result; diff --git a/src/Workspaces/Core/Desktop/Workspace/Host/Mef/MefV1HostServices.cs b/src/Workspaces/Core/Desktop/Workspace/Host/Mef/MefV1HostServices.cs index 15846dc1d70c0..6ec35bcccc9f6 100644 --- a/src/Workspaces/Core/Desktop/Workspace/Host/Mef/MefV1HostServices.cs +++ b/src/Workspaces/Core/Desktop/Workspace/Host/Mef/MefV1HostServices.cs @@ -110,7 +110,7 @@ public IEnumerable> GetExports() internal TestAccessor GetTestAccessor() => new TestAccessor(this); - private struct ExportKey : IEquatable + private readonly struct ExportKey : IEquatable { internal readonly string ExtensionTypeName; internal readonly string MetadataTypeName; diff --git a/src/Workspaces/Core/MSBuild/MSBuild/ProjectLoadProgress.cs b/src/Workspaces/Core/MSBuild/MSBuild/ProjectLoadProgress.cs index 4bb6d2922485a..06045ae809985 100644 --- a/src/Workspaces/Core/MSBuild/MSBuild/ProjectLoadProgress.cs +++ b/src/Workspaces/Core/MSBuild/MSBuild/ProjectLoadProgress.cs @@ -9,7 +9,7 @@ namespace Microsoft.CodeAnalysis.MSBuild /// /// Provides details as a project is loaded. /// - public struct ProjectLoadProgress + public readonly struct ProjectLoadProgress { /// /// The project for which progress is being reported. diff --git a/src/Workspaces/Core/Portable/Classification/ClassifiedSpan.cs b/src/Workspaces/Core/Portable/Classification/ClassifiedSpan.cs index d15f0ed85d1e8..1c11f9d553337 100644 --- a/src/Workspaces/Core/Portable/Classification/ClassifiedSpan.cs +++ b/src/Workspaces/Core/Portable/Classification/ClassifiedSpan.cs @@ -8,7 +8,7 @@ namespace Microsoft.CodeAnalysis.Classification { - public struct ClassifiedSpan : IEquatable + public readonly struct ClassifiedSpan : IEquatable { public string ClassificationType { get; } public TextSpan TextSpan { get; } diff --git a/src/Workspaces/Core/Portable/Classification/ClassifiedText.cs b/src/Workspaces/Core/Portable/Classification/ClassifiedText.cs index ee85121102e65..e8d7fae36d45f 100644 --- a/src/Workspaces/Core/Portable/Classification/ClassifiedText.cs +++ b/src/Workspaces/Core/Portable/Classification/ClassifiedText.cs @@ -4,7 +4,7 @@ namespace Microsoft.CodeAnalysis.Classification { - internal struct ClassifiedText + internal readonly struct ClassifiedText { public string ClassificationType { get; } public string Text { get; } diff --git a/src/Workspaces/Core/Portable/Diagnostics/DiagnosticAnalysisResult.cs b/src/Workspaces/Core/Portable/Diagnostics/DiagnosticAnalysisResult.cs index b0bba7b8da7e6..fba7925057580 100644 --- a/src/Workspaces/Core/Portable/Diagnostics/DiagnosticAnalysisResult.cs +++ b/src/Workspaces/Core/Portable/Diagnostics/DiagnosticAnalysisResult.cs @@ -18,7 +18,7 @@ namespace Microsoft.CodeAnalysis.Workspaces.Diagnostics /// This holds onto diagnostics for a specific version of project snapshot /// in a way each kind of diagnostics can be queried fast. /// - internal struct DiagnosticAnalysisResult + internal readonly struct DiagnosticAnalysisResult { public readonly bool FromBuild; public readonly ProjectId ProjectId; diff --git a/src/Workspaces/Core/Portable/Diagnostics/DiagnosticAnalysisResultMap.cs b/src/Workspaces/Core/Portable/Diagnostics/DiagnosticAnalysisResultMap.cs index 53f665e381507..c68fe72d752e1 100644 --- a/src/Workspaces/Core/Portable/Diagnostics/DiagnosticAnalysisResultMap.cs +++ b/src/Workspaces/Core/Portable/Diagnostics/DiagnosticAnalysisResultMap.cs @@ -22,7 +22,7 @@ public static DiagnosticAnalysisResultMap Create( } } - internal struct DiagnosticAnalysisResultMap + internal readonly struct DiagnosticAnalysisResultMap where TKey : notnull { public static readonly DiagnosticAnalysisResultMap Empty = new( diff --git a/src/Workspaces/Core/Portable/Differencing/Edit.cs b/src/Workspaces/Core/Portable/Differencing/Edit.cs index 2037ff74e5548..b8fb5caef62f9 100644 --- a/src/Workspaces/Core/Portable/Differencing/Edit.cs +++ b/src/Workspaces/Core/Portable/Differencing/Edit.cs @@ -15,7 +15,7 @@ namespace Microsoft.CodeAnalysis.Differencing /// /// Tree node. [DebuggerDisplay("{GetDebuggerDisplay(), nq}")] - public struct Edit : IEquatable> + public readonly struct Edit : IEquatable> { private readonly TreeComparer _comparer; private readonly EditKind _kind; diff --git a/src/Workspaces/Core/Portable/Differencing/SequenceEdit.cs b/src/Workspaces/Core/Portable/Differencing/SequenceEdit.cs index 87bfb11b03645..86b365d04e06b 100644 --- a/src/Workspaces/Core/Portable/Differencing/SequenceEdit.cs +++ b/src/Workspaces/Core/Portable/Differencing/SequenceEdit.cs @@ -14,7 +14,7 @@ namespace Microsoft.CodeAnalysis.Differencing /// Represents an edit operation on a sequence of values. /// [DebuggerDisplay("{GetDebuggerDisplay(), nq}")] - internal struct SequenceEdit : IEquatable + internal readonly struct SequenceEdit : IEquatable { private readonly int _oldIndex; private readonly int _newIndex; diff --git a/src/Workspaces/Core/Portable/Editing/DeclarationModifiers.cs b/src/Workspaces/Core/Portable/Editing/DeclarationModifiers.cs index bb425fbb78ab3..a4bd00effed3a 100644 --- a/src/Workspaces/Core/Portable/Editing/DeclarationModifiers.cs +++ b/src/Workspaces/Core/Portable/Editing/DeclarationModifiers.cs @@ -14,7 +14,7 @@ namespace Microsoft.CodeAnalysis.Internal.Editing namespace Microsoft.CodeAnalysis.Editing #endif { - public struct DeclarationModifiers : IEquatable + public readonly struct DeclarationModifiers : IEquatable { private readonly Modifiers _modifiers; diff --git a/src/Workspaces/Core/Portable/ErrorReporting/InfoBarUI.cs b/src/Workspaces/Core/Portable/ErrorReporting/InfoBarUI.cs index 48daea96abded..6f695f3a70fc2 100644 --- a/src/Workspaces/Core/Portable/ErrorReporting/InfoBarUI.cs +++ b/src/Workspaces/Core/Portable/ErrorReporting/InfoBarUI.cs @@ -8,7 +8,7 @@ namespace Microsoft.CodeAnalysis.ErrorReporting { - internal struct InfoBarUI + internal readonly struct InfoBarUI { public readonly string? Title; public readonly UIKind Kind; diff --git a/src/Workspaces/Core/Portable/FindSymbols/SymbolTree/SymbolTreeInfo.Node.cs b/src/Workspaces/Core/Portable/FindSymbols/SymbolTree/SymbolTreeInfo.Node.cs index ce67fb5932208..4cddecc696ca7 100644 --- a/src/Workspaces/Core/Portable/FindSymbols/SymbolTree/SymbolTreeInfo.Node.cs +++ b/src/Workspaces/Core/Portable/FindSymbols/SymbolTree/SymbolTreeInfo.Node.cs @@ -22,7 +22,7 @@ internal partial class SymbolTreeInfo /// these to s. /// [DebuggerDisplay("{GetDebuggerDisplay(),nq}")] - private struct BuilderNode + private readonly struct BuilderNode { public static readonly BuilderNode RootNode = new("", RootNodeParentIndex, default); @@ -44,7 +44,7 @@ private string GetDebuggerDisplay() } [DebuggerDisplay("{GetDebuggerDisplay(),nq}")] - private struct Node + private readonly struct Node { /// /// The Name of this Node. diff --git a/src/Workspaces/Core/Portable/Log/StatisticResult.cs b/src/Workspaces/Core/Portable/Log/StatisticResult.cs index 695334d6768b9..3ecbff196fe36 100644 --- a/src/Workspaces/Core/Portable/Log/StatisticResult.cs +++ b/src/Workspaces/Core/Portable/Log/StatisticResult.cs @@ -9,7 +9,7 @@ namespace Microsoft.CodeAnalysis.Internal.Log { - internal struct StatisticResult + internal readonly struct StatisticResult { public static StatisticResult FromList(List values) { diff --git a/src/Workspaces/Core/Portable/PatternMatching/CamelCaseResult.cs b/src/Workspaces/Core/Portable/PatternMatching/CamelCaseResult.cs index 798b4b26aff3c..1e467a7f6ef77 100644 --- a/src/Workspaces/Core/Portable/PatternMatching/CamelCaseResult.cs +++ b/src/Workspaces/Core/Portable/PatternMatching/CamelCaseResult.cs @@ -13,7 +13,7 @@ namespace Microsoft.CodeAnalysis.PatternMatching { internal partial class PatternMatcher { - private struct CamelCaseResult + private readonly struct CamelCaseResult { public readonly bool FromStart; public readonly bool Contiguous; diff --git a/src/Workspaces/Core/Portable/PatternMatching/PatternMatch.cs b/src/Workspaces/Core/Portable/PatternMatching/PatternMatch.cs index b969c3838a879..f4176bd0a60e4 100644 --- a/src/Workspaces/Core/Portable/PatternMatching/PatternMatch.cs +++ b/src/Workspaces/Core/Portable/PatternMatching/PatternMatch.cs @@ -9,7 +9,7 @@ namespace Microsoft.CodeAnalysis.PatternMatching { - internal struct PatternMatch : IComparable + internal readonly struct PatternMatch : IComparable { /// /// True if this was a case sensitive match. diff --git a/src/Workspaces/Core/Portable/Rename/ConflictEngine/ConflictResolver.Session.cs b/src/Workspaces/Core/Portable/Rename/ConflictEngine/ConflictResolver.Session.cs index 41abd084afafb..ae4f19d86f981 100644 --- a/src/Workspaces/Core/Portable/Rename/ConflictEngine/ConflictResolver.Session.cs +++ b/src/Workspaces/Core/Portable/Rename/ConflictEngine/ConflictResolver.Session.cs @@ -79,7 +79,7 @@ public Session( private SymbolRenameOptions RenameOptions => _renameLocationSet.Options; private CodeCleanupOptionsProvider FallbackOptions => _renameLocationSet.FallbackOptions; - private struct ConflictLocationInfo + private readonly struct ConflictLocationInfo { // The span of the Node that needs to be complexified public readonly TextSpan ComplexifiedSpan; diff --git a/src/Workspaces/Core/Portable/Rename/RenameLocation.cs b/src/Workspaces/Core/Portable/Rename/RenameLocation.cs index b57ad1c78dd77..52b7fca387f53 100644 --- a/src/Workspaces/Core/Portable/Rename/RenameLocation.cs +++ b/src/Workspaces/Core/Portable/Rename/RenameLocation.cs @@ -8,7 +8,7 @@ namespace Microsoft.CodeAnalysis.Rename { - internal struct RenameLocation : IEquatable + internal readonly struct RenameLocation : IEquatable { public readonly Location Location; public readonly DocumentId DocumentId; diff --git a/src/Workspaces/Core/Portable/Shared/Extensions/TokenSemanticInfo.cs b/src/Workspaces/Core/Portable/Shared/Extensions/TokenSemanticInfo.cs index 94e65b1912af2..a21d810cf958b 100644 --- a/src/Workspaces/Core/Portable/Shared/Extensions/TokenSemanticInfo.cs +++ b/src/Workspaces/Core/Portable/Shared/Extensions/TokenSemanticInfo.cs @@ -11,7 +11,7 @@ namespace Microsoft.CodeAnalysis.Shared.Extensions { - internal struct TokenSemanticInfo + internal readonly struct TokenSemanticInfo { public static readonly TokenSemanticInfo Empty = new( null, null, ImmutableArray.Empty, null, null, default); diff --git a/src/Workspaces/Core/Portable/Shared/Utilities/EditorBrowsableHelpers.cs b/src/Workspaces/Core/Portable/Shared/Utilities/EditorBrowsableHelpers.cs index a803c1637b3b8..e2a7aa1eefd3f 100644 --- a/src/Workspaces/Core/Portable/Shared/Utilities/EditorBrowsableHelpers.cs +++ b/src/Workspaces/Core/Portable/Shared/Utilities/EditorBrowsableHelpers.cs @@ -11,7 +11,7 @@ namespace Microsoft.CodeAnalysis.Shared.Utilities { internal static class EditorBrowsableHelpers { - public struct EditorBrowsableInfo + public readonly struct EditorBrowsableInfo { public Compilation Compilation { get; } public INamedTypeSymbol? HideModuleNameAttribute { get; } diff --git a/src/Workspaces/Core/Portable/SolutionCrawler/InvocationReasons_Constants.cs b/src/Workspaces/Core/Portable/SolutionCrawler/InvocationReasons_Constants.cs index d083f047ab56b..ba7a71e570229 100644 --- a/src/Workspaces/Core/Portable/SolutionCrawler/InvocationReasons_Constants.cs +++ b/src/Workspaces/Core/Portable/SolutionCrawler/InvocationReasons_Constants.cs @@ -8,7 +8,7 @@ namespace Microsoft.CodeAnalysis.SolutionCrawler { - internal partial struct InvocationReasons + internal readonly partial struct InvocationReasons { public static readonly InvocationReasons DocumentAdded = new( diff --git a/src/Workspaces/Core/Portable/Storage/SQLite/v2/Interop/ResettableSqlStatement.cs b/src/Workspaces/Core/Portable/Storage/SQLite/v2/Interop/ResettableSqlStatement.cs index 1f78ad0de4859..6815b7559f2eb 100644 --- a/src/Workspaces/Core/Portable/Storage/SQLite/v2/Interop/ResettableSqlStatement.cs +++ b/src/Workspaces/Core/Portable/Storage/SQLite/v2/Interop/ResettableSqlStatement.cs @@ -24,7 +24,7 @@ namespace Microsoft.CodeAnalysis.SQLite.v2.Interop /// as it will happen to all prepared statemnets when the is /// d. /// - internal struct ResettableSqlStatement : IDisposable + internal readonly struct ResettableSqlStatement : IDisposable { public readonly SqlStatement Statement; diff --git a/src/Workspaces/Core/Portable/Utilities/FlowControlHelper.cs b/src/Workspaces/Core/Portable/Utilities/FlowControlHelper.cs index 686c87f456b96..d0d283ee26f52 100644 --- a/src/Workspaces/Core/Portable/Utilities/FlowControlHelper.cs +++ b/src/Workspaces/Core/Portable/Utilities/FlowControlHelper.cs @@ -12,7 +12,7 @@ internal static class FlowControlHelper public static AsyncFlowControlHelper TrySuppressFlow() => new(ExecutionContext.IsFlowSuppressed() ? default : ExecutionContext.SuppressFlow()); - public struct AsyncFlowControlHelper : IDisposable + public readonly struct AsyncFlowControlHelper : IDisposable { private readonly AsyncFlowControl _asyncFlowControl; diff --git a/src/Workspaces/Core/Portable/Utilities/ParameterName.cs b/src/Workspaces/Core/Portable/Utilities/ParameterName.cs index 9801b3c5370c2..ba42f7c57c28e 100644 --- a/src/Workspaces/Core/Portable/Utilities/ParameterName.cs +++ b/src/Workspaces/Core/Portable/Utilities/ParameterName.cs @@ -11,7 +11,7 @@ namespace Microsoft.CodeAnalysis.Utilities { - internal struct ParameterName : IEquatable + internal readonly struct ParameterName : IEquatable { /// /// The name the underlying naming system came up with based on the argument itself. diff --git a/src/Workspaces/Core/Portable/Workspace/Host/DocumentService/IDocumentExcerptService.cs b/src/Workspaces/Core/Portable/Workspace/Host/DocumentService/IDocumentExcerptService.cs index 6b3a74af3da35..52c539408ef1a 100644 --- a/src/Workspaces/Core/Portable/Workspace/Host/DocumentService/IDocumentExcerptService.cs +++ b/src/Workspaces/Core/Portable/Workspace/Host/DocumentService/IDocumentExcerptService.cs @@ -37,7 +37,7 @@ internal enum ExcerptMode /// /// Result of excerpt /// - internal struct ExcerptResult + internal readonly struct ExcerptResult { /// /// excerpt content diff --git a/src/Workspaces/Core/Portable/Workspace/Host/DocumentService/ISpanMappingService.cs b/src/Workspaces/Core/Portable/Workspace/Host/DocumentService/ISpanMappingService.cs index 9d91ccd31c20b..4f10d32c28c9b 100644 --- a/src/Workspaces/Core/Portable/Workspace/Host/DocumentService/ISpanMappingService.cs +++ b/src/Workspaces/Core/Portable/Workspace/Host/DocumentService/ISpanMappingService.cs @@ -52,7 +52,7 @@ internal interface ISpanMappingService : IDocumentService /// /// Result of span mapping /// - internal struct MappedSpanResult + internal readonly struct MappedSpanResult { /// /// Path to mapped file diff --git a/src/Workspaces/Core/Portable/Workspace/Host/PersistentStorage/NoOpPersistentStorage.cs b/src/Workspaces/Core/Portable/Workspace/Host/PersistentStorage/NoOpPersistentStorage.cs index c40bdde747818..0ccd10b99547f 100644 --- a/src/Workspaces/Core/Portable/Workspace/Host/PersistentStorage/NoOpPersistentStorage.cs +++ b/src/Workspaces/Core/Portable/Workspace/Host/PersistentStorage/NoOpPersistentStorage.cs @@ -96,7 +96,7 @@ public Task WriteStreamAsync(ProjectKey projectKey, string name, Stream st public Task WriteStreamAsync(DocumentKey documentKey, string name, Stream stream, Checksum checksum, CancellationToken cancellationToken) => SpecializedTasks.False; - public struct TestAccessor + public readonly struct TestAccessor { public static readonly IChecksummedPersistentStorage StorageInstance = Instance; } diff --git a/src/Workspaces/Core/Portable/Workspace/Host/SyntaxTreeFactory/AbstractSyntaxTreeFactoryService.AbstractRecoverableSyntaxRoot.cs b/src/Workspaces/Core/Portable/Workspace/Host/SyntaxTreeFactory/AbstractSyntaxTreeFactoryService.AbstractRecoverableSyntaxRoot.cs index a3f27056e7195..5ac4088b900ff 100644 --- a/src/Workspaces/Core/Portable/Workspace/Host/SyntaxTreeFactory/AbstractSyntaxTreeFactoryService.AbstractRecoverableSyntaxRoot.cs +++ b/src/Workspaces/Core/Portable/Workspace/Host/SyntaxTreeFactory/AbstractSyntaxTreeFactoryService.AbstractRecoverableSyntaxRoot.cs @@ -15,7 +15,7 @@ namespace Microsoft.CodeAnalysis.Host { internal abstract partial class AbstractSyntaxTreeFactoryService { - internal struct SyntaxTreeInfo + internal readonly struct SyntaxTreeInfo { public readonly string FilePath; public readonly ParseOptions Options; diff --git a/src/Workspaces/Core/Portable/Workspace/Solution/ProjectChanges.cs b/src/Workspaces/Core/Portable/Workspace/Solution/ProjectChanges.cs index f30193d73727d..bbbe73019b7c6 100644 --- a/src/Workspaces/Core/Portable/Workspace/Solution/ProjectChanges.cs +++ b/src/Workspaces/Core/Portable/Workspace/Solution/ProjectChanges.cs @@ -7,7 +7,7 @@ namespace Microsoft.CodeAnalysis { - public struct ProjectChanges + public readonly struct ProjectChanges { private readonly Project _newProject; private readonly Project _oldProject; diff --git a/src/Workspaces/Remote/Core/VisualStudioMefHostServices.cs b/src/Workspaces/Remote/Core/VisualStudioMefHostServices.cs index 6e446a5238534..ec81802368a05 100644 --- a/src/Workspaces/Remote/Core/VisualStudioMefHostServices.cs +++ b/src/Workspaces/Remote/Core/VisualStudioMefHostServices.cs @@ -70,7 +70,7 @@ public IEnumerable> GetExports() return (IEnumerable>)exports; } - private struct ExportKey : IEquatable + private readonly struct ExportKey : IEquatable { internal readonly string ExtensionTypeName; internal readonly string MetadataTypeName; diff --git a/src/Workspaces/Remote/ServiceHub/Services/DiagnosticAnalyzer/IPerformanceTrackerService.cs b/src/Workspaces/Remote/ServiceHub/Services/DiagnosticAnalyzer/IPerformanceTrackerService.cs index 569ec752f0805..889eb3c39ffb9 100644 --- a/src/Workspaces/Remote/ServiceHub/Services/DiagnosticAnalyzer/IPerformanceTrackerService.cs +++ b/src/Workspaces/Remote/ServiceHub/Services/DiagnosticAnalyzer/IPerformanceTrackerService.cs @@ -19,7 +19,7 @@ internal interface IPerformanceTrackerService : IWorkspaceService event EventHandler SnapshotAdded; } - internal struct ExpensiveAnalyzerInfo + internal readonly struct ExpensiveAnalyzerInfo { public readonly bool BuiltIn; public readonly string AnalyzerId; diff --git a/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/CSharp/Extensions/MemberDeclarationSyntaxExtensions.LocalDeclarationMap.cs b/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/CSharp/Extensions/MemberDeclarationSyntaxExtensions.LocalDeclarationMap.cs index c6bff5b111df4..608765121de93 100644 --- a/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/CSharp/Extensions/MemberDeclarationSyntaxExtensions.LocalDeclarationMap.cs +++ b/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/CSharp/Extensions/MemberDeclarationSyntaxExtensions.LocalDeclarationMap.cs @@ -11,7 +11,7 @@ namespace Microsoft.CodeAnalysis.CSharp.Extensions { internal partial class MemberDeclarationSyntaxExtensions { - public struct LocalDeclarationMap + public readonly struct LocalDeclarationMap { private readonly Dictionary> _dictionary; diff --git a/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/CSharp/Utilities/TypeStyle/CSharpTypeStyleHelper.cs b/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/CSharp/Utilities/TypeStyle/CSharpTypeStyleHelper.cs index 82f906ff707a5..e1c75c5c39761 100644 --- a/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/CSharp/Utilities/TypeStyle/CSharpTypeStyleHelper.cs +++ b/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/CSharp/Utilities/TypeStyle/CSharpTypeStyleHelper.cs @@ -11,7 +11,7 @@ namespace Microsoft.CodeAnalysis.CSharp.Utilities { - internal struct TypeStyleResult + internal readonly struct TypeStyleResult { private readonly CSharpTypeStyleHelper _helper; private readonly TypeSyntax _typeName; diff --git a/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/EmbeddedLanguages/Common/EmbeddedDiagnostic.cs b/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/EmbeddedLanguages/Common/EmbeddedDiagnostic.cs index 86d6e5074756f..e7a7ad81cee1a 100644 --- a/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/EmbeddedLanguages/Common/EmbeddedDiagnostic.cs +++ b/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/EmbeddedLanguages/Common/EmbeddedDiagnostic.cs @@ -17,7 +17,7 @@ namespace Microsoft.CodeAnalysis.EmbeddedLanguages.Common /// for the range of characters for '\\p{0}' (even though the regex engine would only see the \\ /// translated as a virtual char to the single \ character. /// - internal struct EmbeddedDiagnostic : IEquatable + internal readonly struct EmbeddedDiagnostic : IEquatable { public readonly string Message; public readonly TextSpan Span; diff --git a/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/EmbeddedLanguages/Common/EmbeddedSyntaxNodeOrToken.cs b/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/EmbeddedLanguages/Common/EmbeddedSyntaxNodeOrToken.cs index 897d1ca4a3100..93e29e3714a61 100644 --- a/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/EmbeddedLanguages/Common/EmbeddedSyntaxNodeOrToken.cs +++ b/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/EmbeddedLanguages/Common/EmbeddedSyntaxNodeOrToken.cs @@ -8,7 +8,7 @@ namespace Microsoft.CodeAnalysis.EmbeddedLanguages.Common { - internal struct EmbeddedSyntaxNodeOrToken + internal readonly struct EmbeddedSyntaxNodeOrToken where TSyntaxKind : struct where TSyntaxNode : EmbeddedSyntaxNode { diff --git a/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/EmbeddedLanguages/Common/EmbeddedSyntaxToken.cs b/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/EmbeddedLanguages/Common/EmbeddedSyntaxToken.cs index 7a1ad6e6b38e1..f9302a648f4c3 100644 --- a/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/EmbeddedLanguages/Common/EmbeddedSyntaxToken.cs +++ b/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/EmbeddedLanguages/Common/EmbeddedSyntaxToken.cs @@ -12,7 +12,7 @@ namespace Microsoft.CodeAnalysis.EmbeddedLanguages.Common { - internal struct EmbeddedSyntaxToken where TSyntaxKind : struct + internal readonly struct EmbeddedSyntaxToken where TSyntaxKind : struct { public readonly TSyntaxKind Kind; public readonly ImmutableArray> LeadingTrivia; diff --git a/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/EmbeddedLanguages/Common/EmbeddedSyntaxTrivia.cs b/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/EmbeddedLanguages/Common/EmbeddedSyntaxTrivia.cs index afb1b70c9ea0d..44b9fc3116b7e 100644 --- a/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/EmbeddedLanguages/Common/EmbeddedSyntaxTrivia.cs +++ b/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/EmbeddedLanguages/Common/EmbeddedSyntaxTrivia.cs @@ -12,7 +12,7 @@ namespace Microsoft.CodeAnalysis.EmbeddedLanguages.Common /// /// Trivia on an . /// - internal struct EmbeddedSyntaxTrivia where TSyntaxKind : struct + internal readonly struct EmbeddedSyntaxTrivia where TSyntaxKind : struct { public readonly TSyntaxKind Kind; public readonly VirtualCharSequence VirtualChars; diff --git a/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/EmbeddedLanguages/VirtualChars/VirtualCharSequence.Chunks.cs b/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/EmbeddedLanguages/VirtualChars/VirtualCharSequence.Chunks.cs index f719989f794a6..1aba88e39213d 100644 --- a/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/EmbeddedLanguages/VirtualChars/VirtualCharSequence.Chunks.cs +++ b/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/EmbeddedLanguages/VirtualChars/VirtualCharSequence.Chunks.cs @@ -10,7 +10,7 @@ namespace Microsoft.CodeAnalysis.EmbeddedLanguages.VirtualChars { - internal partial struct VirtualCharSequence + internal readonly partial struct VirtualCharSequence { /// /// Abstraction over a contiguous chunk of s. This diff --git a/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/Extensions/SyntaxNodeExtensions.cs b/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/Extensions/SyntaxNodeExtensions.cs index fff2c98d18d3e..17a95ff67d789 100644 --- a/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/Extensions/SyntaxNodeExtensions.cs +++ b/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/Extensions/SyntaxNodeExtensions.cs @@ -834,7 +834,7 @@ public static SyntaxToken WithoutTrailingTrivia(this SyntaxToken token) public static ValueAncestorsAndSelfEnumerable ValueAncestorsAndSelf(this SyntaxNode syntaxNode, bool ascendOutOfTrivia = true) => new(syntaxNode, ascendOutOfTrivia); - public struct ValueAncestorsAndSelfEnumerable + public readonly struct ValueAncestorsAndSelfEnumerable { private readonly SyntaxNode _syntaxNode; private readonly bool _ascendOutOfTrivia; diff --git a/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/Formatting/Engine/TokenPairWithOperations.cs b/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/Formatting/Engine/TokenPairWithOperations.cs index f8d57784f0e46..7b9d98aad3942 100644 --- a/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/Formatting/Engine/TokenPairWithOperations.cs +++ b/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/Formatting/Engine/TokenPairWithOperations.cs @@ -10,7 +10,7 @@ namespace Microsoft.CodeAnalysis.Formatting /// /// it holds onto space and wrapping operation need to run between two tokens. /// - internal struct TokenPairWithOperations + internal readonly struct TokenPairWithOperations { public TokenStream TokenStream { get; } public AdjustSpacesOperation? SpaceOperation { get; } diff --git a/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/Indentation/AbstractIndentation.Indenter.cs b/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/Indentation/AbstractIndentation.Indenter.cs index ff705e059c589..e3512bbcd8a91 100644 --- a/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/Indentation/AbstractIndentation.Indenter.cs +++ b/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/Indentation/AbstractIndentation.Indenter.cs @@ -18,7 +18,7 @@ namespace Microsoft.CodeAnalysis.Indentation { internal abstract partial class AbstractIndentation { - protected struct Indenter + protected readonly struct Indenter { private readonly AbstractIndentation _service; diff --git a/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/NamingStyles/NamingStyle.WordSpanEnumerable.cs b/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/NamingStyles/NamingStyle.WordSpanEnumerable.cs index 326fd562d3913..002f122a32965 100644 --- a/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/NamingStyles/NamingStyle.WordSpanEnumerable.cs +++ b/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/NamingStyles/NamingStyle.WordSpanEnumerable.cs @@ -10,7 +10,7 @@ namespace Microsoft.CodeAnalysis.NamingStyles { internal partial record struct NamingStyle { - private struct WordSpanEnumerable + private readonly struct WordSpanEnumerable { private readonly string _name; private readonly TextSpan _nameSpan; diff --git a/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/Services/SemanticFacts/ForEachSymbols.cs b/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/Services/SemanticFacts/ForEachSymbols.cs index 0bc75f2f60fe4..00fa93dddd45b 100644 --- a/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/Services/SemanticFacts/ForEachSymbols.cs +++ b/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/Services/SemanticFacts/ForEachSymbols.cs @@ -6,7 +6,7 @@ namespace Microsoft.CodeAnalysis.LanguageService { - internal struct ForEachSymbols + internal readonly struct ForEachSymbols { public readonly IMethodSymbol GetEnumeratorMethod; public readonly IMethodSymbol MoveNextMethod; diff --git a/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/Services/SyntaxFacts/ExternalSourceInfo.cs b/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/Services/SyntaxFacts/ExternalSourceInfo.cs index 878706237e7fd..ed9952eed6a42 100644 --- a/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/Services/SyntaxFacts/ExternalSourceInfo.cs +++ b/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/Services/SyntaxFacts/ExternalSourceInfo.cs @@ -6,7 +6,7 @@ namespace Microsoft.CodeAnalysis.LanguageService { - internal struct ExternalSourceInfo + internal readonly struct ExternalSourceInfo { public readonly int? StartLine; public readonly bool Ends; diff --git a/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/SymbolKey/SymbolKey.ComparisonOptions.cs b/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/SymbolKey/SymbolKey.ComparisonOptions.cs index a5a5e5f138499..df85fe3fd88dd 100644 --- a/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/SymbolKey/SymbolKey.ComparisonOptions.cs +++ b/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/SymbolKey/SymbolKey.ComparisonOptions.cs @@ -8,7 +8,7 @@ namespace Microsoft.CodeAnalysis { internal partial struct SymbolKey { - private struct ComparisonOptions + private readonly struct ComparisonOptions { [Flags] private enum Option : byte diff --git a/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/SymbolKey/SymbolKey.PooledArrayBuilder.cs b/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/SymbolKey/SymbolKey.PooledArrayBuilder.cs index 984093a38b63a..30f6c476de0b8 100644 --- a/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/SymbolKey/SymbolKey.PooledArrayBuilder.cs +++ b/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/SymbolKey/SymbolKey.PooledArrayBuilder.cs @@ -10,7 +10,7 @@ namespace Microsoft.CodeAnalysis { internal partial struct SymbolKey { - private ref struct PooledArrayBuilder + private readonly ref struct PooledArrayBuilder { public readonly ArrayBuilder Builder; diff --git a/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/SymbolKey/SymbolKeyResolution.Enumeration.cs b/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/SymbolKey/SymbolKeyResolution.Enumeration.cs index e15ed711fb0a4..7821b27f6eee2 100644 --- a/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/SymbolKey/SymbolKeyResolution.Enumeration.cs +++ b/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/SymbolKey/SymbolKeyResolution.Enumeration.cs @@ -4,9 +4,9 @@ namespace Microsoft.CodeAnalysis { - internal partial struct SymbolKeyResolution + internal readonly partial struct SymbolKeyResolution { - public struct Enumerable where TSymbol : ISymbol + public readonly struct Enumerable where TSymbol : ISymbol { private readonly SymbolKeyResolution _resolution; diff --git a/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/SymbolKey/SymbolKeyResolution.cs b/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/SymbolKey/SymbolKeyResolution.cs index 01b49fa86ffea..79b045235d6ea 100644 --- a/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/SymbolKey/SymbolKeyResolution.cs +++ b/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/SymbolKey/SymbolKeyResolution.cs @@ -15,7 +15,7 @@ namespace Microsoft.CodeAnalysis /// If no symbol can be found will be null and /// will be empty. /// - internal partial struct SymbolKeyResolution + internal readonly partial struct SymbolKeyResolution { private readonly ImmutableArray _candidateSymbols; diff --git a/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/Utilities/AsyncLazy`1.cs b/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/Utilities/AsyncLazy`1.cs index 42d0b6085887b..0f9fcca1e664b 100644 --- a/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/Utilities/AsyncLazy`1.cs +++ b/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/Utilities/AsyncLazy`1.cs @@ -129,7 +129,7 @@ private WaitThatValidatesInvariants TakeLock(CancellationToken cancellationToken return new WaitThatValidatesInvariants(this); } - private struct WaitThatValidatesInvariants : IDisposable + private readonly struct WaitThatValidatesInvariants : IDisposable { private readonly AsyncLazy _asyncLazy; @@ -366,7 +366,7 @@ private AsynchronousComputationToStart RegisterAsynchronousComputation_NoLock() return new AsynchronousComputationToStart(_asynchronousComputeFunction, _asynchronousComputationCancellationSource); } - private struct AsynchronousComputationToStart + private readonly struct AsynchronousComputationToStart { public readonly Func> AsynchronousComputeFunction; public readonly CancellationTokenSource CancellationTokenSource; diff --git a/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/Utilities/BKTree.Edge.cs b/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/Utilities/BKTree.Edge.cs index 7b113600d6d41..eec5be6073be6 100644 --- a/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/Utilities/BKTree.Edge.cs +++ b/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/Utilities/BKTree.Edge.cs @@ -6,7 +6,7 @@ namespace Roslyn.Utilities { internal partial class BKTree { - private struct Edge + private readonly struct Edge { // The edit distance between the child and parent connected by this edge. // The child can be found in _nodes at ChildNodeIndex. diff --git a/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/Utilities/BKTree.Node.cs b/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/Utilities/BKTree.Node.cs index 8512fb7a585dd..df97be77c2311 100644 --- a/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/Utilities/BKTree.Node.cs +++ b/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/Utilities/BKTree.Node.cs @@ -8,7 +8,7 @@ namespace Roslyn.Utilities { internal partial class BKTree { - private struct Node + private readonly struct Node { /// /// The string this node corresponds to. Specifically, this span is the range of diff --git a/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/Utilities/NonReentrantLock.cs b/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/Utilities/NonReentrantLock.cs index 47d5f4942aa8e..e7a97bdf33724 100644 --- a/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/Utilities/NonReentrantLock.cs +++ b/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/Utilities/NonReentrantLock.cs @@ -240,7 +240,7 @@ public SemaphoreDisposer DisposableWait(CancellationToken cancellationToken = de /// /// Since we want to avoid boxing the return from , this type must be public. /// - public struct SemaphoreDisposer : IDisposable + public readonly struct SemaphoreDisposer : IDisposable { private readonly NonReentrantLock _semaphore; diff --git a/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/Utilities/SyntaxPath.cs b/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/Utilities/SyntaxPath.cs index 877c3d318ee68..fa059ce30b0d5 100644 --- a/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/Utilities/SyntaxPath.cs +++ b/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/Utilities/SyntaxPath.cs @@ -26,7 +26,7 @@ internal class SyntaxPath // segment contains the index of the node in its parent, as well as the kind of the node. // The latter is not strictly necessary. However, it ensures that resolving the path against // a different tree will either return the same type of node as the original, or will fail. - protected struct PathSegment + protected readonly struct PathSegment { public int Ordinal { get; } public int Kind { get; } diff --git a/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/Utilities/WordSimilarityChecker.cs b/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/Utilities/WordSimilarityChecker.cs index dbaf48680c06c..76d74f35619bf 100644 --- a/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/Utilities/WordSimilarityChecker.cs +++ b/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/Utilities/WordSimilarityChecker.cs @@ -10,7 +10,7 @@ namespace Roslyn.Utilities { internal class WordSimilarityChecker { - private struct CacheResult + private readonly struct CacheResult { public readonly string CandidateText; public readonly bool AreSimilar; diff --git a/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/LanguageServices/TypeInferenceService/ITypeInferenceService.cs b/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/LanguageServices/TypeInferenceService/ITypeInferenceService.cs index 63f112b37d478..acd8adbfc3595 100644 --- a/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/LanguageServices/TypeInferenceService/ITypeInferenceService.cs +++ b/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/LanguageServices/TypeInferenceService/ITypeInferenceService.cs @@ -33,7 +33,7 @@ internal interface ITypeInferenceService : ILanguageService ImmutableArray GetTypeInferenceInfo(SemanticModel semanticModel, SyntaxNode expression, string nameOpt, CancellationToken cancellationToken); } - internal struct TypeInferenceInfo + internal readonly struct TypeInferenceInfo { public TypeInferenceInfo(ITypeSymbol type) {