提交 5c1daaf0 编写于 作者: V vsadov

Deleting nondeterministic test.

The test basically dereferences unsafe pointer in an async method where the original stack could be long gone. That results in undefined and unsafe behavior.

Fixes #7334
上级 6e1cd85d
......@@ -1920,73 +1920,6 @@ static void Main()
CompileAndVerify(source, "0");
}
[Fact(Skip= "https://github.com/dotnet/roslyn/issues/7334")]
public void Return07_2()
{
var source = @"
using System;
using System.Threading;
using System.Threading.Tasks;
class TestCase
{
unsafe struct S
{
public int value;
public S* next;
}
public async void Run()
{
int test = 0;
int result = 0;
Func<Task<dynamic>> func, func2 = null;
try
{
test++;
S s = new S();
S s1 = new S();
unsafe
{
S* head = &s;
s.next = &s1;
func = async () => { (*(head->next)).value = 1; result++; return head->next->value; };
func2 = async () => (*(head->next));
}
var x = await func();
if (x != 1)
result--;
var xx = await func2();
if (xx.value != 1)
result--;
}
finally
{
Driver.Result = test - result;
Driver.CompleteSignal.Set();
}
}
}
class Driver
{
static public AutoResetEvent CompleteSignal = new AutoResetEvent(false);
public static int Result = -1;
public static void Main()
{
TestCase tc = new TestCase();
tc.Run();
CompleteSignal.WaitOne();
Console.WriteLine(Result);
}
}";
var options = new CSharpCompilationOptions(OutputKind.ConsoleApplication, allowUnsafe: true);
CompileAndVerify(source, "0", options: options);
}
[Fact]
[WorkItem(625282, "DevDiv")]
public void Generic05()
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册