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

[Breaking change]: Regex.CompileToAssembly is marked as Obsolete with diagnostic id SYSLIB0036 #26352

Closed
1 of 2 tasks
jeffhandley opened this issue Oct 1, 2021 · 2 comments · Fixed by #27845
Closed
1 of 2 tasks
Assignees
Labels
breaking-change Indicates a .NET Core breaking change 🏁 Release: .NET 7 Work items for the .NET 7 release doc-idea Indicates issues that are suggestions for new topics [org][type][category] Pri1 High priority, do before Pri2 and Pri3 source incompatible Source code may encounter a breaking change in behavior when targeting the new version.

Comments

@jeffhandley
Copy link
Member

jeffhandley commented Oct 1, 2021

Description

The Regex.CompileToAssembly API has been marked as Obsolete. References to this API will now produce diagnostic ID SYSLIB0036. See dotnet/runtime#59734 for the change.

Version

Other (please put exact version in description textbox)

Previous behavior

Version: .NET 7 Preview 1

In all versions of .NET Core as well as .NET 5 and .NET 6, this API would threw PlatformNotSupportedException. In .NET Framework, this API allowed a regular expression instance to be compiled into an assembly.

New behavior

References to this API will result in a build warning; the diagnostic ID reported is SYSLIB0036.

Type of breaking change

  • Binary incompatible: Existing binaries may encounter a breaking change in behavior, such as failure to load/execute or different run-time behavior.
  • Source incompatible: Source code may encounter a breaking change in behavior when targeting the new runtime/component/SDK, such as compile errors or different run-time behavior.

Reason for change

This functionality will not be carried forward into .NET. Instead, .NET 7 is introducing a Regular Expression Source Generator that can be invoked using the RegexGeneratorAttribute feature.

Recommended action

Use the RegexGeneratorAttribute feature, which invokes a regular expression source generator, allowing for compile-time production of an API specific to a regular expression pattern and its options.

Feature area

Core .NET libraries

Affected APIs

@jeffhandley jeffhandley added doc-idea Indicates issues that are suggestions for new topics [org][type][category] breaking-change Indicates a .NET Core breaking change Pri1 High priority, do before Pri2 and Pri3 labels Oct 1, 2021
@dotnet-bot dotnet-bot added ⌚ Not Triaged Not triaged source incompatible Source code may encounter a breaking change in behavior when targeting the new version. labels Oct 1, 2021
@gewarren gewarren added 🏁 Release: .NET 7 Work items for the .NET 7 release and removed ⌚ Not Triaged Not triaged labels Oct 1, 2021
@gewarren
Copy link
Contributor

@jeffhandley This is actually SYSLIB0036, not 0037, correct?

@jeffhandley jeffhandley changed the title [Breaking change]: Regex.CompileToAssembly is marked as Obsolete with diagnostic id SYSLIB0037 [Breaking change]: Regex.CompileToAssembly is marked as Obsolete with diagnostic id SYSLIB0036 Jan 13, 2022
@jeffhandley
Copy link
Member Author

Great catch, @gewarren. You're correct. I've updated the title and issue description to reflect that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking-change Indicates a .NET Core breaking change 🏁 Release: .NET 7 Work items for the .NET 7 release doc-idea Indicates issues that are suggestions for new topics [org][type][category] Pri1 High priority, do before Pri2 and Pri3 source incompatible Source code may encounter a breaking change in behavior when targeting the new version.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants