Improve error reporting when Crossgen2 crashes on Managed C++ (#38113)
authorTomáš Rylek <trylek@microsoft.com>
Sat, 20 Jun 2020 07:50:37 +0000 (09:50 +0200)
committerGitHub <noreply@github.com>
Sat, 20 Jun 2020 07:50:37 +0000 (09:50 +0200)
commit389cee426773053b5712b0c15d05ef846aceb951
tree121c0ea00232ab1d19f4cda2d30cc7eea11311a7
parent721bea238f445080e8f2ea209a7321af9226d7e6
parent5446176db5a5b90e9c6b4a18242ff8f44d1db316
Improve error reporting when Crossgen2 crashes on Managed C++ (#38113)

* Improve error reporting when Crossgen2 crashes on Managed C++

Based on Manish's feedback from another PR I investigated options
to improve Crossgen2 diagnostics in the presence of Managed C++
that currently crashes the metadata reader in several places.
This is the barebones version of such support, centralizing detection
and reporting of the failures. Right now we don't have any pretty
way of reporting localized strings from this low-level code, I'll
welcome any suggestions how to polish the change in that direction.

Thanks

Tomas

* Make Managed C++ scanning upfront per JanK's PR feedback

* Fix Managed C++ check based on JanK's advice; Simon's feedback

I have changed the check to use the CorFlags.ILOnly / ILLibrary
combination (both bits must be zero for an assembly to be MC++).
Per Simon's suggestion I have moved the check outside of the
Run method. As part of that I have changed typeSystemContext
to a field on the Program class as a first step in breaking Run
into several smaller methods.

Thanks

Tomas