-
Notifications
You must be signed in to change notification settings - Fork 5.2k
Closed
Closed
Copy link
Labels
area-CodeGen-coreclrCLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMICLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI
Milestone
Description
Description
I encountered an AccessViolationException
which reproduces deterministically in our CI.
When analyzing dumps from CI, I found the AV occurred on the i < 10_000
guard and in all 5 dumps that I looked at, i was either 3999 or 9999. My initial suspicion was that it was related to this issue which was fixed in 8.0.16, but updating to 8.0.16 did not fix it.
Reproduction Steps
I've reduced the repro down to this xUnit test:
public sealed class JitAccessViolationTest
{
[Fact]
public void Repro()
{
MyCollection<string?> collection = new();
for (var i = 0; i < 10_000; i++)
{
collection.TryAdd(null);
}
}
public class MyCollection<V>()
{
internal static readonly bool Flag = true;
public bool TryAdd(V value)
{
var newItem = new Item(value);
(newItem.Value as IDisposable)?.Dispose();
return false;
}
private sealed class Item(V value)
{
private readonly V _data = value;
public V Value
{
get
{
if (Flag)
{
}
else
{
return _data;
}
return GetData();
}
}
private V GetData() => _data;
}
}
}
Expected behavior
No crash.
Actual behavior
AccessViolationException
Regression?
No response
Known Workarounds
.NET 9 and .NET 10 do not exhibit this issue.
This issue does not repro when tiered compilation is disabled.
Configuration
.NET 8.0.16, Release build
Other information
No response
Metadata
Metadata
Assignees
Labels
area-CodeGen-coreclrCLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMICLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI