Skip to content

Latest commit

 

History

History
36 lines (30 loc) · 2.14 KB

syslib1040-1049.md

File metadata and controls

36 lines (30 loc) · 2.14 KB
title description ms.date f1_keywords
SYSLIB diagnostics for regex source generation
Learn about the regular expression source-generation analyzers that generate compile-time suggestions SYSLIB1040, SYSLIB1041, SYSLIB1042, SYSLIB1043, SYSLIB1044, and SYSLIB1045.
11/07/2022
syslib1040
syslib1041
syslib1042
syslib1043
syslib1044
syslib1045
syslib1046
syslib1047
syslib1048
syslib1049

SYSLIB diagnostics for regex source generation

The following table shows the diagnostic IDs for regex source-generation analyzers in .NET 7 and later versions. SYSLIB1045 automatically alerts you to places that you can use source generation to generate the regular expression engine implementation at compile time. The remaining diagnostics alert you to errors related to usage of the source generator.

Diagnostic ID Description
SYSLIB1040 Invalid xref:System.Text.RegularExpressions.GeneratedRegexAttribute usage.
SYSLIB1041 Multiple xref:System.Text.RegularExpressions.GeneratedRegexAttribute attributes were applied to the same method, but only one is allowed.
SYSLIB1042 The specified regular expression is invalid.
SYSLIB1043 A xref:System.Text.RegularExpressions.GeneratedRegexAttribute method must be partial, parameterless, non-generic, and non-abstract, and return xref:System.Text.RegularExpressions.Regex.
SYSLIB1044 The regex generator couldn't generate a complete source implementation for the specified regular expression due to an internal limitation. See the explanation in the generated source for more details.
SYSLIB1045 Use xref:System.Text.RegularExpressions.GeneratedRegexAttribute to generate the regular expression implementation at compile time.

For more information about source generation for regular expressions, see .NET regular expression source generators.

[!INCLUDE suppress-syslib-warning]

See also