Skip to content

Commit

Permalink
update fork 2024 (#5)
Browse files Browse the repository at this point in the history
* 9.0.3

* Do not run default code from UI against real converter to save on execution costs

* Apply timeout to simplification

* 9.0.4

* Bump node-forge from 0.10.0 to 1.3.1 in /Web/ClientApp

Bumps [node-forge](https://github.com/digitalbazaar/forge) from 0.10.0 to 1.3.1.
- [Release notes](https://github.com/digitalbazaar/forge/releases)
- [Changelog](https://github.com/digitalbazaar/forge/blob/main/CHANGELOG.md)
- [Commits](digitalbazaar/forge@0.10.0...v1.3.1)

---
updated-dependencies:
- dependency-name: node-forge
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <[email protected]>

* Bump json-schema from 0.3.0 to 0.4.0 in /Web/ClientApp

Bumps [json-schema](https://github.com/kriszyp/json-schema) from 0.3.0 to 0.4.0.
- [Release notes](https://github.com/kriszyp/json-schema/releases)
- [Commits](kriszyp/json-schema@v0.3.0...v0.4.0)

---
updated-dependencies:
- dependency-name: json-schema
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <[email protected]>

* Update CHANGELOG.md

* VB -> CS: Continue the correct of several continuable nested blocks - fixes icsharpcode#946

* Dedupe multiple exit/continue variables

* VB -> CS: Declare inline variable when referencing anonymously in VB - fixes icsharpcode#949

* At least avoid NRE in icsharpcode#948

Doesn't actually fix orderby and select of group though

* Update vb2cs_bug_report.md

* Update cs2vb_bug_report.md

* Update bug_report.md

* Bump loader-utils from 1.4.0 to 1.4.1 in /Web/ClientApp

Bumps [loader-utils](https://github.com/webpack/loader-utils) from 1.4.0 to 1.4.1.
- [Release notes](https://github.com/webpack/loader-utils/releases)
- [Changelog](https://github.com/webpack/loader-utils/blob/v1.4.1/CHANGELOG.md)
- [Commits](webpack/loader-utils@v1.4.0...v1.4.1)

---
updated-dependencies:
- dependency-name: loader-utils
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <[email protected]>

* Bump minimatch and recursive-readdir in /Web/ClientApp

Bumps [minimatch](https://github.com/isaacs/minimatch) and [recursive-readdir](https://github.com/jergason/recursive-readdir). These dependencies needed to be updated together.

Updates `minimatch` from 3.0.4 to 3.1.2
- [Release notes](https://github.com/isaacs/minimatch/releases)
- [Commits](isaacs/minimatch@v3.0.4...v3.1.2)

Updates `recursive-readdir` from 2.2.2 to 2.2.3
- [Release notes](https://github.com/jergason/recursive-readdir/releases)
- [Changelog](https://github.com/jergason/recursive-readdir/blob/master/CHANGELOG.md)
- [Commits](https://github.com/jergason/recursive-readdir/commits/v2.2.3)

---
updated-dependencies:
- dependency-name: minimatch
  dependency-type: indirect
- dependency-name: recursive-readdir
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <[email protected]>

* Bump System.Data.SqlClient from 4.8.3 to 4.8.5 in /CommandLine/CodeConv

Bumps [System.Data.SqlClient](https://github.com/dotnet/corefx) from 4.8.3 to 4.8.5.
- [Release notes](https://github.com/dotnet/corefx/releases)
- [Commits](https://github.com/dotnet/corefx/commits)

---
updated-dependencies:
- dependency-name: System.Data.SqlClient
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <[email protected]>

* Bump System.Data.SqlClient in /CommandLine/CodeConv.NetFramework

Bumps [System.Data.SqlClient](https://github.com/dotnet/corefx) from 4.8.1 to 4.8.5.
- [Release notes](https://github.com/dotnet/corefx/releases)
- [Commits](https://github.com/dotnet/corefx/commits)

---
updated-dependencies:
- dependency-name: System.Data.SqlClient
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <[email protected]>

* Bump System.Data.SqlClient from 4.8.2 to 4.8.5 in /Func

Bumps [System.Data.SqlClient](https://github.com/dotnet/corefx) from 4.8.2 to 4.8.5.
- [Release notes](https://github.com/dotnet/corefx/releases)
- [Commits](https://github.com/dotnet/corefx/commits)

---
updated-dependencies:
- dependency-name: System.Data.SqlClient
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <[email protected]>

* Bump System.Data.SqlClient from 4.8.1 to 4.8.5 in /Vsix

Bumps [System.Data.SqlClient](https://github.com/dotnet/corefx) from 4.8.1 to 4.8.5.
- [Release notes](https://github.com/dotnet/corefx/releases)
- [Commits](https://github.com/dotnet/corefx/commits)

---
updated-dependencies:
- dependency-name: System.Data.SqlClient
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <[email protected]>

* Bump System.Data.SqlClient from 4.8.1 to 4.8.5 in /Web

Bumps [System.Data.SqlClient](https://github.com/dotnet/corefx) from 4.8.1 to 4.8.5.
- [Release notes](https://github.com/dotnet/corefx/releases)
- [Commits](https://github.com/dotnet/corefx/commits)

---
updated-dependencies:
- dependency-name: System.Data.SqlClient
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <[email protected]>

* Bump loader-utils from 1.4.1 to 1.4.2 in /Web/ClientApp

Bumps [loader-utils](https://github.com/webpack/loader-utils) from 1.4.1 to 1.4.2.
- [Release notes](https://github.com/webpack/loader-utils/releases)
- [Changelog](https://github.com/webpack/loader-utils/blob/v1.4.2/CHANGELOG.md)
- [Commits](webpack/loader-utils@v1.4.1...v1.4.2)

---
updated-dependencies:
- dependency-name: loader-utils
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <[email protected]>

* Update README.md

* Remove global json and see what happens

* Temporarily disable these tests until they work with dot net 7

* Wait for build to finish!

* Update README.md

* Change build order in advance of using this in tests

* Don't use InitializeComponent in temp file

* Ignore temp files with InitializeComponent

* Splits static and instance handlers and include property ones icsharpcode#967

* Recommend VS2022

We'll likely need to drop VS2019 support to dodge the bugs caused by various combinations of the libraries

* Update README.md

* Try running exe

* nuget update all

* Use IsKind as required in later versions of codeanalysis

* Satisfy new API requirements

* Downgrade to 4.2.0 to avoid bugs in 4.3 and 4.4

Note: Needed to upgrade >3.11 to avoid dotnet/msbuild#7873
Needed to downgrade < 4.3 to avoid dotnet/roslyn#63780

* Revert attempt to run command line, even though it'd likely now work

* Update expectations (sane indentation) for what the new library does

* Ditch global.json again

* Try to pick a consistent set of dependencies based on the codeanalysis 4.2.0

* Ensure full error details appear in exception (not just log)

* Record version used

* Output version when available

* Block versions before 17.2 which will fail to load after this PR

* 9.1.0

* Undo VS2019 incompatible changes

* Update non-user-facing nuget packages

* Manually install System.Memory to get assembly version 4.1.2 and workaround dotnet/msbuild#7873

* Update CHANGELOG.md

* Update README.md

* Multiline strings correctly followed by a newline - fixes icsharpcode#970

* 9.1.1 (9.1.0 was never released)

* Update CHANGELOG.md

* Update README.md

* Remove converter error from icsharpcode#965 (still creates compile error) - closes icsharpcode#965

* Add test for icsharpcode#975 - closes icsharpcode#975

* Add to changelog

* Err on the side of caution for array types - fixes icsharpcode#962

* Remove todo that appears to be done

* Bump json5 from 1.0.1 to 1.0.2 in /Web/ClientApp

Bumps [json5](https://github.com/json5/json5) from 1.0.1 to 1.0.2.
- [Release notes](https://github.com/json5/json5/releases)
- [Changelog](https://github.com/json5/json5/blob/main/CHANGELOG.md)
- [Commits](json5/json5@v1.0.1...v1.0.2)

---
updated-dependencies:
- dependency-name: json5
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <[email protected]>

* Handle the case when the event container doesn't exist - relates to icsharpcode#977 icsharpcode#979

* Revert unintended change

* 9.1.2

* Sketch of solution for icsharpcode#982

* Add tests to refine details

* Rearrange methods

&& and || are special for not being applicable to nullable objects hence their special handling to get the value

* More tests

* Changelog

* Replace newline with specified character - fixes icsharpcode#973

* Fix test case compilation error - fixes icsharpcode#985

* Test tweaks

* 9.1.3

* Remove crash preventer which ironically now causes crashes - fixes icsharpcode#986

* Convert more targets matching common pattern

Existing MultiFileSolutionAndProjectTests cover this, the regex is generalised to work for other things like UWP projects
icsharpcode#988

* Add ToString when concatenating a string and an object - fixes icsharpcode#974

* Fixup other tests to use ToString

* Denied

CSC : error CS1617: Invalid option '11.0' for /langversion. Use '/langversion:?' to list supported values. [D:\a\CodeConverter\CodeConverter\CodeConverter\CodeConverter.csproj]

Build FAILED.

CSC : error CS1617: Invalid option '11.0' for /langversion. Use '/langversion:?' to list supported values. [D:\a\CodeConverter\CodeConverter\CodeConverter\CodeConverter.csproj]
    0 Warning(s)
    1 Error(s)

* Enable arm64 vsix

* Bump webpack from 5.65.0 to 5.76.1 in /Web/ClientApp

Bumps [webpack](https://github.com/webpack/webpack) from 5.65.0 to 5.76.1.
- [Release notes](https://github.com/webpack/webpack/releases)
- [Commits](webpack/webpack@v5.65.0...v5.76.1)

---
updated-dependencies:
- dependency-name: webpack
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <[email protected]>

* 9.2.0 - first arm64 compatible

* CType(Nothing, Date?) now converts to default(DateTime?) - fixes icsharpcode#994

* Conditional indexer now converted - fixes icsharpcode#993

* 9.2.1

* Fix issue icsharpcode#998

* Fix issue icsharpcode#1000

* Update CHANGELOG.md

* Fix issue icsharpcode#1003

* Update CHANGELOG.md

* Replace self too

* Set some fallback logic for picking name

* Allow object initializer to be self referential - fixes icsharpcode#1002

* Use different example

* Show where the comments end up

* Make progress each recursion - fixes icsharpcode#1007

* 9.2.2

* Pass through statements

* Move try/catch logic all to the same spot - and reuse method body visitor

* Generate a horrible do loop with a switch statement for handlers

TODO:
* Deal with non-returning code paths
* Ensure loops within the method can still break/continue as expected

* Handle one very specific case

* Handle nulls and remove comment from old plan

* Separate method

* Neaten up when there's no fall through

* Add to changelog

* Implement icsharpcode#1008 - could be spruced up with eg code samples, currently only taken the Description -> respective PackageReadme.md

* Update actions versions

* Specifically use 1.0.6 action that is using node 16

* If written or inherited, a property is generated which will do the hookup upon assignment

* Push event assignment to end of constructor - fixes icsharpcode#967

* Passing test - closes icsharpcode#991

* Changelog and test tweak

* Prevent source mapping for field initializers hoisted to constructor - fixes icsharpcode#1017

* Refine IsDefinitelyStatic

* Somewhat ugly mechanism for detecting when within an expression tree

* When converting "Is" and "IsNot" within an expression tree, use "==" - fixes icsharpcode#1015

* Mark WhereClauseSyntax as always boolean in CSharp - fixes icsharpcode#894

* Worked around "CONVERSION ERROR: usingKeyword" bug caused by VS 17.7.0 preview 2 - fixes icsharpcode#1019

Note the added test hasn't been seen to fail since updating the nuget package to the preview caused another issue I'll look into

* Don't use patterns when name is reusable - relates to icsharpcode#1011

* Try to precisely cover each case that requires a single execution

* Latest langversion

* Make it possible to track whether in query

* Don't bother trying to deal with nullables within expressions - closes icsharpcode#1011

* Changelog

* Update characterization

* Dodge null

* 9.2.3

* Bump tough-cookie from 4.0.0 to 4.1.3 in /Web/ClientApp

Bumps [tough-cookie](https://github.com/salesforce/tough-cookie) from 4.0.0 to 4.1.3.
- [Release notes](https://github.com/salesforce/tough-cookie/releases)
- [Changelog](https://github.com/salesforce/tough-cookie/blob/master/CHANGELOG.md)
- [Commits](salesforce/tough-cookie@v4.0.0...v4.1.3)

---
updated-dependencies:
- dependency-name: tough-cookie
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <[email protected]>

* Add Linq.Expressions reference to defaults

* Restore original state rather than forcing false

* Pay attention to lambda expressions - fixes icsharpcode#930

Inspired by https://github.com/JosefPihrt/Roslynator/blob/7ba2f29f5090aa13f4dd6b7936af55180b678333/src/CSharp/CSharp/Extensions/SyntaxExtensions.cs#L3114

* Don't do VB comparison within expressions - fixes icsharpcode#316

* Maintain expression type in variable declaration

* Changelog

* Update README.md

* Omit ByVal as recommended by IDE0081 - fixes icsharpcode#1024

* Bump word-wrap from 1.2.3 to 1.2.4 in /Web/ClientApp

Bumps [word-wrap](https://github.com/jonschlinkert/word-wrap) from 1.2.3 to 1.2.4.
- [Release notes](https://github.com/jonschlinkert/word-wrap/releases)
- [Commits](jonschlinkert/word-wrap@1.2.3...1.2.4)

---
updated-dependencies:
- dependency-name: word-wrap
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <[email protected]>

* add test for a non-VB-Chr Method

* Fix VB.Chr method recognition

* remove trailing NewLine in SpecialConversionTests.cs

* remove EOL

* remove EOL

* really fix the EOL at EOF this time I hope

* Basic implementation with current library version - fixes 1032

* Use verbatim literals rather than manually escape

* Refine logic for using verbatim strings

* Update CHANGELOG.md

* tests: add tests for clashing renamer and enum types

* fix: clashing renamer for enums

* chore: update changelog

* refactor: use INamedTypeSymbol

* tests: regenerate results

* Bump @babel/traverse from 7.16.7 to 7.23.2 in /Web/ClientApp

Bumps [@babel/traverse](https://github.com/babel/babel/tree/HEAD/packages/babel-traverse) from 7.16.7 to 7.23.2.
- [Release notes](https://github.com/babel/babel/releases)
- [Changelog](https://github.com/babel/babel/blob/main/CHANGELOG.md)
- [Commits](https://github.com/babel/babel/commits/v7.23.2/packages/babel-traverse)

---
updated-dependencies:
- dependency-name: "@babel/traverse"
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <[email protected]>

* BinaryConditional's first expression isn't always boolean - fixes icsharpcode#1038

* Walk existing structure bottom up to avoid stack overflow - fixes icsharpcode#1033

Only worth doing this since it's a really easy way to cause an error that's been seen by multiple real users. Not planning to protect against every possible version of this, since that would add a lot of complexity for a tiny reward

* Bump axios from 0.27.2 to 1.6.0 in /Web/ClientApp

Bumps [axios](https://github.com/axios/axios) from 0.27.2 to 1.6.0.
- [Release notes](https://github.com/axios/axios/releases)
- [Changelog](https://github.com/axios/axios/blob/v1.x/CHANGELOG.md)
- [Commits](axios/axios@v0.27.2...v1.6.0)

---
updated-dependencies:
- dependency-name: axios
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <[email protected]>

* Mention Versions

* This couldn't be resolved when running latest version of VS... don't know why

* Try to create this as a net standard project since msbuild is complaining about net 48 stuff

* Recharacterize in this form

* add a workaround

It's only required until dotnet/roslyn#71115 is fixed.

(cherry picked from commit b0a64e6)

* And the sln files

* Exit Property now returns value assigned to return variable - fixes icsharpcode#1051

* Remove square brackets when escaping labels and identifiers - fixes icsharpcode#1043, fixes icsharpcode#1044

* Add example

* Split test class in two

* It's a csharp compile error to use optional parameters before ref parameters - fixes icsharpcode#1057

* `Nothing` is the default, don't bother specifying since we can't get it right for structs - fixes icsharpcode#1056

* Avoid stack overflow in stack overflow prevention code - fixes icsharpcode#1047

* Reformat

* Apply to additional declarations - fixes icsharpcode#1053

Note: Also removed other changelog item which was broken and fixed within this release

* 9.2.4

* Remove missed issue

* Use a wrapper that calls escape identifier

* Overescape identifiers - fixes # 1043

Don't worry about exactly which context, just escape in any case

* This can obviously have dots in, so is a name, and it turns out we don't need to parse it

* Cast to dynamic when the accessed member can't be found but the surrounding object can - fixes icsharpcode#786

There's probably a more specific condition which should trigger this if we look in Roslyn code

* Conversion of parenthesized ref arguments no longer assigns back - fixes icsharpcode#1046

* Add Func + Web startup option

* Update to dot net 8 and react 18 render method

* Set the path in the url needed to debug locally

* Add new test and move existing tests together

The existing test may need an update to work for icsharpcode#749 and icsharpcode#1062

* Remove part of fix for icsharpcode#749 - fixes icsharpcode#1062

* Some more tests

* CHANGELOG

* Recharacterize

* Convert constant characters directly to constant strings

* Select case for a mixture of strings and characters converts correctly - fixes icsharpcode#1061

* Bump follow-redirects from 1.15.3 to 1.15.4 in /Web/ClientApp

Bumps [follow-redirects](https://github.com/follow-redirects/follow-redirects) from 1.15.3 to 1.15.4.
- [Release notes](https://github.com/follow-redirects/follow-redirects/releases)
- [Commits](follow-redirects/follow-redirects@v1.15.3...v1.15.4)

---
updated-dependencies:
- dependency-name: follow-redirects
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <[email protected]>

* Bump System.Data.SqlClient from 4.8.5 to 4.8.6 in /Web

Bumps [System.Data.SqlClient](https://github.com/dotnet/corefx) from 4.8.5 to 4.8.6.
- [Release notes](https://github.com/dotnet/corefx/releases)
- [Commits](https://github.com/dotnet/corefx/commits)

---
updated-dependencies:
- dependency-name: System.Data.SqlClient
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <[email protected]>

* Bump System.Data.SqlClient in /CommandLine/CodeConv.NetFramework

Bumps [System.Data.SqlClient](https://github.com/dotnet/corefx) from 4.8.5 to 4.8.6.
- [Release notes](https://github.com/dotnet/corefx/releases)
- [Commits](https://github.com/dotnet/corefx/commits)

---
updated-dependencies:
- dependency-name: System.Data.SqlClient
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <[email protected]>

* Bump System.Data.SqlClient from 4.8.5 to 4.8.6 in /Func

Bumps [System.Data.SqlClient](https://github.com/dotnet/corefx) from 4.8.5 to 4.8.6.
- [Release notes](https://github.com/dotnet/corefx/releases)
- [Commits](https://github.com/dotnet/corefx/commits)

---
updated-dependencies:
- dependency-name: System.Data.SqlClient
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <[email protected]>

* Bump System.Data.SqlClient from 4.8.5 to 4.8.6 in /Vsix

Bumps [System.Data.SqlClient](https://github.com/dotnet/corefx) from 4.8.5 to 4.8.6.
- [Release notes](https://github.com/dotnet/corefx/releases)
- [Commits](https://github.com/dotnet/corefx/commits)

---
updated-dependencies:
- dependency-name: System.Data.SqlClient
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <[email protected]>

* Bump System.Data.SqlClient from 4.8.5 to 4.8.6 in /CommandLine/CodeConv

Bumps [System.Data.SqlClient](https://github.com/dotnet/corefx) from 4.8.5 to 4.8.6.
- [Release notes](https://github.com/dotnet/corefx/releases)
- [Commits](https://github.com/dotnet/corefx/commits)

---
updated-dependencies:
- dependency-name: System.Data.SqlClient
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <[email protected]>

* Only cast for boxing when it's not implicit - fixes icsharpcode#1071

But since this removes some casts, do still ensure that predefined cast expressions always cast since otherwise casting to T via object gets broken

* 9.2.5

* Set TFM to net6.0;net8.0 for "warning NETSDK1138: The target framework 'netcoreapp3.1' is out of support and will not receive security updates in the future."

* Upgrade Azure Function to .NET 8

* Update NuGet packages for Tests project (based on File/New xUnit project)

* Update CHANGELOG.md

* Test for case similar to icsharpcode#782

* Don't try to ref foreach, Me or Using identifiers - fixes icsharpcode#1052

* Catch when it's a different type or the method is missing due to version issues

* Cater net 45 and non-compiling solutions

---------

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: GrahamTheCoder <[email protected]>
Co-authored-by: Christoph Wille <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: GrahamTheCoder <[email protected]>
Co-authored-by: Jeremy Philippe <[email protected]>
Co-authored-by: Timur Kelman <[email protected]>
Co-authored-by: Timur Kelman <[email protected]>
Co-authored-by: Dominik Baran <[email protected]>
Co-authored-by: Dominik Baran <[email protected]>
  • Loading branch information
10 people authored Feb 28, 2024
1 parent bee68df commit 2432956
Show file tree
Hide file tree
Showing 512 changed files with 78,601 additions and 46,363 deletions.
5 changes: 4 additions & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ root = true
[*]
indent_style = space
indent_size = 4

max_line_length = 200

[*.csproj]
indent_style = space
Expand Down Expand Up @@ -152,3 +152,6 @@ dotnet_analyzer_diagnostic.category-Performance.severity = suggestion

# CC0097: You have missing/unexistent parameters in Xml Docs
dotnet_diagnostic.CC0097.severity = none

csharp_style_namespace_declarations = file_scoped
dotnet_diagnostic.IDE0161.severity = warning
29 changes: 20 additions & 9 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,19 +27,26 @@ In ProjectConversion, you'll see there's a separate entry point for the online s
* Attempts to create a valid syntax tree to convert
* Adds a bunch of default references and imports

The majority of the work happens in the heart of the converter which is based around a visitor pattern with a method for each syntax type. If you don't know what a Syntax Tree is, that's definitely worth [looking up](https://github.com/dotnet/roslyn/wiki/Roslyn-Overview). There are lots of tests, set a breakpoint somewhere like `VisitCompilationUnit`, then run them in debug mode. If you step through the code, you'll see how it walks down the syntax tree converting piece by piece. If you want to find the name of the syntax for some specific code, use [Roslyn Quoter](https://roslynquoter.azurewebsites.net/).
The majority of the work happens in the heart of the converter which is based around a visitor pattern with a method for each syntax type. If you don't know what a Syntax Tree is, that's definitely worth [looking up](https://docs.microsoft.com/en-us/dotnet/csharp/roslyn-sdk/work-with-syntax#syntax-trees). There are lots of tests, set a breakpoint somewhere like `VisitCompilationUnit`, then run them in debug mode. If you step through the code, you'll see how it walks down the syntax tree converting piece by piece. If you want to find the name of the syntax for some specific code, use [Roslyn Quoter](https://roslynquoter.azurewebsites.net/).

See the main 3 visitors containing a method for each bit of syntax (e.g. for an if statement):
* https://github.com/icsharpcode/CodeConverter/blob/master/ICSharpCode.CodeConverter/CSharp/DeclarationNodeVisitor.cs
* https://github.com/icsharpcode/CodeConverter/blob/master/ICSharpCode.CodeConverter/CSharp/MethodBodyExecutableStatementVisitor.cs
* https://github.com/icsharpcode/CodeConverter/blob/master/ICSharpCode.CodeConverter/CSharp/ExpressionNodeVisitor.cs

* https://github.com/icsharpcode/CodeConverter/blob/master/CodeConverter/CSharp/DeclarationNodeVisitor.cs
* https://github.com/icsharpcode/CodeConverter/blob/master/CodeConverter/CSharp/MethodBodyExecutableStatementVisitor.cs
* https://github.com/icsharpcode/CodeConverter/blob/master/CodeConverter/CSharp/ExpressionNodeVisitor.cs

There are some surrounding visitors which keep cross-cutting details out of the way of the main body of code.
After conversion, the roslyn simplifier runs to tidy up the code, removing redundant qualification etc.

Always try to understand the root problem and find the general place to apply a fix that covers or helps with related cases. Example here: https://github.com/icsharpcode/CodeConverter/issues/557

### Example of finding where to put a breakpoint

If you look at the syntax tree of the input code you can see the names of the problematic part. There will be a "Visit..." method for most syntax types. If one doesn't exist, just pick the next one up the tree, and step in from that point.
![image](https://github.com/icsharpcode/CodeConverter/assets/2490482/5ff25972-b795-447b-861f-1fe955ca4d3c)
(source: https://sharplab.io/#v2:DYLgbgRgNALiCGBnGUAmIDUAfACgVwmAEsBjAAgGFglEyBpAUwE8B3AewCdUA5eAWwYBYAFBkxZAMoFJACgCUI8UrIBxNgBU2ZANoAzIgDt4wYEwC6IvYeOmzIRcrFrNOiTAYAHC8O1vPdhzEAUQNUSQIRELCqGiA===)

https://github.com/icsharpcode/CodeConverter/blob/0647b8d2056b1a7d0fc110290caff50b55cdc3f3/CodeConverter/CSharp/MethodBodyExecutableStatementVisitor.cs#L728-L737

## For documentation, prefer:
* Anything process/project related to be visible on GitHub (e.g. these bullet points)
* Anything code-related (i.e. why things are done a certain way, or broad overviews) to be xmldoc in the relevant part of code
Expand All @@ -50,7 +57,7 @@ At the moment there's just a very small amount of first draft documentation. Con

## Implementation advice
* Always try to convert directly between the VB and C# model, avoid converting then post-processing the converted result. This prevents the code getting tangled interdependencies, and means you have the full semantic model available to make an accurate conversion.
* Aim to use symbols rather than syntax wherever possible. Remember, lots of the problems you need to solve have already been solved by the compiler - finding it is the hard part. http://source.roslyn.io helps a bit
* Aim to use symbols rather than syntax wherever possible. Remember, lots of the problems you need to solve have already been solved by the compiler - finding it is the hard part. Sometimes you've just got to look at [its source code](https://github.dev/dotnet/roslyn).
* Avoid using the `SyntaxFactory.Parse*` methods in general - it leads to getting mixed up between which language a string is from, and means you don't learn how the syntax trees are formed. You can use https://roslynquoter.azurewebsites.net/ to help find the correct methods to use, and [Syntax Vizualizer](https://marketplace.visualstudio.com/items?itemName=VisualStudioProductTeam.NETCompilerPlatformSDK) or [sharplab website](https://sharplab.io/#v2:EYLgtghgzgLgpgJwDQBsQDdhJiaMkAmIA1AD4CSYADgPYIxQAEAygJ6xxgCwAUAGIIAlnAB2BRgGEU0JgBU4sKTN6NVjAApD0EeI2AQAxgGtBIgOZ9hKcQEEmAUXSiYACQhiUiFWvUBXYCiCBpK+sDRgjI7OjACyrFEiMIx2kU6Jbh5ePGo5yQQEGQSeCAAUAEKsAGoQKIzaKL5wyQ5pru5FiACU3rm5+samFlbiALyMANoAInCeZjpwALoAdBLhwKZwJf0m5pYzBEh1NY3d2b2RYnkF7cU9uQBKnDROhcXlVTVHDU0pCW2ZCFO5z6hh2Q32jDGUxmcDm8GWjzAz0220Ge2sh3qJzuOXsl0RyNeWWB9wggigcD+72qtQpYkQzUYAHlgAArOAGfCMCo0xg/FrOGwIMxQIHAtSo3bDAD8JTpBEQhzgYt6ePEpPJlNadzVqWcdz8ASCLH8jEeFJgJRVIIGUohYwAcjQYAALQY6y7Mfy8XVKKBQIA===) to visualize the syntax tree.

* Conversion errors should generally be made to result in a compile error. Simply throwing an exception anywhere will achieve this.
Expand All @@ -61,14 +68,18 @@ At the moment there's just a very small amount of first draft documentation. Con
* Investigate: The code heavily uses SyntaxFactory at the moment. In future I intend to make further use of [`SyntaxGenerator`](https://docs.microsoft.com/en-us/dotnet/api/microsoft.codeanalysis.editing.syntaxgenerator?view=roslyn-dotnet).

## Resources
* Lots of high level Roslyn introductions exist, e.g. https://github.com/dotnet/roslyn/wiki/Roslyn-Overview There's lots more on that wiki such as the [FAQs](https://github.com/dotnet/roslyn/wiki/FAQ). Getting deep information is a lot harder. If you see good resources, PR them to this document!
* Lots of high level Roslyn introductions exist, e.g. https://docs.microsoft.com/en-us/dotnet/csharp/roslyn-sdk/ Getting deep information is a lot harder. If you see good resources, PR them to this document!
* To visualize syntax trees, use [Syntax Vizualizer](https://marketplace.visualstudio.com/items?itemName=VisualStudioProductTeam.NETCompilerPlatformSDK), [sharplab website](https://sharplab.io/#v2:EYLgtghgzgLgpgJwDQBsQDdhJiaMkAmIA1AD4CSYADgPYIxQAEAygJ6xxgCwAUAGIIAlnAB2BRgGEU0JgBU4sKTN6NVjAApD0EeI2AQAxgGtBIgOZ9hKcQEEmAUXSiYACQhiUiFWvUBXYCiCBpK+sDRgjI7OjACyrFEiMIx2kU6Jbh5ePGo5yQQEGQSeCAAUAEKsAGoQKIzaKL5wyQ5pru5FiACU3rm5+samFlbiALyMANoAInCeZjpwALoAdBLhwKZwJf0m5pYzBEh1NY3d2b2RYnkF7cU9uQBKnDROhcXlVTVHDU0pCW2ZCFO5z6hh2Q32jDGUxmcDm8GWjzAz0220Ge2sh3qJzuOXsl0RyNeWWB9wggigcD+72qtQpYkQzUYAHlgAArOAGfCMCo0xg/FrOGwIMxQIHAtSo3bDAD8JTpBEQhzgYt6ePEpPJlNadzVqWcdz8ASCLH8jEeFJgJRVIIGUohYwAcjQYAALQY6y7Mfy8XVKKBQIA===) and [Rolsyn Quoter](https://roslynquoter.azurewebsites.net/)
* Understanding VB/C# differences:
* https://en.wikipedia.org/wiki/Comparison_of_C_Sharp_and_Visual_Basic_.NET#Features_of_Visual_Basic_.NET_not_found_in_C#
* https://anthonydgreen.net/2019/02/12/exhausting-list-of-differences-between-vb-net-c/
* Roslyn source for [CSharp binder](http://source.roslyn.codeplex.com/#Microsoft.CodeAnalysis.CSharp/Binder/Binder_Expressions.cs,365) vs [VB binder](http://source.roslyn.codeplex.com/#Microsoft.CodeAnalysis.VisualBasic/Binding/Binder_Expressions.vb,43)
* Roslyn source for [CSharp binder](https://github.com/dotnet/roslyn/blob/main/src/Compilers/CSharp/Portable/Binder/Binder_Expressions.cs) vs [VB binder](https://github.com/dotnet/roslyn/blob/main/src/Compilers/VisualBasic/Portable/Binding/Binder_Expressions.vb)

## Codebase details
* All parallelism is controlled by Env.MaxDop. When a debugger is attached to a debug build, it sets parallelism to 1. If you're seeing a transient issue when the debugger isn't attached but can't reproduce the issue with the debugger, set this to a large number instead.
* The worst part of the code is the query syntax conversion. It's just evolved messily to cover basic cases. To comprehensively cover the syntax would need a proper architecture defined to match how the queries are formed. For an example of other code that solves a similar query syntax problem, see ILSpy's [`CSharpDecompiler`](https://github.com/icsharpcode/ILSpy/blob/e189ad9ca301142b9134c2839e416199cbd3360e/ICSharpCode.Decompiler/CSharp/Transforms/IntroduceQueryExpressions.cs)
* There are a few areas where different special cases collide which are incredibly difficult to reason about all cases. Function hoisting, select case statements and methodswithhandles are some examples which need care. If major work is required, they'll need some extra test cases adding and refactoring to separate the concerns.
* There are a few areas where different special cases collide which are incredibly difficult to reason about all cases. Function hoisting and select case statements are some examples which need care. If major work is required, they'll need some extra test cases adding and refactoring to separate the concerns.

## Roslyn versions

The core library and Visual Studio extension target the Roslyn version matching the oldest supported version of VS. This avoids introducing compatibility issues. If there are newer APIs needed though, we'll weigh up the pros and cons.
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ If there's no error message, try the [Visual Studio Activity log](https://docs.m
> %AppData%\Microsoft\VisualStudio\<version>\ActivityLog.xml.
### Details
* Product in use: e.g. [codeconverter.icsharpcode.net](https://codeconverter.icsharpcode.net) / VS extension / both
* Product in use: e.g. [icsharpcode.github.io/CodeConverter](https://icsharpcode.github.io/CodeConverter/) / VS extension / both
* Version in use: e.g. 5.6.3 or a commit hash (if it's a 3rd party tool using this library, try one of the above)
* Did you see it working in a previous version, which?
* Any other relevant information to the issue, or your interest in contributing a fix.
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/cs2vb_bug_report.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ If relevant, the output you expected, or a description of what you expected.
```

### Details
* Product in use: e.g. [codeconverter.icsharpcode.net](https://codeconverter.icsharpcode.net) / VS extension / both
* Product in use: e.g. [icsharpcode.github.io/CodeConverter](https://icsharpcode.github.io/CodeConverter/) / VS extension / both
* Version in use: e.g. 5.6.3 or a commit hash (if it's a 3rd party tool using this library, try one of the above)
* Did you see it working in a previous version, which?
* Any other relevant information to the issue, or your interest in contributing a fix.
6 changes: 3 additions & 3 deletions .github/ISSUE_TEMPLATE/vb2cs_bug_report.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ assignees: ''

---

### Input code
### VB.Net input code
```vbnet
If relevant, please enter some example code here to reproduce the issue, or the steps taken to cause the issue.
If relevant, please enter some example VB.NET code here to reproduce the issue, or the steps taken to cause the issue.
```

### Erroneous output
Expand All @@ -23,7 +23,7 @@ If relevant, the output you expected, or a description of what you expected.
```

### Details
* Product in use: e.g. [codeconverter.icsharpcode.net](https://codeconverter.icsharpcode.net) / VS extension / both
* Product in use: e.g. [icsharpcode.github.io/CodeConverter](https://icsharpcode.github.io/CodeConverter/) / VS extension / both
* Version in use: e.g. 5.6.3 or a commit hash (if it's a 3rd party tool using this library, try one of the above)
* Did you see it working in a previous version, which?
* Any other relevant information to the issue, or your interest in contributing a fix.
93 changes: 68 additions & 25 deletions .github/workflows/dotnet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,53 +5,96 @@ on:
branches: [ master ]
pull_request:
branches: [ master ]


env:
BuildVersion: '9.2.5'

jobs:
build:
runs-on: windows-latest
runs-on: windows-2022
env:
BuildVersion: '8.2.4'
BuildPlatform: Any CPU
BuildTarget: Release

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- name: Update project version
uses: roryprimrose/set-vs-sdk-project-version@v1
uses: roryprimrose/set-vs-sdk-project-version@v1.0.6
with:
projectFilter: '**/CodeConverter.csproj'
projectFilter: 'Directory.Build.props'
version: ${{ env.BuildVersion }}.${{ github.run_number }}
assemblyVersion: ${{ env.BuildVersion }}.${{ github.run_number }}
fileVersion: ${{ env.BuildVersion }}.${{ github.run_number }}
- name: Setup .NET
uses: actions/setup-dotnet@v1

- name: Setup .NET for main build
uses: actions/setup-dotnet@v3
with:
dotnet-version: 3.1.x
dotnet-version: 6.0.x

- name: Add msbuild to PATH
uses: microsoft/setup-msbuild@v1.0.2
uses: microsoft/setup-msbuild@v1.3
with:
vs-version: '[16.6,)'
- name: Restore the application
run: msbuild CodeConverter.sln /t:Restore /p:Configuration=$env:BuildTarget /p:Platform=$env:BuildPlatform
- name: Build
run: msbuild CodeConverter.sln /p:Configuration=$env:BuildTarget /p:Platform=$env:BuildPlatform
vs-version: '[17.0,)'

- name: Dotnet deterministic Build
run: dotnet build DotNetBuildable.slnf /p:Platform=$env:BuildPlatform /p:Configuration=$env:BuildTarget /p:ContinuousIntegrationBuild=true

- name: Dotnet Publish
run: dotnet publish DotNetPublishable.slnf /p:Platform=$env:BuildPlatform /p:Configuration=$env:BuildTarget

- name: MSBuild Vsix
run: msbuild Vsix\Vsix.csproj -restore /p:Configuration=$env:BuildTarget

- name: Execute unit tests
run: dotnet test $env:Tests1
env:
Tests1: Tests\bin\${{ env.BuildTarget }}\ICSharpCode.CodeConverter.Tests.dll
- name: Pack
run: dotnet pack CodeConverter/CodeConverter.csproj -c $env:BuildTarget
Tests1: Tests/bin/${{ env.BuildTarget }}/ICSharpCode.CodeConverter.Tests.dll

- name: Upload NuGet package
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v3
with:
name: ICSharpCode.CodeConverter.${{ env.BuildVersion }}.nupkg
path: CodeConverter\bin\${{ env.BuildTarget }}\ICSharpCode.CodeConverter.*.nupkg
path: CodeConverter/bin/${{ env.BuildTarget }}/ICSharpCode.CodeConverter.*.nupkg
- name: Upload VSIX
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v3
with:
name: ICSharpCode.CodeConverter.VsExtension.${{ env.BuildVersion }}.vsix
path: Vsix\bin\${{ env.BuildTarget }}\ICSharpCode.CodeConverter.VsExtension.vsix
- name: Upload code conv tool
uses: actions/upload-artifact@v2
path: Vsix/bin/${{ env.BuildTarget }}/ICSharpCode.CodeConverter.VsExtension.vsix
- name: Upload Tool
uses: actions/upload-artifact@v3
with:
name: ICSharpCode.CodeConverter.CodeConv.${{ env.BuildVersion }}.nupkg
path: CommandLine\CodeConv\bin\${{ env.BuildTarget }}\ICSharpCode.CodeConverter.CodeConv.*.nupkg
path: CommandLine/CodeConv/bin/${{ env.BuildTarget }}/ICSharpCode.CodeConverter.CodeConv.*.nupkg
- name: Upload Web
uses: actions/upload-artifact@v3
with:
name: ICSharpCode.CodeConverter.Web.${{ env.BuildVersion }}.zip
path: Web/bin/${{ env.BuildTarget }}/publish/
- name: Upload Function
uses: actions/upload-artifact@v3
with:
name: ICSharpCode.CodeConverter.Func.${{ env.BuildVersion }}.zip
path: Func/bin/${{ env.BuildTarget }}/publish/

deploy:
if: ${{ github.ref == 'refs/heads/master' }}
concurrency: ci-${{ github.ref }}
needs: [build] # The second job must depend on the first one to complete before running and uses ubuntu-latest instead of windows.
runs-on: ubuntu-latest
steps:
- name: Checkout 🛎️
uses: actions/checkout@v3

- name: Download Artifacts 🔻 # The built project is downloaded into the 'site' folder.
uses: actions/download-artifact@v3
with:
name: ICSharpCode.CodeConverter.Web.${{ env.BuildVersion }}.zip
path: site

- name: Deploy 🚀
uses: JamesIves/github-pages-deploy-action@v4
with:
branch: 'autoupdated/gh-pages'
folder: 'site/wwwroot'

Loading

0 comments on commit 2432956

Please sign in to comment.