Razor runtime compilation fails to compile new array syntax in .NET 8.0.2 (only runtime compile)
- Dominant language
- C#
- Stars
- 38.4k
- Forks
- 10.9k
- Avg merge
- 2d 5h
- Merged PRs (30d)
- 276
Description
### Is there an existing issue for this?
- [X] I have searched the existing issues
### Describe the bug
A razor view that uses the new .NET 8 C# target typed compact array initialization syntax `string[] test = ["Hello"];` does not compile with razor runtime compilation (normal compilation works fine) when .NET SDK is updated from 8.0.100 to 8.0.200.
### Expected Behavior
Compiles and works correctly whether runtime compilation is enabled or not.
### Steps To Reproduce
```cs
@page
@{
string[] array = ["Test"];
}
@array[0]
```
If you remove runtime compilation, it works. If you downgrade to .NET 8.0 release and downgrade razor runtime compile package to 8.0.1 it also works.
Tested working: .NET SDK 8.0.100
Tested broken: .NET SDK 8.0.200
Repro public GitHub repo: https://github.com/rwasef1830/aspnetcoreIssue54089/
### Exceptions (if any)
It gives runtime error (due to compilation failure) when visiting the /Index page:
```
Invalid expression term '['
```
### .NET Version
8.0.201
### Anything else?

Contributor guide
Assessment
This issue has not been assessed yet.