RSSAmplifier

Blog

Sunrise Programmer

Sweating the details of programming

sunriseprogrammer.blogspot.comRSS feed ↗25 posts

Latest posts

Your Bluetooth is bad, August 2026 (Battery and Name)

Your Bluetooth is bad, and you should feel bad Alternate title: Your Bluetooth is OK, but it could be better Just two gripes this time! Always include a name. I'm looking at you, Ruuvi. The Ruuvi sensors are interesting little devices. They started out back when the Eddystone protocol was an exciting new thing (fun fact: Copilot thinks there are still major Eddystone devices in the real world!),…

API Rules for designers: use one encoding, not two

API Rules for designers: use one encoding, not two "If you haven't tested your code, it's probably wrong" Today's bad API example is from the Bluetooth Heart Rate system. Most of the protocol is fine: you get a notification every so often with updated heart rate information (e.g., heart rate in beats per minutes (BPM) plus optional stuff for overall energy and the "RR Interval" for fine-grained…

IL2104 IL2026 TRIM and JSON with WinUI3 and newer C#

JSON: why is C# TRIM so horrible for no reason Trim analysis warning IL2026: SerializeExtra.Demonstrate_Bug_Program.Demonstrate_Bug_Main(): Using member 'System.Text.Json.JsonSerializer.Serialize(!!0, JsonSerializerOptions)' which has 'RequiresUnreferencedCodeAttribute' can break functionality when trimming application code. JSON serialization and deserialization might require types that cannot be…

Fixing the dreaded XAML parsing failed

Fixing my XAML Parsing Failed bug (subfolders) This is a doozy, and is about the last possible bug one would imagine in the new WinUI3 that Microsoft is pushing for us to use when making apps for Windows. The background when you make an app using C# (and really, why wouldn't you?), you will use the XAML mini-language for describing your layout. XAML has conceptually been around for years, but…

Weird EPUB bug: empty image files in the IRS i1040gi.epub file

This EPUB bug brought to you by the IRS and their i1040gi.epub file Normally government EPUB files are pretty good about making usable EPUB files. But this year only, the IRS's "i1040gi.epub" file (the file with USA government tax information for filing out the very common 1040 tax form) has a subtly malformed epub file. The list of images (EPUB/img) has 28 GIF files which are all fine, and one…

Developing on ARM64: DEP0700 failures in Debug mode

Can you solve this error message? DEP0700: Registration of the app failed. [0x80073CF3] Windows cannot install package NAME because this package depends on a framework that could not be found. Provide the framework "Microsoft.VCLibs.140.00.Debug.UWPDesktop" published by "CN=Microsoft Corporation, O=Microsoft Corporation, L=Redmond, S=Washington, C=US", with neutral or ARM64 processor architecture…

Github is both awesome and painful with VS 2026

The old days of programming, before source control systems, was kind of dangerous. There was always the possibility of losing all your work, and there wasn't a good way to move files from one computer to another. Indeed, when I was a consultant, I paid good money for a "Jaz" drive and for a WinZip license just to be able to move files from one office to another. GitHub integration is awesome for…

More Visual Studio and WinUI3 issues, September 2025 version

I'm getting closer to releasing my next app (tentatively called "Simple Exporter for Bing Maps Collections"), I'm running into more silly issues with both Visual Studio 2022 and with the WinUI3 toolkit. Error box fit-and-finish Let's start with terrible fit-and-finish. This is the "Error" list that Visual Studio 2022 shows to help consolidate all errors. Take a look in particular at the column…

From the past: Win32s was both awesome and awful

WIN32S: a programmer's dream from the Windows 3.1 era Gather 'round, young 'uns, and let me give you some wisdom from the days of the Win32s compatibility library. When Windows was being made, it was a 16-bit system, meaning that pointers were short and it was painful to address much memory. I'll also share a key feature of technical decisions: how to make an early decision that you don't know the…

Weird issues with WinUI3 and ALT key: so many beeps!

Like any good developer, I want my WinUI3 app to have keyboard control over the menus. And once again, the terrible fit-and-finish of the WinUI3 framework is causing problems. This time: every time the user presses the ALT key (like they are supposed to!) Windows decides to make the program BEEP! This is reported as this bug 4379 and 9074 . Some useless comments are here . And somehow, the code I…

Weird issues in WebView2 / WinUI3: handling the ALT key

Applies to: WinUI3 apps with a WebView2 and a menu Problem: Normally users press the "Alt" ("Menu") key to use an app's menu. But after the user clicks on a WebView2 (as one does; it's a common practice), all Alt keys will be swallowed up by the WebView2. Solution: capture the 'Alt' key and use that as a trigger to move focus. In the JavaScript for the one specific page I use, add a 'keydown'…

Weird issues in WebView2 / WinUI3: using the ms-appx: scheme

Update your WebView2 WinUI3 code to read ms-appx:/// URLS from your Assets folder It was the simplest of APIs, it was the most irritating of APIs. The ms-appx:/// URL scheme is one of the unheralded awesome parts of the WinRT API set. With it, there's a simple and straightforward way for an app to combine a bunch of C# code and also some useful HTML code. I'm using it this month for my (upcoming)…

