From 7772c1c1ada3b3377f0ab3231062da9e5e60c270 Mon Sep 17 00:00:00 2001 From: GrahamTheCoder Date: Sun, 21 Apr 2024 17:22:37 +0100 Subject: [PATCH] Revert to 4.1.0 before https://github.com/dotnet/roslyn/issues/63921 was introduced The issue says it's fixed, but the tests can't run due to the issue --- CHANGELOG.md | 2 +- CodeConverter/CSharp/CommonConversions.cs | 4 ++-- .../CSharp/ProjectMergedDeclarationExtensions.cs | 2 +- CodeConverter/CodeConverter.csproj | 5 +++-- CodeConverter/Common/SymbolRenamer.cs | 2 +- .../CodeConv.NetFramework/CodeConv.NetFramework.csproj | 10 +++++----- CommandLine/CodeConv/CodeConv.csproj | 6 +++--- Func/Func.csproj | 10 +++++----- README.md | 4 ++-- Tests/Tests.csproj | 8 ++++---- 10 files changed, 27 insertions(+), 26 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b3d9ab1c8..c836d1acd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,7 +7,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) ### Vsix -* Compatible with Visual Studio 2022 17.6 onwards +* Compatible with Visual Studio 2022 17.1 onwards ### VB -> C# diff --git a/CodeConverter/CSharp/CommonConversions.cs b/CodeConverter/CSharp/CommonConversions.cs index 2d57fc120..4402d5a05 100644 --- a/CodeConverter/CSharp/CommonConversions.cs +++ b/CodeConverter/CSharp/CommonConversions.cs @@ -569,7 +569,7 @@ public static CSSyntax.VariableDeclaratorSyntax CreateVariableDeclarator(string { if (operation is IPropertyReferenceOperation pro && pro.Arguments.Any() && !VisualBasicExtensions.IsDefault(pro.Property)) { - var isSetter = pro.Parent.Kind == OperationKind.SimpleAssignment && pro.Parent.ChildOperations.First() == pro; + var isSetter = pro.Parent.Kind == OperationKind.SimpleAssignment && pro.Parent.Children.First() == pro; var extraArg = isSetter ? await GetParameterizedSetterArgAsync(operation) : null; @@ -674,7 +674,7 @@ public static ExpressionSyntax ThrowawayParameters(ExpressionSyntax invocable, i return SyntaxFactory.ParenthesizedLambdaExpression(parameters, SyntaxFactory.InvocationExpression(invocable)); } - public static CSSyntax.ParameterListSyntax CreateParameterList(IEnumerable ps) + public static CSSyntax.ParameterListSyntax CreateParameterList(IEnumerable ps) { return SyntaxFactory.ParameterList(SyntaxFactory.SeparatedList(ps)); } diff --git a/CodeConverter/CSharp/ProjectMergedDeclarationExtensions.cs b/CodeConverter/CSharp/ProjectMergedDeclarationExtensions.cs index edd019226..cf41e9689 100644 --- a/CodeConverter/CSharp/ProjectMergedDeclarationExtensions.cs +++ b/CodeConverter/CSharp/ProjectMergedDeclarationExtensions.cs @@ -164,7 +164,7 @@ private static async Task RenamePrefixAsync(Project project, string old for (var symbolToRename = await GetElementToRename(project); symbolToRename != null; symbolToRename = await GetElementToRename(project, toSkip)) { string newName = symbolToRename.Name.Replace(oldNamePrefix, newNamePrefix); try { - var renamedSolution = await Renamer.RenameSymbolAsync(project.Solution, symbolToRename, new SymbolRenameOptions(), newName, cancellationToken); + var renamedSolution = await Renamer.RenameSymbolAsync(project.Solution, symbolToRename, newName, project.Solution.Workspace.Options, cancellationToken); project = renamedSolution.GetProject(project.Id); } catch (Exception e) { toSkip++; diff --git a/CodeConverter/CodeConverter.csproj b/CodeConverter/CodeConverter.csproj index 1c292b5d9..80642c84b 100644 --- a/CodeConverter/CodeConverter.csproj +++ b/CodeConverter/CodeConverter.csproj @@ -36,8 +36,9 @@ - - + + + all diff --git a/CodeConverter/Common/SymbolRenamer.cs b/CodeConverter/Common/SymbolRenamer.cs index 3891a30b6..5ee789494 100644 --- a/CodeConverter/Common/SymbolRenamer.cs +++ b/CodeConverter/Common/SymbolRenamer.cs @@ -35,7 +35,7 @@ public static async Task PerformRenamesAsync(Project project, IEnumerab ISymbol currentDeclaration = SymbolFinder.FindSimilarSymbols(originalSymbol, compilation).FirstOrDefault(); if (currentDeclaration == null) continue; //Must have already renamed this symbol for a different reason - solution = await Renamer.RenameSymbolAsync(solution, currentDeclaration, new SymbolRenameOptions(), newName, cancellationToken); + solution = await Renamer.RenameSymbolAsync(solution, currentDeclaration, newName, solution.Workspace.Options); } return solution.GetProject(project.Id); diff --git a/CommandLine/CodeConv.NetFramework/CodeConv.NetFramework.csproj b/CommandLine/CodeConv.NetFramework/CodeConv.NetFramework.csproj index c67bca35f..9f1735fa6 100644 --- a/CommandLine/CodeConv.NetFramework/CodeConv.NetFramework.csproj +++ b/CommandLine/CodeConv.NetFramework/CodeConv.NetFramework.csproj @@ -10,14 +10,14 @@ - + - - - + + + - + diff --git a/CommandLine/CodeConv/CodeConv.csproj b/CommandLine/CodeConv/CodeConv.csproj index db838c8c3..83443a382 100644 --- a/CommandLine/CodeConv/CodeConv.csproj +++ b/CommandLine/CodeConv/CodeConv.csproj @@ -33,9 +33,9 @@ - - - + + + all runtime; build; native; contentfiles; analyzers diff --git a/Func/Func.csproj b/Func/Func.csproj index a7605188b..1efbf0c58 100644 --- a/Func/Func.csproj +++ b/Func/Func.csproj @@ -31,11 +31,11 @@ - - - - - + + + + + diff --git a/README.md b/README.md index 06dd1980c..a7a7ae725 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ Convert code from VB.NET to C# (and vice versa) using Roslyn - all free and open * [Visual Studio extension](https://marketplace.visualstudio.com/items?itemName=SharpDevelopTeam.CodeConverter) * To install close VS and double-click the downloadeded .vsix file * [Online snippet converter](https://icsharpcode.github.io/CodeConverter/) -* Command line `dotnet tool install ICSharpCode.CodeConverter.codeconv --global` (still requires VS2022 17.6+ installed) +* Command line `dotnet tool install ICSharpCode.CodeConverter.codeconv --global` (still requires VS2022 17.1+ installed) * [Nuget library](https://www.nuget.org/packages/ICSharpCode.CodeConverter/) (this underpins all other free converters you'll find online) See [wiki](https://github.com/icsharpcode/CodeConverter/wiki) for advice on getting the best results, or the [changelog](https://github.com/icsharpcode/CodeConverter/blob/master/CHANGELOG.md) for recent improvements. @@ -15,7 +15,7 @@ See [wiki](https://github.com/icsharpcode/CodeConverter/wiki) for advice on gett Adds context menu items to convert projects/files between VB.NET and C#. See the [wiki documentation](https://github.com/icsharpcode/CodeConverter/wiki) for advice / help using it. -Download from [Visual Studio Marketplace](https://marketplace.visualstudio.com/items?itemName=SharpDevelopTeam.CodeConverter) (Use VS 2022 17.6+) +Download from [Visual Studio Marketplace](https://marketplace.visualstudio.com/items?itemName=SharpDevelopTeam.CodeConverter) (Use VS 2022 17.1+) * Flexible: Convert a small selection, or a whole solution in one go, in either direction. * Accurate: Full project context (through Roslyn) is used to get the most accurate conversion. diff --git a/Tests/Tests.csproj b/Tests/Tests.csproj index 8901c1bf4..01aef701e 100644 --- a/Tests/Tests.csproj +++ b/Tests/Tests.csproj @@ -36,10 +36,10 @@ - - - - + + + +