I'm working on a compiler that's producing bad output in certain cases of expanding generators. PEVerify simply says "Type load failed" without giving any explanation as to why. When I've seen this in the past, it's generally been because the generated type has the wrong number of generic parameters, but everything seems to match up here.
Is there any good way to get more detailed information about what went wrong with the generated type? Barring that, are there any good tips and techniques for how to track down the error?
Output from PEVerify:
C:\Build\Test>peverify testcase.exe /VERBOSE /UNIQUE
Microsoft (R) .NET Framework PE Verifier. Version 4.0.30319.0 Copyright (c) Microsoft Corporation. All rights reserved.
[IL]: Error: [C:\Build\Test\testcase.exe : Testing.Linq_operatorModule::IndexWhereImpl[T]][mdToken=0x6000002][offset 0x00000002] Unable to resolve token.
[IL]: Error: [C:\Build\Test\testcase.exe : Testing.Linq_operatorModule+$IndexWhereImpl$3`1[T]::.ctor][mdToken=0x6000006] [HRESULT 0 x8007000B] - An attempt was made to load a program with an incorrect format.
[token 0x02000004] Type load failed.
3 Error(s) Verifying testcase.exe
Comprehensive dump from ILDasm is here, as it's too large to put in a SO post.