Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
d31e02c
git insists on commiting this formatting change
GrahamTheCoder Nov 15, 2025
26324ca
Default vscode setup
GrahamTheCoder Nov 15, 2025
3a207d2
Use enumerable method, not array method
GrahamTheCoder Nov 15, 2025
33c66c8
Remove duplicated
GrahamTheCoder Nov 15, 2025
669966b
Update ConsoleApp4.vbproj to target .NET 10.0
GrahamTheCoder Nov 15, 2025
462d5e4
Project says netcore - stop it tageting netframework
GrahamTheCoder Nov 15, 2025
132dccd
Don't force accessibility modifiers on interfaces
GrahamTheCoder Nov 15, 2025
765a3ea
Upgrade, and use type that becomes preferred in later versions
GrahamTheCoder Nov 15, 2025
7075a86
Remove NetFramework project from sln (can tidy up fully later)
GrahamTheCoder Nov 15, 2025
68cf7dd
Enable tests
GrahamTheCoder Nov 15, 2025
0aca918
Fix compile issues
GrahamTheCoder Nov 15, 2025
864f150
Optional cancellation
GrahamTheCoder Nov 15, 2025
30a8eea
Move to new library to allow dotnet10 compatibility (it has a breakin…
GrahamTheCoder Nov 15, 2025
b280e11
Use new overload - the extra rename options can all be left as defaul…
GrahamTheCoder Nov 15, 2025
cc61579
Fixups for API changes
GrahamTheCoder Nov 15, 2025
614d868
Upgrade versions SPIKE: Ignore warnings to get compiling so I can test
GrahamTheCoder Nov 15, 2025
3569e02
Remove dependencies including build locator - theoretically this is a…
GrahamTheCoder Nov 15, 2025
dbeef5f
Add new project, remove old
GrahamTheCoder Nov 15, 2025
e588686
Paste across files and tweak to try to get compiling as before
GrahamTheCoder Nov 15, 2025
ce78a88
Totally redo this converter by getting AI to merge in bits of a separ…
GrahamTheCoder Nov 15, 2025
4c94be2
Reintegrate existing logic
GrahamTheCoder Nov 15, 2025
b113149
Remove superfluous - todo check if there were any extra failure types…
GrahamTheCoder Nov 15, 2025
3966664
Get compilable
GrahamTheCoder Nov 15, 2025
a5c311d
Prepare for .NET 10 upgrade
GrahamTheCoder Nov 15, 2025
4c91085
Store final changes for step 'Validate that a .NET 10.0 SDK required …
GrahamTheCoder Nov 15, 2025
0ea3757
Modernize CSharpConsoleApp.csproj to SDK-style format
GrahamTheCoder Nov 15, 2025
38fc8f8
Remove unused references from CSharpConsoleApp.csproj
GrahamTheCoder Nov 15, 2025
43f4995
Store final changes for step 'Upgrade ConsoleApp2/CSharpConsoleApp.cs…
GrahamTheCoder Nov 15, 2025
72aac81
Move these test projs to dot net 10 and net standard
GrahamTheCoder Nov 15, 2025
c28f81d
Totally overwrite previous output of these tests
GrahamTheCoder Nov 15, 2025
fa6ba19
Try to add references to useful things
GrahamTheCoder Nov 15, 2025
6571042
Remove old built in api - I think we always use the azure function now
GrahamTheCoder Nov 16, 2025
14d93eb
Get references working the same as before in tests at least
GrahamTheCoder Nov 16, 2025
80369d7
Accept changes which seem fine and likely just caused by evolving lib…
GrahamTheCoder Nov 16, 2025
47f0b1f
Make results closer match for existing
GrahamTheCoder Nov 16, 2025
4a6e2ff
These don't matter much - it's hard to reference webui nowadays
GrahamTheCoder Nov 16, 2025
9c19a67
Remove accidental copying of default value for these
GrahamTheCoder Nov 16, 2025
ebff467
Fall back on handling private or unknown cs symbols based on their sy…
GrahamTheCoder Nov 16, 2025
f4b2f84
These changes seem ok
GrahamTheCoder Nov 16, 2025
907a497
Take a best effort match. ExtractBestMatch is a bit of a misnomer - i…
GrahamTheCoder Nov 16, 2025
d4c6bd8
Remove old net framework version
GrahamTheCoder Nov 16, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ dotnet_diagnostic.RCS1124.severity = none
dotnet_diagnostic.RCS1077.severity = none

# IDE0040: Add accessibility modifiers
dotnet_style_require_accessibility_modifiers = always:warning
dotnet_style_require_accessibility_modifiers = for_non_interface_members:warning

# IDE0048: Add parentheses for clarity
dotnet_style_parentheses_in_relational_binary_operators = always_for_clarity:none
Expand Down
34 changes: 34 additions & 0 deletions .github/upgrades/dotnet-upgrade-plan.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# .NET 10 Upgrade Plan

## Execution Steps

Execute steps below sequentially one by one in the order they are listed.

1. Validate that a .NET 10.0 SDK required for this upgrade is installed on the machine and if not, help to get it installed.
2. Ensure that the SDK version specified in global.json files is compatible with the .NET 10.0 upgrade.
3. Upgrade CSharpNetStandardLib/CSharpNetStandardLib.csproj
4. Upgrade ConsoleApp2/CSharpConsoleApp.csproj
5. Upgrade ConsoleApp1/VisualBasicConsoleApp.vbproj

## Settings

### Project upgrade details

#### CSharpNetStandardLib/CSharpNetStandardLib.csproj modifications

Project properties changes:
- Target framework should be changed from `netstandard2.0` to `net10.0`

#### ConsoleApp2/CSharpConsoleApp.csproj modifications

Project file needs to be converted to SDK-style format.

Project properties changes:
- Target framework should be changed from `.NETFramework,Version=v4.8` to `net10.0`

#### ConsoleApp1/VisualBasicConsoleApp.vbproj modifications

Project file needs to be converted to SDK-style format.

Project properties changes:
- Target framework should be changed from `.NETFramework,Version=v4.8` to `net10.0`
35 changes: 35 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
{
"version": "0.2.0",
"configurations": [
{
// Use IntelliSense to find out which attributes exist for C# debugging
// Use hover for the description of the existing attributes
// For further information visit https://github.com/dotnet/vscode-csharp/blob/main/debugger-launchjson.md.
"name": ".NET Core Launch (web)",
"type": "coreclr",
"request": "launch",
"preLaunchTask": "build",
// If you have changed target frameworks, make sure to update the program path.
"program": "${workspaceFolder}/Web/bin/Debug/ICSharpCode.CodeConverter.Web.dll",
"args": [],
"cwd": "${workspaceFolder}/Web",
"stopAtEntry": false,
// Enable launching a web browser when ASP.NET Core starts. For more information: https://aka.ms/VSCode-CS-LaunchJson-WebBrowser
"serverReadyAction": {
"action": "openExternally",
"pattern": "\\bNow listening on:\\s+(https?://\\S+)"
},
"env": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"sourceFileMap": {
"/Views": "${workspaceFolder}/Views"
}
},
{
"name": ".NET Core Attach",
"type": "coreclr",
"request": "attach"
}
]
}
5 changes: 5 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"dotnet.preferCSharpExtension": true,
"dotnet.defaultSolution": "CodeConverter.sln",
"vscode-as-git-mergetool.settingsAssistantOnStartup": false
}
41 changes: 41 additions & 0 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
{
"version": "2.0.0",
"tasks": [
{
"label": "build",
"command": "dotnet",
"type": "process",
"args": [
"build",
"${workspaceFolder}/CodeConverter.sln",
"/property:GenerateFullPaths=true",
"/consoleloggerparameters:NoSummary;ForceNoAlign"
],
"problemMatcher": "$msCompile"
},
{
"label": "publish",
"command": "dotnet",
"type": "process",
"args": [
"publish",
"${workspaceFolder}/CodeConverter.sln",
"/property:GenerateFullPaths=true",
"/consoleloggerparameters:NoSummary;ForceNoAlign"
],
"problemMatcher": "$msCompile"
},
{
"label": "watch",
"command": "dotnet",
"type": "process",
"args": [
"watch",
"run",
"--project",
"${workspaceFolder}/CodeConverter.sln"
],
"problemMatcher": "$msCompile"
}
]
}
15 changes: 2 additions & 13 deletions CodeConverter.sln
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.1.31911.260
# Visual Studio Version 18
VisualStudioVersion = 18.0.11205.157 d18.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CodeConverter", "CodeConverter\CodeConverter.csproj", "{7EA075C6-6406-445C-AB77-6C47AFF88D58}"
EndProject
Expand All @@ -26,12 +26,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "CommandLine", "CommandLine"
CommandLine\README.md = CommandLine\README.md
EndProjectSection
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CodeConv.NetFramework", "CommandLine\CodeConv.NetFramework\CodeConv.NetFramework.csproj", "{CF18CBCF-67FF-46CA-8D1D-3221B7706D7D}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CodeConv", "CommandLine\CodeConv\CodeConv.csproj", "{160F0B34-0F6F-4532-8D7B-39064956364D}"
ProjectSection(ProjectDependencies) = postProject
{CF18CBCF-67FF-46CA-8D1D-3221B7706D7D} = {CF18CBCF-67FF-46CA-8D1D-3221B7706D7D}
EndProjectSection
EndProject
Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "CodeConv.Shared", "CommandLine\CodeConv.Shared\CodeConv.Shared.shproj", "{D3A957FF-DAFC-4265-9AE2-D94F6473411A}"
EndProject
Expand Down Expand Up @@ -59,10 +54,6 @@ Global
{08A20D4F-6310-43BB-B339-6317ACF3B52E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{08A20D4F-6310-43BB-B339-6317ACF3B52E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{08A20D4F-6310-43BB-B339-6317ACF3B52E}.Release|Any CPU.Build.0 = Release|Any CPU
{CF18CBCF-67FF-46CA-8D1D-3221B7706D7D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{CF18CBCF-67FF-46CA-8D1D-3221B7706D7D}.Debug|Any CPU.Build.0 = Debug|Any CPU
{CF18CBCF-67FF-46CA-8D1D-3221B7706D7D}.Release|Any CPU.ActiveCfg = Release|Any CPU
{CF18CBCF-67FF-46CA-8D1D-3221B7706D7D}.Release|Any CPU.Build.0 = Release|Any CPU
{160F0B34-0F6F-4532-8D7B-39064956364D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{160F0B34-0F6F-4532-8D7B-39064956364D}.Debug|Any CPU.Build.0 = Debug|Any CPU
{160F0B34-0F6F-4532-8D7B-39064956364D}.Release|Any CPU.ActiveCfg = Release|Any CPU
Expand All @@ -76,7 +67,6 @@ Global
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{CF18CBCF-67FF-46CA-8D1D-3221B7706D7D} = {926D43FE-D6AE-45E7-A933-8A0F866E7876}
{160F0B34-0F6F-4532-8D7B-39064956364D} = {926D43FE-D6AE-45E7-A933-8A0F866E7876}
{D3A957FF-DAFC-4265-9AE2-D94F6473411A} = {926D43FE-D6AE-45E7-A933-8A0F866E7876}
EndGlobalSection
Expand All @@ -85,7 +75,6 @@ Global
EndGlobalSection
GlobalSection(SharedMSBuildProjectFiles) = preSolution
CommandLine\CodeConv.Shared\CodeConv.Shared.projitems*{160f0b34-0f6f-4532-8d7b-39064956364d}*SharedItemsImports = 5
CommandLine\CodeConv.Shared\CodeConv.Shared.projitems*{cf18cbcf-67ff-46ca-8d1d-3221b7706d7d}*SharedItemsImports = 5
CommandLine\CodeConv.Shared\CodeConv.Shared.projitems*{d3a957ff-dafc-4265-9ae2-d94f6473411a}*SharedItemsImports = 13
EndGlobalSection
EndGlobal
13 changes: 11 additions & 2 deletions CodeConverter/CSharp/ArgumentConverter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public async Task<CSharpSyntaxNode> ConvertSimpleArgumentAsync(VBSyntax.SimpleAr
var baseSymbol = symbol?.OriginalDefinition.GetBaseSymbol();
var possibleParameters = (CommonConversions.GetCsOriginalSymbolOrNull(baseSymbol) ?? symbol)?.GetParameters();
if (possibleParameters.HasValue) {
var refType = _semanticModel.GetRefConversionType(node, argList, possibleParameters.Value, out var argName, out var refKind);
var refType = CommonConversions.GetRefConversionType(node, argList, possibleParameters.Value, out var argName, out var refKind);
token = CommonConversions.GetRefToken(refKind);
if (refType != SemanticModelExtensions.RefConversion.Inline) {
convertedArgExpression = HoistByRefDeclaration(node, convertedArgExpression, refType, argName, refKind);
Expand Down Expand Up @@ -147,14 +147,23 @@ private CSSyntax.ExpressionSyntax HoistByRefDeclaration(VBSyntax.SimpleArgumentS
private ISymbol GetInvocationSymbol(SyntaxNode invocation)
{
var symbol = invocation.TypeSwitch(
(VBSyntax.InvocationExpressionSyntax e) => _semanticModel.GetSymbolInfo(e).ExtractBestMatch<ISymbol>(),
(VBSyntax.InvocationExpressionSyntax e) => _semanticModel.GetSymbolInfo(e).CandidateSymbols
.OrderByDescending(s => s.GetParameters().Length == e.ArgumentList.Arguments.Count)
.ThenByDescending(s => ParameterMatchScore(s, e.ArgumentList.Arguments))
.FirstOrDefault(),
(VBSyntax.ObjectCreationExpressionSyntax e) => _semanticModel.GetSymbolInfo(e).ExtractBestMatch<ISymbol>(),
(VBSyntax.RaiseEventStatementSyntax e) => _semanticModel.GetSymbolInfo(e.Name).ExtractBestMatch<ISymbol>(),
(VBSyntax.MidExpressionSyntax _) => CommonConversions.KnownTypes.VbCompilerStringType?.GetMembers("MidStmtStr").FirstOrDefault(),
_ => throw new NotSupportedException());
return symbol;
}

private static int ParameterMatchScore(ISymbol symbol, SeparatedSyntaxList<VBSyntax.ArgumentSyntax> arguments)
{
//TODO: Match on name/position and type
return 1;
}

private IEnumerable<CSSyntax.ArgumentSyntax> GetAdditionalRequiredArgs(
IEnumerable<VBSyntax.ArgumentSyntax> arguments,
ISymbol invocationSymbol)
Expand Down
26 changes: 23 additions & 3 deletions CodeConverter/CSharp/CommonConversions.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System.Linq.Expressions;
using System.Collections.Immutable;
using System.Linq.Expressions;
using System.Runtime.CompilerServices;
using ICSharpCode.CodeConverter.Util.FromRoslyn;
using Microsoft.CodeAnalysis.Classification;
Expand Down Expand Up @@ -577,7 +578,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.Children.First() == pro;
var isSetter = pro.Parent.Kind == OperationKind.SimpleAssignment && pro.Parent.ChildOperations.First() == pro;
var extraArg = isSetter
? await GetParameterizedSetterArgAsync(operation)
: null;
Expand Down Expand Up @@ -669,6 +670,7 @@ public ISymbol GetCsOriginalSymbolOrNull(ISymbol symbol)
symbol = symbol.OriginalDefinition;
// Construct throws an exception if ConstructedFrom differs from it, so let's use ConstructedFrom directly
var symbolToFind = symbol is IMethodSymbol m ? m.ConstructedFrom : symbol;
// This no longer works for private members: https://github.com/dotnet/roslyn/issues/72369#issuecomment-1975066163
var similarSymbol = SymbolFinder.FindSimilarSymbols(symbolToFind, _csCompilation).FirstOrDefault();
return similarSymbol;
}
Expand All @@ -684,7 +686,7 @@ public static ExpressionSyntax ThrowawayParameters(ExpressionSyntax invocable, i

public static CSSyntax.ParameterListSyntax CreateParameterList(IEnumerable<SyntaxNode> ps)
{
return SyntaxFactory.ParameterList(SyntaxFactory.SeparatedList(ps));
return SyntaxFactory.ParameterList(SyntaxFactory.SeparatedList(ps.Cast<CSSyntax.ParameterSyntax>()));
}

public static ExpressionSyntax NotNothingComparison(ExpressionSyntax otherArgument, bool isReferenceType, bool inExpressionLambda = false)
Expand Down Expand Up @@ -747,6 +749,9 @@ public RefKind GetCsRefKind(IParameterSymbol vbParameter, Microsoft.CodeAnalysis
return csParam.RefKind;
}

var syntaxNodes = vbParameter?.DeclaringSyntaxReferences.Select(r => r.GetSyntax());
optionalParameterSyntax ??= syntaxNodes?.OfType<VBSyntax.ParameterSyntax>().FirstOrDefault();

if (optionalParameterSyntax?.AttributeLists.Any(this.HasOutAttribute) == true) {
return RefKind.Out;
}
Expand Down Expand Up @@ -800,4 +805,19 @@ public async Task<CSharpSyntaxNode> WithRemovedRedundantConversionOrNullAsync(VB
return writtenByUser ? null : this.TypeConversionAnalyzer.AddExplicitConversion(conversionArg, csharpArg,
forceTargetType: forceTargetType, defaultToCast: true);
}

public SemanticModelExtensions.RefConversion GetRefConversionType(VBSyntax.ArgumentSyntax node, VBSyntax.ArgumentListSyntax argList, ImmutableArray<IParameterSymbol> parameters, out string argName, out RefKind refKind)
{
var parameter = node.IsNamed && node is VBSyntax.SimpleArgumentSyntax sas
? parameters.FirstOrDefault(p => p.Name.Equals(sas.NameColonEquals.Name.Identifier.Text, StringComparison.OrdinalIgnoreCase))
: parameters.ElementAtOrDefault(argList.Arguments.IndexOf(node));
if (parameter != null) {
refKind = GetCsRefKind(parameter);
argName = parameter.Name;
} else {
refKind = RefKind.None;
argName = null;
}
return SemanticModel.NeedsVariableForArgument(node, refKind);
}
}
8 changes: 5 additions & 3 deletions CodeConverter/CSharp/HandledEventsAnalyzer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,9 @@ private async Task<HandledEventsAnalysis> AnalyzeAsync()
.ToDictionary(m => m.Key, g => g.First(), StringComparer.OrdinalIgnoreCase); // Uses the fact that GroupBy maintains addition order to get the closest declaration
#pragma warning restore RS1024 // Compare symbols correctly

var writtenWithEventsProperties = await ancestorPropsMembersByName.Values.OfType<IPropertySymbol>().ToAsyncEnumerable().ToDictionaryAwaitAsync(async p => p.Name, async p => (p, await IsNeverWrittenOrOverriddenAsync(p)), StringComparer.OrdinalIgnoreCase);

var writtenWithEventsProperties = await ancestorPropsMembersByName.Values.OfType<IPropertySymbol>().ToAsyncEnumerable()
.ToDictionaryAsync(async (p, _) => p.Name, async (p, cancellationToken) => (p, await IsNeverWrittenOrOverriddenAsync(p, cancellationToken)));

var eventContainerToMethods = _type.GetMembers().OfType<IMethodSymbol>()
.SelectMany(HandledEvents)
Expand All @@ -62,10 +64,10 @@ private static int ParametersToDiscard(IEventSymbol e, IMethodSymbol handlingMet
return toDiscard;
}

private async Task<bool> IsNeverWrittenOrOverriddenAsync(ISymbol symbol)
private async Task<bool> IsNeverWrittenOrOverriddenAsync(ISymbol symbol, CancellationToken cancellationToken = default)
{
var projectSolution = _commonConversions.Document.Project.Solution;
if (!await projectSolution.IsNeverWrittenAsync(symbol, _initializeComponentLocationOrNull)) return false;
if (!await projectSolution.IsNeverWrittenAsync(symbol, _initializeComponentLocationOrNull, cancellationToken: cancellationToken)) return false;
return !_typeToInheritors.Contains(symbol.ContainingType);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -542,7 +542,7 @@ public override async Task<SyntaxList<StatementSyntax>> VisitMultiLineIfBlock(VB
elseClause = elseClause.WithVbSourceMappingFrom(node.ElseBlock); //Special case where explicit mapping is needed since block becomes clause so cannot be easily visited

var elseIfBlocks = await node.ElseIfBlocks.SelectAsync(async elseIf => await ConvertElseIfAsync(elseIf));
foreach (var elseIf in elseIfBlocks.Reverse()) {
foreach (var elseIf in Enumerable.Reverse(elseIfBlocks)) {
var ifStmt = SyntaxFactory.IfStatement(elseIf.ElseIfCondition, elseIf.ElseBlock, elseClause);
elseClause = SyntaxFactory.ElseClause(ifStmt);
}
Expand Down
4 changes: 2 additions & 2 deletions CodeConverter/CSharp/NameExpressionNodeVisitor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -435,7 +435,7 @@ List<IParameterSymbol> GetRefParameters(VBSyntax.ArgumentListSyntax argumentList
var arg = (ArgumentSyntax)CommonConversions.CsSyntaxGenerator.Argument(p.RefKind, SyntaxFactory.IdentifierName(p.Name));
arguments.Add(arg);
var par = (ParameterSyntax)CommonConversions.CsSyntaxGenerator.ParameterDeclaration(p);
parameters.Add(par);
parameters.Add(par.WithDefault(null));
}
return (SyntaxFactory.SeparatedList(arguments), SyntaxFactory.SeparatedList(parameters));
}
Expand All @@ -452,7 +452,7 @@ private bool RequiresLocalFunction(VBSyntax.InvocationExpressionSyntax invocatio

bool RequiresLocalFunction(RefConversion possibleInline, VBSyntax.InvocationExpressionSyntax invocation, IMethodSymbol invocationSymbol, VBSyntax.ArgumentSyntax a)
{
var refConversion = _semanticModel.GetRefConversionType(a, invocation.ArgumentList, invocationSymbol.Parameters, out string _, out _);
var refConversion = CommonConversions.GetRefConversionType(a, invocation.ArgumentList, invocationSymbol.Parameters, out string _, out _);
if (RefConversion.Inline == refConversion || possibleInline == refConversion) return false;
if (!(a is VBSyntax.SimpleArgumentSyntax sas)) return false;
var argExpression = sas.Expression.SkipIntoParens();
Expand Down
3 changes: 1 addition & 2 deletions CodeConverter/CSharp/PerScopeState.cs
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ public IEnumerable<StatementSyntax> ConvertContinue(VBasic.SyntaxKind vbBlockKey
{
var scopesToExit = _hoistedNodesPerScope.Where(x => x.ExitableKind is not VBasic.SyntaxKind.None).TakeWhile(x => x.ExitableKind != vbBlockKeywordKind && x.IsBreakableInCs).ToArray();
// Select is breakable, but not continuable, so only need to break out of it on the way to something else, not if it's last.
scopesToExit = scopesToExit.Reverse().SkipWhile(x => x.ExitableKind is VBasic.SyntaxKind.SelectKeyword).Reverse().ToArray();
scopesToExit = Enumerable.Reverse(scopesToExit).SkipWhile(x => x.ExitableKind is VBasic.SyntaxKind.SelectKeyword).Reverse().ToArray();
var assignmentExpression = CommonConversions.Literal(true);
int i = 0;
foreach (var scope in scopesToExit) {
Expand Down Expand Up @@ -253,7 +253,6 @@ private static AdditionalDeclaration HoistConditionalBreakOrContinue(ScopeState
var ifTrue = new PostIfTrueBlock(scopeVar.IdentifierName, stmt);
scope.HoistedNodes.Add(scopeVar);
scope.HoistedNodes.Add(ifTrue);
return scopeVar;
}

return scopeVar;
Expand Down
2 changes: 1 addition & 1 deletion CodeConverter/CSharp/ProjectMergedDeclarationExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ private static async Task<Project> 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, newName, project.Solution.Workspace.Options, cancellationToken);
var renamedSolution = await Renamer.RenameSymbolAsync(project.Solution, symbolToRename, new SymbolRenameOptions(), newName, cancellationToken);
project = renamedSolution.GetProject(project.Id);
} catch (Exception e) {
toSkip++;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ private static ExpressionSyntax ReplacePlaceholderArgs(ExpressionSyntax zeroOrSi
private static bool QualifiedMethodNameMatches(ISymbol symbol, params string[] parts)
{
if (symbol == null) return false;
foreach (var part in parts.Reverse()) {
foreach (var part in Enumerable.Reverse(parts)) {
if (!part.Equals(symbol.Name, StringComparison.OrdinalIgnoreCase)) return false;
symbol = symbol.ContainingSymbol;
}
Expand Down
Loading
Loading