Skip to content

6.0.0-beta.1

Pre-release
Pre-release
Compare
Choose a tag to compare
@Washi1337 Washi1337 released this 15 Jun 13:18
f70da79

This marks the second major bump of AsmResolver since the rewrite. Note that this is still a pre-release and that last-minute breaking API changes may still be introduced before full release.

Summary

Version 6.0.0 of AsmResolver focuses on achieving three very important long-awaited milestones:

  1. Unmanaged PE file building: A complete revamp of the underlying PE file building mechanism has finally allowed for a long-awaited UnmanagedPEFileBuilder: A robust yet flexible foundation for reconstructing fully native PE files as well as mixed-mode .NET modules. We are not quite there yet with integrating it into the AsmResolver.DotNet package, but it should pave the way for it as well as help with processing ReadyToRun- and NativeAOT-compiled files in the future. See the new documentation for details.

  2. .NET Framework 3.5 support: Previously, AsmResolver targeted .NET standard 2.0, allowing developers to use a .NET Framework version as low as 4.6.1. While 4.8.1 is installed by default on modern Windows machines and we are approaching the release of .NET 9, many use-cases still require older versions of .NET (in particular, game-modding and dynamic code deobfuscation). With the awesome help of the people behind the @MonoMod project, we have been finally able to make AsmResolver 6.0.0 fully compatible with .NET Framework 3.5.

  3. API simplification and improvements: The existing public API also has undergone many quality-of-life improvements to ensure a better developer experience. This includes removing many of the redundant interfaces, as well as flattening a lot of namespaces to reduce the number of using directives required for typical usecases of AsmResolver. Performance has also been improved a lot in various areas, partially thanks to the new concept of RuntimeContexts. And of course, many bug fixes have been squashed.

Important to note is that this release introduces breaking changes with respect to 5.x.x. In the following, the important changes are listed:

New Features

  • Add UnmanagedPEFileBuilder, allowing for PEImages containing only native code or both native and managed .NET code to be built with little effort (#554).
  • It is now much easier to customize existing PE file builders (or create your own) to get full control over the final PE file layout thanks to the new PEFileBuilder base class.
  • Add .NET 3.5 support, using MonoMod.Backports (#536, #540, #544, #450, #439, with the help of @MonoMod and @Windows10CE).
  • Add the concept of RuntimeContexts, allowing for .NET modules to be loaded under a specific .NET runtime or AppHost bundle context, which avoids many type resolution problems, drastically reduces memory footprint and also increases overall performance (#471, #537).
  • Add PEImage::ToPEFile().
  • Add TrampolineTableBuffer, allowing for IAT trampolines to be built easily.
  • Add TypeMemoryLayout::IsReferenceOrContainsReferences flag, equivalent to RuntimeHelpers::IsReferenceOrContainsReferences<T> but determined statically (#530, #539).
  • Add BundleAssemblyResolver (2fc1872)
  • Add SetAccessorMethods to PropertyDefinition and EventDefinition (#555, thanks @ds5678).
  • Add AggressiveInlining, AggressiveOptimization and HasSecurityMitigations flags to MethodDefinition and MethodImplAttributes (bf80344).
  • Add IInputFile::BaseAddress (a1af121)

Improvements

  • Remove many redundant interfaces (e.g., IPEFile and IPEImage). Developers are expected to use their immediate implementing class (i.e., PEFile and PEImage) (#445, #561, #562).
  • Flatten many namespaces, drastically reducing the required using directives for typical AsmResolver usecases (#446, #560).
  • Use EmptyErrorListener.Instance for reading input files by default (#472, #564).
  • Remove System.Text.Json as a hard dependency requirement, making the library more portable for older .NET targets ( #450, #538).
  • Add .NET 9 as a known corlib (#548, thanks @ds5678).
  • Add correct interpretation of #Schema and #JTD metadata streams (#557, thanks @ElektroKill).
  • Add FunctionPointerTypeSignature support for SignatureComparer::GetHashCode (#551, thanks @BadRyuner).
  • Rewrite IconResource into a more intuitive API that also supports language-specific icons and cursors (#565).
  • Let PESection::Name accept arbitrary UTF8 strings (#454).
  • Add OptionalHeader::SetDataDirectory (7b27c91).
  • Add SetDataDirectory.CreateForSegment (7b27c91.)

Bug Fixes

  • Fix an issue where EnC metadata streams are looked up using case insensitive name lookup (#557, thanks @ElektroKill).
  • Fix an issue where Win32 resources were inserted into a PE's root resource directory out-of-order, causing version info and icons to not be interpreted by Windows correctly (#552, #553).
  • Fix a data race in caching mechanism of StringsStream and UserStringsStream (b1ded1f).
  • Fix an issue related to reading and writing signed compressed integers for lower bounds in array type signatures (c7bc9f6).

Documentation