-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
[wasm][debugger] Remove usage of GeneratedRegex #86911
Conversation
Tagging subscribers to this area: @thaystg Issue Detailsnull
|
/backport to release/8.0-preview5 |
Started backporting to release/8.0-preview5: https://github.com/dotnet/runtime/actions/runs/5125322906 |
[GeneratedRegex(@"([:/])")] | ||
private static partial Regex RegexForEscapeFileName(); | ||
#pragma warning disable SYSLIB1045 | ||
private static readonly Regex regexForEscapeFileName = new Regex(@"([:/])"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
private static readonly Regex regexForEscapeFileName = new Regex(@"([:/])"); | |
private static readonly Regex s_regexForEscapeFileName = new(@"([:/])"); |
private static partial Regex RegexForReplaceVarName(); | ||
|
||
#pragma warning disable SYSLIB1045 | ||
private static Regex regexForReplaceVarName = new Regex(@"[^A-Za-z0-9_]", RegexOptions.Singleline); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
private static Regex regexForReplaceVarName = new Regex(@"[^A-Za-z0-9_]", RegexOptions.Singleline); | |
private static Regex s_regexForReplaceVarName = new(@"[^A-Za-z0-9_]", RegexOptions.Singleline); |
[GeneratedRegex(@"\<(?<varName>[^)]*)\>(?<varId>[^)]*)(__)(?<scopeId>\d+)", RegexOptions.Singleline)] | ||
private static partial Regex RegexForAsyncLocals(); //<testCSharpScope>5__1 // works | ||
#pragma warning disable SYSLIB1045 | ||
private static Regex regexForAsyncLocals = new Regex(@"\<(?<varName>[^)]*)\>(?<varId>[^)]*)(__)(?<scopeId>\d+)", RegexOptions.Singleline); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
private static Regex regexForAsyncLocals = new Regex(@"\<(?<varName>[^)]*)\>(?<varId>[^)]*)(__)(?<scopeId>\d+)", RegexOptions.Singleline); | |
private static Regex s_regexForAsyncLocals = new(@"\<(?<varName>[^)]*)\>(?<varId>[^)]*)(__)(?<scopeId>\d+)", RegexOptions.Singleline); |
.. and similar for all the other instances.
What prompted this change? |
I didn't fully follow this. We're using P4 components with P5? Should this change only be made to the P5 branch rather than to main? Note that IndexOfAnyValues still exists but was renamed to SearchValues. |
Yeah. I don't want to merge it on main. |
The issue was that the debug proxy was built with the sdk specified in global.json (which is p4 on the release/8.0-preview5 branch) so it generated source using IndexOfAnyValues, that binary was repackaged in aspnetcore then run against a p5 runtime where IndexOfAnyValues did not exist. We currently build it with the system/.dotnet sdk to avoid depending on local coreclr and source generator builds as part of the debugger lane. We hadn't really considered this mode of breakage because it hadn't come up before. |
Thanks for the explanation. This PR can be closed then, as the change was merged into the preview branch, yes? |
@lewing asked me to keep it as a draft. I think we will be able to close it soon. |
I'll need to merge it because preview 6 is still broken. I will revert theses changes once the SDK used to build the BrowserDebugProxy is higher than preview 5. |
I'll revert it once preview 6 is branched. Preview 6 is not using SDK from preview 5 yet. |
The P5 BrowserDebugHost is compiled as part of the runtime build but consumed in aspnetcore at a transport package and previously used the RegexSourceGenerator. Because dotnet/runtime builds with the SDK set by arcade in global.json when BrowserDebugHost was compiled with the Preview4 SDK the and regex source generator used IndexOfAnyValues which no longer exists in the P5 runtime after dotnet/docs#35244 so the proxy fails to start using a P5 runtime.
This stops using the source generator for to regex code to avoid the missing symbol.