Fix type name parsing in NativeAOT#79963
Conversation
Simplified type name parsing was breaking if full name or assembly name has underscode ('_') in it. That breaks referencing `SQLitePCL.Batteries_V2, SQLitePCLRaw.batteries_v2` type inside `Microsoft.Data.Sqlite`
Fixes dotnet/efcore#29725
|
Tagging subscribers to this area: @agocke, @MichalStrehovsky, @jkotas Issue DetailsSimplified type name parsing was breaking if full name or assembly name has underscode ('_') in it. That breaks referencing Fixes dotnet/efcore#29725
|
| StringBuilder typeNamespace = new StringBuilder(); | ||
| string containingTypeName = null; | ||
| while (i < name.Length && (char.IsLetterOrDigit(name[i]) || name[i] == '.' || name[i] == '`' || name[i] == '+')) | ||
| while (i < name.Length && (char.IsLetterOrDigit(name[i]) || name[i] == '.' || name[i] == '_' || name[i] == '`' || name[i] == '+')) |
There was a problem hiding this comment.
Not sure what the style conventions are in the compiler, but you could simplify this with a pattern if that's allowed?
| while (i < name.Length && (char.IsLetterOrDigit(name[i]) || name[i] == '.' || name[i] == '_' || name[i] == '`' || name[i] == '+')) | |
| while (i < name.Length && (char.IsLetterOrDigit(name[i]) || name[i] is '.' or '_' or '`' or '+')) |
There was a problem hiding this comment.
No need to polish this; this file will be nuked from orbit with #72833. This parser is kind of garbage. It's from a time when this being a heuristic was enough, as the comment above says. That time has passed.
| StringBuilder typeNamespace = new StringBuilder(); | ||
| string containingTypeName = null; | ||
| while (i < name.Length && (char.IsLetterOrDigit(name[i]) || name[i] == '.' || name[i] == '`' || name[i] == '+')) | ||
| while (i < name.Length && (char.IsLetterOrDigit(name[i]) || name[i] == '.' || name[i] == '_' || name[i] == '`' || name[i] == '+')) |
There was a problem hiding this comment.
No need to polish this; this file will be nuked from orbit with #72833. This parser is kind of garbage. It's from a time when this being a heuristic was enough, as the comment above says. That time has passed.
Simplified type name parsing was breaking if full name or assembly name has underscode ('_') in it. That breaks referencing
SQLitePCL.Batteries_V2, SQLitePCLRaw.batteries_v2type insideMicrosoft.Data.SqliteFixes dotnet/efcore#29725