Skip to content

Conversation

@radekdoulik
Copy link
Member

@radekdoulik radekdoulik commented Apr 19, 2018

We don't want to leave the *-JniMarshalMethods.dll files behind, so
we need to delete them, once the methods are moved back to the
originating assemblies.

Because the dynamic assembly builder needs to save the temporary
assembly, we need it to use AssemblyBuilderAccess.Save, which means
the assembly cannot be unloaded from the domain.

Thus we do the work in separate AppDomain and unload the whole
domain at the end, so that the temporary files are not locked
anymore. A bit of refactoring was needed for that.

There is also new --keeptemp option to enable the old behavior and
keep the temporary files.

And finally the help message is printed when no arguments
supplied. Plus new error message in case no assemblies were specified.

@radekdoulik radekdoulik requested a review from jonpryor April 19, 2018 11:26
@radekdoulik radekdoulik force-pushed the pr-remove-temporary-files-work-in-separate-appdomain branch from 6baca21 to 55cf0d6 Compare April 19, 2018 11:58
{ "d|debug",
"Inject debug messages",
v => Debug = true },
{ "k|keep-temporary",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be keeptemp, as that's what mkbundle uses.

I also don't think it needs a "short" -k form.

We don't want to leave the `*-JniMarshalMethods.dll` files behind, so
we need to delete them, once the methods are moved back to the
originating assemblies.

Because the dynamic assembly builder needs to save the temporary
assembly, we need it to use `AssemblyBuilderAccess.Save`, which means
the assembly cannot be unloaded from the domain.

Thus we do the work in separate `AppDomain` and unload the whole
domain at the end, so that the temporary files are not locked
anymore. A bit of refactoring was needed for that.

There is also new `--keeptemp` option to enable the old behavior and
keep the temporary files.

And finally the help message is printed when no arguments
supplied. Plus new error message in case no assemblies were specified.
@radekdoulik radekdoulik force-pushed the pr-remove-temporary-files-work-in-separate-appdomain branch from 55cf0d6 to c7678bc Compare April 20, 2018 09:19
@jonpryor jonpryor merged commit 2a9ac6a into dotnet:master Apr 20, 2018
@github-actions github-actions bot locked and limited conversation to collaborators Apr 14, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants