[fix] fix the bug in GenericReferenceWriter where _systemTypePattern did not properly escape the '.' in type names. This caused issues when compiler-generated anonymous types and functions contained string sequences like 'System-Int', incorrectly matching them to 'System.Int', resulting in runtime exceptions.

main
walon 2024-11-05 18:19:13 +08:00
parent 4e172129d8
commit f19ba3eb30
1 changed files with 1 additions and 1 deletions

View File

@ -39,7 +39,7 @@ namespace HybridCLR.Editor.AOT
{
_typeSimpleNameMapping.Add(e.Key.FullName, e.Value);
}
_systemTypePattern = new Regex(string.Join("|", _typeSimpleNameMapping.Keys.Select (k => $@"\b{k}\b")));
_systemTypePattern = new Regex(string.Join("|", _typeSimpleNameMapping.Keys.Select (k => $@"\b{Regex.Escape(k)}\b")));
}
public string PrettifyTypeSig(string typeSig)