Building iOS store certificates on Windows

UPDATE Oct 2019: 2FA breaks things :(

How many times have you been working on a cross platform app and been ready to submit to the app stores, but then the Apple store needs a .csr that you should “use a Mac” to generate?

When I google this, I got lots of complicated methods using IIS to request certificates through a quite frankly terrible UI/UX, and most of the guides glossed over how to actually get that .p12 at the end you needed.

Incorporating .NET Core 2.1 into existing .NET Framework/UWP applications

EDIT: As a colleague pointed out, the method below could potentially cause errors at runtime if the .NET Core 2.1 runtime is not installed.

The recently announced .NET Core 2.1 brings some nice new features, but the big draw is the support of Span and it’s performance happy friends.

Adventures in Xamarin Forms

Xamarin Forms should be an easy sell.

  • Work in C# and XAML. Two good (XAML…?) and well defined languages
  • Works across major mobile OS’s
  • Even works for UWP, enabling a desktop experience if desired

But there’s a shadow that hangs over Xamarin, one shared by most mobile dev platforms: FIDDLINESS.

Software Testing

Testing is an oft argued topic, as I discovered when I started at Readify.
As a bit of a testing noob, I’d only read a bit about testing and thought “That sounds useful, more things caught before deployment”, but upon trying to write them, I found it hard to come up with sensible scenarios. Many of the tutorials I’d seen were around calculations which just aren’t a part of my job in any way.

ASP.NET Core Background Service

Background tasks are often delegated to worker projects or external libraries to be handled, but ASP.NET Core has something like this inbuilt.
The actual interface is IHostedService and is registered in startup.cs like:

services.AddHostedServices<SOME_BACKGROUND_SERVICE>

Mailkit ASP.NET Core

Mailkit is the new official replacement for the SMTPClient as indicated here. There are much better tutorials than anything I can write right now, but here’s a quick primer (there’s also a good tutorial in the Readme for Mailkit)

Issues with Android Emulator DNS

The Android Emulator is pretty sweet now. Fairly performant, works with Hyper-V still enabled, etc.
Recently I started having an issue where the emulator wouldn’t get it’s network set up properly. My adapter list looks pretty crazy (15 or so adapters), so maybe it’s getting confused? Anyway, seems to be an issue that others have come across as well, because I found a few StackOverflow issues about it.

Adding Snyk to VSTS

Snyk is an open source tool for checking project packages for vulnerabilities. It currently checks the main package sources like npm and Nuget. While it has many integrations with source control (github, bitbucket, etc), there’s no VSTS build pipeline integration yet.
As such, I’ve gone and used the API instead! It was fairly straightforward to set up, which is good for the safety of our clients.

tl;dr

  • Setup Snyk account and get API key
  • Setup pipeline with SNYK_TOKEN (api key)
  • Have task to install Snyk and run snyk test

Forcing any version of Xcode on VSTS Mac build agent

Developers using the Apple Store might have recently noticed a message indiciating that “This app has been built for iOS 11.x. Starting March 2019, all apps will be required to target iOS 12.1 available in Xcode 10.1”

Using Service Connections in Azure DevOps

I was recently setting up a build pipeline in Azure DevOps and realised I didn’t have access to the Azure resources to be able to pick the app service as a deployment target.
The easy way would be to get my account access to the Azure resources, but:

  1. I’d be the only one with the ability to change those deployment options, or at least new devs would to get access as well before they could.
  2. The onsite guy for that kind of access was away.

VSCode Extension: Hugo syntax highlighting for Markdown

Some time ago, just after the first post on this blog, I started using Hugo Shortcodes.
The theme I was (still am) using didn’t have great support for some of the markdown stylings that I wanted, and instead of fiddling with that, I figured I’d create my own with custom styles and Hugo Shortcodes.

Angular Transclusion With Parameters

I recently came across a scenario where I had several components with the same structure in them, so I figured I’d extract it out into it’s own component.
Simple right? Everyday scenario?
Were it so easy…

Service Worker Updates

Service workers are the new hotness when it comes to web applications.
They allow a website to have some offline behaviours similar to that of an app, including an “installable” desktop experience.
In essence, they’re a small app that browsers can interpret and run, caching info and queueing requests, enabling offline access and data-saving.

Visual Studio and VS Code Tips and Tricks

A colleague mentioned they weren’t aware of Logpoints in Visual Studio, so here’s some things that aren’t on or known about by default (usually because they’re experimental or stylistic)

Some that I’ve found useful:

  • Logpoints
  • Cursor animations
  • Semantic highlighting
  • Parallel stacks
  • Output window filters
  • Unreferenced assembly Intellisense

Node as a Dependency

Managing node versions can become painful when switching between projects.
There’s a mechanism to check node versions during an npm install called Engines, but that doesn’t help if the projects are installed already.
The fix is to install node as a dependency. Who would have thought?

Casting NaN to Numerics

I came across an interesting problem today where a cast from double to int resulted in int.MinValue. Further digging revealed that it was a NaN problem. How did I get a NaN in simple C#? Damn divide by zero, that’s how. But wait, how did I not get an exception? I had: double first = 0; double second = 0; var result = (int)Math.Round(first / second); In the above case, result was -2147483648, but why!

Hugo Syntax Extension: Revisited

Hugo Shortcode Syntax Highlighter VSCode extension is live!

More improvements in April 2024

Migrating to dotnetcore 3.1 (mostly EFCore)

Dotnetcore 3 has been out for a little while now, and there were some changes I wanted in the project I was working on, so off I went and gave it a burl.
Needless to say, there were some issues, but in fairness, some of it was our fault.

C# - Static members in Generic classes are weird

Generic classes are useful coding constructs that I thought I mostly understood, but I had an issue with them recently that blew my mind… Static members in Generic classes don’t work as I naively expected.

HTML 5 Video and Images for Web

I like being efficient with my bits and bytes. I bought into the webp image format train pretty early, adopting it when I made this blog.
Recently I made a video longer than 2 seconds, so I started looking properly into codecs like VP9 and AV1.
Lets take a look into some video and image codecs and how the new shiny ones can be used.

Nancy + Castle + .NET 4.7 to dotnetcore

Nancy was deprecated earlier this year, so I decided to do a full upgrade of a codebase from .NET 4.7 to dotnetcore 3.1.
It’s been a loooong journey…Nancy and Castle have been interesting to migrate away from.

Revisiting Av1

AV1 on FFMpeg isn’t so bad now!

SQL Performance Chasing

We’re moving a client to Azure from on premises and there were some performance hurdles.
They weren’t unexpected, and nearly all of them were database related.

Playing with Blazor in .NET 5

.NET 5 was released recently, with boatloads of goodies.
Blazor got some attention in this release, and I had some free time to play with it.
There’s good news and bad news…

Azure and The Performance Mystery

Semi-recently, we moved a client from On Premises to Azure with the promise that it’d be better.
While generally true, lately we’ve been getting reports of performance issues…

Caching MediatR Queries

Previously, I did some performance investigations in Azure. The cause remains elusive, so I’ve started looking into caching, most interestingly caching Mediatr Query results.

Migrating Newtonsoft to System.Text.Json

System.Text.Json was released with dotnetcore 3 in 2019, and has been improved in NET 5.
After recently upgrading this project to dotnetcore 5 (which was much easier than the linked upgrade to dotnetcore 3…), I was curious to see what the migration path looked like for a real project.

Some Useful Blender Tips

Some Blender tips and tricks that I’ve built up over my short time, so saving them here so I don’t forget them :D
This will keep being updated as I think of them.

Dockerising a Full Stack (SQL, aspnetcore, React) application with a nice F5 experience

I work in Managed Services, and we end up with a lot of projects on different versions of things (node, packages, dotnet, etc)
So I want to get a full stack project with good F5 debugging experience and easy onboarding that can run without those dependencies!
I succeeded! Kinda…

Upgrading .NET 4.8 to NET 6: Aspnetcore Auth + Background Service

I recently upgraded a project from NET 4.8 to NET 6, and the most interesting parts were Autofac to MS DI, Auth, and the Windows Service.
It went fairly well!

Android Emulator: Connecting to Localhost

I often use the Android Emulator to do testing on a Xamarin Forms app, or Cordova, or something of the sort.
It’s a long round trip to point at test when you want to debug the backend behaviour, so let’s point it at local dev!

Managed Services Handovers: the Good, the Bad, and the rest

I work in Managed Services, and we often get handover from the Professional Services when they roll off a project.
What makes a good handover to Managed Services/Sustained Engineering?
What do we want? What makes us sad?

What I Use

I recently mentioned Win + V in some internal channels and people are always surprised it exists.
So, here’s a list of things, both tools and basic tips, from what I think is most useful descending.

Another go at Blazor: Complex State?

Previously on Blazor: Good and Bad I played with Blazor and made a toy app to test things out.
I came to the conclusion that some was good, some was bad, time will tell.
Now that I’ve come back to it with a much more complex app, my opinion hasn’t really changed, but I did have a go at more complex state management.

CosmosDB Partition Keys and running Azurite from VS

CosmosDB partition keys got me and some others on Stackoverflow, so I’m gonna drop a short one here.
Also, getting Azurite to run when the project is launched in VS.

Setting Azure App Service node version

I wanted to use the Azure App Service console to install some software to test which needed NodeJS.
The default Node version is 0.10.1

VSCode in Browser: Unexpectedly difficult

Can I provide a fully powered IDE experience to users without external requirements?
I figured there must be something like the Github . experience that I could use. Apparently I was wrong.

Obsidian: Previous Week Review

I’ve been playing with Obsidian over the last few months, and aside from some minor UI changes (via CSS) it’s been pretty good!
However, I found that I wanted to see what I was up to last week in the context of what I’m doing today.
Here’s how I did it.

Android: Foreground Services

I have a Xamarin Forms app that needs to send location info (for example a shopping center assistant app) to the server every 5 seconds, but I know that the user will likely be using some other app during this time, so my app will be in the background. How can I make that happen?

Android: VS Debugging

In my spelunking with Android Foreground Services, I needed to do debugging, and since I’m in Xamarin Forms, I used built in Visual Studio tools.

Swagger and OpenAPI Example attribute: Why so difficult?!

Swagger is a useful tool to describe your API and how it behaves.
OpenAPI is the standard which describes what tools like Swagger should expose.
I wanted my Azure Function to show an example on my properties, something the spec indicates is allowed, but I could not do it easily with the dotnet tools ☹️

Nextcloud: LAN only

EDIT: May 2023. I’m admitting defeat here. I got to the point where I was pulling the docker images and editing them to work locally and I realised it’s just ridiculous.
I’m frustrated it’s this difficult.
Still, I also realised that I wanted an offsite backup anyway, so here’s the new plan.

A few times during debugging sessions, some of my colleagues have brought up this fairly cool looking notes app.
It turns out to be far more than a notes app, and is in fact, an entire personal cloud called Nextcloud.
While it looked and felt cool (my own cloud!!), I wasn’t sure I’d really make use of it, so before purchasing anything, I figured I’d set it up locally.
This took longer than I expected.

Nextcloud: My Journey so far

After admitting defeat on my previous post attempting to get Nextcloud running locally (and remembering that I wanted an offsite backup anyway), I’ve bought a VPS and installed Nextcloud on it.

What does a production MAUI app look like?

In the past, I’ve played with MAUI in toy projects but recently I decided to try and upgrade a Xamarin Forms app to MAUI.
That went poorly with the Upgrade Assistant so I started with a fresh project and migrated across. Here’s a few tips and tricks and common patterns for a MAUI app that I found useful.

Azure Docker: No space left on disk

This took me too long to figure out NOT to write a blog post about it 🥲

Gitkraken vs Fork: Facts vs Feelings

I’ve tried almost all the major git clients out there, and these two are the main ones that stuck with me.
Tower and Sourcetree just didn’t jive with me, Git Extensions…I really hated, even VSCode and Visual Studio git are fine in a pinch.
I started with Gitkraken, moved to Fork because it was cheaper and I wanted to try something new, so after a year, how do they compare?

Newtonsoft vs System.Text.Json: Memory Allocations using BenchmarkDotNet

Recently, I’ve been investigating some poor memory behaviour in an Azure App Service and had the usual niggle to dig into performance again.
This time, it’s about serialisation performance, specifically regarding memory allocations.

Aspnetcore - A multiple authentication scheme story

Many of the Aspnetcore auth samples and tutorials discuss using multiple authentication schemes, but I ran into an interesting issue that I found interesting.
It’s also obvious in retrospect 😭
In short: I had multiple schemes working fine, but the default scheme always ran (even though it failed) and logged failure messages.
Why?

Cross platform options: A very shallow exploration

You’re starting a new app, which cross platform mobile framework should you choose?
You’ve had Cordova apps, and they made you sad, you’ve heard “why not native?”, and decided that’s not viable (for your own reasons), so what to do?
Well I built a similar toy app in a few of the big frameworks to compare them extremely subjectively (with some objectivity sprinkled in)
Honestly, I still don’t know which of them I like best.

Adding a new site with Apache

A while back, I started playing with Nextcloud and wrote a bit about it noting that I wondered if I’d use it.
Well I haven’t really, but as many have mentioned to me, the whole self-hosting thing is addictive!
So…I’ve been playing with Jellyfin, Plausible, and VSCode/Coder but I keep forgetting how to set them up.
So far, they’ve all been similar in their configuration and setup with my existing reverse proxy Apache2.
I’m going to quickly document the setup here for future reference.

Windows Setup Gripes

I recently setup a new Windows laptop and immediately ran across some issues or things I don’t think should be default.

TLDR

Sql Performance Debugging for Developers

Databases are magic black boxes that we developers use all the time, but rarely really understand.
Sure, we could understand them, but:

Ain’t nobody got time for that!
Ain’t nobody got time for that!

So what can we mere lazy mortals do when SQL Server databases misbehave?