stream:// .net


Architecting .NET Desktop and Mobile applications | DotNetCurry

This tutorial introduces several architectural and design patterns that can be used to implement common scenarios in .NET desktop and mobile applications.

6 Best Practices to Keep a .NET Application's Memory Healthy - Michael's Coding Spot

Memory problems in a big .NET application are a silent killer of sorts. Kind of like high blood pressure. You can eat junk food for a long time ignoring it until one day you face a serious problem. In the case of a .NET program, that serious problem can be high memory consumption, major performance issues, and outright crashes. In this post, you'll see how to keep our application's blood pressure at healthy levels.

ILogger and Null Object Pattern

The Null Object Pattern is a pattern that uses objects with null behavior instead of performing null checks throughout the codebase. ILogger and ILoggerFactory are dependencies that often require a lot of null checking, so they are perfect candidates for the null object pattern. Suppose your classes take ILogger or ILoggerFactory as a dependency, and you are not using the null object pattern. In that case, you will probably find that your code is either subject to NullReferenceExceptions, or forcing implementors to supply loggers as arguments. Use the null object pattern to avoid both these problems. This article teaches you how in C#. Null object might be confusing for some people because it seems to imply that the object reference might be null. However, the opposite is true. The object will never be a null reference. Null refers to the behavior of the object - not the reference itself. I think that a better name for the pattern would be Dummy Object Pattern since the objects you will use are shells with no behavior.  Why Use the Null Object Pattern? If you inject dependencies into your classes, you need to validate against null or perform null checking throughout your code. The null conditional operator ?. helps, but it is still very easy to miss one. Every single missed question mark is a bug in the code. The null object pattern gives you a third option of using a dummy object instead. This reduces the number of code paths and therefore decreases the chance of NullReferenceExceptions while still allowing the implementor to instantiate the class without creating an instance of the dependency. In the case of ILogger, it is quite onerous to create an implementation. Simply put, you shouldn't do it. If you want to implement logging, you should use an existing logging library. It becomes even more onerous if the dependency is ILoggerFactory. The implementor needs to pull in external dependencies or create a cascading set of classes that they may have no idea how to implement. It gets much worse when you try to mock ILogger or ILoggerFactory dependencies. Although it is still important to verify that logging gets called. You can read about that here.  The Basics The good news is that the Microsoft.Extensions.Logging.Abstractions namespace comes with null objects right out of the box. All you need to do is use NullLogger.Instance and NullLoggerFactory.Instance as default instances in your constructor. That's it. Your class can now depend on these instances, as though there is a real instance.  This example guarantees that the logger will never be null without forcing the code to supply a logger. The readonly modifier ensures that the instance cannot be set to null after construction. The code does not throw a NullReferenceException: using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging.Abstractions; using System; namespace ConsoleApp { class Program { static void Main(string[] args) { new Example().Print(Hello World!); } } public class Example { readonly ILogger _logger; public Example(ILogger logger = null) { _logger = logger ?? NullLogger.Instance; } public void Print(string message) { _logger.LogTrace(Logged message: {message}, message); Console.WriteLine(message); } } } In some cases, your class should take an ILoggerFactory instance because it may need to pass loggers to child dependencies in the future. You can use the same approach. namespace ConsoleApp { class Program { static void Main(string[] args) { new Example().Print(Hello World!); } } public class Example { readonly ILogger _logger; readonly ILoggerFactory _loggerFactory; public Example(ILoggerFactory loggerFactory = null) { _loggerFactory = loggerFactory ?? NullLoggerFactory.Instance; _logger = _loggerFactory.CreateLogger<Example>(); } public void Print(string message) { _logger.LogTrace(Logged message: {message}, message); Console.WriteLine(message); } } } Notice that we use the static property instance of both classes. We could create new instances of these objects in each case, but this would consume extra memory CPU to construct. The static instances only instantiate once i...

When does Blazor decide to render your UI?

Sometimes Blazor needs a nudge to render

Game Development with .NET | .NET Blog

Launching .NET for game development that runs on a wide variety of platform using purpose built gaming engines. Develop games on Windows, Linux, or mcaOS.

Moving away from Visual Studio to JetBrains Rider - Hi, I'm Ankit

The post describes JetBrains Rider as an alternate to Visual Studio and how Rider can help mitigate some of the Visual Studio pain-points.

Introducing DotNet.SystemCollections.Analyzers

I have been a developer for the past 7 years. I’ve gone through a lot of code reviews during that time. I have devoted my time to learn good software engineering practices through C#. Last ye…

Microsoft told, 'We're not happy' by GitHub contributors to open-source .NET Core WPF | ZDNet

