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);