Kristoffer Strube

Kristoffer Strube

Meet Kristoffer, one of the core developers behind elmah.io. Kristoffer writes highly technical posts about anything from C# and LINQ to Blazor.

Denmark
25 posts
Ahead-Of-Time Compilation for Blazor Wasm

Shows how to enable Blazor WebAssembly Ahead-Of-Time compilation in .NET 6 via RunAOTCompilation in csproj and dotnet workload install wasm-tools, then benchmarks it: AOT took 4m42s to publish (30.4 MB, 8.1 MB first load) versus 11s normally (25.7 MB, 3.3 MB), using a Conway's Game of Life demo. ...

Logging in Unity

Sets up logging in a Unity game by adding a dedicated MonoBehaviour component that hooks the Awake lifecycle event before Start or Update run, covering Debug.LogError/LogException versus throwing, and forwarding messages on to elmah.io. ...

New LINQ extensions in .NET 6 and benchmarks

Benchmarks .NET 6's new LINQ extensions with BenchmarkDotNet, comparing ElementAt(^2) against Count()-2 and TakeLast on a 1,000-item range, then covers MaxBy, DistinctBy, and FirstOrDefault overloads with custom default values. ...

Using the new PriorityQueue from .NET 6

Solves Kattis's flightcollision drone problem using .NET 6's new PriorityQueue, building a collision queue keyed by (drone1, drone2) tuples with collision time as priority to repeatedly find and remove the next pair to collide. ...

Rendering dynamic content in Blazor Wasm using DynamicComponent

Uses .NET 6's DynamicComponent tag to render a list of Type/Dictionary tuples instead of a big switch statement, then drives it from an appsettings.json content section parsed via IConfiguration and Type.GetType to avoid page-component coupling. ...

Blazor WASM 404 error and fix for GitHub Pages

Fixes the 404 that hits direct-linked Blazor WASM routes on GitHub Pages by adding a wwwroot/404.html using the spa-github-pages redirect script with pathSegmentsToKeep set to 1, restoring the original route via query string. ...

Easy generation of fake/dummy data in C# with Faker.Net 🕵️

Populates a UserProfile model with Faker.Net: Faker.Name.FullName with prefixes, Faker.RandomNumber for follower counts, Faker.Address for country/city, Faker.Enum.Random for a Visibility enum, and Faker.Internet.Email built from the generated name. ...

Generate iCal calendar with .NET using iCAL.NET 📅

Demonstrates serving iCal calendar feeds from .NET using the Ical.Net NuGet package (version 4.1.2 for .NET Core 3.0+), covering creating a Calendar and CalendarEvent, serializing to VCALENDAR text with CalendarSerializer, adding time zones via NodaTime identifiers, and handling recurring events. ...

Using JS Object References in Blazor WASM to wrap JS libraries

Among the .NET 5 Blazor improvements there are IJSObjectReference's (JavaScript Object References). The name indicates that this can only be used to isolate JavaScript sources similar to CSS Isolation. But IJSObjectReference can do so much more than just isolation. ...