Skip to content

Commit f19ba3e

Browse files
committed
[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.
1 parent 4e17212 commit f19ba3e

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

Editor/AOT/GenericReferenceWriter.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ public GenericReferenceWriter()
3939
{
4040
_typeSimpleNameMapping.Add(e.Key.FullName, e.Value);
4141
}
42-
_systemTypePattern = new Regex(string.Join("|", _typeSimpleNameMapping.Keys.Select (k => $@"\b{k}\b")));
42+
_systemTypePattern = new Regex(string.Join("|", _typeSimpleNameMapping.Keys.Select (k => $@"\b{Regex.Escape(k)}\b")));
4343
}
4444

4545
public string PrettifyTypeSig(string typeSig)

0 commit comments

Comments
 (0)