Add PDB support for PersistedAssemblyBuilder#100706
Conversation
|
Note regarding the |
|
Tagging subscribers to this area: @dotnet/area-system-reflection-emit |
src/libraries/System.Private.CoreLib/src/System/Reflection/Emit/ILGenerator.cs
Show resolved
Hide resolved
src/libraries/System.Private.CoreLib/src/System/Reflection/Emit/LocalBuilder.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.Reflection.Emit/src/Resources/Strings.resx
Outdated
Show resolved
Hide resolved
src/libraries/System.Reflection.Emit/src/Resources/Strings.resx
Outdated
Show resolved
Hide resolved
src/libraries/System.Reflection.Emit/src/System/Reflection/Emit/ILGeneratorImpl.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.Reflection.Emit/src/System/Reflection/Emit/ILGeneratorImpl.cs
Show resolved
Hide resolved
src/libraries/System.Reflection.Emit/src/System/Reflection/Emit/ModuleBuilderImpl.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.Private.CoreLib/src/System/Reflection/Emit/ILGenerator.cs
Show resolved
Hide resolved
… name to the locals table
Fixes the failure from dotnet/runtime#100706 (comment)
src/libraries/System.Reflection.Emit/src/Resources/Strings.resx
Outdated
Show resolved
Hide resolved
| /// <param name="endColumn">The column in the line where the sequence point ends.</param> | ||
| /// <exception cref="ArgumentException"><paramref name="document"/> is not valid.</exception> | ||
| /// <remarks>The parameters validated in the caller: <see cref="MarkSequencePoint"/>.</remarks> | ||
| protected virtual void MarkSequencePointCore(ISymbolDocumentWriter document, int startLine, int startColumn, int endLine, int endColumn) { } |
There was a problem hiding this comment.
I made it no-op in order to avoid breaking somebody that is not using/emitting PDB, but the more think about it is seems better to throw here so that people know that they are using an AssemblyBuilder implementation that doesn't support symbols.
src/libraries/System.Private.CoreLib/src/System/Reflection/Emit/LocalBuilder.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.Reflection.Emit/src/System/Reflection/Emit/PersistedAssemblyBuilder.cs
Show resolved
Hide resolved
src/libraries/System.Private.CoreLib/src/System/Reflection/Emit/ILGenerator.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.Private.CoreLib/src/System/Reflection/Emit/ILGenerator.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.Private.CoreLib/src/System/Reflection/Emit/ILGenerator.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.Reflection.Emit/src/System/Reflection/Emit/ModuleBuilderImpl.cs
Show resolved
Hide resolved
Co-authored-by: Aaron Robinson <arobins@microsoft.com>
| /// <exception cref="ArgumentNullException"><paramref name="document"/> is <see langword="null"/>.</exception> | ||
| /// <exception cref="ArgumentException"><paramref name="document"/> is not valid.</exception> | ||
| /// <exception cref="ArgumentOutOfRangeException"> | ||
| /// <paramref name="startLine"/> is not within range [0, 0x20000000) or |
There was a problem hiding this comment.
Where did these max values come from?
There was a problem hiding this comment.
From the runtime doc
runtime/docs/design/specs/PortablePdb-Metadata.md
Lines 124 to 133 in 617f81f
src/libraries/System.Reflection.Emit/src/Resources/Strings.resx
Outdated
Show resolved
Hide resolved
src/libraries/System.Reflection.Emit/src/System/Reflection/Emit/ModuleBuilderImpl.cs
Show resolved
Hide resolved
| parentImport = GetImportScopeHandle(scope._importNamespaces, parentImport); | ||
| firstLocalVariableHandle = GetLocalVariableHandle(scope._locals, firstLocalVariableHandle); | ||
| _pdbBuilder.AddLocalScope(methodHandle, parentImport, firstLocalVariableHandle, | ||
| constantList: MetadataTokens.LocalConstantHandle(1), scope._startOffset, scope._endOffset - scope._startOffset); |
There was a problem hiding this comment.
Where is LocalConstantHandle(1) coming from?
There was a problem hiding this comment.
…tatrtLine/StartColumn
* Initial PDB API shape and sequence point implementation * Finish PDB implementation and testing * Fix bug in multi doc sequence point * Validate null name for SetLocalSymInfo, do not add locals that has no name to the locals table * Throw on parent virtual methods, remove unnecessary throw * Apply suggestions from code review Co-authored-by: Aaron Robinson <arobins@microsoft.com> * Apply feedback, fix issue found in sequence point PreviousNonHidden.StatrtLine/StartColumn --------- Co-authored-by: Aaron Robinson <arobins@microsoft.com>
Added new APIs needed for adding symbol info and implemented PDB metadata generation
MetadataReaderApproved API shape:
Contributes to #92975
Fixes #99935