-
.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.
-
Fixing the dreaded JsonConverter JsonException: “Converter read too much or not enough”
Last week I wrote about creating a JsonConverter to handle some funky data conversion problems I was experiencing using System.Text.Json.JsonSerializer’s Deserialize<T>() method. I had some JSON-formatted data coming back from Azure DevOps and when I was parsing it, there were some data type formats that System.Text.Json.JsonSerializer wasn’t especially happy about. The solution to the problem…
-
Fixing JSON parsing exception “value could not be converted” using a JsonConverter
I’ve been working on a tool lately to parse a bunch of work item data from Azure DevOps. Specifically, I needed to call the Work Item Updates REST service in order to get all the state value changes for a bunch of work items. Everything was fine until I needed to convert the JSON result…
-
Azure DevOps API Continuation Tokens / Graph API not returning all users
I was doing some work last week with Azure DevOps user and security management Graph APIs. The Graph APIs let you manage users, and groups, and group memberships and I needed to make some changes for a couple thousand user accounts. It was definitely worth automating. When I was working with the API call that…
-
Angular WebAPI Project using .NET Core gets ‘404 Not Found’ or runs on wrong port
My Angular / WebAPI application suddenly stopped working from Visual Studio and VSCode. Turned out that I was missing an environment variable.
-
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…
-
3 Common Problems with ClaimsIdentity and ClaimsPrincipal in ASP.NET Core
In .NET Core, the ClaimsIdentity class represents a user in your application. It helps describe who they are and helps manage the list of claims which describe what they can do. But if you use the wrong constructor on ClaimsIdentity or provide the subtly wrong information to that constructor, you might see some strange behavior. …
-
Profile a Unit Test in Visual Studio Fails with “File contains no data buffers”
Visual Studio has a fantastic feature in it that lets you quickly run the performance profiler against a unit test. Got a test that is running slow and you want to find out why? Go to Test Explorer, right-click that test and choose Profile. That’ll automatically run that test with the profiler attached. It usually…
-
Some Model Properties Not Binding in ASP.NET MVC Core
[TL/DR? – skip to the bottom] I ran into a problem with an ASP.NET MVC Core app today and it took me a while to figure it out. Here’s the problem: on an extremely simple and straightforward form, I couldn’t get a field in my model to POST back to the server. Every time that…
-
Some Useful Visual Studio Code Snippets
Update: June 20, 2019 — Here’s an updated version of this post and the snippets including support for Visual Studio and Visual Studio for Mac. A couple of months ago, I got inspired to really learn .NET Core and Visual Studio Code (VSCode). But I didn’t just want to learn it from Windows — the…