Skip to content

Commit

Permalink
Fix type name parsing in NativeAOT (dotnet#79963)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
kant2002 authored Dec 25, 2022
1 parent 712b878 commit bd67092
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public static bool ResolveType(string name, ModuleDesc callingModule, TypeSystem
StringBuilder typeName = new StringBuilder();
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] == '+'))
{
if (name[i] == '.')
{
Expand Down Expand Up @@ -59,7 +59,7 @@ public static bool ResolveType(string name, ModuleDesc callingModule, TypeSystem

// Consume assembly name
StringBuilder assemblyName = new StringBuilder();
while (i < name.Length && (char.IsLetterOrDigit(name[i]) || name[i] == '.'))
while (i < name.Length && (char.IsLetterOrDigit(name[i]) || name[i] == '.' || name[i] == '_'))
{
assemblyName.Append(name[i]);
i++;
Expand Down

0 comments on commit bd67092

Please sign in to comment.