Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Regex.Replace fails with aggressive linking #40582

Closed
davidfowl opened this issue Aug 9, 2020 · 3 comments
Closed

Regex.Replace fails with aggressive linking #40582

davidfowl opened this issue Aug 9, 2020 · 3 comments
Labels
area-System.Text.RegularExpressions linkable-framework Issues associated with delivering a linker friendly framework untriaged New issue has not been triaged by the area owner
Milestone

Comments

@davidfowl
Copy link
Member

var regex = new Regex(@"\w+");
regex.Replace("a b c 1 2 3", "b");
Unhandled exception. System.TypeLoadException: Type 'System.Text.RegularExpressions.GroupCollection' from assembly 'System.Text.RegularExpressions, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' tried to override method 'System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<System.String,System.Text.RegularExpressions.Group>>.GetEnumerator' but does not implement or inherit that method.
   at System.Text.RegularExpressions.Match.Reset(Regex regex, String text, Int32 textbeg, Int32 textend, Int32 textstart)
   at System.Text.RegularExpressions.RegexRunner.InitializeForGo()
   at System.Text.RegularExpressions.RegexRunner.Scan[TState](Regex regex, String text, Int32 textstart, TState& state, MatchCallback`1 callback, TimeSpan timeout)
   at System.Text.RegularExpressions.Regex.Run[TState](String input, Int32 startat, TState& state, MatchCallback`1 callback)
   at System.Text.RegularExpressions.RegexReplacement.Replace(Regex regex, String input, Int32 count, Int32 startat)
   at System.Text.RegularExpressions.Regex.Replace(String input, String replacement, Int32 count, Int32 startat)
   at System.Text.RegularExpressions.Regex.Replace(String input, String replacement)
   at ConsoleApp1.Program.Main(String[] args) in C:\Users\davifowl\source\repos\WebApplication60\ConsoleApp1\Program.cs:line 13
@Dotnet-GitSync-Bot Dotnet-GitSync-Bot added area-System.Text.RegularExpressions untriaged New issue has not been triaged by the area owner labels Aug 9, 2020
@ghost
Copy link

ghost commented Aug 9, 2020

Tagging subscribers to this area: @eerhardt, @pgovind
See info in area-owners.md if you want to be subscribed.

@davidfowl davidfowl added the linkable-framework Issues associated with delivering a linker friendly framework label Aug 9, 2020
@stephentoub stephentoub added this to the 5.0.0 milestone Aug 9, 2020
@stephentoub
Copy link
Member

cc: @MichalStrehovsky, @marek-safar

@MichalStrehovsky
Copy link
Member

Nice linker bug. Moving to dotnet/linker#1421.

@ghost ghost locked as resolved and limited conversation to collaborators Dec 7, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-System.Text.RegularExpressions linkable-framework Issues associated with delivering a linker friendly framework untriaged New issue has not been triaged by the area owner
Projects
None yet
Development

No branches or pull requests

4 participants