6.0.0-beta.6
Pre-release
Pre-release
·
64 commits
to master
since this release
This release brings the long-needed metadata resolution revamp. The previous system often caused incorrect, duplicated, or silent failed assembly resolutions, which sometimes resulted in bad metadata to be emitted in output binaries. The new system makes RuntimeContext act more like an AppDomain/AssemblyLoadContext, centralizing assembly management and requiring all metadata resolution to go through it. Resolution is now also much more explicit, by always requiring a RuntimeContext instance. This ensures more reliable, predictable behavior when creating and processing .NET metadata.
Check out the updated documentation on RuntimeContexts on how to use the new APIs.
Full change log below:
New Features
- Breaking change: Revamp of metadata resolution system and
RuntimeContexts (#704).IAssemblyResolveris drastically simplified and is no longer responsible for caching anymore.IMetadataResolverand friends are removed.RuntimeContextconstruction is drastically simplified.RuntimeContextis now responsible for resolving and maintaining assembly and metadata caches.- Add
RuntimeContext::LoadAssemblymethods to load assemblies into the context (similar toAssemblyDefinition::FromX, but using the context for reader parameters, cache and automatic wiring of dependencies). - Remove all
Resolvemethods in favor of aResolveandTryResolvemethod taking aRuntimeContext. Additionally, all properties and methods that may have implicitly required resolution will now take aRuntimeContextas well. SignatureComparercan now take aRuntimeContextin its constructor. When none is provided, the comparer will no longer try to resolve forwarder types and compare signatures as-is.
- Add
TargetRuntimeProberto detect the target runtime of a PE image without loading it as a fullModuleDefinition(#704). - Add
MetadataDirectory::GetImpliedStreamSelection()(#704). - Add read support for
S_TRAMPOLINEandS_GTHREAD32andS_LTHREAD32PDB symbols (#711, thanks @dongle-the-gadget).
Improvements
- Breaking Change: Rename
UnmanagedPEFileBuildertoTemplatedPEFileBuilderto more accurately reflect its behavior (727c554) - Add .NET 11 support (#696, thanks @ds5678).
- Add support for (potentially unreleased) future target runtime versions not known yet to the current distribution of AsmResolver.DotNet (i.e., not explicitly added to
KnownCorLibs) (#702, 55c847f). - Optimize
BinaryStreamWriterfor .NET 10+ targets (#695, thanks @Sergio0694). - Let
Utf8StringimplementISpanFormattableandIUtf8SpanFormattable(#699, thanks @Sergio0694). - Add automatic sorting of CIL exception handlers on build (#707, thanks @Windows10CE).
- Add
Utf8String::CreateUnsafefactory method (#709, thanks @Windows10CE) - Add
TypeAttributes::WindowsRuntime(#710, thanks @Sergio0694). - Add
ModuleDefinition::CreateConstructoroverload takingCorLibTypeFactory(#712, thanks @Sergio0694). - Add missing
Class2,Structure2,Union2andInterface2PDB leaf record types (#714, thanks @ds5678).
Bug Fixes
- Fix an issue where auto-importing a type reference with a module definition as its scope would not turn into the declaring assembly (#697).
- Fix an issue where the custom attribute signature writer would incorrectly consider the context module of a type as the target module (#697).
- Fix an issue where associated metadata was duplicated even if the owner row was deduplicated (#697 ).
- Fix an issue where offsets in TLS data directories would not roundtrip properly (#706, #708).
- Fix an issue where relocation table entries would be duplicated or misaligned in some cases (#708).