diff --git a/src/SourceBuild/content/eng/Version.Details.xml b/src/SourceBuild/content/eng/Version.Details.xml index 876705d94e26..b9d93fc94779 100644 --- a/src/SourceBuild/content/eng/Version.Details.xml +++ b/src/SourceBuild/content/eng/Version.Details.xml @@ -2,9 +2,9 @@ - + https://github.com/dotnet/arcade - 45d845e04c05fbe5da9838c454bbc3af1df6be81 + e58820063a8754d418518bce69ca2df0e3b4ac25 diff --git a/src/SourceBuild/content/eng/Versions.props b/src/SourceBuild/content/eng/Versions.props index 2bb9444913fc..49955ebee40b 100644 --- a/src/SourceBuild/content/eng/Versions.props +++ b/src/SourceBuild/content/eng/Versions.props @@ -23,8 +23,8 @@ of a .NET major or minor release, prebuilts may be needed. When the release is mature, prebuilts are not necessary, and this property is removed from the file. --> - 10.0.100-alpha.1.24612.1 - 10.0.100-alpha.1.24612.1-2 + 10.0.100-alpha.1.25057.1 + 10.0.100-alpha.1.25057.1-2 0.1.0-10.0.100-7 2.0.0-beta4.24126.1 diff --git a/src/SourceBuild/content/global.json b/src/SourceBuild/content/global.json index 86ca740c5b0e..ae06a19bb0da 100644 --- a/src/SourceBuild/content/global.json +++ b/src/SourceBuild/content/global.json @@ -1,10 +1,10 @@ { "tools": { - "dotnet": "10.0.100-alpha.1.24611.6" + "dotnet": "10.0.100-alpha.1.25056.8" }, "msbuild-sdks": { "Microsoft.Build.NoTargets": "3.7.0", "Microsoft.Build.Traversal": "3.4.0", - "Microsoft.DotNet.Arcade.Sdk": "10.0.0-beta.24604.4" + "Microsoft.DotNet.Arcade.Sdk": "10.0.0-beta.25056.1" } } diff --git a/src/SourceBuild/patches/razor/0001-Remove-unused-fields.patch b/src/SourceBuild/patches/razor/0001-Remove-unused-fields.patch new file mode 100644 index 000000000000..e710243f76d6 --- /dev/null +++ b/src/SourceBuild/patches/razor/0001-Remove-unused-fields.patch @@ -0,0 +1,45 @@ +From faa695199c8b8886c0d923f25a57c9728afeafbf Mon Sep 17 00:00:00 2001 +From: Matt Thalman +Date: Tue, 7 Jan 2025 14:48:06 -0600 +Subject: [PATCH] Remove unused fields + +Backport: https://github.com/dotnet/razor/pull/11358 +--- + .../Microsoft.AspNetCore.Razor.LanguageServer/LspServices.cs | 4 +--- + .../AutoInsert/RemoteAutoInsertService.cs | 1 - + 2 files changed, 1 insertion(+), 4 deletions(-) + +diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/LspServices.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/LspServices.cs +index 43a17a0402..01bf4ada70 100644 +--- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/LspServices.cs ++++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/LspServices.cs +@@ -14,16 +14,14 @@ namespace Microsoft.AspNetCore.Razor.LanguageServer; + internal class LspServices : ILspServices + { + private readonly IServiceProvider _serviceProvider; +- private readonly IEnumerable _startupServices; + public bool IsDisposed = false; + + public LspServices(IServiceCollection serviceCollection) + { + serviceCollection.AddSingleton(this); + _serviceProvider = serviceCollection.BuildServiceProvider(); +- + // Create all startup services +- _startupServices = _serviceProvider.GetServices(); ++ _serviceProvider.GetServices(); + } + + public ImmutableArray GetRegisteredServices() +diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Remote.Razor/AutoInsert/RemoteAutoInsertService.cs b/src/Razor/src/Microsoft.CodeAnalysis.Remote.Razor/AutoInsert/RemoteAutoInsertService.cs +index 27dcc78952..f8ab749b66 100644 +--- a/src/Razor/src/Microsoft.CodeAnalysis.Remote.Razor/AutoInsert/RemoteAutoInsertService.cs ++++ b/src/Razor/src/Microsoft.CodeAnalysis.Remote.Razor/AutoInsert/RemoteAutoInsertService.cs +@@ -32,7 +32,6 @@ internal sealed class RemoteAutoInsertService(in ServiceArgs args) + } + + private readonly IAutoInsertService _autoInsertService = args.ExportProvider.GetExportedValue(); +- private readonly IFilePathService _filePathService = args.ExportProvider.GetExportedValue(); + private readonly IRazorFormattingService _razorFormattingService = args.ExportProvider.GetExportedValue(); + + protected override IDocumentPositionInfoStrategy DocumentPositionInfoStrategy => PreferHtmlInAttributeValuesDocumentPositionInfoStrategy.Instance; diff --git a/src/SourceBuild/patches/razor/0002-Remove-unused-field-in-RazorContentTypeChangeListener.patch b/src/SourceBuild/patches/razor/0002-Remove-unused-field-in-RazorContentTypeChangeListener.patch new file mode 100644 index 000000000000..8c7dcd117401 --- /dev/null +++ b/src/SourceBuild/patches/razor/0002-Remove-unused-field-in-RazorContentTypeChangeListener.patch @@ -0,0 +1,63 @@ +From 1d6f0ce17c97fcf541b5f45b000b4f54356e8f25 Mon Sep 17 00:00:00 2001 +From: Matt Thalman +Date: Tue, 7 Jan 2025 18:28:41 -0600 +Subject: [PATCH] Remove unused field in RazorContentTypeChangeListener + +Backport: https://github.com/dotnet/razor/pull/11361 +--- + .../LanguageClient/RazorContentTypeChangeListener.cs | 8 -------- + .../LanguageClient/RazorContentTypeChangeListenerTest.cs | 1 - + 2 files changed, 9 deletions(-) + +diff --git a/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/LanguageClient/RazorContentTypeChangeListener.cs b/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/LanguageClient/RazorContentTypeChangeListener.cs +index dcc90c5787..13fb4b0696 100644 +--- a/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/LanguageClient/RazorContentTypeChangeListener.cs ++++ b/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/LanguageClient/RazorContentTypeChangeListener.cs +@@ -18,7 +18,6 @@ internal class RazorContentTypeChangeListener : ITextBufferContentTypeListener + private readonly TrackingLSPDocumentManager _lspDocumentManager; + private readonly ITextDocumentFactoryService _textDocumentFactory; + private readonly ILspEditorFeatureDetector _lspEditorFeatureDetector; +- private readonly IEditorOptionsFactoryService _editorOptionsFactory; + private readonly IFileToContentTypeService _fileToContentTypeService; + + [ImportingConstructor] +@@ -26,7 +25,6 @@ internal class RazorContentTypeChangeListener : ITextBufferContentTypeListener + ITextDocumentFactoryService textDocumentFactory, + LSPDocumentManager lspDocumentManager, + ILspEditorFeatureDetector lspEditorFeatureDetector, +- IEditorOptionsFactoryService editorOptionsFactory, + IFileToContentTypeService fileToContentTypeService) + { + if (textDocumentFactory is null) +@@ -44,11 +42,6 @@ internal class RazorContentTypeChangeListener : ITextBufferContentTypeListener + throw new ArgumentNullException(nameof(lspEditorFeatureDetector)); + } + +- if (editorOptionsFactory is null) +- { +- throw new ArgumentNullException(nameof(editorOptionsFactory)); +- } +- + if (fileToContentTypeService is null) + { + throw new ArgumentNullException(nameof(fileToContentTypeService)); +@@ -63,7 +56,6 @@ internal class RazorContentTypeChangeListener : ITextBufferContentTypeListener + + _textDocumentFactory = textDocumentFactory; + _lspEditorFeatureDetector = lspEditorFeatureDetector; +- _editorOptionsFactory = editorOptionsFactory; + _fileToContentTypeService = fileToContentTypeService; + } + +diff --git a/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/LanguageClient/RazorContentTypeChangeListenerTest.cs b/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/LanguageClient/RazorContentTypeChangeListenerTest.cs +index d01ea46d5c..d6afae6491 100644 +--- a/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/LanguageClient/RazorContentTypeChangeListenerTest.cs ++++ b/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/LanguageClient/RazorContentTypeChangeListenerTest.cs +@@ -226,7 +226,6 @@ public class RazorContentTypeChangeListenerTest : ToolingTestBase + textDocumentFactory, + lspDocumentManager, + lspEditorFeatureDetector, +- Mock.Of(s => s.GetOptions(It.IsAny()) == Mock.Of(MockBehavior.Strict), MockBehavior.Strict), + fileToContentTypeService); + + return listener; diff --git a/src/SourceBuild/patches/razor/0003-Remove-unnecessary-using.patch b/src/SourceBuild/patches/razor/0003-Remove-unnecessary-using.patch new file mode 100644 index 000000000000..2ad84ab1351c --- /dev/null +++ b/src/SourceBuild/patches/razor/0003-Remove-unnecessary-using.patch @@ -0,0 +1,23 @@ +From fa8b9938dfaa72c790a1bf4a657af77ef2de5f13 Mon Sep 17 00:00:00 2001 +From: David Wengier +Date: Wed, 8 Jan 2025 12:03:12 +1100 +Subject: [PATCH] Remove using + +Backport: https://github.com/dotnet/razor/pull/11361 + +--- + .../LanguageClient/RazorContentTypeChangeListener.cs | 1 - + 1 file changed, 1 deletion(-) + +diff --git a/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/LanguageClient/RazorContentTypeChangeListener.cs b/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/LanguageClient/RazorContentTypeChangeListener.cs +index 13fb4b0696..535223227b 100644 +--- a/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/LanguageClient/RazorContentTypeChangeListener.cs ++++ b/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/LanguageClient/RazorContentTypeChangeListener.cs +@@ -5,7 +5,6 @@ using System; + using System.ComponentModel.Composition; + using Microsoft.VisualStudio.LanguageServer.ContainedLanguage; + using Microsoft.VisualStudio.Text; +-using Microsoft.VisualStudio.Text.Editor; + using Microsoft.VisualStudio.Utilities; + + namespace Microsoft.VisualStudio.Razor.LanguageClient; diff --git a/src/SourceBuild/patches/winforms/0001-Fix-code-analysis-issues.patch b/src/SourceBuild/patches/winforms/0001-Fix-code-analysis-issues.patch new file mode 100644 index 000000000000..00000140e9d2 --- /dev/null +++ b/src/SourceBuild/patches/winforms/0001-Fix-code-analysis-issues.patch @@ -0,0 +1,307 @@ +From 03549bcc6e902a551be08339490e9f13db217ad6 Mon Sep 17 00:00:00 2001 +From: Matt Thalman +Date: Wed, 8 Jan 2025 07:20:08 -0600 +Subject: [PATCH] Fix code analysis issues + +Backport: https://github.com/dotnet/winforms/pull/12735 +--- + .../Drawing/Printing/PrinterSettings.StringCollection.cs | 2 +- + .../System/Collections/Generic/CollectionExtensions.cs | 2 +- + .../System/Drawing/IIcon.cs | 2 +- + .../CollectionEditor.CollectionEditorCollectionForm.cs | 2 +- + .../src/System/ComponentModel/Design/DesignerHost.cs | 2 +- + ...omSerializationStore.ComponentListCodeDomSerializer.cs | 2 +- + .../Windows/Forms/Design/Behavior/SelectionManager.cs | 4 ++-- + .../Forms/Design/Behavior/TableLayoutPanelBehavior.cs | 2 +- + .../Design/Behavior/ToolStripPanelSelectionBehavior.cs | 2 +- + .../src/System/Windows/Forms/Design/CommandSet.cs | 2 +- + .../Windows/Forms/Design/FlowLayoutPanelDesigner .cs | 2 +- + .../src/System/Windows/Forms/Design/OleDragDropHandler.cs | 2 +- + .../Windows/Forms/Design/TableLayoutPanelDesigner.cs | 2 +- + .../Windows/Forms/ActiveX/AxHost.AxPropertyDescriptor.cs | 2 +- + .../ComponentModel/COM2Interop/COM2PropertyDescriptor.cs | 2 +- + .../COM2Interop/ICom2ExtendedBrowsingHandler.cs | 4 ++-- + .../System/Windows/Forms/Controls/ComboBox/ComboBox.cs | 2 +- + .../System/Windows/Forms/Controls/ToolStrips/ToolStrip.cs | 2 +- + .../Forms/Controls/ToolStrips/ToolStripDropDown.cs | 2 +- + .../Windows/Forms/Dialogs/TaskDialog/TaskDialogPage.cs | 8 ++++---- + 20 files changed, 25 insertions(+), 25 deletions(-) + +diff --git a/src/System.Drawing.Common/src/System/Drawing/Printing/PrinterSettings.StringCollection.cs b/src/System.Drawing.Common/src/System/Drawing/Printing/PrinterSettings.StringCollection.cs +index 15dc585aa..d063cdd21 100644 +--- a/src/System.Drawing.Common/src/System/Drawing/Printing/PrinterSettings.StringCollection.cs ++++ b/src/System.Drawing.Common/src/System/Drawing/Printing/PrinterSettings.StringCollection.cs +@@ -15,7 +15,7 @@ public partial class PrinterSettings + /// + /// Initializes a new instance of the class. + /// +- public StringCollection(string[] array) => _list = new(array); ++ public StringCollection(string[] array) => _list = [..array]; + + /// + /// Gets a value indicating the number of strings. +diff --git a/src/System.Private.Windows.Core/src/System/Collections/Generic/CollectionExtensions.cs b/src/System.Private.Windows.Core/src/System/Collections/Generic/CollectionExtensions.cs +index 15dd20bbf..eb0852ff0 100644 +--- a/src/System.Private.Windows.Core/src/System/Collections/Generic/CollectionExtensions.cs ++++ b/src/System.Private.Windows.Core/src/System/Collections/Generic/CollectionExtensions.cs +@@ -25,7 +25,7 @@ internal static class CollectionExtensions + } + + // Fall back to just setting the count (by removing). +- List list = new(readOnlyList); ++ List list = [..readOnlyList]; + list.RemoveRange(count, list.Count - count); + return list; + } +diff --git a/src/System.Private.Windows.GdiPlus/System/Drawing/IIcon.cs b/src/System.Private.Windows.GdiPlus/System/Drawing/IIcon.cs +index 7b53bdaf0..5eed2338f 100644 +--- a/src/System.Private.Windows.GdiPlus/System/Drawing/IIcon.cs ++++ b/src/System.Private.Windows.GdiPlus/System/Drawing/IIcon.cs +@@ -5,5 +5,5 @@ namespace System.Drawing; + + internal interface IIcon : IHandle + { +- public Size Size { get; } ++ Size Size { get; } + } +diff --git a/src/System.Windows.Forms.Design/src/System/ComponentModel/Design/CollectionEditor.CollectionEditorCollectionForm.cs b/src/System.Windows.Forms.Design/src/System/ComponentModel/Design/CollectionEditor.CollectionEditorCollectionForm.cs +index e5428772c..d30b80ffb 100644 +--- a/src/System.Windows.Forms.Design/src/System/ComponentModel/Design/CollectionEditor.CollectionEditorCollectionForm.cs ++++ b/src/System.Windows.Forms.Design/src/System/ComponentModel/Design/CollectionEditor.CollectionEditorCollectionForm.cs +@@ -807,7 +807,7 @@ public partial class CollectionEditor + { + if (_listBox.SelectedItems.Count > 1) + { +- List toBeDeleted = _listBox.SelectedItems.Cast().ToList(); ++ List toBeDeleted = [.._listBox.SelectedItems.Cast()]; + foreach (ListItem item in toBeDeleted) + { + RemoveInternal(item); +diff --git a/src/System.Windows.Forms.Design/src/System/ComponentModel/Design/DesignerHost.cs b/src/System.Windows.Forms.Design/src/System/ComponentModel/Design/DesignerHost.cs +index 0e5f01025..1260870a2 100644 +--- a/src/System.Windows.Forms.Design/src/System/ComponentModel/Design/DesignerHost.cs ++++ b/src/System.Windows.Forms.Design/src/System/ComponentModel/Design/DesignerHost.cs +@@ -1119,7 +1119,7 @@ internal sealed partial class DesignerHost : Container, IDesignerLoaderHost2, ID + _state[s_stateLoading] = true; + Unload(); + +- List errorList = errorCollection is null ? [] : errorCollection.Cast().ToList(); ++ List errorList = errorCollection is null ? [] : [..errorCollection.Cast()]; + errorList.Insert(0, ex); + + errorCollection = errorList; +diff --git a/src/System.Windows.Forms.Design/src/System/ComponentModel/Design/Serialization/CodeDomComponentSerializationService.CodeDomSerializationStore.ComponentListCodeDomSerializer.cs b/src/System.Windows.Forms.Design/src/System/ComponentModel/Design/Serialization/CodeDomComponentSerializationService.CodeDomSerializationStore.ComponentListCodeDomSerializer.cs +index 9eb2a6a71..cb2e80289 100644 +--- a/src/System.Windows.Forms.Design/src/System/ComponentModel/Design/Serialization/CodeDomComponentSerializationService.CodeDomSerializationStore.ComponentListCodeDomSerializer.cs ++++ b/src/System.Windows.Forms.Design/src/System/ComponentModel/Design/Serialization/CodeDomComponentSerializationService.CodeDomSerializationStore.ComponentListCodeDomSerializer.cs +@@ -91,7 +91,7 @@ public sealed partial class CodeDomComponentSerializationService + + // We need to also ensure that for every entry in the statement table we have a + // corresponding entry in objectNames. Otherwise, we won't deserialize completely. +- HashSet completeNames = new(objectNames); ++ HashSet completeNames = [..objectNames]; + completeNames.UnionWith(_statementsTable.Keys); + + _objectState = new(objectState); +diff --git a/src/System.Windows.Forms.Design/src/System/Windows/Forms/Design/Behavior/SelectionManager.cs b/src/System.Windows.Forms.Design/src/System/Windows/Forms/Design/Behavior/SelectionManager.cs +index 73648af22..23bbac7ba 100644 +--- a/src/System.Windows.Forms.Design/src/System/Windows/Forms/Design/Behavior/SelectionManager.cs ++++ b/src/System.Windows.Forms.Design/src/System/Windows/Forms/Design/Behavior/SelectionManager.cs +@@ -257,7 +257,7 @@ internal sealed class SelectionManager : IDisposable + /// + private void OnBeginDrag(object? source, BehaviorDragDropEventArgs e) + { +- List dragComps = e.DragComponents.Cast().ToList(); ++ List dragComps = [..e.DragComponents.Cast()]; + List glyphsToRemove = []; + foreach (ControlBodyGlyph g in BodyGlyphAdorner.Glyphs) + { +@@ -412,7 +412,7 @@ internal sealed class SelectionManager : IDisposable + SelectionGlyphAdorner.Glyphs.Clear(); + BodyGlyphAdorner.Glyphs.Clear(); + +- List selComps = _selectionService.GetSelectedComponents().Cast().ToList(); ++ List selComps = [.._selectionService.GetSelectedComponents().Cast()]; + object? primarySelection = _selectionService.PrimarySelection; + + // add all control glyphs to all controls on rootComp +diff --git a/src/System.Windows.Forms.Design/src/System/Windows/Forms/Design/Behavior/TableLayoutPanelBehavior.cs b/src/System.Windows.Forms.Design/src/System/Windows/Forms/Design/Behavior/TableLayoutPanelBehavior.cs +index eb6b29b06..a0514c3ac 100644 +--- a/src/System.Windows.Forms.Design/src/System/Windows/Forms/Design/Behavior/TableLayoutPanelBehavior.cs ++++ b/src/System.Windows.Forms.Design/src/System/Windows/Forms/Design/Behavior/TableLayoutPanelBehavior.cs +@@ -166,7 +166,7 @@ internal class TableLayoutPanelBehavior : Behavior + { + if ((_styles is null || isColumn != _currentColumnStyles) && _table is not null) + { +- _styles = ((TableLayoutStyleCollection)_changedProp.GetValue(_table)).Cast().ToList(); ++ _styles = [..((TableLayoutStyleCollection)_changedProp.GetValue(_table)).Cast()]; + _currentColumnStyles = isColumn; + } + } +diff --git a/src/System.Windows.Forms.Design/src/System/Windows/Forms/Design/Behavior/ToolStripPanelSelectionBehavior.cs b/src/System.Windows.Forms.Design/src/System/Windows/Forms/Design/Behavior/ToolStripPanelSelectionBehavior.cs +index e717ea8d0..1f5aa98e0 100644 +--- a/src/System.Windows.Forms.Design/src/System/Windows/Forms/Design/Behavior/ToolStripPanelSelectionBehavior.cs ++++ b/src/System.Windows.Forms.Design/src/System/Windows/Forms/Design/Behavior/ToolStripPanelSelectionBehavior.cs +@@ -223,7 +223,7 @@ internal sealed class ToolStripPanelSelectionBehavior : Behavior + + if (e.Data is DropSourceBehavior.BehaviorDataObject data) + { +- components = new List(data.DragComponents); ++ components = [..data.DragComponents]; + + foreach (IComponent dragComponent in components) + { +diff --git a/src/System.Windows.Forms.Design/src/System/Windows/Forms/Design/CommandSet.cs b/src/System.Windows.Forms.Design/src/System/Windows/Forms/Design/CommandSet.cs +index d39ed9f70..2b4645fd5 100644 +--- a/src/System.Windows.Forms.Design/src/System/Windows/Forms/Design/CommandSet.cs ++++ b/src/System.Windows.Forms.Design/src/System/Windows/Forms/Design/CommandSet.cs +@@ -804,7 +804,7 @@ internal partial class CommandSet : IDisposable + // Don't snap if we are moving a component in the ComponentTray + if (invertSnap && useSnapLines && primaryControl is not null && comp.Site is not null) + { +- List selComps = SelectionService.GetSelectedComponents().Cast().ToList(); ++ List selComps = [..SelectionService.GetSelectedComponents().Cast()]; + + // create our snapline engine + dragManager = new DragAssistanceManager(comp.Site, selComps); +diff --git a/src/System.Windows.Forms.Design/src/System/Windows/Forms/Design/FlowLayoutPanelDesigner .cs b/src/System.Windows.Forms.Design/src/System/Windows/Forms/Design/FlowLayoutPanelDesigner .cs +index 3db868f5c..0e92902a0 100644 +--- a/src/System.Windows.Forms.Design/src/System/Windows/Forms/Design/FlowLayoutPanelDesigner .cs ++++ b/src/System.Windows.Forms.Design/src/System/Windows/Forms/Design/FlowLayoutPanelDesigner .cs +@@ -757,7 +757,7 @@ internal partial class FlowLayoutPanelDesigner : FlowPanelDesigner + // Get the sorted drag controls. We use these for an internal drag. + if (de.Data is DropSourceBehavior.BehaviorDataObject data) + { +- _dragControls = data.GetSortedDragControls(out int primaryIndex).OfType().ToList(); ++ _dragControls = [..data.GetSortedDragControls(out int primaryIndex).OfType()]; + _primaryDragControl = _dragControls[primaryIndex]; + } + +diff --git a/src/System.Windows.Forms.Design/src/System/Windows/Forms/Design/OleDragDropHandler.cs b/src/System.Windows.Forms.Design/src/System/Windows/Forms/Design/OleDragDropHandler.cs +index bcf00c49a..8adc80b1c 100644 +--- a/src/System.Windows.Forms.Design/src/System/Windows/Forms/Design/OleDragDropHandler.cs ++++ b/src/System.Windows.Forms.Design/src/System/Windows/Forms/Design/OleDragDropHandler.cs +@@ -257,7 +257,7 @@ internal partial class OleDragDropHandler + { + host?.Activate(); + +- List selectComps = new(comps); ++ List selectComps = [..comps]; + + for (int i = 0; i < comps.Length; i++) + { +diff --git a/src/System.Windows.Forms.Design/src/System/Windows/Forms/Design/TableLayoutPanelDesigner.cs b/src/System.Windows.Forms.Design/src/System/Windows/Forms/Design/TableLayoutPanelDesigner.cs +index 1ea69253c..7f8d0da94 100644 +--- a/src/System.Windows.Forms.Design/src/System/Windows/Forms/Design/TableLayoutPanelDesigner.cs ++++ b/src/System.Windows.Forms.Design/src/System/Windows/Forms/Design/TableLayoutPanelDesigner.cs +@@ -952,7 +952,7 @@ internal partial class TableLayoutPanelDesigner : FlowPanelDesigner + { + if (de.Data is DropSourceBehavior.BehaviorDataObject data) + { +- _dragComponents = new List(data.DragComponents); ++ _dragComponents = [..data.DragComponents]; + return _dragComponents[0] as Control; + } + +diff --git a/src/System.Windows.Forms/src/System/Windows/Forms/ActiveX/AxHost.AxPropertyDescriptor.cs b/src/System.Windows.Forms/src/System/Windows/Forms/ActiveX/AxHost.AxPropertyDescriptor.cs +index 0d60dda12..d66e015cd 100644 +--- a/src/System.Windows.Forms/src/System/Windows/Forms/ActiveX/AxHost.AxPropertyDescriptor.cs ++++ b/src/System.Windows.Forms/src/System/Windows/Forms/ActiveX/AxHost.AxPropertyDescriptor.cs +@@ -254,7 +254,7 @@ public abstract partial class AxHost + return; + } + +- List attributes = new(AttributeArray!); ++ List attributes = [..AttributeArray!]; + attributes.AddRange(_updateAttributes); + AttributeArray = [.. attributes]; + _updateAttributes.Clear(); +diff --git a/src/System.Windows.Forms/src/System/Windows/Forms/ComponentModel/COM2Interop/COM2PropertyDescriptor.cs b/src/System.Windows.Forms/src/System/Windows/Forms/ComponentModel/COM2Interop/COM2PropertyDescriptor.cs +index 33dd3d9e8..53a8148a3 100644 +--- a/src/System.Windows.Forms/src/System/Windows/Forms/ComponentModel/COM2Interop/COM2PropertyDescriptor.cs ++++ b/src/System.Windows.Forms/src/System/Windows/Forms/ComponentModel/COM2Interop/COM2PropertyDescriptor.cs +@@ -238,7 +238,7 @@ internal unsafe partial class Com2PropertyDescriptor : PropertyDescriptor, IClon + + if (attributeList.Count > 0) + { +- newAttributes ??= new(AttributeArray); ++ newAttributes ??= [..AttributeArray]; + + // Push any new attributes into the base type. + for (int i = 0; i < attributeList.Count; i++) +diff --git a/src/System.Windows.Forms/src/System/Windows/Forms/ComponentModel/COM2Interop/ICom2ExtendedBrowsingHandler.cs b/src/System.Windows.Forms/src/System/Windows/Forms/ComponentModel/COM2Interop/ICom2ExtendedBrowsingHandler.cs +index 291b42c5d..8fb6a7b67 100644 +--- a/src/System.Windows.Forms/src/System/Windows/Forms/ComponentModel/COM2Interop/ICom2ExtendedBrowsingHandler.cs ++++ b/src/System.Windows.Forms/src/System/Windows/Forms/ComponentModel/COM2Interop/ICom2ExtendedBrowsingHandler.cs +@@ -21,11 +21,11 @@ internal unsafe interface ICom2ExtendedBrowsingHandler + /// + /// Returns if the given object is supported by this type. + /// +- public bool ObjectSupportsInterface(object @object); ++ bool ObjectSupportsInterface(object @object); + + /// + /// Called to setup the property handlers on a given property. In this method, the handler will add listeners + /// to the events that the surfaces that it cares about. + /// +- public void RegisterEvents(Com2PropertyDescriptor[]? properties); ++ void RegisterEvents(Com2PropertyDescriptor[]? properties); + } +diff --git a/src/System.Windows.Forms/src/System/Windows/Forms/Controls/ComboBox/ComboBox.cs b/src/System.Windows.Forms/src/System/Windows/Forms/Controls/ComboBox/ComboBox.cs +index d078054db..95f65362b 100644 +--- a/src/System.Windows.Forms/src/System/Windows/Forms/Controls/ComboBox/ComboBox.cs ++++ b/src/System.Windows.Forms/src/System/Windows/Forms/Controls/ComboBox/ComboBox.cs +@@ -2052,7 +2052,7 @@ public partial class ComboBox : ListControl + else + { + // Remove one character from matching text and rematch +- MatchingText = MatchingText.Remove(MatchingText.Length - 1); ++ MatchingText = MatchingText[..^1]; + SelectedIndex = FindString(MatchingText); + } + +diff --git a/src/System.Windows.Forms/src/System/Windows/Forms/Controls/ToolStrips/ToolStrip.cs b/src/System.Windows.Forms/src/System/Windows/Forms/Controls/ToolStrips/ToolStrip.cs +index 040b4ff8e..4775f3e96 100644 +--- a/src/System.Windows.Forms/src/System/Windows/Forms/Controls/ToolStrips/ToolStrip.cs ++++ b/src/System.Windows.Forms/src/System/Windows/Forms/Controls/ToolStrips/ToolStrip.cs +@@ -3933,7 +3933,7 @@ public partial class ToolStrip : ScrollableControl, IArrangedElement, ISupportTo + /// contains ToolStrip or ToolStripDropDown items to disconnect + internal virtual void ReleaseToolStripItemsProviders(ToolStripItemCollection items) + { +- ToolStripItem[] itemsArray = items.Cast().ToArray(); ++ ToolStripItem[] itemsArray = [..items.Cast()]; + foreach (ToolStripItem toolStripItem in itemsArray) + { + if (toolStripItem is ToolStripDropDownItem dropDownItem && dropDownItem.DropDownItems.Count > 0) +diff --git a/src/System.Windows.Forms/src/System/Windows/Forms/Controls/ToolStrips/ToolStripDropDown.cs b/src/System.Windows.Forms/src/System/Windows/Forms/Controls/ToolStrips/ToolStripDropDown.cs +index 83777ba57..573607e61 100644 +--- a/src/System.Windows.Forms/src/System/Windows/Forms/Controls/ToolStrips/ToolStripDropDown.cs ++++ b/src/System.Windows.Forms/src/System/Windows/Forms/Controls/ToolStrips/ToolStripDropDown.cs +@@ -1948,7 +1948,7 @@ public partial class ToolStripDropDown : ToolStrip + } + else + { +- List dropDowns = new(ActiveDropDowns); ++ List dropDowns = [..ActiveDropDowns]; + + // We can't iterate through the active dropdown collection + // here as changing visibility changes the collection. +diff --git a/src/System.Windows.Forms/src/System/Windows/Forms/Dialogs/TaskDialog/TaskDialogPage.cs b/src/System.Windows.Forms/src/System/Windows/Forms/Dialogs/TaskDialog/TaskDialogPage.cs +index 40be8a27f..f8b6f7f43 100644 +--- a/src/System.Windows.Forms/src/System/Windows/Forms/Dialogs/TaskDialog/TaskDialogPage.cs ++++ b/src/System.Windows.Forms/src/System/Windows/Forms/Dialogs/TaskDialog/TaskDialogPage.cs +@@ -868,10 +868,10 @@ public class TaskDialogPage + radioButtons.BoundPage = this; + + // Sort the buttons. +- _boundCustomButtons = buttons.Where(e => !e.IsStandardButton).ToArray(); +- _boundStandardButtonsByID = new Dictionary( +- buttons.Where(e => e.IsStandardButton) +- .Select(e => new KeyValuePair(e.ButtonID, e))); ++ _boundCustomButtons = [..buttons.Where(e => !e.IsStandardButton)]; ++ _boundStandardButtonsByID = buttons ++ .Where(e => e.IsStandardButton) ++ .ToDictionary(e => e.ButtonID); + + // Assign IDs to the buttons based on their index. + defaultButtonID = 0;