Introducing, DeepSource for C#
.NET is one of the most widely used developer platforms out there, especially adopted by large enterprises. It is free, cross-platform and lets you build many different types of applications for web, mobile, desktop, games, and IoT. Package managers such as NuGet let you pick packages of your choice from over 90,000 available packages. As of today, .NET has seen over 100,000+ OSS contributions and 3,700+ OSS company contributors. Its latest version, .NET 6 is dubbed as "The Fastest .NET Yet" by Microsoft and includes plenty of new features and enhancements along with C# 10 and F# 6.
Naturally, we've had several users request us to support C# over the years.
A few months ago, we set out to build a better static analysis experience for C# ground up. The slow speed of analysis has been one the biggest complaints from users who've had experience with the existing tools, so fixing that was our top priority. Building a fast analysis runtime that doesn't compromise on accuracy and reliability was the primary goal, so we designed our own runtime focused on that.
Today, I'm super stoked to announce the first public release of the C# Analyzer. It's available to all users on DeepSource Cloud and Enterprise in beta.
How's our C# Analyzer different from others?
Most existing static analysis tools for C# require the users to specify complex configuration or integrate them as part of the build process. It takes a lot of effort to set up the analysis due to this, and even the analysis is painfully slow. The DeepSource C# Analyzer, on the other hand, automatically figures out the structure of your project and doesn't require any special configuration. As DeepSource runs analysis in its own independent runtime, integration with the build pipeline isn't required as well.
Finally, and most importantly, the Analyzer is fundamentally faster than anything you'd have seen before — even when analyzing the most complex codebases. We even made a fun video about it!
How to use the C# Analyzer?
You can begin using the C# Analyzer by adding an entry to the [[analyzers]] table in the .deepsource.toml file in your repository.
Alternatively, you can add the Analyzer and activate your repository directly from the DeepSource dashboard.
Issues detected by the C# Analyzer
In the beta version, the Analyzer detects 50+ issues. Some of the interesting ones are:
- (CS-R1007) Use Guid.Empty to create an empty GUID
- (CS-R1011) ToString method should never return null
- (CS-A1001) Call to potentially dangerous method DangerousGetHandle
- (CS-W1002) Usage of deprecated Threading APIs
You can view the list of all issues in the Directory. As the Analyzer moves into general availability over the next few months, we'll add more issues and Autofix.
If you use C#, we'd love it if you gave DeepSource a try. For any questions or feedback, you can reach out to us on the discuss forum. See you soon!