-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
[API Proposal] Add APIs that needed for emitting symbols with reflection emit PersistedAssemblyBuilder #99935
Labels
Milestone
Comments
Tagging subscribers to this area: @dotnet/area-system-reflection-metadata |
20 tasks
namespace System.Reflection.Emit;
public abstract partial class ModuleBuilder : System.Reflection.Module
{
[EditorBrowsable(Never)]
public ISymbolDocumentWriter DefineDocument (string url, Guid language, Guid languageVendor, Guid documentType) => DefineDocument(url, language);
public ISymbolDocumentWriter DefineDocument(string url, Guid language = default);
protected virtual ISymbolDocumentWriter DefineDocumentCore(string url, Guid language = default);
}
public abstract partial class ILGenerator
{
public void MarkSequencePoint(ISymbolDocumentWriter document, int startLine, int startColumn, int endLine, int endColumn) { }
protected virtual void MarkSequencePointCore(ISymbolDocumentWriter document, int startLine, int startColumn, int endLine, int endColumn) { }
}
public abstract partial class LocalBuilder : LocalVariableInfo
{
public void SetLocalSymInfo(string name);
protected virtual void SetLocalSymInfoCore(string name) { }
}
public sealed class PersistedAssemblyBuilder : AssemblyBuilder
{
public MetadataBuilder GenerateMetadata(out BlobBuilder ilStream, out BlobBuilder mappedFieldData, out MetadataBuilder pdbBuilder) { }
} |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Labels
Background and motivation
Now we have added
PersistedAssemblyBuilder
in NET 9.0, further we need to add PDB support. For this we need the APIs that used for adding symbol info with reflection emit APIs. The proposed APIs are quite similar the ones that now exist in .NET framework reflection emit implementation:AssemblyBuilder.DefineDynamicModule
overloads hadbool emitSymbolInfo
parameter, we will not have that option, in order to populate PDB user should useMetadataBuilder GenerateMetadata(out BlobBuilder ilStream, out BlobBuilder mappedFieldData, out MetadataBuilder pdbMetadata)
method and use thepdbMetadata
out parameter for producing PDB as desired. Further, based on the customer feedback we could addSave
overload that sets some options and defaulting other options.ModuleBuilder.GetSymWriter()
method that returnsISymbolWriter
. It was used with native code to add debug info, it cannot work with portable PDB.API Proposal
The symbols metadata will be populating with
PersistedAssemblyBuilder.GenerateMetadata(...)
overload that has additional parameterout MetadataBuilder pdbMetadata
. Further steps for producing portable PDB:PortablePdbBuilder
instance with the PDB metadata and type-system metadata produced from above methodPortablePdbBuilder
intoBlob
, write theBlob
into a PDB file in case generating standalone PDBDebugDirectoryBuilder
instance and add aCodeViewEntry
orEmbeddedPortablePdbEntry
debugDirectoryBuilder
argument when creatingManagedPEBuilder
Blob
, and write theBlob
into a file or a streamAPI usage:
Furter user could add
CustomDebugInformation
by calling the AddCustomDebugInformation method onpdbMetadata
to add source embedding and source indexing etc.CC @AaronRobinsonMSFT @ericstj @jeffhandley @jkotas @steveharter
Contributes to #92975
The text was updated successfully, but these errors were encountered: