Digests » 378

sponsor

Why do C# developers use static code analyzer?

You'll find the answer to this question on the PVS-Studio blog. Use the #digest promo code to get a month free trial of the analyzer.

this week's favorite

A neat trick to debug exceptions in C#

Assume we have a method called UnsafeMethod(), which throws an exception upon calling it. What we want to do is to debug this method and find out where this exception comes from. The naïve approach is to simply surround it with a try-catch, and set a debug point in the catch-block.

Testing websites with Selenium

Selenium facilitates running automated E2E tests as if you were a user accessing the website using the any browser with a supported WebDriver. This enables you to test things not normally available to unit and integration tests such as cross browser support. And using a well thought out strategy, can make it easy to maintain tests even for a complex difficult to test legacy code base. I'll be writing my examples in C# and some of it will be C# specific, but the concepts can apply to multiple languages.

New .NET 6 APIs driven by the developer community

.NET 6 is on the way, and I wanted to share some of my favorite new APIs in .NET and ASP.NET Core that you are going to love. Why are you going to love them? Well because they were directly driven by our fantastic .NET developer community! Let’s get started!

Build a machine learning data analysis application

Neural networks are very powerful to perform predictive analysis and solve analytical tasks. They are widely used for data classification to detect patterns in the input data and make predictions. The business cases are varied from customer data classification and protection, text classification, consumer behavior, and many others.

.NET locking in an Async Method

This snippet is for initializing a SignalR connection, I found this pattern to work really well for my use case. Since I want only one connection to my external service started the lock makes sure multiple calls to GetConnection will return a single initialized instances also making it lazily started. The pattern is simple enough, but could be enhanced with a key/value cache on the URL, so multiple connections can be cached.