Refactoring Essentials now with a Roslyn Code Converter

Sign in to queue

Description

Refactoring Essentials, one of our favorite projects, continues rolling on with the release of v4 with a raft of new features and a new C# to VB Roslyn powered converter.

What's really cool is that that converter, and the rest of it, is all open source, RefactoringEssentials. :)

Refactoring Essentials 4.0 Comes With Roslyn Code Converter

On Wednesday at //build/ 2016 Microsoft released Update 2 for Visual Studio 2015. Today, our @roslyn 1.2 compatible version 4.0 of Refactoring Essentials follows suit (I totally like doing useful stuff on April 1st).

We are proud that we now have crossed the line of 250 refactorings/analyzers and fixes for C# and VB, and we expect to extend our VB support via cross-language analyzers using the new IOperation API. However, before getting ahead of ourselves with futures, one more feature stands out in the 4.0 release: our Roslyn Code Converter.

It has soft-launched on the Web with a REST API (background information), and is now available in the Refactoring Essentials extension, where it runs locally:

image

Details of what else is new can be found - as is now customary - in the release notes in our GH wiki. ...

Version 4.0

What's New in C#

New: C# to VB Converter
New refactorings:
  • "Convert instance method to static"
New analyzers:
    • "Comparing equal expression for equality is usually useless"
    • "Issue in format string"
    • "Function never returns"
    • "Local variable hides member"
    • "Parameter hides member"
    • "Redundant .ToString() call"
    • "Redundant 'unsafe' statement"
    • "Member hides static member from outer class"
    • "Initializing field with default value is redundant"
    • "Redundant empty finally block"
    • "Static field in generic type"
    • "Type parameter is never used"
    • "Method with optional parameter is hidden by overload"
    • "Parameter name differs in partial method definition"
    • "'for' loop control variable is never modified"

Check out the main page, http://vsrefactoringessentials.com/



The Discussion

  • User profile image
    alashcraft

    We're inching closer and closer to that fateful day... the day I can open/edit/save a *.vb file in the C# editor in Visual Studio.

    ...or vice-versa if that's your thing.  ;)

  • User profile image
    Kelps

    Looking forward for the VB to C# converter. I need this to convince my bosses to change our current code base to C#. I'll take a look at the source code as soon as I find the time to see if I can contribute in the effort to code that converter....

  • User profile image
    KeyboardG

    This is a great project to prove out the Roslyn tools. I just can't imagine a use case in the business world.

  • User profile image
    tutor

    @Kelps: FYI - http://www.icsharpcode.net/OpenSource/SD/Download/  v4.4 has a convert VB PROJECT to C#  (98% accurate).

  • User profile image
    Masoud

    Hello,

    it seems that your converter cannot correctly convert the following code to a true VB.NET code. In C# we can explicitly make the set function private but see the result of pasting the following code. it's wrong.

    public class Test {
    public string Name {get; private set;}
    }

    The wrong conversion is : ( the following is wrong because the name is now public and any body can set the value of it even outside of the Test class. but the c# code does not allow this property to be set outside of the Test class).

    Public Class Test
    Public Property Name As String
    End Class

  • User profile image
    Masoud

    The correct VB.NET code of the my previous comment must be :

    Public Class Test
    Public Property Name() As String
    Get
    Return m_Name
    End Get
    Private Set
    m_Name = Value
    End Set
    End Property
    Private m_Name As String
    End Class

  • User profile image
    gduncan411

    @Masoud: Thanks for checking it out. The best way to raise this with the team is to post the issue in the repo here, https://github.com/icsharpcode/RefactoringEssentials/issues

  • User profile image
    AL17

    Excellent,

    I was testing the c #  to visual basic (V.S) converter and I can say that it is excellent.

    A step in the right direction. Simply, powerful and useful!

    Thank you

    ;)

Add Your 2 Cents