Skip to content

Instantly share code, notes, and snippets.

@ekalchev
Created November 21, 2023 18:10
Show Gist options
  • Save ekalchev/e82c644219f8af2716d7d3340f4aa3f3 to your computer and use it in GitHub Desktop.
Save ekalchev/e82c644219f8af2716d7d3340f4aa3f3 to your computer and use it in GitHub Desktop.
internal class Program
{
private static Test test;
static void Main(string[] args)
{
Task.Run(() =>
{
while (true)
{
Test localTest = test;
if (localTest != null && localTest.Ref == null)
{
}
}
});
while (true)
{
test = null;
test = new Test();
}
}
class Test
{
public Test()
{
Ref = new object();
}
public object Ref { get; }
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment