Skip to content

Commit d97bfbb

Browse files
committed
Revert "Merge pull request icsharpcode#1223 from GrahamTheCoder/master"
This reverts commit 63c7a2a, reversing changes made to 763a24b.
1 parent 3c6b556 commit d97bfbb

15 files changed

+27
-229
lines changed

.github/scripts/update-testdata-targetframework.ps1

Lines changed: 0 additions & 57 deletions
This file was deleted.

.github/workflows/dotnet-tests.yml

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ jobs:
1919

2020
steps:
2121
- uses: actions/checkout@v4
22+
2223
- name: Setup .NET
2324
uses: actions/setup-dotnet@v4
2425
with:
@@ -29,19 +30,11 @@ jobs:
2930
with:
3031
vs-version: ${{ inputs.vs-version }}
3132

32-
- name: Build
33-
run: dotnet build DotNetBuildable.slnf /p:Configuration=Release
34-
35-
- name: Create global.json to enforce .NET 8 for MSBuild and update Tests/TestData projects
36-
if: inputs.dotnet-version == '8.0.x'
37-
shell: pwsh
38-
run: ./.github/scripts/update-testdata-targetframework.ps1
39-
4033
- name: Log MSBuild version
4134
run: msbuild -version
4235

43-
- name: Log .NET version
44-
run: dotnet --info
36+
- name: Build
37+
run: dotnet build DotNetBuildable.slnf /p:Configuration=Release
4538

4639
- name: Execute unit tests
47-
run: dotnet test Tests/Tests.csproj -c Release --framework net${{ inputs.dotnet-version == '8.0.x' && '8.0' || '10.0' }} --no-build
40+
run: dotnet test Tests/bin/Release/ICSharpCode.CodeConverter.Tests.dll

.github/workflows/dotnet.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ on:
77
branches: [ master, main ]
88

99
env:
10-
BuildVersion: '10.0.1'
10+
BuildVersion: '10.0.0'
1111

1212
jobs:
1313
build:

CHANGELOG.md

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -14,17 +14,6 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
1414
### C# -> VB
1515

1616

17-
## [10.0.1] - 2026-02-28
18-
19-
* Reintroduce tentative legacy support for dotnet 8 and VS2022
20-
* Support slnx format [1195](https://github.com/icsharpcode/CodeConverter/issues/1195)
21-
22-
### VB -> C#
23-
* Fix for ReDim Preserve of array property - [#1156](https://github.com/icsharpcode/CodeConverter/issues/1156)
24-
* Fix for with block conversion with null conditional [#1174](https://github.com/icsharpcode/CodeConverter/issues/1174)
25-
Fixes #1195
26-
27-
2817
## [10.0.0] - 2026-02-06
2918

3019
* Support for net framework dropped. Please use an older version if you are converting projects that still use it.

CodeConverter/CSharp/MethodBodyExecutableStatementVisitor.cs

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -320,18 +320,8 @@ private async Task<SyntaxList<StatementSyntax>> ConvertRedimClauseAsync(VBSyntax
320320
var csTargetArrayExpression = await node.Expression.AcceptAsync<ExpressionSyntax>(_expressionVisitor);
321321
var convertedBounds = (await CommonConversions.ConvertArrayBoundsAsync(node.ArrayBounds)).Sizes.ToList();
322322
if (preserve && convertedBounds.Count == 1) {
323-
bool isProperty = _semanticModel.GetSymbolInfo(node.Expression).Symbol?.IsKind(SymbolKind.Property) == true;
324-
var arrayToResize = isProperty ? CreateLocalVariableWithUniqueName(node.Expression, "arg" + csTargetArrayExpression.ToString().Split('.').Last(), csTargetArrayExpression) : default;
325-
var resizeArg = isProperty ? (ExpressionSyntax)arrayToResize.Reference : csTargetArrayExpression;
326-
327-
var argumentList = new[] { resizeArg, convertedBounds.Single() }.CreateCsArgList(SyntaxKind.RefKeyword);
323+
var argumentList = new[] { csTargetArrayExpression, convertedBounds.Single() }.CreateCsArgList(SyntaxKind.RefKeyword);
328324
var arrayResize = SyntaxFactory.InvocationExpression(ValidSyntaxFactory.MemberAccess(nameof(Array), nameof(Array.Resize)), argumentList);
329-
330-
if (isProperty) {
331-
var assignment = SyntaxFactory.AssignmentExpression(SyntaxKind.SimpleAssignmentExpression, csTargetArrayExpression, arrayToResize.Reference);
332-
return SyntaxFactory.List(new StatementSyntax[] { arrayToResize.Declaration, SyntaxFactory.ExpressionStatement(arrayResize), SyntaxFactory.ExpressionStatement(assignment) });
333-
}
334-
335325
return SingleStatement(arrayResize);
336326
}
337327
var newArrayAssignment = CreateNewArrayAssignment(node.Expression, csTargetArrayExpression, convertedBounds);

CodeConverter/CSharp/NameExpressionNodeVisitor.cs

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
using System.Data;
1+
using System.Data;
22
using System.Globalization;
33
using ICSharpCode.CodeConverter.CSharp.Replacements;
44
using ICSharpCode.CodeConverter.Util.FromRoslyn;
@@ -688,19 +688,14 @@ private static QualifiedNameSyntax Qualify(string qualification, ExpressionSynta
688688

689689
private static bool IsSubPartOfConditionalAccess(VBasic.Syntax.MemberAccessExpressionSyntax node)
690690
{
691-
static bool IsMemberAccessChain(SyntaxNode exp) =>
692-
exp?.IsKind(VBasic.SyntaxKind.InvocationExpression,
693-
VBasic.SyntaxKind.SimpleMemberAccessExpression,
694-
VBasic.SyntaxKind.ParenthesizedExpression,
695-
VBasic.SyntaxKind.ConditionalAccessExpression) == true;
696-
697-
for (SyntaxNode child = node, parent = node.Parent; IsMemberAccessChain(parent); child = parent, parent = parent.Parent) {
698-
if (parent is VBSyntax.ConditionalAccessExpressionSyntax cae && cae.WhenNotNull == child) {
699-
return true; // On right hand side of a ?. conditional access
700-
}
691+
var firstPossiblyConditionalAncestor = node.Parent;
692+
while (firstPossiblyConditionalAncestor != null &&
693+
firstPossiblyConditionalAncestor.IsKind(VBasic.SyntaxKind.InvocationExpression,
694+
VBasic.SyntaxKind.SimpleMemberAccessExpression)) {
695+
firstPossiblyConditionalAncestor = firstPossiblyConditionalAncestor.Parent;
701696
}
702697

703-
return false;
698+
return firstPossiblyConditionalAncestor?.IsKind(VBasic.SyntaxKind.ConditionalAccessExpression) == true;
704699
}
705700

706701
private static CSharpSyntaxNode ReplaceRightmostIdentifierText(CSharpSyntaxNode expr, SyntaxToken idToken, string overrideIdentifier)

CodeConverter/Common/SolutionFileTextEditor.cs

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -15,21 +15,9 @@ public class SolutionFileTextEditor : ISolutionFileTextEditor
1515
var projectReferenceReplacements = new List<(string Find, string Replace, bool FirstOnly)>();
1616
foreach (var relativeProjPath in relativeProjPaths)
1717
{
18-
// Add replacements for both backslash and forward-slash variants so .slnx files using either separator are handled
19-
var nativeVariant = relativeProjPath;
20-
var altVariant = relativeProjPath.Replace(Path.DirectorySeparatorChar, Path.AltDirectorySeparatorChar);
21-
22-
// native (likely backslashes on Windows)
23-
var escapedNative = Regex.Escape(nativeVariant);
24-
var newNative = PathConverter.TogglePathExtension(nativeVariant);
25-
projectReferenceReplacements.Add((escapedNative, newNative, false));
26-
27-
// alternate (forward slashes)
28-
if (altVariant != nativeVariant) {
29-
var escapedAlt = Regex.Escape(altVariant);
30-
var newAlt = PathConverter.TogglePathExtension(altVariant);
31-
projectReferenceReplacements.Add((escapedAlt, newAlt, false));
32-
}
18+
var escapedProjPath = Regex.Escape(relativeProjPath);
19+
var newProjPath = PathConverter.TogglePathExtension(relativeProjPath);
20+
projectReferenceReplacements.Add((escapedProjPath, newProjPath, false));
3321
}
3422

3523
return projectReferenceReplacements;

Directory.Build.props

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@
88
<WarningLevel>4</WarningLevel>
99
<EnforceCodeStyleInBuild>true</EnforceCodeStyleInBuild>
1010
<LangVersion Condition="'$(LangVersion)' == ''">14.0</LangVersion>
11-
<AssemblyVersion>10.0.1.0</AssemblyVersion>
12-
<FileVersion>10.0.1.0</FileVersion>
13-
<Version>10.0.1</Version>
11+
<AssemblyVersion>10.0.0.0</AssemblyVersion>
12+
<FileVersion>10.0.0.0</FileVersion>
13+
<Version>10.0.0</Version>
1414
<Authors>ICSharpCode</Authors>
1515
<Copyright>Copyright (c) 2017-2023 AlphaSierraPapa for the CodeConverter team</Copyright>
1616
<Company>ICSharpCode</Company>

Tests/CSharp/StatementTests/MethodStatementTests.cs

Lines changed: 2 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
using System.Threading.Tasks;
1+
using System.Threading.Tasks;
22
using ICSharpCode.CodeConverter.Tests.TestRunners;
33
using Xunit;
44

@@ -1673,44 +1673,4 @@ public object Func()
16731673
}
16741674
}");
16751675
}
1676-
1677-
[Fact]
1678-
public async Task WithBlockWithNullConditionalAccessAsync()
1679-
{
1680-
await TestConversionVisualBasicToCSharpAsync(@"
1681-
Public Class Class1
1682-
Public Property x As Class1
1683-
Public Property Name As String
1684-
End Class
1685-
1686-
Public Class TestClass
1687-
Private _Data As Class1
1688-
Private x As String
1689-
1690-
Public Sub TestMethod()
1691-
With _Data
1692-
x = .x?.Name
1693-
End With
1694-
End Sub
1695-
End Class", @"
1696-
public partial class Class1
1697-
{
1698-
public Class1 x { get; set; }
1699-
public string Name { get; set; }
1700-
}
1701-
1702-
public partial class TestClass
1703-
{
1704-
private Class1 _Data;
1705-
private string x;
1706-
1707-
public void TestMethod()
1708-
{
1709-
{
1710-
ref var withBlock = ref _Data;
1711-
x = withBlock.x?.Name;
1712-
}
1713-
}
1714-
}");
1715-
}
1716-
}
1676+
}

Tests/CSharp/StatementTests/RedimPreserveTests.cs

Lines changed: 0 additions & 33 deletions
This file was deleted.

0 commit comments

Comments
 (0)