Skip to content

Instantly share code, notes, and snippets.

View StephaneDelcroix's full-sized avatar

Stephane Delcroix StephaneDelcroix

View GitHub Profile
@StephaneDelcroix
StephaneDelcroix / brewbuddy-session.md
Created March 7, 2026 11:59
BrewBuddy MAUI Session State - Jura E8 Coffee Machine Controller

BrewBuddy Session State

Project Overview

A .NET MAUI iOS app ("BrewBuddy") to control a Jura E8 coffee machine via Bluetooth, track coffee beans, brew history, and preferences, with AI-powered recommendations using Microsoft.Extensions.AI and AppleIntelligenceChatClient. Fun coffee-themed color scheme.

Architecture

  • .NET 10 MAUI targeting net10.0-ios and net10.0-maccatalyst
  • CommunityToolkit.Mvvm for [ObservableProperty] and [RelayCommand]
  • SQLite via sqlite-net-pcl for local persistence
  • Plugin.BLE v3 for Bluetooth LE
@StephaneDelcroix
StephaneDelcroix / xaml-diffing-tests.md
Created March 6, 2026 08:10
XAML Diffing Engine — Test Catalog for XamlNodeDiff.ComputeDiff()

XAML Diffing Engine — Test Catalog

Tests for XamlNodeDiff.ComputeDiff(), the build-time diff engine that compares two XAML node trees and produces a change set of property changes (set/clear) and child list mutations (add/remove/reorder).

All XAML snippets are wrapped in <ContentPage xmlns="..." x:Class="Test.MyPage">…</ContentPage>. The Diff block shows the exact ToDebugString() output where available.


1 · Identical trees

@StephaneDelcroix
StephaneDelcroix / plan.md
Created March 4, 2026 14:39
XAML Incremental Hot Reload via XSG - Feature Spec

Spec: XAML Incremental Hot Reload via XSG (XAML Source Generation)

Source: Loop document "Xaml (incremental) HotReload on XSG"


Objective

Leverage Roslyn XAML Source Generation (XSG) to implement incremental XAML Hot Reload (XHR) by deferring work to C# Hot Reload. This improves consistency, testability, supportability, and performance, and reduces maintenance overhead.

@StephaneDelcroix
StephaneDelcroix / MauiProgram.cs
Created February 24, 2026 13:52
MAUI CarPlay MauiProgram.cs - hello MauiCarkit
using Microsoft.Maui.LifecycleEvents;
#if __IOS__
using System.Runtime.InteropServices;
using UIKit;
using Foundation;
#endif
namespace Maui.Controls.Sample;
public static class MauiProgram
@StephaneDelcroix
StephaneDelcroix / lazy-rd-example.xaml
Last active February 1, 2026 21:28
Lazy ResourceDictionary SourceGen Example - MAUI resources created on-demand via AddFactory
<?xml version="1.0" encoding="UTF-8"?>
<ContentPage
xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="Microsoft.Maui.Controls.Xaml.UnitTests.LazyResourceDictionary">
<ContentPage.Resources>
<Color x:Key="PrimaryColor">Blue</Color>
<Thickness x:Key="StandardPadding">10</Thickness>
<Style x:Key="MyLabelStyle" TargetType="Label">
<Setter Property="TextColor" Value="{StaticResource PrimaryColor}"/>
@StephaneDelcroix
StephaneDelcroix / BenchmarkMini.xaml.xsg.cs
Last active January 30, 2026 14:25
BenchmarkMini - With Lazy RD (no content, resources only)
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a .NET MAUI source generator.
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
#nullable enable
#pragma warning disable CS0219 // Variable is assigned but its value is never used
@StephaneDelcroix
StephaneDelcroix / BenchmarkMini.xaml.xsg.cs
Created January 30, 2026 14:07
BenchmarkMini - ORIGINAL (no lazy RD)
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a .NET MAUI source generator.
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
#nullable enable
#pragma warning disable CS0219 // Variable is assigned but its value is never used
@StephaneDelcroix
StephaneDelcroix / Benchmark.xaml.xsg.cs
Last active January 30, 2026 12:57
Lazy ResourceDictionary SourceGen output for Benchmark.xaml
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a .NET MAUI source generator.
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
#nullable enable
#pragma warning disable CS0219 // Variable is assigned but its value is never used
@StephaneDelcroix
StephaneDelcroix / lazy-resourcedictionary-spec.md
Last active January 28, 2026 12:07
Lazy ResourceDictionary + x:Shared spec for .NET MAUI

Lazy ResourceDictionary Specification

Problem

  1. Slow inflation time: All resources are instantiated upfront during XAML inflation, even if never used
  2. No x:Shared support: Resources that need parenting (e.g., StrokeShape) cannot be StaticResources because the same instance is shared - causing crashes when multiple elements try to parent the same object

Proposed Solution

Store Func<object> factories instead of object instances in ResourceDictionary. Resources are created on-demand when accessed.

@StephaneDelcroix
StephaneDelcroix / XamlCSharpExpressions-v2.md
Created January 27, 2026 09:28
XAML C# Expressions Spec v2

XAML C# Expressions

Overview

XAML C# Expressions allow writing C# expressions directly in XAML attribute values. The source generator parses these expressions and generates appropriate bindings or event handlers.

Motivation

Currently, XAML property values can be:

  1. Literal strings - Text="Hello World"