.NET
Spawning Processes into Interactive Sessions
Starting a Windows process using .NET is normally an easy thing.You call Process.Start() with a l...
NET Core CORS Setup
Here’s a quick rundown on how to setup CORS in a NET Core API. It takes three pieces: CORS ...
Net Deep Copy/Cloning
Below are some references for different methods of accomplishing deep copies of object types. NO...
C# Equality Operator Overloading
Here’s a good example for how to implement operator for equality (==, !=, .Equals()). This is ta...
When Two Referenced Assemblies Have Overlapping Namespace
You will come across a problem at some point, where you will use a class, that exists in two libr...
DotNet Assembly Searching
Here are notes about the Assembly Helper classes that are part of OGA.SharedKernel.Lib and OGA.Co...
C# CLIWrap Chaining Multiple Statements
Normally, each call to CLIWrap is performed inside an independent terminal session. So, there mu...
C# Calculate Hash of List<T>
Here's a quick method that will generate a hash from a List of objects: public int GetHashCodeOf...
C# Check Two Lists<T> Are Equal
Quick method for check if two given lists of objects are equal: static public bool AreListsEqual...
Named Async Locks
As application complexity grows, you will eventually need a scalable way to serialize queries and...
Good Article on Net Core With or Without IIS
Publishing and Running ASP.NET Core Applications with IIS - Rick Strahl's Web Log (west-wind.com)
NET Core Func Variables
Here are some use cases for a Func. Func as Method Callback If you want to have a lambda that y...
C# Unit Tests with Async Task Signature
When writing unit tests, it’s good to standardize as much as possible.This includes the method si...
Process Logging Behavior
Here’s my current conventions for logging in application processes. Logging features, here are i...
Dotnet Dev on Linux
To create a new project at the current folder: dotnet new console --framework net6.0 --use-progr...
NET Core Error Responses
Here’s a decent mechanism for returning useful errors from a WEB API. Aside: We have a standing ...
NET Core Test API
We have a standing REST API with various endpoints for simulating different method types, return ...
Six Ways to Multi-Thread
Six ways to initiate tasks on another thread in .NET
Return Multiple Values from Async Method
Async method cannot have Ref or an Out parameters. So, we cannot pass back data from them through...
Strongly Typed Constant Parameters
You will eventually run into the need for a function to accept a restricted set of value for a pa...
Consuming Services Inside Startup
During Startup.ConfigureServices During application startup, the Startup.ConfigureServices metho...
NET Core Background Services
NOTE: Refer to this page for how to register and consume a background service: Consuming NET Core...
Consuming NET Core Background Service with DI
To properly consumes a background service from a controller or another service, it must be regist...
C# Disposed in Derived Types
People make lots of references to Microsoft articles about how to properly handle Dispose in deri...
Duplicating .NET Core DI
NOTE: If you are looking for how to access DI services, see this: HowTo Access DI Services Here ...
Unit Testing with IServiceProvider
When you create unit tests for class types that directly use DI to retrieve dependencies, you wil...
Unit Testing Conventions
Suppress Async Warning Project-Wide Since we have several calls to base classes for diagnostics ...
VS IDE Suppress Compiler Warnings Project Wide
There are some cases where it is necessary to suppress IDE compiler warnings that apply to the en...
#nullable Warning
If the compiler is giving you warnings about nullable reference types, then you may need to enabl...
.NET Framework Unit Testing Issues
Since we have some libraries that still output to NET Framework targets, some workarounds are req...
Unit Testing for an Exception
Sometimes, a unit test needs to ensure a particular exception type occurs. Here’s how to check t...
Unit Test Cheat Sheet
Here’s a list of elements for unit testing in Visual Studio using MSTest. Documentation for Visu...
C# Unit Test Template Classes
If you are using MSTest as your testing framework, and want to leverage the test functionality fr...
Xamarin
PostgreSQL DotNet DataType Mapping
Here’s a list of .NET datatypes, and how best to store each one. .NET Datatype Post...
Missing AspNetCore Nuget Packages
There are several aspects of an ASP Net Core web API that cannot be placed in a class library wit...
Ubuntu: How to Kill DotNet Runtime
Sometimes, a a dotnet runtime closes without releasing a listening port. This will prevent it fr...
HowTo Run DotNet Core App as Standalone
How to startup a net core application and specify the listening IP address and port: exename.exe...
Cancellation Token as Method Parameter
When writing a method that accepts a cancellation token, the method will need to deal with a pass...
.NET Process Boilerplate
Exploring standardized boilerplate for a variety of process types. Here's a known list of proces...
Updating Controls from Non-GUI Thread
Here are a couple methods for how to update form controls from a non-GUI thread. Explicit Setter...
VS Project Conditional Constants
When developing cross-platform libraries, you will have the need to enable and disable different ...
.NET Core In-Memory Cache
Here is a working method for using the In-Memory cache. For a thread-safe cache update, see the ...
C# Lambdas
Here are quick examples of how to create anonymous lambdas in C# method blocks. With Delegate ...
.NET How to Create and Publish Nuget Package
Taken from here: docs.microsoft.com-nuget/docs/quickstart/create-and-publish-a-package-using-the...
How To Add Release Notes to Nuget Package
These are the steps needed to include release notes in a Nuget package. These are taken from thi...
Nuget Build and Publish Scripts for Multiple Targets
Here’s a set of basic command line steps to run, to generate a nuget package for a library or an ...
Create Nuget for Multiple Targets or Architectures
Creating nuget packages that contain libraries for multiple frameworks or runtimes, requires some...
Nuget Package Reference
Here’s the golden reference for all things Nuget: docs.microsoft.com-nuget/docs at main · NuGet/...
Code Signing References
Here are pages associated with signing .NET binaries (exe and dll) and installers: Code Signing ...
HowTo: Create a New Cloud Service or Library
Current as of: 20250126 This list will be revised as more steps get automated. This is a workin...
Visual Studio 2022 Offline Installation
Here are steps to install Visual Studio 2022 in an offline environment. It involved creating a l...
Getting Correct Scheme, Host, Port Behind a Proxy
When running an API behind a reverse proxy, such as NGINX, the service will not, by default, see ...
URIService Behind Hostname Separated NGINX Server Blocks
If you have an API service that is called by multiple server blocks of an NGINX proxy, and the se...
Mocking a DBContext for Testing
The easiest means to mock a data context for testing, is to use an in-memory database. An in-mem...
Net Core DI Truths
References: NET Core DI Best Practices Here’s a list of behaviors of the NET Core DI registry: ...
IServiceProvider vs IServiceScopeFactory
References: Net Core DI Truths Internet’s Claim of Anti-Patterns Contrary to what the internet ...
How to Create IOptions Instance
It’s pretty standard for classes to require configuration in their constructors in the IOptions f...
HowTo Access DI Services
NOTE: If you are looking for how to generate an instance of ServiceProvider, outside of NET Core ...
HowTo Make .Net Desktop App DPI Aware
For a better desktop UI experience, it is necessary to have access to the current screen size and...
Unit Tests with PostgreSQL Backends
In order to easily stand up a Postgres database for unit and integration testing, we need a class...
EF - DataContext Attributes
When creating a provider-scoped data context (one for a specific backend), you need to decorate t...
EF - Backend vs .NET Datatypes
Here's a list of what datatypes that Entity Framework uses to store .NET datatypes in a couple di...
Using Visual Studio with Git
Visual Studio brings in lots of files and folders that don't belong in a checked in repository. ...
EF: Derived Stored Types
If you want to create an entity type that happens to derive from another entity type, JUST TO sim...
EF: Data Contexts - DbContexts
When working in EF, you will come across the need to create a DbContext type. MS has a base clas...