SigParse uploaded to MSDN Code Gallery


A while back I posted some sample code written by Rico Mariani to parse CLR metadata signatures.  This code is now also available on the MSDN Code Gallery SigParse page.  If any of you were nervous about incorporating that source into your product without an official license agreement, please take a look at the MSDN Code Gallery page, where you’ll find the source code is now governed by the MICROSOFT PUBLIC LICENSE (Ms-PL).


Comments (4)

  1. Has this parser been tested on C++/CLI code? When I wrote my own parser, I found that C++/CLI generates lots of signatures that aren't compliant with the ECMA spec, but the CLR handles them just fine.

  2. davbr says:

    Hi, Jeroen.  I believe the parser was written to ECMA specifications, and a small amount of unit testing was done on it, likely only for C#-generated assemblies.  By "C++/CLI", are you referring to Microsoft's managed C++ compiler?  If you find a signature type that sigparse is designed to parse, but which it cannot parse because of peculiarities with our managed C++ compiler, that would be interesting to hear about.

  3. Yes, I meant Microsoft's C++ compiler. When I was testing my parser, I just parsed everything in the GAC and found a whole bunch of assemblies with strange stuff. For more on C++/CLI see for example this connect issue: connect.microsoft.com/…/c-cli-generic-interfaces-and-cv-qualified-type-arguments

    Also note the last comment by int19h. This is about a discrepancy between C++/CLI and the CLR, but it also shows a place where C++/CLI inserts custom modifiers that I'm sure the SigParse code isn't prepared to handle.

  4. davbr says:

    Interesting, thanks for posting this extra info.  I don't know how sigparse will deal with these (I haven't tried), but it's quite possible that if those modifiers are not mentioned in the ECMA spec, then sigparse could have a problem with them.  You're welcome to try it out and report your findings.  :-)