Summary
Two critical Hot Reload diagnostic details are absent from official documentation:
HOTRELOAD_XAML_LOG_MESSAGES environment variable — enables verbose XAML Hot Reload logging. This is the first thing to set when diagnosing silent XAML hot reload failures, but it doesn't appear in any official docs.
- UTF-8 with BOM encoding requirement — all
.cs files must be saved with UTF-8 BOM encoding for XAML Hot Reload to work. Files without BOM cause silent hot reload failures with no error message.
Why it matters
Both of these are the most common reasons Hot Reload "just doesn't work" with no visible error. Without knowing about the env var, developers have no way to get diagnostic output. Without knowing about the BOM requirement, they spend hours debugging a file encoding issue that doesn't surface in any build output.
These issues affect all IDEs (Visual Studio, VS Code, Rider) and are especially common when:
- Files are created via terminal (
touch, cat, or non-BOM editors)
- Code is copied from Linux/macOS environments where UTF-8 without BOM is the default
- Projects are cloned and modified on machines with different editor defaults
What should be documented
1. Document HOTRELOAD_XAML_LOG_MESSAGES
Add to the hot reload troubleshooting docs:
# Enable XAML Hot Reload verbose logging
# macOS/Linux:
export HOTRELOAD_XAML_LOG_MESSAGES=1
# Windows (Command Prompt):
set HOTRELOAD_XAML_LOG_MESSAGES=1
# Windows (PowerShell):
$env:HOTRELOAD_XAML_LOG_MESSAGES=1
Also document Microsoft_CodeAnalysis_EditAndContinue_LogDir for C# Hot Reload:
# macOS/Linux:
export Microsoft_CodeAnalysis_EditAndContinue_LogDir=/tmp/HotReloadLog
# Windows:
set Microsoft_CodeAnalysis_EditAndContinue_LogDir=%temp%\HotReloadLog
2. Document the UTF-8 BOM requirement
Add a prominent note:
File encoding requirement: All .cs files must be saved with UTF-8 with BOM encoding. Files encoded as UTF-8 without BOM (common on Linux/macOS) will cause XAML Hot Reload to silently fail with no error message.
Check encoding:
# macOS/Linux — should show "UTF-8 Unicode (with BOM)"
file -I YourFile.cs
# Find all .cs files missing BOM:
find . -name "*.cs" -exec sh -c 'head -c 3 "$1" | od -An -tx1 | grep -q "ef bb bf" || echo "Missing BOM: $1"' _ {} \;
Fix in VS Code: Open file → bottom-right encoding selector → "Save with Encoding" → "UTF-8 with BOM"
3. Add a quick-start checklist
A checklist of the most common silent-failure causes:
Suggested location
Existing hot reload page (e.g., docs/fundamentals/hot-reload.md) or a new troubleshooting sub-page. A dedicated troubleshooting section with the checklist and environment variable reference would be most useful.
Summary
Two critical Hot Reload diagnostic details are absent from official documentation:
HOTRELOAD_XAML_LOG_MESSAGESenvironment variable — enables verbose XAML Hot Reload logging. This is the first thing to set when diagnosing silent XAML hot reload failures, but it doesn't appear in any official docs..csfiles must be saved with UTF-8 BOM encoding for XAML Hot Reload to work. Files without BOM cause silent hot reload failures with no error message.Why it matters
Both of these are the most common reasons Hot Reload "just doesn't work" with no visible error. Without knowing about the env var, developers have no way to get diagnostic output. Without knowing about the BOM requirement, they spend hours debugging a file encoding issue that doesn't surface in any build output.
These issues affect all IDEs (Visual Studio, VS Code, Rider) and are especially common when:
touch,cat, or non-BOM editors)What should be documented
1. Document
HOTRELOAD_XAML_LOG_MESSAGESAdd to the hot reload troubleshooting docs:
Also document
Microsoft_CodeAnalysis_EditAndContinue_LogDirfor C# Hot Reload:2. Document the UTF-8 BOM requirement
Add a prominent note:
3. Add a quick-start checklist
A checklist of the most common silent-failure causes:
.csfiles are UTF-8 with BOMHOTRELOAD_XAML_LOG_MESSAGES=1set to see XAML reload diagnostic outputSuggested location
Existing hot reload page (e.g.,
docs/fundamentals/hot-reload.md) or a new troubleshooting sub-page. A dedicated troubleshooting section with the checklist and environment variable reference would be most useful.