Microsoft's .NET Core team admits it needs to be better at supporting contributors to its open-source projects.

Use System.IO.Pipelines and System.Threading.Channels APIs to Boost Performance

How to use System.IO.Pipelines and System.Threading.Channels APIs to speed up processing

Test-driving C# Source Generators - codecentric AG Blog

C# 8 will ship soon with .Net Core 5, and one of the most exciting features is Source Generators, a great new addition to the .Net ecosystem.

Tim Deschryver

Tracking the cause of my first memory leak written in C# (that I know of)

New Features in Visual Studio 2019 v16.8 Preview 3.1 | Visual Studio Blog

Visual Studio 2019 v16.8 Preview 3.1 brings Git Integration, C++20 conformance, .NET Productivity, and more. Plus, sign-up for Visual Studio Codespaces!

F# Ukraine Interview Session #1 with Vagif Abilov

Vagif is a Russian/Norwegian developer working for a Norwegian company Miles. He has about three decades of programming experience, currently focusing on bui...

The future of .NET Standard | .NET Blog

Since .NET 5 was announced, many of you have asked what this means for .NET Standard and whether it will still be relevant. In this post, I’m going to explain how .NET 5 improves code sharing and replaces .NET Standard. I’ll also cover the cases where you still need .NET Standard.

What's new in C# 9.0 - C# Guide

Get an overview of the new features available in C# 9.0.

Announcing .NET 5.0 RC 1 | .NET Blog

Today, we are shipping .NET 5.0 Release Candidate 1 (RC1). It is a near-final release of .NET 5.0, and the first of two RCs before the official release in November. RC1 is a “go live” release; you are supported using it in production.

Algorithms and Data Structures in C#

Web-site dedicated to study of Algorithms and Data Structures. All Examples are in C#.

Martin Björkström - Migrating WCF to gRPC - The protobuf-net way

Driving Digital Transformation on Serverless Containers...

Using Redis as a .NET Core Data Store

In this episode of On .NET, Todd Gardner walks Christos through how his company is using Redis in their .NET Core application as the main data store. He expl...

Microservices with event sourcing using .NET Core

I spend some time last year implementing an example project on how to structure an API using microservices in .NET Core. In my summer…

mj1856/TimeZoneConverter

Lightweight libraries to convert between IANA, Windows, Rails, and POSIX time zones. - mj1856/TimeZoneConverter

Automatically find latent bugs in your code with .NET 5 | .NET Blog

Introducing AnalysisLevel in the C# compiler to introduce warnings to patterns like common codingmistakes or common API misuse.

Convention based Concurrency Management in Entity Framework Core

Who does not love convention over configuration? Whenever it makes sense I try to use it in my role as a system architect. It helps my programmers write more robust code out of the box. Writing con…

Wordpress on .NET Core

Peachpie is an open source project that allows for a seamless interoperability between PHP and .NET applications. In this episode, Benjamin and Jakub from th...

How to Debug Hangs Using the dotTrace Performance Profiler – .NET Tools Blog | JetBrains

This is a guest blog post from Michael Shpilt. Michael has been developing software for over 20 years. He owns the popular blog michaelscodingspot.com and recently published the book Practical Debuggi

Hot Vacancies

.NET Developer

American startup, .NET
This week

A developer is needed for an American startup that manages the operation and maintenance of residential complexes. This is a new project from scratch with a temporary integration of the old system (Web Forms, no code access).

.NET Backend Developer

Field Complete, .NET

Field Complete is a team of passionate, young & fun-loving professionals looking to change the uneffective way that Servicing Industry works on US markets. Field Complete is growing really fast. We are looking for a Back End Developer to build a top-level modern API, ready for high load. Strong expertise with:

Senior Xamarin Developer

DraftKings, Mobile

You will join a mobile team which is working on two very exciting projects, Sportsbook and Casino. The apps are used by users in the US, where we are working on the regulated markets. We are releasing apps every two weeks. Our apps are generating almost 75% of the company revenue and the user base is growing daily. Technical stack on the project: Xamarin.Forms, MVVM with DI, NewRelic, Azure + App Center etc. Switching to .Net MAUI in the nearest 2-3 months.

Senior .NET Engineer

DraftKings, .NET

You will be working in a large US-oriented company that puts as a priority: security, performance, and stability. The candidate will work on pushing a huge number of changes (several thousand per sec) to several thousand clients in a near real-time manner.

Middle strong .NET developer

SoftServe, .NET

Our customer is an American company that develops software for businesses to help manage their networks, systems, and information technology infrastructure. The company provides purpose-built products for IT professionals, MSPs, and DevOps pros.