dotnet / dotnet/roslyn

Compiler Crash on Equality Comparison of a Tuple Casted from dynamic

Open
#76,028 3 comments 0 reactions 1 assignee Claimed by @RikkiGibson View on GitHub
Area-Compilers
Dominant language
C#
Stars
20.7k
Forks
4.3k
PR merge metrics
PR metrics pending

Description

**Version Used**: .NET 9.0.0

**Steps to Reproduce**:

1. Compile the following C# code ([SharpLab Link](https://sharplab.io/#v2:CYLg1APgAgzABFATHAwnA3gWAFBzw+KARgDY4AjAe0oBs4AVAUwGcAXACmAE8A7AQwC2ASwDGcSgEo4AXgB8OfIrjsVQnqwA0cNawkTJM6csRaYEgNw4AvjiA===)):
- The code involves casting a `dynamic` value to a tuple and performing an equality comparison on another tuple.

```csharp
public class C {
public static bool Test(dynamic o) =>
(((int, int))o) == (2, 3);
}
```

**Expected Behavior**: The compiler compiles the code without crashes.

**Actual Behavior**:
- The compilation process fails in Visual Studio with the error:
> `"csc.exe" exited with code -2146232797`
- Additional details, including a stack trace, are available in the linked SharpLab page.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.