mirror of
https://github.com/icsharpcode/ILSpy.git
synced 2026-10-12 02:15:58 +00:00
Windows maps CON, PRN, AUX, NUL, COM1-9 and LPT1-9 to devices -- on many builds even with an extension appended, so a type named Con made both whole-project export and the save dialog fail with IOException '\\.\Con'. CleanUpName only checked for reserved names after re-appending the file extension, where they never match, and the save-dialog default-name helpers did not check them at all. The escape appends the underscore to the base name (con_.txt, not con.txt_) because device-name parsing ignores everything after the first dot, and is applied per path segment so reserved directory names produced by namespaces are covered too. The ILSpy.Tests.Windows fixture verifies on a real Windows filesystem that the escaped names are creatable. Assisted-by: Claude:claude-fable-5:Claude Code