Skip to content

Rewiring serializes task runs? #334

Description

@jhwj9617

I'm on version 1.5.3

And I noticed the tasks that I spawn in my unit test become serialized after rewiring.

            var tasks = new List<Task>()
            {
                Task.Run(() =>
                {
                    for (int i = 0; i<5; i++)
                    {
                        Console.WriteLine("A");
                    }
                }),
                Task.Run(() =>
                {
                    for (int i = 0; i<5; i++)
                    {
                        Console.WriteLine("B");
                    }
                }),
            };

            Task.WaitAll(tasks.ToArray());

This will always print "AAAAABBBBB" or "BBBBBAAAAA".
But if I don't rewire and I get Assembly is not rewritten for testing, see https://aka.ms/coyote-rewrite.
I will get expected interleavings, e.g. "AAABABBABB"

Why does rewiring have this result? Shouldn't it properly explore all these interleavings?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions