Update to the RewriteTests test cases to actually invoke the newly rewritten assembly #52
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Note: this approach requires one small (but worthwhile) change to ILPack to allow it to rename the assembly and namespace meta data that it generates. This allows the test runner to load both the original and the cloned assembly without needing AppDomain support (which netcore doesn't have).
Overall this is a much cleaner approach than previous pull request #51 which I've retracted. Also I've removed the original test cases from RewriteTests which weren't really effective in detecting problems and this new approach should cover everything they did anyway.
The notes below are copied from comments included in the RewriteTests.cs test case file.
Finally, note that some of the test cases included here are failing, but they're separate issues to this pull request.
These test cases work by taking the RewriteOriginal project, passing it
through ILPack to generate a new assembly and then checking that the
newly generated assembly is correct by actually loading it and invoking
methods and properties on it.
It works as follows:
RewriteOriginal.dll
is loaded through a project reference and foundwith a simple typeof(MyClass)
ILPack is used to to rewrite a new assembly
RewriteClone.dll
To allow the second DLL to be loaded into the same process (we don't
have AppDomains under net core), we use ILPack's RenameForTesting method
to change the names of the assembly and the contained namespace(s)
Use CSharpScript to load the newly cloned assembly and poke it in
various ways to make sure it still works.
Also, in the Lokad.ILPack.Tests project folder there's a dump.bat script
which on Windows will run ildasm and mddumper on both the original and the
cloned assemblies. Handy for comparison when diagnosing issues. (ildasm
and mddumper both need to be on your path)