-
Notifications
You must be signed in to change notification settings - Fork 509
[ILVerify] Define and Implement a public API surface #3734
Comments
Isn't ILVerify a COM thing? Or has it been ported to managed code (which would be super awesome!)? Edit: I see that work is being done! https://github.com/dotnet/corert/tree/master/src/ILVerify (not sure it is living in the correct place though) |
@leppie I guess what you mean by "COM thing" is PEVerify. And yes, your guess is basically correct: ILVerify will be a managed port of that (...well not 100% port... ). Look here: https://github.com/dotnet/corert/tree/master/src/ILVerify
Well, I'm not the one making these kinds of decisions, and honestly I don't have a strong opinion on where this should be, but one thing I can say: we need an infrastructure to parse and "understand" .NET assemblies and that infrastructure is definitely given in this repo. |
As part of working on integrating ILVerify into the test framework for Roslyn, I prototyped a simple API (note: this is not a PR for review, I left a number of temporary hacks in there). Basically, a new public type (
I think there is no need for a If this API sounds alright as a starting point, I'll make a PR. Thanks Tagging @ArztSamuel @VSadov |
We should build the .exe tool and tests on top of the same API. It will ensure that the API is reasonably flexible, and that we don't have to redo it from the ground up multiple times. I do not think that the API should take the modules as |
I agree with not requiring the caller to read/resolve. Peehaps verifier ahould take abstract resolver as an input and a trivial implementation of resolver would be a bag pre-filled with binaries. |
Here's a second proposal for API. Let me know what you think. interface IResolver
{
PEReader Resolve(string name);
}
class Verifier
{
Verifier(IResolver resolver);
VerificationResult Verify(string[] names);
}
class VerificationResult
{
bool Success;
string Message;
} Note: I'd suggest that |
So should it be AssemblyName then? The lookup in ILVerify does actually start with AssemblyName - it is just using simple name out of the AssemblyName for the actual lookup.
What are these names? I would think that we should have For convenience, we can also have |
Also, we need a way to specify system assembly. |
I think it would make sense to change it to: PEReader Resolve(AssemblyName name);
I also think that it makes sense to have mutiple overloads of
As @jcouv mentioned earlier, the system assembly could be detected automatically, since it does not reference any other assemblies. However, that would require resolving all assemblies first, which defeats the whole purpose of the IResolver, right? As far as the verification result is concerned: |
If the API takes PEReader and caller has AssemblyName, the caller can call resolver like: The API that takes PEReader is the more core one. I think we should have it. If we actually see callers that have AssemblyName, we can make it a bit easier for them by introducing convenience overload that just does |
I don't see how |
That is true. But I guess that is the responsibility of the IResolver then, not ILVerify. |
PR for review at #5186 |
Currently basically everything is internal in ILVerify.
Having a public API surface is needed for at least two things:
Step1: would be: let's discuss what we want to expose as public API
Step2: implement it. I'm happy to do that.
The text was updated successfully, but these errors were encountered: