-
How to Fix C# Primary Constructor Warning: CS9107 “Parameter is captured into the state of the enclosing type”
In refactoring a C# project, the author encountered the CS9107 warning in Visual Studio 2022 while using Primary Constructors. This warning arises from a shared variable reference between the primary constructor and the base class. The fix involves using the base class variable exclusively to avoid dual references, eliminating the warning.
-
How to Add Performance Counters to your .NET Core Application
The post discusses ways to monitor the performance of .NET Core applications for DevOps observability and for performance tuning. We start by explaining how to implement performance metrics in .NET Core applications using System.Diagnostics.Metrics. We wrap up by showing you how to use a tool called dotnet-counters to view the live performance data.
-
Fix: Azure App Services Log Stream is Empty for .NET Core App
When you’re trying to debug your .NET Core app that’s running on an Azure App Service, the Log Stream is an essential tool. So how do you connect the console logs from your .NET Core app to the Log Stream output?
-
.NET Core Solution & Project Utilities (slnutil)
Announcing the Solution & Project Utilities (slnutil)! These are a collection of the handy utilities that I’ve written for working with .NET Core Solutions, Projects, and configuration files. I hope you find them useful.
-
C#: How to Find All Files Including Hidden Files?
I was writing some code yesterday that needed to enumerate all files in a directory. So I wrote what I’ve been writing since the beginning of time: var files = Directory.GetFiles(“*.*”, new EnumerationOptions { RecurseSubdirectories = true }); At first, it seemed to be working just fine but then I noticed that hidden files were…
-
A Handy Script for .NET Developer Containers on Docker
I’m a .NET Core developer and I mostly work on a Mac. Before docker and containers, this would have been hard to do. But now there are containers for SQL Server, the Azure Storage emulator, and the CosmosDb emulator. Developing on a Mac is easy now. And developing on a Mac makes it easy to…
-
GitHub Actions for Building, Testing, and Deploying .NET Core & ASP.NET Core Apps
Seems like there’s a lot of action(s) happening over on GitHub. How do I get a piece of that action(s)? Wheee! Puns! (I’ve been cooped up in my house too long.) So if you’re a .NET Core developer or an ASP.NET Core developer who maybe uses Entity Framework Core (EF Core), how do you deploy your apps using GitHub…
-
Force ‘dotnet publish’ to publish dependencies using PublishWithAspNetCoreTargetManifest
I ran into a problem today doing an automated build for a ASP.NET Core 2 project and then trying to deploy the output. From the command line, I ran “dotnet publish -o c:\temp\presidents” to build and publish the code for my ASP.NET Core web application. Then I went to the directory that I just published…
-
“DevOps with ASP.NET Core, EF Core, & TFS2017”: Slides & Code
[Updated 3/23/2017 — If you saw this talk at DevBoston or Code Camp Boston, it’s the same slides and code at NYC .NET.] I spoke at the NYC .NET Developers user group last night and gave my new “DevOps with ASP.NET Core, EF Core, & TFS2017” talk. DevOps is all about software delivery. Create an…
-
Deploy Entity Framework Core Migrations from a DLL
[Updated 4/27/2018 — Added an EF Core 2 version of this script in a new blog post.] [Updated 3/29/2017 — Added a bash version of this script for deploying EF Core Migrations from Linux.] Entity Framework Migrations let you deploy incremental updates to a target database. With Entity Framework Core (EF Core) this is done from…