Skip to content

Instantly share code, notes, and snippets.

View buyaa-n's full-sized avatar

Buyaa Namnan buyaa-n

  • Microsoft
  • WA
View GitHub Profile
@buyaa-n
buyaa-n / pdb.md
Last active March 18, 2024 18:45
API shape for PDB support

New APIs:

public abstract partial class ModuleBuilder : System.Reflection.Module
{
+    public virtual ISymbolDocumentWriter DefineDocument(string url, Guid language = default) { }
}

 public abstract class ILGenerator
 {

System.Reflection.Emit: Saving generated assemblies in NET 9.0.

The AssemblyBuilder.Save method haven't ported to .NET Core with technical difficulties like its implementation heavily depend on windows specific native code that also not ported into .NET Core. Previously with .NET core developers can only run the generated assembly. Emitting assembly, IL is quite challenging work, without having an option to save an assembly, it is very difficult to debug in-memory assemblies. Saving the assembly to a file allows generated assemblies to be verified with tools such as ILVerify, or decompiled and manually examined with tools such as ILSpy. Furthermore, the saved assembly can be shared or loaded directly which can be used to decrease application startup time. Github issue for adding support for AssemblyBuilder.Save has been open for several years and it's been the most upvoted issue in the Reflection area. Many customers report it as a blocker for porting th