Skip to content

Escape assembly name when starting with number#2013

Merged
manodasanW merged 3 commits intostaging/2.3from
manodasanw/fixleadingnumber
Jul 11, 2025
Merged

Escape assembly name when starting with number#2013
manodasanW merged 3 commits intostaging/2.3from
manodasanw/fixleadingnumber

Conversation

@manodasanW
Copy link
Member

Fixes #1880

@manodasanW manodasanW requested review from Sergio0694 and Copilot July 11, 2025 07:01
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR ensures that assembly names beginning with a digit are prefixed with an underscore before sanitizing, preventing invalid identifiers.

  • Prefixes an underscore when the input starts with a numeric character
  • Continues to replace all non-alphanumeric/underscore characters with underscores
Comments suppressed due to low confidence (1)

src/Authoring/WinRT.SourceGenerator/Helper.cs:1241

  • Add a unit test for inputs starting with a digit (e.g., "1MyLib") to verify the underscore prefixing behavior is applied correctly.
            var prefixedTypeName = Regex.Match(typeName, @"(^\d)").Success ? "_" + typeName : typeName;
@manodasanW manodasanW merged commit d5abe78 into staging/2.3 Jul 11, 2025
12 checks passed
@manodasanW manodasanW deleted the manodasanw/fixleadingnumber branch July 11, 2025 21:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

3 participants