Skip to content

6.0.0-beta.6

Pre-release
Pre-release

Choose a tag to compare

@Washi1337 Washi1337 released this 23 Feb 19:18
· 64 commits to master since this release
bd3c354

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).
    • IAssemblyResolver is drastically simplified and is no longer responsible for caching anymore.
    • IMetadataResolver and friends are removed.
    • RuntimeContext construction is drastically simplified.
    • RuntimeContext is now responsible for resolving and maintaining assembly and metadata caches.
    • Add RuntimeContext::LoadAssembly methods to load assemblies into the context (similar to AssemblyDefinition::FromX, but using the context for reader parameters, cache and automatic wiring of dependencies).
    • Remove all Resolve methods in favor of a Resolve and TryResolve method taking a RuntimeContext. Additionally, all properties and methods that may have implicitly required resolution will now take a RuntimeContext as well.
    • SignatureComparer can now take a RuntimeContext in its constructor. When none is provided, the comparer will no longer try to resolve forwarder types and compare signatures as-is.
  • Add TargetRuntimeProber to detect the target runtime of a PE image without loading it as a full ModuleDefinition (#704).
  • Add MetadataDirectory::GetImpliedStreamSelection() (#704).
  • Add read support for S_TRAMPOLINE and S_GTHREAD32 and S_LTHREAD32 PDB symbols (#711, thanks @dongle-the-gadget).

Improvements

  • Breaking Change: Rename UnmanagedPEFileBuilder to TemplatedPEFileBuilder to 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 BinaryStreamWriter for .NET 10+ targets (#695, thanks @Sergio0694).
  • Let Utf8String implement ISpanFormattable and IUtf8SpanFormattable (#699, thanks @Sergio0694).
  • Add automatic sorting of CIL exception handlers on build (#707, thanks @Windows10CE).
  • Add Utf8String::CreateUnsafe factory method (#709, thanks @Windows10CE)
  • Add TypeAttributes::WindowsRuntime (#710, thanks @Sergio0694).
  • Add ModuleDefinition::CreateConstructor overload taking CorLibTypeFactory (#712, thanks @Sergio0694).
  • Add missing Class2, Structure2, Union2 and Interface2 PDB 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).