New route analysers don't appear to support regex
- Dominant language
- C#
- Stars
- 38.4k
- Forks
- 10.9k
- Avg merge
- 2d 10h
- Merged PRs (30d)
- 281
Description
### Is there an existing issue for this?
- [X] I have searched the existing issues
### Describe the bug
After upgrading to .NET 8 this line:
```c#
[HttpGet(@"{platform:alpha}/{locale:regex([[a-z]]+(-[[a-z]]+)?)}")]
```
Now generates these errors
```
I18nController.cs(26,66): error ASP0017: Route issue: There is an incomplete parameter in the route template. Check that each '{' character has a matching '}' character. (https://aka.ms/aspnet/analyzers)
I18nController.cs(26,66): error ASP0017: Route issue: There is an incomplete parameter in the route template. Check that each '{' character has a matching '}' character. (https://aka.ms/aspnet/analyzers)
I18nController.cs(26,32): error ASP0017: Route issue: An optional parameter must be at the end of the segment. In the segment '{locale:regex([[a-z]]+(-[[a-z]]+)?)}', optional parameter 'locale' is followed by ')}'. (https://aka.ms/aspnet/analyzers)
```
Do these [new analysers](https://devblogs.microsoft.com/dotnet/aspnet-core-route-tooling-dotnet-8/) support regex constraint?
### Expected Behavior
The new analysers to support regex constraint.
### Steps To Reproduce
https://github.com/mcm-ham/bugrepro-routeissue
### Exceptions (if any)
_No response_
### .NET Version
8.0.100
### Anything else?
**dotnet info**
.NET SDK:
Version: 8.0.100
Commit: 57efcf1350
Workload version: 8.0.100-manifests.6c33ef20
Runtime Environment:
OS Name: Mac OS X
OS Version: 14.1
OS Platform: Darwin
RID: osx-arm64
Base Path: /usr/local/share/dotnet/sdk/8.0.100/
.NET workloads installed:
Workload version: 8.0.100-manifests.6c33ef20
There are no installed workloads to display.
Host:
Version: 8.0.0
Architecture: arm64
Commit: 5535e31a71
.NET SDKs installed:
6.0.414 [/usr/local/share/dotnet/sdk]
7.0.401 [/usr/local/share/dotnet/sdk]
8.0.100 [/usr/local/share/dotnet/sdk]
.NET runtimes installed:
Microsoft.AspNetCore.App 6.0.22 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 7.0.11 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 8.0.0 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.NETCore.App 6.0.22 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 7.0.11 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 8.0.0 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
Other architectures found:
None
Environment variables:
Not set
**vscode about**
Version: 1.84.2
Commit: 1a5daa3a0231a0fbba4f14db7ec463cf99d7768e
Date: 2023-11-09T10:52:57.054Z
Electron: 25.9.2
ElectronBuildId: 24603566
Chromium: 114.0.5735.289
Node.js: 18.15.0
V8: 11.4.183.29-electron.0
OS: Darwin arm64 23.1.0
Contributor guide
Assessment
This issue has not been assessed yet.