Posts Tagged: dotnet
Stay up-to-date with the latest news, tips, and insights on the .NET Framework and learn how to build, deploy, and manage your applications.
Posts In 2024
The Smartest Way to Onboard Developers (Video)
Published by Stuart Blackler on: 2024-01-01. Tagged:dotnetaspnetcore
Change happens. People will leave your team and people join your team. But what if there was an easy way to get new people up to speed in minutes, not weeks. Imagine clippy could hold your hand through a code base which you can easily refer back to at any time. The best bit? Anyone can do this.
Posts In 2023
Using the Factory Design Pattern in .NET (Article)
Published by Stuart Blackler on: 2023-05-09. Tagged:dotnet
The Factory Design pattern is a popular technique for creating objects in .NET applications. It allows developers to create objects without specifying the exact class of object that will be created, making it an excellent option for improving code flexibility and maintainability. This article will explore the concept behind the Factory Design pattern, its benefits, and how it can be implemented in C# code.
2 MUST USE Features for Dotnet Test Debugging (Video)
Published by Stuart Blackler on: 2023-05-08. Tagged:dotnet
In this video, Stu demonstrates how to use the dotnet test feature to debug two types of test failures: test crashes and test hangs. Stu shows how to use the “blame-crash” parameter to generate sequence and memory dump files to help diagnose test crashes, and the “blame-hang” parameter to collect hang dumps when tests exceed the given timeout. He also shares how to set these parameters as csproj properties to achieve consistent debugging behavior. By the end of this video, viewers will have a valuable tool to help them save time when debugging test failures.
Using the Decorator Design Pattern in .NET (Article)
Published by Stuart Blackler on: 2023-05-08. Tagged:dotnet
The Decorator design pattern is a widely-used technique for extending the functionality of an existing object or component. By wrapping an object in a series of decorators, you can add new behaviours, features, or properties without modifying the underlying code. This makes it a powerful and flexible way to customize and extend software systems. In .NET, the Decorator design pattern can be used in various ways to enhance and modify existing classes and components, which can help you write more maintainable, extensible, and flexible code.
Using the Singleton Design Pattern in .NET (Article)
Published by Stuart Blackler on: 2023-05-07. Tagged:dotnet
As a .NET developer, you understand the importance of writing efficient, scalable, and maintainable code. One design pattern that can help achieve these goals is the Singleton pattern. The Singleton pattern is a creational pattern that ensures only one instance of a class is created and provides global access to that instance throughout the application. In this blog post, we’ll look in-depth at the Singleton pattern, exploring its benefits, use cases, and implementation in C#. By the end of this post, you’ll have a solid understanding of how to leverage the Singleton pattern to optimize your .NET applications.
Saying Hello to the Newest .NET Community - WeAreDotnet! (Video)
Published by Stuart Blackler on: 2023-04-27. Tagged:dotnet
In this first interview of a series, we’re meeting the founders of WeAreDotnet, a new .NET community. Tim shares his motivations for starting a new community with Matthias & Gerald and their plans for its future. We dive into what sets WeAreDotnet apart from other .NET communities, how they aim to help developers grow their skills, and the kind of events and resources they offer. Join us as we get to know this exciting new addition to the .NET community landscape!
Using the Builder Design Pattern in .NET (Article)
Published by Stuart Blackler on: 2023-03-14. Tagged:dotnet
As a .NET developer, you’re probably familiar with the importance of design patterns for creating maintainable and flexible code. The Builder pattern is one of the most potent creational patterns in the .NET ecosystem. In this blog post, we’ll dive deep into the Builder design pattern, explaining what it is, what problems it solves, how to implement it in C#, and answering frequently asked questions.
Posts In 2022
The Way You Publish Apps Is Changing | .NET 7 (Video)
Published by Stuart Blackler on: 2022-11-15. Tagged:dotnetaspnetcore
Go from zero to docker image in 30 seconds! In this video, we’re going to discuss the changes that are happening with publishing apps in .NET 7. I’ll show you how to make the changes backwards compatible with .NET 6 and how to customize your experience.
AWS Timestream & .NET - Underrated? (Video)
Published by Stuart Blackler on: 2022-10-21. Tagged:dotnetaws
Let’s look at how to use AWS Timestream in .NET. Timestream is a managed time series database from AWS. It’s fast and scalable, with advanced features like scheduled queries.
Mocking APIs Made Easy With Mockaco (Video)
Published by Stuart Blackler on: 2022-10-07. Tagged:dotnetaspnetcore
Mockaco is an HTTP-based dotnet API mocking server with fast setup - great for when you need to setup a mock API to test locally. As Mockaco is also a docker image, we can utilize this in our build pipelines to get some confidence in our tests without requiring external dependencies.
ASP.NET Core Versioning: Minimal APIs (Article)
Published by Stuart Blackler on: 2022-10-04. Tagged:dotnetaspnetcore
This blog post is also available as a video on my YouTube Channel. If your API is a key part of your product you are going to want to version your APIs. One of the major reasons that we consider versioning our api’s is so that we provide a consistent experience for our users. If we consistently change our API’s then our consumers will break, they will get annoyed and eventually leave our product. ASP.NET Core Versioning: MVC APIs (Article)
Published by Stuart Blackler on: 2022-09-30. Tagged:dotnetaspnetcore
This blog post is also available as a video on my YouTube Channel. If your API is a key part of your product you are going to want to version your APIs. One of the major reasons that we consider versioning our api’s is so that we provide a consistent experience for our users. If we consistently change our API’s then our consumers will break, they will get annoyed and eventually leave our product. Pro Testing With Xunit & Localstack (Article)
Published by Stuart Blackler on: 2022-09-25. Tagged:dotnetaspnetcore
This blog post is also available as a video on my YouTube Channel.
Ever wondered how to get docker images to run nicely with XUnit tests? Then you’re in the right place. Let me show you how to setup Localstack with XUnit properly so that the only thing you need to worry about is having docker running. I’m using Localstack as the example but you can repeat a very similar process using the techniques shown here.
Testing Like a PRO With XUnit & Localstack - .NET 7 (Video)
Published by Stuart Blackler on: 2022-09-21. Tagged:dotnet
If you’re relying on your CI pipeline to start up your docker containers, or not seeding your data in localstack before your tests start then this video is for you. Learn how to spin up a localstack aws instance correctly with xunit and never worry about doing anything else other than start docker & dotnet test.
How to Version ASP.NET Core MVC & Minimal APIs (Video)
Published by Stuart Blackler on: 2022-09-13. Tagged:dotnetaspnetcore
Versioning API’s can be extremely important for your product. Learn 4 different ways to version your APIs in .NET minimal APIs and .NET MVC APIs. The techniques you’ll learn are: content type negotiation versioning, custom headers versioning, query string versioning and URL versioning.
New .NET 7 Feature - Regex Source Generator #Shorts (Video)
Published by Stuart Blackler on: 2022-09-07. Tagged:dotnet
Take a quick look at the new .NET 7 source generator for Regex. Check out the full video here: https://www.youtube.com/watch?v=6USQ3_81wQM
The Fastest .NET Serializer Is NOT What You Think (Video)
Published by Stuart Blackler on: 2022-08-28. Tagged:dotnet
Recently, I needed to compare the current performance of .NET serializers for a project. In this video, I compare the current state of the serializers and produce some interesting results.
Link to the benchmarks repository: https://github.com/Im5tu/SerializationBenchmarks
Json Serializers
- Jil: https://www.nuget.org/packages/Jil/
- Newtonsoft.Json: https://www.nuget.org/packages/Newtonsoft.Json
- ServiceStack.Text: https://www.nuget.org/packages/ServiceStack.Text
- SpanJson: https://www.nuget.org/packages/SpanJson
- UTF8Json: https://www.nuget.org/packages/Utf8Json
Binary Serializers
- AvroConvert: https://www.nuget.org/packages/AvroConvert
- Bebop: https://www.nuget.org/packages/bebop
- BSON: https://www.nuget.org/packages/MongoDB.Bson
- GroBuf: https://www.nuget.org/packages/GroBuf
- Hyperion: https://www.nuget.org/packages/Hyperion
- MessagePack: https://www.nuget.org/packages/MessagePack
- MsgPack: https://www.nuget.org/packages/MsgPack.Cli
- protobuf-net: https://www.nuget.org/packages/protobuf-net
.NET 7 - Pattern Matching With Spans #Shorts (Video)
Published by Stuart Blackler on: 2022-08-25. Tagged:dotnet
With .NET 7 just around the corner, we have a better idea of the features that are going to in it. Let’s take a look at 10 features you can use today: https://www.youtube.com/watch?v=6USQ3_81wQM
.NET 7 - PatchAsync & PatchAsJsonAsync #Shorts (Video)
Published by Stuart Blackler on: 2022-08-23. Tagged:dotnet
With .NET 7 just around the corner, we have a better idea of the features that are going to in it. Let’s take a look at 10 features you can use today: https://www.youtube.com/watch?v=6USQ3_81wQM
.NET 7: 10 New Features You Need to Know (Video)
Published by Stuart Blackler on: 2022-08-21. Tagged:dotnet
With .NET 7 just around the corner, we have a better idea of the features that are going to in it. Let’s take a look at 10 features you can use today. Links to all of the features can be found below.
Using PASETO in .NET - #Shorts (Video)
Published by Stuart Blackler on: 2022-08-18. Tagged:dotnetaspnetcore
For the full video, go here: https://www.youtube.com/watch?v=oNQdDjvS_54
Creating a restricted file download with S3 is easy with pre-signed URLs. But what your endpoint isn’t a file? Or you’re not sourcing it from S3? In this video, we take a look at an upcoming technology called PASETO (platform agnostic security token) and see how to create an endpoint that is restricted by time.
A New Way to Create Time Restricted Endpoints in .NET (Video)
Published by Stuart Blackler on: 2022-08-15. Tagged:dotnetaspnetcore
Creating a restricted file download with S3 is easy with pre-signed URLs. But what your endpoint isn’t a file? Or you’re not sourcing it from S3? In this video, we take a look at an upcoming technology called PASETO (platform agnostic security token) and see how to create an endpoint that is restricted by time.
.NET 7 Reflection Improvements Can't Beat THIS (Video)
Published by Stuart Blackler on: 2022-08-01. Tagged:dotnet
Inspired by a blog post and video from two of .NET’s biggest content creators, I decided to take a look an old trick I knew to see how it compared to the performance improvements in .NET 7 using .NET 6 as a comparison. Stay until the end for something really mind bending!
Running an OpenTelemetry Collector Locally With Docker (Video)
Published by Stuart Blackler on: 2022-07-19. Tagged:devopsdotnetopentelemetry
Recently we’ve looked into adding logs, metrics & traces using console exporters. In reality, we want to send this telemetry to one or more places. Collectors allow your service to offload data quickly, standardise access to protected exporter endpoints and can take care of additional handling like retries and batching.
In this video, you will learn:
- The difference between the standard collector and the contributors collector
- How to run an OpenTelemetry Collector using docker compose
- How to configure an OpenTelemetry Collector
Metrics in .NET Has Never Been Easier - OpenTelemetry (Video)
Published by Stuart Blackler on: 2022-07-12. Tagged:dotnetopentelemetry
Metrics are often handled via one of many protocols. The new contender to this is OpenTelemetry - a system for sending your logs, traces and metrics. This OpenTelemetry tutorial will guide you through how to setup a .NET Application to export your .NET metrics and do basic processing. You’re going to learn the following:
- How to edit and drop metrics
- How to setup application metrics with OpenTelemetry using the console exporter
- How to add external instrumentation like runtime metrics
How to Setup OpenTelemetry Logging in .NET (Video)
Published by Stuart Blackler on: 2022-07-08. Tagged:dotnetopentelemetry
You’ve discovered that OpenTelemetry can send logs as well as traces but you’re not sure how set this up? This OpenTelemetry tutorial will guide you through how to setup a .NET Application to include log exports and do basic processing. All your logs and traces will be linked automatically.
How to Use NuGet Packages in Source Generators (Video)
Published by Stuart Blackler on: 2022-07-05. Tagged:dotnet
Learn two slightly different approaches to using NuGet Packages as part of the C# Source Generators you’re building. You may want to do this to parse a configuration file from a YAML based format. Now, you could either write the YAML parser yourself, or like most others, I would prefer to use a pre-built and tested NuGet package.
Possibly the Quickest Package Versioning on .NET? #Shorts (Video)
Published by Stuart Blackler on: 2022-07-03. Tagged:dotnet
Learn possibly the quickest way to version a .NET NuGet package or Application with minimal fuss by using MinVer. Source code available to all of my sponsors in the link below.
How to Use Git to Save Your .NET Source Generator Output Files (Video)
Published by Stuart Blackler on: 2022-06-30. Tagged:dotnet
Ever wanted to see the files generated by .NET Source Generators? Ever wondered what the effect of your changes to your generators are? Well this is the video for you. See how you can output the generated files and potentially save them in Git.
Warning: if you generate thousands of generated files and don’t tell you co-workers first, they might be annoyed…. :D
How to Make Your Csproj Settings Available via NuGet (Video)
Published by Stuart Blackler on: 2022-06-21. Tagged:dotnet
Want to know how to set your global usings across all your packages simply by using a .NET NuGet package? Then this is the video for you. I’ll show you how to setup your NuGet package and which properties and files to create for all the magic to happen.
3 Ways to Increase the Reliability of Your Applications With Polly (Video)
Published by Stuart Blackler on: 2022-02-03. Tagged:dotnet
In this video, we’re going to talk about how to increase the reliability of your applications using Polly. Polly is a software that allows you to monitor the reliability of your applications and make improvements as needed. By using Polly, you’ll be able to identify and fix reliability issues early, saving you time and money in the long run. This video will teach you how to use Polly to increase the reliability of your applications, so be sure to watch it!
3 Ways to Increase App Reliability With Polly (Article)
Published by Stuart Blackler on: 2022-02-03. Tagged:dotnet
In this article, we’re going to take a look at the different ways that you can make your .NET applications more stable by using 3 different patterns: Retrying with decorrelated jitter, bulkheads and circuit breakers.
Extending the AWS SDK for .NET (Video)
Published by Stuart Blackler on: 2022-01-08. Tagged:dotnetaws
In this video we’re taking a look at how to extend the AWS SDK for .NET, which can be useful for various tasks like adding in some custom observability components into the request pipeline. This article is a companion resource for the video linked above in case you prefer a written version. I’m actively using the approach described here to implement distributed tracing for all my AWS calls.
Extending the AWS SDK for .Net (Article)
Published by Stuart Blackler on: 2022-01-08. Tagged:dotnetaws
In this article we’re taking a look at how to extend the AWS SDK for .NET, which can be useful for various tasks like adding in some custom observability components into the request pipeline. This article is a companion resource for the video linked above in case you prefer a written version. I’m actively using the approach described here to implement distributed tracing with OpenTelemetry for all AWS calls at work.
Things You Might Not Know About CSharp - Duck Typing (Article)
Published by Stuart Blackler on: 2022-01-07. Tagged:dotnet
This is the next part of my series taking a look at some of the lesser known features of the C# language. Today we will be looking at duck typing and how it is used in C#. Much like the previous article, your millage may vary in terms of actually using these features for day to day programming, so think of this series as raising awareness that these things exist, not that you should use for general purpose programming. Without further adieu…
Things You Might Not Know About CSharp - Using Params With Indexers (Article)
Published by Stuart Blackler on: 2022-01-02. Tagged:dotnet
This is the first part of my series taking a look at some of the lesser known features of the C# language. Today we will be looking at index parameters, specifically how to use
params
with them, and how they are used in C#. With these articles, your millage may vary in terms of usability of these features for day to day programming, so think of this series as raising awareness that these things exist, not that you should use for general purpose programming. Without further adieu…
Posts In 2021
Snitch: The Smart Way to Clean Up Your .NET Dependencies (Video)
Published by Stuart Blackler on: 2021-02-17. Tagged:dotnet
Transitive dependencies can be problematic when the same package is registered in multiple projects. Learn how to use a tool called Snitch to clean up your .NET project files and prevent future problems.
OpenTelemetry: Simple Distributed Tracing in .NET Libraries (Video)
Published by Stuart Blackler on: 2021-02-11. Tagged:dotnetopentelemetry
Following on from our introductory video, this OpenTelemetry tutorial walks through how to add custom ActivitySources that can be used in many libraries such as OpenTelemetry to support a distributed tracing scenario, without creating any dependencies. This is incredibly powerful for .NET library authors as they don’t have to wait for .NET 5 to take advantage of this amazing capability.
Get Started With OpenTelemetry Tracing and ASP.NET Core (Video)
Published by Stuart Blackler on: 2021-02-07. Tagged:dotnetopentelemetry
In this OpenTelemetry Tutorial, take a look at how to quickly get up and running with OpenTelemetry in an ASP.NET Core application. You’ll learn how to setup the automatic instrumentation for both inbound and outbound web requests and how to configure the Jaeger Exporter (https://jaegertracing.io) - running it all in a local environment.
For more information about the differences between OpenTelemetry and what is available in .NET out of the box, also checkout this article by Rehan Saeed: https://rehansaeed.com/deep-dive-into-open-telemetry-for-net/
AWS Architecture Design - Global Lifts Scenario (Video)
Published by Stuart Blackler on: 2021-02-04. Tagged:dotnetaws
Ever wondered how to answer the architecture design questions in interviews? If so, this video is for you. I take a sample of what I often receive as an architecture test and walk through how I would design the architecture on AWS explaining each design decision on the way - often with notes about the technology capabilities along the way. We will also go through some common questions that are often thrown in as curve balls during the process - including how to prevent them through efficient design.
Nothing in this video is scripted or prepared in anyway, just the scenario, the camera (which died) and my thoughts. Please do your own research on the techniques presented here before you implement them in your architectures to make sure you have a real understanding of how it all works.
If you like this video and want to see more like this, or have a scenario you would like me to cover, please let me know in the comments below and we can explore new scenarios together :)
Building Better NuGet Packages (Video)
Published by Stuart Blackler on: 2021-02-01. Tagged:dotnet
In this NuGet tutorial, learn how to set common package tags in your csproj, enable deterministic builds, enable SourceLink for your packages and validate them using dotnet validate and NuGet Package Explorer.
Stateless Workers in Microsoft Orleans (Video)
Published by Stuart Blackler on: 2021-01-26. Tagged:dotnet
Learn about the use cases for stateless workers in Microsoft Orleans, and how to use them. This video is part of the Running Microsoft Orleans in AWS series. If you missed the introduction, or want to watch more in the series, see the playlist here: https://bit.ly/orleans-code-with-stu
5 Ways to Improve Your .NET Builds (Video)
Published by Stuart Blackler on: 2021-01-18. Tagged:dotnet
Ever wish that you could share your .NET project properties across multiple projects? Or debug that funky build? In this video, you’ll learn at least 5 different tips and tricks to hack and improve your .NET builds by leveraging some cool features that MsBuild has to offer.
Using Certificates From AWS Private Certificate Authority in .NET (Article)
Published by Stuart Blackler on: 2021-01-17. Tagged:dotnetdevopsaws
As more and more companies get hacked, there is a strong resurgence in the community for the desire to have TLS for everything, everywhere. There are many valuable projects, tools and resources, such as LetsEncrypt available to help both individuals & companies secure their resources. One of those tools is AWS Private Certificate Authority.
Timers & Reminders Backed by DynamoDB in Microsoft Orleans (Video)
Published by Stuart Blackler on: 2021-01-13. Tagged:dotnet
Following on from the previous video, you’ll learn how the difference between timers and reminders in Microsoft Orleans, and how to implement each one. This video is part of the Running Microsoft Orleans in AWS series. If you missed the introduction, or want to watch more in the series, see the playlist here: https://bit.ly/orleans-code-with-stu
Call Filters in Microsoft Orleans (Video)
Published by Stuart Blackler on: 2021-01-11. Tagged:dotnet
Following on from the previous video, you’ll learn how to implement a basic incoming and outgoing call filter in Microsoft Orleans. This video is part of the Running Microsoft Orleans in AWS series. If you missed the introduction, or want to watch more in the series, see the playlist here: https://bit.ly/orleans-code-with-stu
Posts In 2020
Blending Metrics Using EventCounters in C# (Article)
Published by Stuart Blackler on: 2020-12-27. Tagged:dotnet
In a world where we use auto-scaling a lot, its often not just one metric that we will take into consideration when deciding whether or not to scale our applications. For example, we might have a combination of CPU usage, memory usage and web request latency. Some services like AWS CloudWatch Metrics only allow scaling based off a single value. Luckily, we can blend metrics together to create new ones, which we can then use in our scaling policies. A blended metric is made up of however one or more existing metrics that you choose, called aspects, and can be published as if it were any other metric, eg: publish to DataDog/Cloudwatch.
Publish Metrics to Cloudwatch in .NET Core (Article)
Published by Stuart Blackler on: 2020-12-13. Tagged:dotnetdevopsaws
In a previous post I took a look at how we can utilize .NET event counters to record metrics in our applications. However, I never covered the implementation of how I write the metrics to either CloudWatch or DataDog. In this article, I’m going to take a look at how to publish metrics to CloudWatch and one way of integrating it with the aforementioned blog series.
Clustering Microsoft Orleans With DynamoDB (Video)
Published by Stuart Blackler on: 2020-12-06. Tagged:dotnet
Following on from the previous video, you’ll learn how to setup clustering with DynamoDB as the backend. This video is part of the Running Microsoft Orleans in AWS series. If you missed the introduction, or want to watch more in the series, see the playlist here: https://bit.ly/orleans-code-with-stu
Building a Zero Trust Architecture in AWS (Article)
Published by Stuart Blackler on: 2020-12-05. Tagged:dotnetdevopsaws
In the vast majority of companies that I’ve been in, software engineering & infrastructure best practises have often been left as something that needs to be updated later because building the product comes first. This is completely understandable as if you don’t have a product, you don’t have employment. This presents problems later when companies are beginning to scale rapidly and become popular. Not only does the company becomes a target for malicious actors, but security-related incidents can easily occur by leaving storage devices open accidentally. Once a malicious actor is in your system, you usually have pretty big problems unless you design your architectures with Zero Trust in mind.
Persisting Microsoft Orleans Grain State With DynamoDB (Video)
Published by Stuart Blackler on: 2020-11-29. Tagged:dotnet
Following on from the previous video, you’ll learn how to setup grain persistence with DynamoDB local. This video is part of the Running Microsoft Orleans in AWS series. If you missed the introduction, or want to watch more in the series, see the playlist here: https://bit.ly/orleans-code-with-stu
Using Moq With Ref, in and Out Parameters in C# (Article)
Published by Stuart Blackler on: 2020-11-28. Tagged:dotnet
In this article, I want to take a look at a scenario that I came across this week which I’ve come across a few times. Occasionally, you will have an interface that you wish to mock out with Moq and find you have troubles because the method signature takes a
ref
or anout
parameter. This week, I’ve found a way that we can successfully mock the method without too much of a change to the test code.Introduction to Microsoft Orleans (Video)
Published by Stuart Blackler on: 2020-11-22. Tagged:dotnet
In this video, I’m going to take you through an Introduction to the Microsoft Orleans actor framework. You’ll learn:
- What is the virtual actor model?
- What is a grain?
- What is a silo?
- How this works in conjunction with AspNetCore using the Generic Hosting Model
A Look Into CloudEvents (Article)
Published by Stuart Blackler on: 2020-11-21. Tagged:dotnetdevops
Over the past few months, I’ve been looking into the internal architecture setup for Checkout.com and seeing how we can scale it for the next few years. As part of that research, I’ve been looking into the CloudEvents specification as a potential option as the basis for a common event schema across teams.
Setting Up a Repository Template in Github for K6 (Article)
Published by Stuart Blackler on: 2020-10-11. Tagged:dotnetdevops
In my previous article, we took a look at setting up a template repository for our .Net projects. Repository templates can massively help with the consistency and startup speed of a new project. In this article, we will take a look at a different repository template that I’ve been using for work for running our performance tests.
Setting Up a Repository Template in Github for .Net (Article)
Published by Stuart Blackler on: 2020-10-10. Tagged:dotnetdevops
Over the past few weeks, I’ve been updating some of my projects to latest standards, adding in Github Actions where appropriate etc. Most recently I’ve setup a template repository in Github.
Implementing Simple Feature Toggles in AspNetCore Using IConfiguration (Article)
Published by Stuart Blackler on: 2020-08-29. Tagged:dotnetaspnetcore
Recently, we’ve had the need to build a few feature toggles in our applications that can be changed at runtime. This article walks through a simple approach that you can use in your applications, including a description of a route to dynamic feature toggles.
Architecture Pathway Introduction (Article)
Published by Stuart Blackler on: 2020-07-15. Tagged:dotnetarchitecture
Over the past year or so, I’ve had the pleasure of mentoring people on their software development journeys. Some of those personnel have expressed a desire to pursue the software architect route. As it’s something that I often refer to, I’ve decided to post a mini-pathway to help guide on some of the basics.
My Favourite Git Aliases (Article)
Published by Stuart Blackler on: 2020-07-11. Tagged:dotnetdevopsgit
Git aliases are used to create new git commands that can either invoke a function, or be used to create commands that map to longer commands. For example, we could map
git co
togit checkout
or havegit undo
undo our previous commit. In this article, I’m going to show you some of my favourite git aliases.Diagnostics in .Net Core 3: An Alternative Approach to Using Dotnet-Counters With Docker (Article)
Published by Stuart Blackler on: 2020-06-25. Tagged:dotnet
In a previous article, we took a look at a way to use
dotnet-counters
with an external image. This article takes a look at how we can embed the tooling that we require into the image so that we extract the counter/memory information as required. This approach does not require elevated permissions as before.Diagnostics in .Net Core 3: Listening to Inbound HTTP Requests (Article)
Published by Stuart Blackler on: 2020-06-19. Tagged:dotnetaspnetcore
In my previous article we took a look at how to monitor outbound HTTP requests using a
DiagnosticListener
. In this article, we will re-use some of the same components to monitor inbound HTTP requests. We could use middleware to do as most approaches do, but this approach is highly dependent on the middleware that you have and the duration of this, so we will re-use some of the code from last time.Diagnostics in .Net Core 3: Listening to Outbound HTTP Requests (Article)
Published by Stuart Blackler on: 2020-06-18. Tagged:dotnet
Throughout the course of my Diagnostics in .Net Core series, we’ve taken a look at the basics of how to use the Event Counters API. In this article, we will take a look at how we can capture all outbound HTTP requests automatically as they occur.
Diagnostics in .Net Core 3: Using Dotnet-Counters With Docker (Article)
Published by Stuart Blackler on: 2020-01-25. Tagged:dotnet
In my previous post, I described how we can leverage the new EventCounter diagnostics API to add custom event counters and listen for built in counters. In this article, I will walk through how we can leverage the
dotnet-counters
tool with a running docker image.Diagnostics in .Net Core 3: Event Counters (Article)
Published by Stuart Blackler on: 2020-01-05. Tagged:dotnet
Recently, I’ve been playing with the new diagnostic improvements in .Net Core 3. Traditionally, I’ve always used the great AppMetrics package to capture the metrics from our applications and send scrape them with a Prometheus & Grafana setup. Whilst reading about the improvements, I wondered whether or not it would be possible to push metrics to Prometheus.
Posts In 2018
Utf8Json Media Formatters for ASP.Net Core (Article)
Published by Stuart Blackler on: 2018-07-29. Tagged:dotnetaspnetcore
Recently, I have been looking at the Utf8Json project and evaluating for use in our high performance payments API. Looking at the benchmarks on the Github page, and running my own benchmarks, the numbers stated seemed to tally up, so I built a few media formatters for aspnet core.
Building Service Fabric Apps With VSTS YML Build Definitions (Article)
Published by Stuart Blackler on: 2018-06-30. Tagged:dotnetdevops
In my previous article, we setup a standarised build using the new YML build definitions within VSTS, using the .Net CLI tooling. In this article, we will use the same setup as our base, but we will build and publish a service fabric application.
Automated Builds in VSTS With YML Build Definitions (Article)
Published by Stuart Blackler on: 2018-06-17. Tagged:dotnetdevopsaspnetcore
In this article we will explore a preview feature inside of Visual Studio Team Services (VSTS) called YML Build Definitions. In essence, this allows you to change your build process from a
.yml
file in your git repository much in the same way as you can do with other services such as AppVeyor. During the article, we will setup a build definition for an Aspnet Core website.
Posts In 2017
Ensuring Samesite Cookies With URL Rewrite (Article)
Published by Stuart Blackler on: 2017-06-11. Tagged:dotnetdevopsseo
In this article, we will increase our websites level of protecting against Cross-Site Request Forgery and Cross-Site Script Inclusion attacks by appending an additional modifier to the
Set-Cookie
HTTP header.Ensuring Secure Cookies With URL Rewrite (Article)
Published by Stuart Blackler on: 2017-06-11. Tagged:dotnetdevopsseo
In this article, we will take a look at secure cookies, that is by appending an additional modifier to the
Set-Cookie
HTTP header.Ensuring HttpOnly Cookies With URL Rewrite (Article)
Published by Stuart Blackler on: 2017-06-06. Tagged:dotnetdevopsseo
In this article, I will give a brief overview of cookies, why we want them to be httpOnly and how we can ensure this via URL Rewrite. We will also be creating our first outbound rewrite rule with a pre-condition.
Removing Trailing Slashes With URL Rewrite (Article)
Published by Stuart Blackler on: 2017-06-05. Tagged:dotnetdevopsseo
In the previous post, I explained why canonical urls are important and how to enforce them . In this article, I will show you how to have a canonical host url.
Canonical Host Urls With URL Rewrite (Article)
Published by Stuart Blackler on: 2017-06-04. Tagged:dotnetdevopsseo
In the previous post, I gave a brief intoduction to URL Rewriting and showed you how to get from HTTP to HTTPS. In this article, I will show you how to have a canonical host url.
Up and Running With URL Rewrite - Going From HTTP to HTTPS (Article)
Published by Stuart Blackler on: 2017-06-03. Tagged:dotnetdevopsseo
In this series, I am going to take you through a few
web.config
snippets that have come in handy for me when using URL Rewrite on IIS. Firstly, I am going to introduce the URL Rewrite module then show a sample of going from HTTP to HTTPS.Domain Driven Design Notes (Article)
Published by Stuart Blackler on: 2017-05-24. Tagged:dotnetarchitecture
These are my notes on domain driven design whilst watching the course by Dino Esposito on Pluralsight.
Domain Driven Design (or DDD), is the process of discovering both data and behavioural requirements for a given problem domain where traditional approaches usually focus purely on data collection aspects. The aim is to provide better tools to tackle the complexity at the heart of software.
Posts In 2016
Write Good Code, Not Code Hastily (Article)
Published by Stuart Blackler on: 2016-12-21. Tagged:dotnet
This article is a rework of a draft that I’ve had sitting in my drafts folder for a long while now. Over the last six months or so, I’ve been reviewing a lot more code than I had previously thanks in part to a promotion and in part, code reviewing applicants coding entries. Some of the code has been good, with some code, really not so good!
Posts In 2015
Up and Running With Git and Powershell (Article)
Published by Stuart Blackler on: 2015-02-23. Tagged:dotnetdevopsgit
We’ve all experienced a time where we use our pc’s for a prolonged period of time, accumulating a ton of crap along the way as we try out various technologies and fads. After a while, the pc begins to do funny things like crash for no apparent reason. This week, I needed to rebuild my dev machine and decided to change from Atlassian’s Source Tree over to Powershell and raw git.
3 Easy Steps to Configuring Azure With Powershell (Article)
Published by Stuart Blackler on: 2015-02-17. Tagged:dotnetdevopsazure
Recently, I had to automate some tasks in Azure. This is the easiest way I could get started.
DevOps (Article)
Published by Stuart Blackler on: 2015-01-24. Tagged:dotnetdevopsdevelopment
As part of my role as a .Net Developer, I have recently been getting to grips with the build and deployment features of both Teamcity and Octopus Deploy. This has been making me think about the industry buzz word “DevOps” and exactly what that means.
Posts In 2014
Message Queue Fundamentals: MSMQ (Article)
Published by Stuart Blackler on: 2014-09-28. Tagged:dotnet
MSMQ is Microsoft’s Message Queuing service that can be used to implement both synchronous and asynchronous solutions. Typically solutions are architectured using the available C++ API’s or via the relevant COM objects. The .Net Framework exposes the System.Messaging namespace which contains all the classes that you need to work with the MSMQ API.
Message Queue Fundamentals: Introduction (Article)
Published by Stuart Blackler on: 2014-09-07. Tagged:dotnet
Message queues are a substantial part of modern day enterprise architectures and a vital part of providing scalable solutions. They are designed for asynchronous communication between different parts of the system. They help scale individual components of a system and increase reliability with the optional addition of the persistence of messages to a storage system.
Finding Reducible Expressions (Article)
Published by Stuart Blackler on: 2014-06-24. Tagged:dotnet
Today I just wanted to share a quick note regarding a Stack Overflow answer that I recently came across. In the answer the author explains that a call to
Expression.CanReduce
will typically return false, whileExpression.Reduce()
will return the current expression. The author continues to state that one of the types that overridesExpression.Reduce()
andExpression.CanReduce
isMemberInitExpression
.How Your Binary Search Implementation Is Broken and How to Fix It (Article)
Published by Stuart Blackler on: 2014-06-20. Tagged:dotnetjava
I have recently begun studying the theory and implementations of algorithms. During this study, I came across this post which describes how a bug exists in most implementations of a binary search algorithm.
Unit Testing Equals the Forgotten Tests (Article)
Published by Stuart Blackler on: 2014-06-18. Tagged:dotnet
Today I wanted to cover something that is not often covered when unit testing an object. If an object has the
Equals
method overridden, then there are a number of tests that we should be running as a minimum:Enabling HTTP Strict Transport Security HSTS via Web Config (Article)
Published by Stuart Blackler on: 2014-06-10. Tagged:dotnet
In my previous post, I discussed how to enable HSTS via MVC Action Filters. I thought that I would just do a follow up post showing you how to enable it via the web.config.
Enabling HTTP Strict Transport Security HSTS via ASP Net MVC ActionFilters (Article)
Published by Stuart Blackler on: 2014-04-21. Tagged:dotnetaspnetcore
After reading Troy Hunt’s free ebook on the OWASP Top 10 for .Net Developers, I discovered an additional mechanism to help developers secure their websites. That mechanism is HTTP Strict Transport Security.
Posts In 2013
Using IDisposible Correctly (Article)
Published by Stuart Blackler on: 2013-05-06. Tagged:dotnet
In this article, I am going to show you how to use the
IDisposable
interface correctly in your code. When I read other’s code, it is easy to pick up on subtle bugs. We need to begin to train ourselves to see the bugs and we do this by understanding what we are using. Before we begin, we need to make sure that we understand a core piece of computer science theory: Destructors.Semaphore vs SeamphoreSlim Micro Benchmark (Article)
Published by Stuart Blackler on: 2013-03-11. Tagged:dotnet
In this post, I am going to show a small micro-benchmark to demonstrate the performance difference between the
Semaphore
andSemaphoreSlim
classes in C#. ASemaphore
is often used to restrict the number of threads than can access some (physical or logical) resource. In this case, we want the restriction to be as little as possible.
Posts In 2012
Flicker Free Forms and Listview in .Net (Article)
Published by Stuart Blackler on: 2012-12-30. Tagged:dotnet
On a project I have been working on recently, I came across a problem where under Windows an Mdi Child form would flicker when it loads. Trying to find information on what was the cause of this was near impossible. I ended up trying a lot of code snippets that I found when googling the problem and this is what I have come up with.
Extension Methods in Dotnet (Article)
Published by Stuart Blackler on: 2012-12-01. Tagged:dotnet
In this article we will take a look at what extension methods are and how to use them in .Net. Personally, they are one of the best things that has been introduced into the .Net framework in terms of readability. I will take you through what extension methods are, how to create them (in c# and vb) then I will show you some of the extension methods that I have created (in c# only, conversion is for you to try).