A lifetime of weird issues: VSCode and more

Upleveling my gripes + making better software People who read my blogs know that I'll write mostly about things not working: painful Bluetooth protocols, awkward APIs, and inconvenient programs. That's good, but what advice would I give someone who's looking for a plan to improve, say, VSCode for C# developers. Count up friction points, and reduce them A classic PM thing is to make up a metric,…

Wierd issues in the WinUI3 / WebView2: Solving the User-Agent problem

TL/DR: To verify that you are setting the right user-agent, you have to check the "web resource requested" event's copy of the request headers, not the "navigation starting" event's copy. And you need to call AddWebResourceRequestedFilter. Background: why am I setting the user-agent, and why do I need to check it? I'm writing a simple app to parse NMEA data from a small GPS tracker (because that's…

Weird issues in Visual Studio 2022: Solving the CS0534 error when solving the Json trimming problem

TL/DR: Visual Studio 2022 is wrong, and your code is OK Background: I'm having to switch from the awesome NewtonSoft JSON library over to some crappy System.Text.Json library (because VS thinks that breaking everyone to support Trimming is somehow ever OK). The sample code for that is wrong, but that's OK, it points to the right code. Except that if you copy-paste the sample code, it fails: The…

Weird issues in Visual Studio 2022 ┄ missing publish profiles with WinUI Blank App Packaged

TL/DR: Desktop .NET Core apps might be missing a Publish directory because it's in the .github ignore list. The files are actually all very similar and can be copy-pasted from another project. Background: A part of the .NET Core is that projects are both "built" and "published". This has apparently been around for ages. The problem is that there's a terrible split in the tooling: some parts of the…

VS: Don't start your project names with numbers!

Weird issues in Visual Studio 2022 -- an ongoing saga Ever get an error in a brand new project saying that "App.WinRTVtable.g.cs" is failing and that "global::WinRT is a namespace?Tearing your hair out because what in the world could you have done to make this fail? It turns out it's your project name. When you make a WinUI Blank App (Packaged) in Visual Studio 2022, and the project name starts…

(untitled)

A quick guide to using Bluetooth serial ports from C# Reading from classic Bluetooth serial ports isn't hard but does involve understanding 5 different classes and connecting them together. In this post, I'm show all the classes you need to make the code work, how to create or use them, and how they fit together. This walk-through will be in reverse order: I'll start with actually reading data and…

Modbus: deciphering the CRC protocol

The Modbus over Serial protocol doc has a clear, simple set of instructions on how to decode. You just have to know that two of the steps are in a reverse order, but it actually makes sense. The Modbus protocol is used by the Daybetter LED light Bluetooth protocol. It's arguably a terrible fit for this: the protocol includes a bunch of stuff that isn't even slightly relevant with Bluetooth (like…

EPUB format thoughts

How hard can EPUB files be? "EPUB is just HTML"! Hah! I've got a fun EPUB ebook reader in the store; it's got two nifty features that, IMHO, all ebook readers should have (it can do an offline search of Project Gutenberg, and it's got a two-screen mode, so you can see both a critical image and the text that talks about the image in one spot). Over the years, I've had to work around a lot of EPUB…

First thoughts on std::expected

std::expected -- what can you do with it? There's a fancy new thing in C++: std::expected. There's a lot of pots about it's awesomeness, but what is it, really? Answer: if you've got a std::expected, you can do three important things. Let's give a name to our std::expected: it's called result . And as a reminder: std::expected holds one of two values, which in this post I'll cleverly call "first"…

XAML Style Dictionaries

Step by step: adding consistent styles to a XAML app XAML has a useful feature where you can set up a single file with a bunh of "style" configuration for your XAML (UWP) app, and then use those styles everywhere in your app. The plus side is having a centralized style configuration: all your titles can be one size, and all your technical text has the correct font, and all. The downside is that…

Overview: Installers for .NET Core

Installer types for .NET Core applications I've got a new application, and I want a nice installer for it. Visual Studio has a metric ton of different installer projects, variously called "publisher" and "setup" and "install" and "deploy" -- so many, many different adjectives. TL/DR: Make a setup project My goal is an installer that is a single file, probably .EXE but I'll do a .MSI or .MSIX or…

Project: Govee E-Ink display

The Govee H5074 E-Ink display project! All complete! This project uses an Adafruit nrf52840 board running CircuitPython and their 2.13 inch e-ink display (the tri-color one) to pull in data via Bluetooth LE from a Govee H5074 temperate and humidity sensor. Watch it on YouTube . Also, the code is up on Github ; take a look! Some of the challenging / fun parts: on reset, the device will look around…

Using E-Ink displays with CircuitPython

Using E-Ink displays with CircuitPython Adafruit has some very nifty e-ink displays. It's something I've always wanted to try out: I've got an e-book reader that uses e-ink, and of course I've seen retail proce tags that use them. What I found is that although the demo code worked great, there were some major gotcha moments when using them in a project. Firstly, the update process for the display…