-
Notifications
You must be signed in to change notification settings - Fork 484
Restore ability on .NET 9 and later to save dynamic assemblies to disk #718
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
@jonorossi, do you think the ability to save dynamic assemblies should be publicly exposed, or should it remain an internal development-only feature? I am undecided whether the feature makes sense in general, given that there is no way to load the saved assemblies back into DynamicProxy's type cache. (That would require de-serialization using |
src/Castle.Core.Tests/DynamicProxy.Tests/PersistentProxyBuilderTestCase.cs
Outdated
Show resolved
Hide resolved
src/Castle.Core.Tests/DynamicProxy.Tests/PersistentProxyBuilderTestCase.cs
Outdated
Show resolved
Hide resolved
src/Castle.Core.Tests/DynamicProxy.Tests/PersistentProxyBuilderTestCase.cs
Outdated
Show resolved
Hide resolved
src/Castle.Core/DynamicProxy/PersistentIsolatedTypesModuleScope.cs
Outdated
Show resolved
Hide resolved
57d19d4 to
f50b0e9
Compare
|
@jonorossi, I haven't exactly given you much time so far to review this PR. I might push ahead and merge fairly soon, so that I can continue working on better by-ref-like type support more comfortably... being able to inspect the dynamic assemblies would definitely help there. If you do have any feedback on the new .NET 9 |
Note that `catch`-ing strong-naming failures in all cases isn't just a refactoring, but a functional change. It seems appropriate, and more correct than what we had before, becaus creating a dynamic assembly and strong-naming it are really separate concerns.
f50b0e9 to
737ef78
Compare
This PR adds a
PersistentProxyBuilderimplementation for .NET 9+ – similar, but not identical, to the one we already have for the .NET Framework. The minimum platform requirement for this new implementation is .NET 9 because it is based on SRE'sPersistedAssemblyBuilder, which was introduced in that version of the runtime. Therefore I am also adding thenet9.0TFM to the library.I have an immediate need for this as an aid in improving by-ref-like types support further (#663), which is quite difficult when one cannot inspect the generated assemblies directly. While the proposed implementation should suffice for that specific purpose, it isn't thoroughly tested yet and it comes with certain caveats (as noted in its XML documentation comment). However, since it is an opt-in feature, it seems reasonably safe to me to publicly expose it.
What is left to be done at a later time is setting up IL verification during test execution on .NET 9 and later, even though that now seems to be within reach.
Closes #697.