When using Reflection.Emit to build an assembly at runtime, I'd like to verify the assembly MSIL before saving to disc. Like PEVerify but at runtime. Is there such an API?
Reflection.Emit
It seems that peverify.exe is a front-end to c:WindowsMicrosoft.NETFrameworkv4.0.30319peverify.dll (or c:WindowsMicrosoft.NETFrameworkv2.0.50727peverify.dll for CLR 2.0), which is a native DLL (actually, peverify.exe is also native)
I don't see this documented anywhere so it's probably not a public API. You may be able to figure out the exported functions from that DLL using something like Dependency Walker, but I think it would be simpler to just call peverify.exe.
EDIT: anecdotal evidence:
2.1m questions
2.1m answers
60 comments
57.0k users