C# and VB.NET Code Searcher – Using Roslyn

RoslynCodeSearchervs2010-full

This article is about a CodeProject article I created, C# and VB.NET code searcher using Roslyn.

About a year ago I had an assignment that required a lot of searching through the source code of a large legacy codebase (61 solutions, C# code). A field had to be moved from one table to another table. It was a change that would impact some parts of the codebase. To find out I had to find methods in the data layer where Stored procedures were called. Then I had to go bottom-up through the codebase to see where these methods were called, and what the impact was on the code.

At first I used the freeware tool “TextCrawler 2” for that (http://www.digitalvolcano.co.uk/content/index.php). This is quite a fast text search utility. But the problem is, it doesn’t “know” anything about the C# language. For example, if you search for method calls to a certain method, TextCrawler will happily find files for you that have the method calls commented out. Another problem was, it wasn’t fast enough (searching through 61 solutions can take some time..). I also used the Microsoft Desktop Search tool, this was fast but also not “intelligent” with the source code.

Since I read about Roslyn I thought of ways I could make it useful for this purpose.

Here’s the CodeProject article I created for this:

http://www.codeproject.com/Articles/416472/Csharp-and-VB-NET-Code-Searcher-Using-Roslyn