Roslyn crashes when reporting an error with an "unusual" compilation unit name
- Dominant language
- C#
- Stars
- 5.5k
- Forks
- 1.5k
- Avg merge
- 1d 8h
- Merged PRs (30d)
- 141
Description
**Version Used**: .NET 9.0.100
**Steps to Reproduce**:
1. Create a new console application (`dotnet new console`)
2. Edit Program.cs to:
```csharp
#line 100 ":invalid:"
int x = 5.0;
```
3. Run `dotnet build`
**Expected Behavior**:
Normal error messages without a crash.
**Actual Behavior**:
```text
C:\Program Files\dotnet\sdk\9.0.100\Roslyn\Microsoft.CSharp.Core.targets(89,5): error MSB6006: "csc.dll" exited with code 1.
```
**Notes**:
- Visual Studio indicates csc.dll exiting with code 1 as well
- This is not reproducible in SharpLab - I suspect it's injecting its own `#line` directives
- Changing `":invalid:"` to `"valid"` produces normal error messages.
- Names of `"."`, `".."` and `"..."` produce some interesting results
- Changing the code to only produce a warning (e.g. just `int x = 5;` which results in CS0219) when using `":invalid:"` is weird - the build succeeds without issuing a warning at all
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.