Skip to content

[RuntimeAsync] Problem with boxing in resume stub when return type is a struct instantiated over object type #3010

@VSadov

Description

@VSadov

Re: #2951 (comment)

A possible repro is to add a scenario in shared-generics.cs test that looks like:
(regardless of Await optimization)

        Async1EntryPoint<S<string>>(typeof(S<string>), new S<string> {t = "ghj" }).Wait();
. . .

struct S<T>
{
    public T t;
}

We end up generating a resume stub that boxes S<__Canon> and that ends up failing around

            // There is a pathological case where invalid IL refereces __Canon type directly, but there is no dictionary availabled to store the lookup.
            if (!pContextMD->IsSharedByGenericInstantiations())
                   COMPlusThrow(kInvalidProgramException);

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